All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: venus: dec: Fix handling of the start cmd
@ 2023-01-30 10:54 Michał Krawczyk
  2023-01-30 12:31 ` kernel test robot
  2023-01-30 13:54 ` [PATCH v2] " Michał Krawczyk
  0 siblings, 2 replies; 10+ messages in thread
From: Michał Krawczyk @ 2023-01-30 10:54 UTC (permalink / raw)
  To: Stanimir Varbanov, Vikash Garodia
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel,
	Michał Krawczyk

From: Michał Krawczyk <mk@semihalf.com>

The decoder driver should clear the last_buffer_dequeued flag of the
capture queue upon receiving V4L2_DEC_CMD_START.

The last_buffer_dequeued flag is set upon receiving EOS (which always
happens upon receiving V4L2_DEC_CMD_STOP).

Without this patch, after issuing the V4L2_DEC_CMD_STOP and
V4L2_DEC_CMD_START, the vb2_dqbuf() function will always fail, even if
the buffers are completed by the hardware.

Fixes: beac82904a87 ("media: venus: make decoder compliant with stateful codec API")

Signed-off-by: Michał Krawczyk <mk@semihalf.com>
---
 drivers/media/platform/qcom/venus/vdec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index 4ceaba37e2e5..175488ea08ff 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -526,6 +526,7 @@ static int
 vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 {
 	struct venus_inst *inst = to_inst(file);
+	struct vb2_queue *dst_vq;
 	struct hfi_frame_data fdata = {0};
 	int ret;
 
@@ -556,6 +557,13 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
 			inst->codec_state = VENUS_DEC_STATE_DRAIN;
 			inst->drain_active = true;
 		}
+	} else if (cmd->cmd == V4L2_DEC_CMD_START &&
+		   inst->codec_state == VENUS_DEC_STATE_STOPPED) {
+		dst_vq = v4l2_m2m_get_vq(inst->fh.m2m_ctx,
+					 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+		vb2_clear_last_buffer_dequeued(&inst->fh.m2m_ctx->cap_q_ctx.q);
+
+		inst->codec_state = VENUS_DEC_STATE_DECODING;
 	}
 
 unlock:
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-04-05  9:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30 10:54 [PATCH] media: venus: dec: Fix handling of the start cmd Michał Krawczyk
2023-01-30 12:31 ` kernel test robot
2023-01-30 13:54 ` [PATCH v2] " Michał Krawczyk
2023-02-07  9:17   ` Michał Krawczyk
2023-02-07  9:54     ` Vikash Garodia
2023-02-07 11:15       ` Michał Krawczyk
2023-02-10 15:18         ` Michał Krawczyk
2023-03-10 15:05           ` Michał Krawczyk
2023-04-05  9:29             ` Michał Krawczyk
2023-04-05  9:42               ` Dikshita Agarwal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.