Lines Matching refs:inst
41 bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt) in venus_helper_check_codec() argument
43 struct venus_core *core = inst->core; in venus_helper_check_codec()
44 u32 session_type = inst->session_type; in venus_helper_check_codec()
93 static void free_dpb_buf(struct venus_inst *inst, struct intbuf *buf) in free_dpb_buf() argument
95 ida_free(&inst->dpb_ids, buf->dpb_out_tag); in free_dpb_buf()
98 dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da, in free_dpb_buf()
103 int venus_helper_queue_dpb_bufs(struct venus_inst *inst) in venus_helper_queue_dpb_bufs() argument
109 if (inst->dpb_buftype == HFI_BUFFER_OUTPUT) in venus_helper_queue_dpb_bufs()
110 dpb_size = inst->output_buf_size; in venus_helper_queue_dpb_bufs()
111 else if (inst->dpb_buftype == HFI_BUFFER_OUTPUT2) in venus_helper_queue_dpb_bufs()
112 dpb_size = inst->output2_buf_size; in venus_helper_queue_dpb_bufs()
114 list_for_each_entry_safe(buf, next, &inst->dpbbufs, list) { in venus_helper_queue_dpb_bufs()
127 free_dpb_buf(inst, buf); in venus_helper_queue_dpb_bufs()
133 ret = hfi_session_process_buf(inst, &fdata); in venus_helper_queue_dpb_bufs()
145 int venus_helper_free_dpb_bufs(struct venus_inst *inst) in venus_helper_free_dpb_bufs() argument
149 list_for_each_entry_safe(buf, n, &inst->dpbbufs, list) { in venus_helper_free_dpb_bufs()
152 free_dpb_buf(inst, buf); in venus_helper_free_dpb_bufs()
155 if (list_empty(&inst->dpbbufs)) in venus_helper_free_dpb_bufs()
156 INIT_LIST_HEAD(&inst->dpbbufs); in venus_helper_free_dpb_bufs()
162 int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) in venus_helper_alloc_dpb_bufs() argument
164 struct venus_core *core = inst->core; in venus_helper_alloc_dpb_bufs()
168 u32 buftype = inst->dpb_buftype; in venus_helper_alloc_dpb_bufs()
177 if (!inst->dpb_fmt) in venus_helper_alloc_dpb_bufs()
180 if (inst->dpb_buftype == HFI_BUFFER_OUTPUT) in venus_helper_alloc_dpb_bufs()
181 dpb_size = inst->output_buf_size; in venus_helper_alloc_dpb_bufs()
182 else if (inst->dpb_buftype == HFI_BUFFER_OUTPUT2) in venus_helper_alloc_dpb_bufs()
183 dpb_size = inst->output2_buf_size; in venus_helper_alloc_dpb_bufs()
188 ret = venus_helper_get_bufreq(inst, buftype, &bufreq); in venus_helper_alloc_dpb_bufs()
213 id = ida_alloc_min(&inst->dpb_ids, VB2_MAX_FRAME, GFP_KERNEL); in venus_helper_alloc_dpb_bufs()
221 list_add_tail(&buf->list, &inst->dpbbufs); in venus_helper_alloc_dpb_bufs()
228 venus_helper_free_dpb_bufs(inst); in venus_helper_alloc_dpb_bufs()
233 static int intbufs_set_buffer(struct venus_inst *inst, u32 type) in intbufs_set_buffer() argument
235 struct venus_core *core = inst->core; in intbufs_set_buffer()
243 ret = venus_helper_get_bufreq(inst, type, &bufreq); in intbufs_set_buffer()
274 ret = hfi_session_set_buffers(inst, &bd); in intbufs_set_buffer()
280 list_add_tail(&buf->list, &inst->internalbufs); in intbufs_set_buffer()
292 static int intbufs_unset_buffers(struct venus_inst *inst) in intbufs_unset_buffers() argument
298 list_for_each_entry_safe(buf, n, &inst->internalbufs, list) { in intbufs_unset_buffers()
305 ret = hfi_session_unset_buffers(inst, &bd); in intbufs_unset_buffers()
308 dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da, in intbufs_unset_buffers()
340 int venus_helper_intbufs_alloc(struct venus_inst *inst) in venus_helper_intbufs_alloc() argument
346 if (IS_V6(inst->core)) { in venus_helper_intbufs_alloc()
349 } else if (IS_V4(inst->core)) { in venus_helper_intbufs_alloc()
358 ret = intbufs_set_buffer(inst, intbuf[i]); in venus_helper_intbufs_alloc()
366 intbufs_unset_buffers(inst); in venus_helper_intbufs_alloc()
371 int venus_helper_intbufs_free(struct venus_inst *inst) in venus_helper_intbufs_free() argument
373 return intbufs_unset_buffers(inst); in venus_helper_intbufs_free()
377 int venus_helper_intbufs_realloc(struct venus_inst *inst) in venus_helper_intbufs_realloc() argument
379 enum hfi_version ver = inst->core->res->hfi_version; in venus_helper_intbufs_realloc()
384 list_for_each_entry_safe(buf, n, &inst->internalbufs, list) { in venus_helper_intbufs_realloc()
396 ret = hfi_session_unset_buffers(inst, &bd); in venus_helper_intbufs_realloc()
398 dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da, in venus_helper_intbufs_realloc()
405 ret = intbufs_set_buffer(inst, HFI_BUFFER_INTERNAL_SCRATCH(ver)); in venus_helper_intbufs_realloc()
409 ret = intbufs_set_buffer(inst, HFI_BUFFER_INTERNAL_SCRATCH_1(ver)); in venus_helper_intbufs_realloc()
413 ret = intbufs_set_buffer(inst, HFI_BUFFER_INTERNAL_SCRATCH_2(ver)); in venus_helper_intbufs_realloc()
434 static void return_buf_error(struct venus_inst *inst, in return_buf_error() argument
437 struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; in return_buf_error()
448 put_ts_metadata(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf) in put_ts_metadata() argument
455 for (i = 0; i < ARRAY_SIZE(inst->tss); i++) { in put_ts_metadata()
456 if (!inst->tss[i].used) { in put_ts_metadata()
463 dev_dbg(inst->core->dev, VDBGL "no free slot\n"); in put_ts_metadata()
469 inst->tss[slot].used = true; in put_ts_metadata()
470 inst->tss[slot].flags = vbuf->flags; in put_ts_metadata()
471 inst->tss[slot].tc = vbuf->timecode; in put_ts_metadata()
472 inst->tss[slot].ts_us = ts_us; in put_ts_metadata()
473 inst->tss[slot].ts_ns = vb->timestamp; in put_ts_metadata()
476 void venus_helper_get_ts_metadata(struct venus_inst *inst, u64 timestamp_us, in venus_helper_get_ts_metadata() argument
482 for (i = 0; i < ARRAY_SIZE(inst->tss); ++i) { in venus_helper_get_ts_metadata()
483 if (!inst->tss[i].used) in venus_helper_get_ts_metadata()
486 if (inst->tss[i].ts_us != timestamp_us) in venus_helper_get_ts_metadata()
489 inst->tss[i].used = false; in venus_helper_get_ts_metadata()
490 vbuf->flags |= inst->tss[i].flags; in venus_helper_get_ts_metadata()
491 vbuf->timecode = inst->tss[i].tc; in venus_helper_get_ts_metadata()
492 vb->timestamp = inst->tss[i].ts_ns; in venus_helper_get_ts_metadata()
499 session_process_buf(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf) in session_process_buf() argument
522 if (inst->session_type == VIDC_SESSION_TYPE_DEC) in session_process_buf()
523 put_ts_metadata(inst, vbuf); in session_process_buf()
525 venus_pm_load_scale(inst); in session_process_buf()
527 if (inst->session_type == VIDC_SESSION_TYPE_ENC) in session_process_buf()
530 fdata.buffer_type = inst->opb_buftype; in session_process_buf()
535 return hfi_session_process_buf(inst, &fdata); in session_process_buf()
538 static bool is_dynamic_bufmode(struct venus_inst *inst) in is_dynamic_bufmode() argument
540 struct venus_core *core = inst->core; in is_dynamic_bufmode()
550 caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type); in is_dynamic_bufmode()
557 int venus_helper_unregister_bufs(struct venus_inst *inst) in venus_helper_unregister_bufs() argument
563 if (is_dynamic_bufmode(inst)) in venus_helper_unregister_bufs()
566 list_for_each_entry_safe(buf, n, &inst->registeredbufs, reg_list) { in venus_helper_unregister_bufs()
568 ret = hfi_session_unset_buffers(inst, &bd); in venus_helper_unregister_bufs()
576 static int session_register_bufs(struct venus_inst *inst) in session_register_bufs() argument
578 struct venus_core *core = inst->core; in session_register_bufs()
584 if (is_dynamic_bufmode(inst)) in session_register_bufs()
587 list_for_each_entry(buf, &inst->registeredbufs, reg_list) { in session_register_bufs()
589 ret = hfi_session_set_buffers(inst, &bd); in session_register_bufs()
619 static int platform_get_bufreq(struct venus_inst *inst, u32 buftype, in platform_get_bufreq() argument
622 enum hfi_version version = inst->core->res->hfi_version; in platform_get_bufreq()
625 bool is_dec = inst->session_type == VIDC_SESSION_TYPE_DEC; in platform_get_bufreq()
626 struct venc_controls *enc_ctr = &inst->controls.enc; in platform_get_bufreq()
634 params.num_vpp_pipes = inst->core->res->num_vpp_pipes; in platform_get_bufreq()
637 params.width = inst->width; in platform_get_bufreq()
638 params.height = inst->height; in platform_get_bufreq()
639 params.out_width = inst->out_width; in platform_get_bufreq()
640 params.out_height = inst->out_height; in platform_get_bufreq()
641 params.codec = inst->fmt_out->pixfmt; in platform_get_bufreq()
642 params.hfi_color_fmt = to_hfi_raw_fmt(inst->fmt_cap->pixfmt); in platform_get_bufreq()
643 params.dec.max_mbs_per_frame = mbs_per_frame_max(inst); in platform_get_bufreq()
646 inst->opb_buftype == HFI_BUFFER_OUTPUT2; in platform_get_bufreq()
648 params.hfi_dpb_color_fmt = inst->dpb_fmt; in platform_get_bufreq()
650 inst->pic_struct != HFI_INTERLACE_FRAME_PROGRESSIVE; in platform_get_bufreq()
652 params.width = inst->out_width; in platform_get_bufreq()
653 params.height = inst->out_height; in platform_get_bufreq()
654 params.codec = inst->fmt_cap->pixfmt; in platform_get_bufreq()
655 params.hfi_color_fmt = to_hfi_raw_fmt(inst->fmt_out->pixfmt); in platform_get_bufreq()
661 params.enc.is_tenbit = inst->bit_depth == VIDC_BITDEPTH_10; in platform_get_bufreq()
664 return hfi_plat->bufreq(¶ms, inst->session_type, buftype, req); in platform_get_bufreq()
667 int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, in venus_helper_get_bufreq() argument
671 enum hfi_version ver = inst->core->res->hfi_version; in venus_helper_get_bufreq()
679 hfi_bufreq_set_count_min(req, ver, inst->fw_min_cnt); in venus_helper_get_bufreq()
681 ret = platform_get_bufreq(inst, type, req); in venus_helper_get_bufreq()
684 inst->fw_min_cnt = hfi_bufreq_get_count_min(req, ver); in venus_helper_get_bufreq()
688 ret = hfi_session_get_property(inst, ptype, &hprop); in venus_helper_get_bufreq()
918 int venus_helper_get_profile_level(struct venus_inst *inst, u32 *profile, u32 *level) in venus_helper_get_profile_level() argument
924 ret = hfi_session_get_property(inst, ptype, &hprop); in venus_helper_get_profile_level()
928 v4l2_id_profile_level(inst->hfi_codec, &hprop.profile_level, profile, level); in venus_helper_get_profile_level()
934 int venus_helper_set_profile_level(struct venus_inst *inst, u32 profile, u32 level) in venus_helper_set_profile_level() argument
939 hfi_id_profile_level(inst->hfi_codec, profile, level, &pl); in venus_helper_set_profile_level()
941 return hfi_session_set_property(inst, ptype, &pl); in venus_helper_set_profile_level()
1123 int venus_helper_set_input_resolution(struct venus_inst *inst, in venus_helper_set_input_resolution() argument
1133 return hfi_session_set_property(inst, ptype, &fs); in venus_helper_set_input_resolution()
1137 int venus_helper_set_output_resolution(struct venus_inst *inst, in venus_helper_set_output_resolution() argument
1148 return hfi_session_set_property(inst, ptype, &fs); in venus_helper_set_output_resolution()
1152 static u32 venus_helper_get_work_mode(struct venus_inst *inst) in venus_helper_get_work_mode() argument
1158 if (inst->session_type == VIDC_SESSION_TYPE_DEC) { in venus_helper_get_work_mode()
1159 num_mbs = (ALIGN(inst->height, 16) * ALIGN(inst->width, 16)) / 256; in venus_helper_get_work_mode()
1160 if (inst->hfi_codec == HFI_VIDEO_CODEC_MPEG2 || in venus_helper_get_work_mode()
1161 inst->pic_struct != HFI_INTERLACE_FRAME_PROGRESSIVE || in venus_helper_get_work_mode()
1165 num_mbs = (ALIGN(inst->out_height, 16) * ALIGN(inst->out_width, 16)) / 256; in venus_helper_get_work_mode()
1166 if (inst->hfi_codec == HFI_VIDEO_CODEC_VP8 && in venus_helper_get_work_mode()
1174 int venus_helper_set_work_mode(struct venus_inst *inst) in venus_helper_set_work_mode() argument
1180 if (!IS_V4(inst->core) && !IS_V6(inst->core)) in venus_helper_set_work_mode()
1183 mode = venus_helper_get_work_mode(inst); in venus_helper_set_work_mode()
1185 return hfi_session_set_property(inst, ptype, &wm); in venus_helper_set_work_mode()
1189 int venus_helper_set_format_constraints(struct venus_inst *inst) in venus_helper_set_format_constraints() argument
1194 if (!IS_V6(inst->core)) in venus_helper_set_format_constraints()
1197 if (inst->opb_fmt == HFI_COLOR_FORMAT_NV12_UBWC || in venus_helper_set_format_constraints()
1198 inst->opb_fmt == HFI_COLOR_FORMAT_YUV420_TP10_UBWC) in venus_helper_set_format_constraints()
1213 return hfi_session_set_property(inst, ptype, &pconstraint); in venus_helper_set_format_constraints()
1217 int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, in venus_helper_set_num_bufs() argument
1228 ret = hfi_session_set_property(inst, ptype, &buf_count); in venus_helper_set_num_bufs()
1235 ret = hfi_session_set_property(inst, ptype, &buf_count); in venus_helper_set_num_bufs()
1243 ret = hfi_session_set_property(inst, ptype, &buf_count); in venus_helper_set_num_bufs()
1250 int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format, in venus_helper_set_raw_format() argument
1259 return hfi_session_set_property(inst, ptype, &fmt); in venus_helper_set_raw_format()
1263 int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt) in venus_helper_set_color_format() argument
1267 if (inst->session_type == VIDC_SESSION_TYPE_DEC) in venus_helper_set_color_format()
1269 else if (inst->session_type == VIDC_SESSION_TYPE_ENC) in venus_helper_set_color_format()
1278 return venus_helper_set_raw_format(inst, hfi_format, buftype); in venus_helper_set_color_format()
1282 int venus_helper_set_multistream(struct venus_inst *inst, bool out_en, in venus_helper_set_multistream() argument
1292 ret = hfi_session_set_property(inst, ptype, &multi); in venus_helper_set_multistream()
1299 return hfi_session_set_property(inst, ptype, &multi); in venus_helper_set_multistream()
1303 int venus_helper_set_dyn_bufmode(struct venus_inst *inst) in venus_helper_set_dyn_bufmode() argument
1309 if (!is_dynamic_bufmode(inst)) in venus_helper_set_dyn_bufmode()
1315 ret = hfi_session_set_property(inst, ptype, &mode); in venus_helper_set_dyn_bufmode()
1321 return hfi_session_set_property(inst, ptype, &mode); in venus_helper_set_dyn_bufmode()
1325 int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype) in venus_helper_set_bufsize() argument
1333 return hfi_session_set_property(inst, ptype, &bufsz); in venus_helper_set_bufsize()
1337 unsigned int venus_helper_get_opb_size(struct venus_inst *inst) in venus_helper_get_opb_size() argument
1340 if (inst->session_type == VIDC_SESSION_TYPE_ENC) in venus_helper_get_opb_size()
1341 return inst->output_buf_size; in venus_helper_get_opb_size()
1343 if (inst->opb_buftype == HFI_BUFFER_OUTPUT) in venus_helper_get_opb_size()
1344 return inst->output_buf_size; in venus_helper_get_opb_size()
1345 else if (inst->opb_buftype == HFI_BUFFER_OUTPUT2) in venus_helper_get_opb_size()
1346 return inst->output2_buf_size; in venus_helper_get_opb_size()
1355 struct venus_inst *inst; in delayed_process_buf_func() local
1358 inst = container_of(work, struct venus_inst, delayed_process_work); in delayed_process_buf_func()
1360 mutex_lock(&inst->lock); in delayed_process_buf_func()
1362 if (!(inst->streamon_out & inst->streamon_cap)) in delayed_process_buf_func()
1365 list_for_each_entry_safe(buf, n, &inst->delayed_process, ref_list) { in delayed_process_buf_func()
1369 ret = session_process_buf(inst, &buf->vb); in delayed_process_buf_func()
1371 return_buf_error(inst, &buf->vb); in delayed_process_buf_func()
1376 mutex_unlock(&inst->lock); in delayed_process_buf_func()
1379 void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx) in venus_helper_release_buf_ref() argument
1383 list_for_each_entry(buf, &inst->registeredbufs, reg_list) { in venus_helper_release_buf_ref()
1386 schedule_work(&inst->delayed_process_work); in venus_helper_release_buf_ref()
1401 static int is_buf_refed(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf) in is_buf_refed() argument
1406 list_add_tail(&buf->ref_list, &inst->delayed_process); in is_buf_refed()
1407 schedule_work(&inst->delayed_process_work); in is_buf_refed()
1415 venus_helper_find_buf(struct venus_inst *inst, unsigned int type, u32 idx) in venus_helper_find_buf() argument
1417 struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; in venus_helper_find_buf()
1426 void venus_helper_change_dpb_owner(struct venus_inst *inst, in venus_helper_change_dpb_owner() argument
1433 buf_type != inst->dpb_buftype) in venus_helper_change_dpb_owner()
1436 list_for_each_entry(dpb_buf, &inst->dpbbufs, list) in venus_helper_change_dpb_owner()
1446 struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue); in venus_helper_vb2_buf_init() local
1454 list_add_tail(&buf->reg_list, &inst->registeredbufs); in venus_helper_vb2_buf_init()
1462 struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue); in venus_helper_vb2_buf_prepare() local
1463 unsigned int out_buf_size = venus_helper_get_opb_size(inst); in venus_helper_vb2_buf_prepare()
1470 dev_err(inst->core->dev, "%s field isn't supported\n", in venus_helper_vb2_buf_prepare()
1480 vb2_plane_size(vb, 0) < inst->input_buf_size) in venus_helper_vb2_buf_prepare()
1487 static void cache_payload(struct venus_inst *inst, struct vb2_buffer *vb) in cache_payload() argument
1493 inst->payloads[idx] = vb2_get_plane_payload(vb, 0); in cache_payload()
1499 struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue); in venus_helper_vb2_buf_queue() local
1500 struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; in venus_helper_vb2_buf_queue()
1506 if (inst->session_type == VIDC_SESSION_TYPE_DEC && in venus_helper_vb2_buf_queue()
1508 inst->codec_state == VENUS_DEC_STATE_DRC) in venus_helper_vb2_buf_queue()
1511 cache_payload(inst, vb); in venus_helper_vb2_buf_queue()
1513 if (inst->session_type == VIDC_SESSION_TYPE_ENC && in venus_helper_vb2_buf_queue()
1514 !(inst->streamon_out && inst->streamon_cap)) in venus_helper_vb2_buf_queue()
1518 ret = is_buf_refed(inst, vbuf); in venus_helper_vb2_buf_queue()
1522 ret = session_process_buf(inst, vbuf); in venus_helper_vb2_buf_queue()
1524 return_buf_error(inst, vbuf); in venus_helper_vb2_buf_queue()
1529 void venus_helper_buffers_done(struct venus_inst *inst, unsigned int type, in venus_helper_buffers_done() argument
1535 while ((buf = v4l2_m2m_src_buf_remove(inst->m2m_ctx))) in venus_helper_buffers_done()
1538 while ((buf = v4l2_m2m_dst_buf_remove(inst->m2m_ctx))) in venus_helper_buffers_done()
1546 struct venus_inst *inst = vb2_get_drv_priv(q); in venus_helper_vb2_stop_streaming() local
1547 struct venus_core *core = inst->core; in venus_helper_vb2_stop_streaming()
1550 mutex_lock(&inst->lock); in venus_helper_vb2_stop_streaming()
1552 if (inst->streamon_out & inst->streamon_cap) { in venus_helper_vb2_stop_streaming()
1553 ret = hfi_session_stop(inst); in venus_helper_vb2_stop_streaming()
1554 ret |= hfi_session_unload_res(inst); in venus_helper_vb2_stop_streaming()
1555 ret |= venus_helper_unregister_bufs(inst); in venus_helper_vb2_stop_streaming()
1556 ret |= venus_helper_intbufs_free(inst); in venus_helper_vb2_stop_streaming()
1557 ret |= hfi_session_deinit(inst); in venus_helper_vb2_stop_streaming()
1559 if (inst->session_error || test_bit(0, &core->sys_error)) in venus_helper_vb2_stop_streaming()
1563 hfi_session_abort(inst); in venus_helper_vb2_stop_streaming()
1565 venus_helper_free_dpb_bufs(inst); in venus_helper_vb2_stop_streaming()
1567 venus_pm_load_scale(inst); in venus_helper_vb2_stop_streaming()
1568 INIT_LIST_HEAD(&inst->registeredbufs); in venus_helper_vb2_stop_streaming()
1571 venus_helper_buffers_done(inst, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, in venus_helper_vb2_stop_streaming()
1573 venus_helper_buffers_done(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, in venus_helper_vb2_stop_streaming()
1577 inst->streamon_out = 0; in venus_helper_vb2_stop_streaming()
1579 inst->streamon_cap = 0; in venus_helper_vb2_stop_streaming()
1581 venus_pm_release_core(inst); in venus_helper_vb2_stop_streaming()
1583 inst->session_error = 0; in venus_helper_vb2_stop_streaming()
1585 mutex_unlock(&inst->lock); in venus_helper_vb2_stop_streaming()
1589 void venus_helper_vb2_queue_error(struct venus_inst *inst) in venus_helper_vb2_queue_error() argument
1591 struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; in venus_helper_vb2_queue_error()
1601 int venus_helper_process_initial_cap_bufs(struct venus_inst *inst) in venus_helper_process_initial_cap_bufs() argument
1603 struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; in venus_helper_process_initial_cap_bufs()
1608 ret = session_process_buf(inst, &buf->vb); in venus_helper_process_initial_cap_bufs()
1610 return_buf_error(inst, &buf->vb); in venus_helper_process_initial_cap_bufs()
1619 int venus_helper_process_initial_out_bufs(struct venus_inst *inst) in venus_helper_process_initial_out_bufs() argument
1621 struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; in venus_helper_process_initial_out_bufs()
1626 ret = session_process_buf(inst, &buf->vb); in venus_helper_process_initial_out_bufs()
1628 return_buf_error(inst, &buf->vb); in venus_helper_process_initial_out_bufs()
1637 int venus_helper_vb2_start_streaming(struct venus_inst *inst) in venus_helper_vb2_start_streaming() argument
1641 ret = venus_helper_intbufs_alloc(inst); in venus_helper_vb2_start_streaming()
1645 ret = session_register_bufs(inst); in venus_helper_vb2_start_streaming()
1649 venus_pm_load_scale(inst); in venus_helper_vb2_start_streaming()
1651 ret = hfi_session_load_res(inst); in venus_helper_vb2_start_streaming()
1655 ret = hfi_session_start(inst); in venus_helper_vb2_start_streaming()
1662 hfi_session_unload_res(inst); in venus_helper_vb2_start_streaming()
1664 venus_helper_unregister_bufs(inst); in venus_helper_vb2_start_streaming()
1666 venus_helper_intbufs_free(inst); in venus_helper_vb2_start_streaming()
1673 struct venus_inst *inst = priv; in venus_helper_m2m_device_run() local
1674 struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; in venus_helper_m2m_device_run()
1678 mutex_lock(&inst->lock); in venus_helper_m2m_device_run()
1681 ret = session_process_buf(inst, &buf->vb); in venus_helper_m2m_device_run()
1683 return_buf_error(inst, &buf->vb); in venus_helper_m2m_device_run()
1687 ret = session_process_buf(inst, &buf->vb); in venus_helper_m2m_device_run()
1689 return_buf_error(inst, &buf->vb); in venus_helper_m2m_device_run()
1692 mutex_unlock(&inst->lock); in venus_helper_m2m_device_run()
1698 struct venus_inst *inst = priv; in venus_helper_m2m_job_abort() local
1700 v4l2_m2m_job_finish(inst->m2m_dev, inst->m2m_ctx); in venus_helper_m2m_job_abort()
1704 int venus_helper_session_init(struct venus_inst *inst) in venus_helper_session_init() argument
1706 enum hfi_version version = inst->core->res->hfi_version; in venus_helper_session_init()
1707 u32 session_type = inst->session_type; in venus_helper_session_init()
1711 codec = inst->session_type == VIDC_SESSION_TYPE_DEC ? in venus_helper_session_init()
1712 inst->fmt_out->pixfmt : inst->fmt_cap->pixfmt; in venus_helper_session_init()
1714 ret = hfi_session_init(inst, codec); in venus_helper_session_init()
1718 inst->clk_data.vpp_freq = hfi_platform_get_codec_vpp_freq(version, codec, in venus_helper_session_init()
1720 inst->clk_data.vsp_freq = hfi_platform_get_codec_vsp_freq(version, codec, in venus_helper_session_init()
1722 inst->clk_data.low_power_freq = hfi_platform_get_codec_lp_freq(version, codec, in venus_helper_session_init()
1729 void venus_helper_init_instance(struct venus_inst *inst) in venus_helper_init_instance() argument
1731 if (inst->session_type == VIDC_SESSION_TYPE_DEC) { in venus_helper_init_instance()
1732 INIT_LIST_HEAD(&inst->delayed_process); in venus_helper_init_instance()
1733 INIT_WORK(&inst->delayed_process_work, in venus_helper_init_instance()
1752 int venus_helper_get_out_fmts(struct venus_inst *inst, u32 v4l2_fmt, in venus_helper_get_out_fmts() argument
1755 struct venus_core *core = inst->core; in venus_helper_get_out_fmts()
1765 caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type); in venus_helper_get_out_fmts()
1769 if (inst->bit_depth == VIDC_BITDEPTH_10 && inst->session_type == VIDC_SESSION_TYPE_DEC) { in venus_helper_get_out_fmts()
1816 bool venus_helper_check_format(struct venus_inst *inst, u32 v4l2_pixfmt) in venus_helper_check_format() argument
1818 struct venus_core *core = inst->core; in venus_helper_check_format()
1826 caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type); in venus_helper_check_format()
1840 int venus_helper_set_stride(struct venus_inst *inst, in venus_helper_set_stride() argument
1854 return hfi_session_set_property(inst, ptype, &plane_actual_info); in venus_helper_set_stride()