Przeglądaj źródła

video: driver: fix invalid output buffer tag receipt in fence usecase

When fence is enabled, output buffer tag is sent to fw via
output metadata buffer. Since fw relies on bytesused field of
output metadata buffer to invalidate cache and perform read operation,
output metadata buffer's filled length cannot be zero.
Hence set valid size for bytesused field to fix this issue.

Change-Id: I7bd87ec49508402d2d654095f06e75992771c39d
Signed-off-by: Akshata Sahukar <[email protected]>
Akshata Sahukar 3 lat temu
rodzic
commit
91f3bc9ab7

+ 1 - 2
driver/platform/kalama/src/msm_vidc_kalama.c

@@ -1327,8 +1327,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = {
 		0,
 		HFI_PROP_PIPE},
 
-	{POC, DEC, H264,
-		0, 18, 1, 1,
+	{POC, DEC, H264, 0, 2, 1, 1,
 		0,
 		HFI_PROP_PIC_ORDER_CNT_TYPE},
 

+ 30 - 0
driver/vidc/inc/msm_vidc_driver.h

@@ -153,6 +153,36 @@ static inline bool is_meta_tx_out_enabled(struct msm_vidc_inst *inst, u32 cap)
 	return enabled;
 }
 
+static inline bool is_any_meta_tx_out_enabled(struct msm_vidc_inst *inst)
+{
+	bool enabled = false;
+	u32 i;
+
+	for (i = INST_CAP_NONE + 1; i < META_CAP_MAX; i++) {
+		if (is_meta_tx_out_enabled(inst, i)) {
+			enabled = true;
+			break;
+		}
+	}
+
+	return enabled;
+}
+
+static inline bool is_any_meta_tx_inp_enabled(struct msm_vidc_inst *inst)
+{
+	bool enabled = false;
+	u32 i;
+
+	for (i = INST_CAP_NONE + 1; i < META_CAP_MAX; i++) {
+		if (is_meta_tx_inp_enabled(inst, i)) {
+			enabled = true;
+			break;
+		}
+	}
+
+	return enabled;
+}
+
 static inline bool is_input_meta_enabled(struct msm_vidc_inst *inst)
 {
 	bool enabled = false;

+ 0 - 12
driver/vidc/src/msm_vdec.c

@@ -2050,18 +2050,6 @@ int msm_vdec_qbuf(struct msm_vidc_inst *inst, struct vb2_buffer *vb2)
 		}
 	}
 
-	if (vb2->type == OUTPUT_META_PLANE) {
-		if (is_meta_rx_out_enabled(inst, META_DPB_TAG_LIST)) {
-			/*
-			 * vb2 is not allowing client to pass data in output meta plane.
-			 * adjust the bytesused as client will send buffer tag metadata
-			 * in output meta plane if DPB_TAG_LIST metadata enabled.
-			 */
-			if (!vb2->planes[0].bytesused)
-				vb2->planes[0].bytesused = 1024;
-		}
-	}
-
 	if (inst->adjust_priority) {
 		s32 priority = inst->capabilities->cap[PRIORITY].value;
 

+ 1 - 0
driver/vidc/src/msm_vidc_control.c

@@ -2810,6 +2810,7 @@ int msm_vidc_adjust_dec_lowlatency_mode(void *instance, struct v4l2_ctrl *ctrl)
 		&outbuf_fence, __func__))
 		return -EINVAL;
 
+	/* enable lowlatency if outbuf fence is enabled */
 	if (outbuf_fence & V4L2_MPEG_VIDC_META_ENABLE &&
 		outbuf_fence & V4L2_MPEG_VIDC_META_RX_INPUT)
 		adjusted_value = 1;

+ 1 - 2
driver/vidc/src/msm_vidc_driver.c

@@ -5568,8 +5568,7 @@ void msm_vidc_destroy_buffers(struct msm_vidc_inst *inst)
 	}
 
 	list_for_each_entry_safe(fence, dummy_fence, &inst->fence_list, list) {
-		i_vpr_e(inst, "%s: destroying fence id: %llu\n",
-			__func__, fence->dma_fence.seqno);
+		i_vpr_e(inst, "%s: destroying fence %s\n", __func__, fence->name);
 		msm_vidc_fence_destroy(inst, (u32)fence->dma_fence.seqno);
 	}
 

+ 18 - 6
driver/vidc/src/msm_vidc_vb2.c

@@ -450,12 +450,24 @@ void msm_vidc_buf_queue(struct vb2_buffer *vb2)
 		goto unlock;
 	}
 
-	/* Expecting non-zero filledlen on INPUT port */
-	if (vb2->type == INPUT_MPLANE && !vb2->planes[0].bytesused) {
-		i_vpr_e(inst,
-			"%s: zero bytesused input buffer not supported\n", __func__);
-		rc = -EINVAL;
-		goto unlock;
+	if (!vb2->planes[0].bytesused) {
+		if (vb2->type == INPUT_MPLANE) {
+			/* Expecting non-zero filledlen on INPUT port */
+			i_vpr_e(inst,
+				"%s: zero bytesused input buffer not supported\n", __func__);
+			rc = -EINVAL;
+			goto unlock;
+		}
+		if ((vb2->type == OUTPUT_META_PLANE && is_any_meta_tx_out_enabled(inst)) ||
+			(vb2->type == INPUT_META_PLANE && is_any_meta_tx_inp_enabled(inst))) {
+			/*
+			 * vb2 is not allowing client to pass data in output meta plane.
+			 * adjust the bytesused as client will send buffer tag metadata
+			 * in output meta plane if DPB_TAG_LIST, or OUTBUF_FENCE metadata
+			 * is enabled.
+			 */
+			vb2->planes[0].bytesused = vb2->planes[0].length;
+		}
 	}
 
 	if (is_encode_session(inst) && vb2->type == INPUT_MPLANE) {