[PATCH v2 04/12] staging: media: rkvdec: Block start streaming until both queues run

From: Sebastian Fricke
Date: Thu Jan 12 2023 - 07:57:45 EST


Ensure that both the CAPTURE and the OUTPUT queue are running (e.g. busy
-> have buffers allocated) before starting the actual streaming process.

Signed-off-by: Sebastian Fricke <sebastian.fricke@xxxxxxxxxxxxx>
---
drivers/staging/media/rkvdec/rkvdec.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
index c849f6c20279..e0e95d06e216 100644
--- a/drivers/staging/media/rkvdec/rkvdec.c
+++ b/drivers/staging/media/rkvdec/rkvdec.c
@@ -562,6 +562,13 @@ static int rkvdec_start_streaming(struct vb2_queue *q, unsigned int count)
if (V4L2_TYPE_IS_CAPTURE(q->type))
return 0;

+ /*
+ * Make sure that both the output and the capture queue are running
+ */
+ if (rkvdec_queue_busy(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) == 0 ||
+ rkvdec_queue_busy(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) == 0)
+ return -EAGAIN;
+
desc = ctx->coded_fmt_desc;
if (WARN_ON(!desc))
return -EINVAL;

--
2.25.1