venus: vdec: decoded picture buffer handling during reconfig sequence
Subsystems (4)
PATCH v5 1/1 venus: vdec: decoded picture buffer handling during reconfig sequence
In existing implementation, driver is freeing and un-mapping all the decoded picture buffers(DPB) as part of dynamic resolution change(DRC) handling. As a result, when firmware try to access the DPB buffer, from previous sequence, SMMU context fault is seen due to the buffer being already unmapped.
With this change, driver defines ownership of each DPB buffer. If a buffer is owned by firmware, driver would skip from un-mapping the same.
changes in V5:
- Addressed kernel test robot reported warnings/errors changes in V4:
- As per comments moved static global variable to venus_inst structure
- Addressed other review comments
Changes in V3:
- Migrated id allocation using kernel API ida_alloc_min()
--- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/helpers.c | 51 ++++++++++++++++++++- drivers/media/platform/qcom/venus/helpers.h | 3 ++ drivers/media/platform/qcom/venus/vdec.c | 7 ++- 4 files changed, 60 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/venus/core.h +1 -0
@@ -452,6 +452,7 @@ struct venus_inst {bool next_buf_last;bool drain_active;enum venus_inst_modes flags; +struct ida dpb_ids; };#define IS_V1 (core) ((core)->res->hfi_version == HFI_VERSION_1XX)
drivers/media/platform/qcom/venus/helpers.c +50 -1
108 lines not on this page · raw message
drivers/media/platform/qcom/venus/helpers.h +3 -0
@@ -14,6 +14,9 @@ struct venus_core;bool venus_helper_check_codec (struct venus_inst *inst,u32 v4l2_pixfmt);struct vb2_v4l2_buffer *venus_helper_find_buf (struct venus_inst *inst,unsigned int type,u32 idx); +void venus_helper_change_dpb_owner (struct venus_inst *inst, +struct vb2_v4l2_buffer *vbuf,unsigned int type, +unsigned int buf_type,u32 idx);void venus_helper_buffers_done (struct venus_inst *inst,unsigned int type,enum vb2_buffer_state state);int venus_helper_vb2_buf_init (struct vb2_buffer *vb);
drivers/media/platform/qcom/venus/vdec.c +6 -1
@@ -1306,8 +1306,10 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type, type =V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ; vbuf =venus_helper_find_buf (inst, type, tag); -if (!vbuf) +if (!vbuf) { +venus_helper_change_dpb_owner (inst, vbuf, type, buf_type, tag);return ; + } vbuf->flags = flags; vbuf->field =V4L2_FIELD_NONE ;
@@ -1580,6 +1582,8 @@ static int vdec_open(struct file *file)vdec_inst_init (inst); +ida_init (&inst->dpb_ids); +/* * create m2m device for every instance, the m2m context scheduling * is made by firmware side so we do not need to care about.
@@ -1625,6 +1629,7 @@ static int vdec_close(struct file *file)v4l2_m2m_ctx_release (inst->m2m_ctx);v4l2_m2m_release (inst->m2m_dev);vdec_ctrl_deinit (inst); +ida_destroy (&inst->dpb_ids);hfi_session_destroy (inst);mutex_destroy (&inst->lock);v4l2_fh_del (&inst->fh);
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation