[PATCH] media: venus: vdec: Clear streamon flags on streaming errors
From: fengchenguang
Date: Wed Sep 30 2026 - 00:25:02 EST
From: Chenguang Feng <fengchenguang@xxxxxxxxxx>
The decoder only clears inst->streamon_out and inst->streamon_cap on
the success path. When vdec_start_output() runs with the decoder in
the INIT or CAPTURE_SETUP state, it still sets streamon_out at its
done: label even if venus_helper_process_initial_out_bufs() failed,
and the error path of vdec_start_streaming() does not reset the
flags. vdec_stop_streaming() skips the clearing as well whenever
the hfi flush fails.
In both cases the driver and vb2 disagree about the streaming state:
vdec_decoder_cmd() and delayed_process_buf_func() keep going as if
the queue were still streaming, and a later capture streamon assumes
the output queue is streaming too.
The encoder clears both flags unconditionally in the same
situations, so make the decoder do the same and print an error when
the flush fails.
Fixes: beac82904a87 ("media: venus: make decoder compliant with stateful codec API")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Chenguang Feng <fengchenguang@xxxxxxxxxx>
---
drivers/media/platform/qcom/venus/vdec.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index 6a43ea191da1..b25d9299f4d2 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -1217,6 +1217,10 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count)
vdec_pm_put(inst, false);
error:
venus_helper_buffers_done(inst, q->type, VB2_BUF_STATE_QUEUED);
+ if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
+ inst->streamon_out = 0;
+ else
+ inst->streamon_cap = 0;
mutex_unlock(&inst->lock);
return ret;
}
@@ -1297,15 +1301,14 @@ static void vdec_stop_streaming(struct vb2_queue *q)
inst->session_error = 0;
- if (ret)
- goto unlock;
-
if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
inst->streamon_out = 0;
else
inst->streamon_cap = 0;
-unlock:
+ if (ret)
+ dev_err(inst->core->dev_dec, "dec: failed to stop streaming: %d\n", ret);
+
mutex_unlock(&inst->lock);
}
--
2.25.1