* [PATCH v2 1/2] media: chips-media: wave5: Fix conditional in start_streaming
@ 2025-10-21 20:46 Brandon Brnich
2025-10-21 20:46 ` [PATCH v2 2/2] media: chips-media: wave5: Process ready frames when CMD_STOP sent to Encoder Brandon Brnich
2025-10-28 16:42 ` [PATCH v2 1/2] media: chips-media: wave5: Fix conditional in start_streaming Nicolas Dufresne
0 siblings, 2 replies; 6+ messages in thread
From: Brandon Brnich @ 2025-10-21 20:46 UTC (permalink / raw)
To: Nas Chung, Jackson Lee, Mauro Carvalho Chehab, linux-media,
linux-kernel, Nicolas Dufresne
Cc: Darren Etheridge, Brandon Brnich
When STREAMON(CAP) is called after STREAMON(OUT), the driver was failing to
switch states from VPU_INST_STATE_OPEN to VPU_INST_STATE_INIT_SEQ and
VPU_INST_STATE_PIC_RUN because the capture queue streaming boolean had not
yet been set to true. This led to a hang in the encoder since the state
was stuck in VPU_INST_STATE_OPEN. During the second call to
start_streaming, the sequence initialization and frame buffer allocation
should occur.
Signed-off-by: Brandon Brnich <b-brnich@ti.com>
---
drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
index 1978551a28fa..0a2eab372913 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
@@ -1367,7 +1367,8 @@ static int wave5_vpu_enc_start_streaming(struct vb2_queue *q, unsigned int count
if (ret)
goto return_buffers;
}
- if (inst->state == VPU_INST_STATE_OPEN && m2m_ctx->cap_q_ctx.q.streaming) {
+ if (inst->state == VPU_INST_STATE_OPEN && (m2m_ctx->cap_q_ctx.q.streaming ||
+ q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) {
ret = initialize_sequence(inst);
if (ret) {
dev_warn(inst->dev->dev, "Sequence not found: %d\n", ret);
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] media: chips-media: wave5: Process ready frames when CMD_STOP sent to Encoder
2025-10-21 20:46 [PATCH v2 1/2] media: chips-media: wave5: Fix conditional in start_streaming Brandon Brnich
@ 2025-10-21 20:46 ` Brandon Brnich
2025-10-28 16:42 ` Nicolas Dufresne
2025-10-28 16:42 ` [PATCH v2 1/2] media: chips-media: wave5: Fix conditional in start_streaming Nicolas Dufresne
1 sibling, 1 reply; 6+ messages in thread
From: Brandon Brnich @ 2025-10-21 20:46 UTC (permalink / raw)
To: Nas Chung, Jackson Lee, Mauro Carvalho Chehab, linux-media,
linux-kernel, Nicolas Dufresne
Cc: Darren Etheridge, Brandon Brnich
CMD_STOP being sent to encoder before last job is executed by device_run
can lead to an occasional dropped frame. Ensure that remaining ready
buffers are drained by making a call to v4l2_m2m_try_schedule.
Signed-off-by: Brandon Brnich <b-brnich@ti.com>
---
drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
index 0a2eab372913..7ee77c9a30c0 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
@@ -649,6 +649,8 @@ static int wave5_vpu_enc_encoder_cmd(struct file *file, void *fh, struct v4l2_en
m2m_ctx->last_src_buf = v4l2_m2m_last_src_buf(m2m_ctx);
m2m_ctx->is_draining = true;
+
+ v4l2_m2m_try_schedule(m2m_ctx);
break;
case V4L2_ENC_CMD_START:
break;
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] media: chips-media: wave5: Fix conditional in start_streaming
2025-10-21 20:46 [PATCH v2 1/2] media: chips-media: wave5: Fix conditional in start_streaming Brandon Brnich
2025-10-21 20:46 ` [PATCH v2 2/2] media: chips-media: wave5: Process ready frames when CMD_STOP sent to Encoder Brandon Brnich
@ 2025-10-28 16:42 ` Nicolas Dufresne
2025-10-29 15:08 ` Brandon Brnich
1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Dufresne @ 2025-10-28 16:42 UTC (permalink / raw)
To: Brandon Brnich, Nas Chung, Jackson Lee, Mauro Carvalho Chehab,
linux-media, linux-kernel
Cc: Darren Etheridge
[-- Attachment #1: Type: text/plain, Size: 1613 bytes --]
Le mardi 21 octobre 2025 à 15:46 -0500, Brandon Brnich a écrit :
> When STREAMON(CAP) is called after STREAMON(OUT), the driver was failing to
> switch states from VPU_INST_STATE_OPEN to VPU_INST_STATE_INIT_SEQ and
> VPU_INST_STATE_PIC_RUN because the capture queue streaming boolean had not
> yet been set to true. This led to a hang in the encoder since the state
> was stuck in VPU_INST_STATE_OPEN. During the second call to
> start_streaming, the sequence initialization and frame buffer allocation
> should occur.
>
> Signed-off-by: Brandon Brnich <b-brnich@ti.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> index 1978551a28fa..0a2eab372913 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> @@ -1367,7 +1367,8 @@ static int wave5_vpu_enc_start_streaming(struct
> vb2_queue *q, unsigned int count
> if (ret)
> goto return_buffers;
> }
> - if (inst->state == VPU_INST_STATE_OPEN && m2m_ctx-
> >cap_q_ctx.q.streaming) {
> + if (inst->state == VPU_INST_STATE_OPEN && (m2m_ctx-
> >cap_q_ctx.q.streaming ||
> + q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) {
> ret = initialize_sequence(inst);
> if (ret) {
> dev_warn(inst->dev->dev, "Sequence not found: %d\n",
> ret);
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] media: chips-media: wave5: Process ready frames when CMD_STOP sent to Encoder
2025-10-21 20:46 ` [PATCH v2 2/2] media: chips-media: wave5: Process ready frames when CMD_STOP sent to Encoder Brandon Brnich
@ 2025-10-28 16:42 ` Nicolas Dufresne
0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Dufresne @ 2025-10-28 16:42 UTC (permalink / raw)
To: Brandon Brnich, Nas Chung, Jackson Lee, Mauro Carvalho Chehab,
linux-media, linux-kernel
Cc: Darren Etheridge
[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]
Le mardi 21 octobre 2025 à 15:46 -0500, Brandon Brnich a écrit :
> CMD_STOP being sent to encoder before last job is executed by device_run
> can lead to an occasional dropped frame. Ensure that remaining ready
> buffers are drained by making a call to v4l2_m2m_try_schedule.
>
> Signed-off-by: Brandon Brnich <b-brnich@ti.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> index 0a2eab372913..7ee77c9a30c0 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> @@ -649,6 +649,8 @@ static int wave5_vpu_enc_encoder_cmd(struct file *file,
> void *fh, struct v4l2_en
>
> m2m_ctx->last_src_buf = v4l2_m2m_last_src_buf(m2m_ctx);
> m2m_ctx->is_draining = true;
> +
> + v4l2_m2m_try_schedule(m2m_ctx);
> break;
> case V4L2_ENC_CMD_START:
> break;
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] media: chips-media: wave5: Fix conditional in start_streaming
2025-10-28 16:42 ` [PATCH v2 1/2] media: chips-media: wave5: Fix conditional in start_streaming Nicolas Dufresne
@ 2025-10-29 15:08 ` Brandon Brnich
2025-12-09 20:31 ` Nicolas Dufresne
0 siblings, 1 reply; 6+ messages in thread
From: Brandon Brnich @ 2025-10-29 15:08 UTC (permalink / raw)
To: Nicolas Dufresne, Nas Chung, Jackson Lee, Mauro Carvalho Chehab,
linux-media, linux-kernel
Cc: Darren Etheridge
Hi Nicolas,
On 10/28/2025 11:42 AM, Nicolas Dufresne wrote:
> Le mardi 21 octobre 2025 à 15:46 -0500, Brandon Brnich a écrit :
>> When STREAMON(CAP) is called after STREAMON(OUT), the driver was failing to
>> switch states from VPU_INST_STATE_OPEN to VPU_INST_STATE_INIT_SEQ and
>> VPU_INST_STATE_PIC_RUN because the capture queue streaming boolean had not
>> yet been set to true. This led to a hang in the encoder since the state
>> was stuck in VPU_INST_STATE_OPEN. During the second call to
>> start_streaming, the sequence initialization and frame buffer allocation
>> should occur.
>>
>> Signed-off-by: Brandon Brnich <b-brnich@ti.com>
>
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
I just saw I received a messaged from the CI bot on an alignment error
on my conditional statement below. Would you like me to submit a v3 or
will this be fixed up before being pulled to media tree? I can submit a
new version today if required.
Best,
Brandon
>
>> ---
>> drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
>> b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
>> index 1978551a28fa..0a2eab372913 100644
>> --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
>> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
>> @@ -1367,7 +1367,8 @@ static int wave5_vpu_enc_start_streaming(struct
>> vb2_queue *q, unsigned int count
>> if (ret)
>> goto return_buffers;
>> }
>> - if (inst->state == VPU_INST_STATE_OPEN && m2m_ctx-
>>> cap_q_ctx.q.streaming) {
>> + if (inst->state == VPU_INST_STATE_OPEN && (m2m_ctx-
>>> cap_q_ctx.q.streaming ||
>> + q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) {
>> ret = initialize_sequence(inst);
>> if (ret) {
>> dev_warn(inst->dev->dev, "Sequence not found: %d\n",
>> ret);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] media: chips-media: wave5: Fix conditional in start_streaming
2025-10-29 15:08 ` Brandon Brnich
@ 2025-12-09 20:31 ` Nicolas Dufresne
0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Dufresne @ 2025-12-09 20:31 UTC (permalink / raw)
To: Brandon Brnich, Nas Chung, Jackson Lee, Mauro Carvalho Chehab,
linux-media, linux-kernel
Cc: Darren Etheridge
[-- Attachment #1: Type: text/plain, Size: 2285 bytes --]
Hi,
Le mercredi 29 octobre 2025 à 10:08 -0500, Brandon Brnich a écrit :
> Hi Nicolas,
>
> On 10/28/2025 11:42 AM, Nicolas Dufresne wrote:
> > Le mardi 21 octobre 2025 à 15:46 -0500, Brandon Brnich a écrit :
> > > When STREAMON(CAP) is called after STREAMON(OUT), the driver was failing to
> > > switch states from VPU_INST_STATE_OPEN to VPU_INST_STATE_INIT_SEQ and
> > > VPU_INST_STATE_PIC_RUN because the capture queue streaming boolean had not
> > > yet been set to true. This led to a hang in the encoder since the state
> > > was stuck in VPU_INST_STATE_OPEN. During the second call to
> > > start_streaming, the sequence initialization and frame buffer allocation
> > > should occur.
> > >
> > > Signed-off-by: Brandon Brnich <b-brnich@ti.com>
> >
> > Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
>
> I just saw I received a messaged from the CI bot on an alignment error
> on my conditional statement below. Would you like me to submit a v3 or
> will this be fixed up before being pulled to media tree? I can submit a
> new version today if required.
Late response, I'll fix while applying.
cheers,
Nicolas
>
> Best,
> Brandon
>
> >
> > > ---
> > > drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > > b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > > index 1978551a28fa..0a2eab372913 100644
> > > --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > > +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > > @@ -1367,7 +1367,8 @@ static int wave5_vpu_enc_start_streaming(struct
> > > vb2_queue *q, unsigned int count
> > > if (ret)
> > > goto return_buffers;
> > > }
> > > - if (inst->state == VPU_INST_STATE_OPEN && m2m_ctx-
> > > > cap_q_ctx.q.streaming) {
> > > + if (inst->state == VPU_INST_STATE_OPEN && (m2m_ctx-
> > > > cap_q_ctx.q.streaming ||
> > > + q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) {
> > > ret = initialize_sequence(inst);
> > > if (ret) {
> > > dev_warn(inst->dev->dev, "Sequence not found: %d\n",
> > > ret);
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-12-09 20:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-21 20:46 [PATCH v2 1/2] media: chips-media: wave5: Fix conditional in start_streaming Brandon Brnich
2025-10-21 20:46 ` [PATCH v2 2/2] media: chips-media: wave5: Process ready frames when CMD_STOP sent to Encoder Brandon Brnich
2025-10-28 16:42 ` Nicolas Dufresne
2025-10-28 16:42 ` [PATCH v2 1/2] media: chips-media: wave5: Fix conditional in start_streaming Nicolas Dufresne
2025-10-29 15:08 ` Brandon Brnich
2025-12-09 20:31 ` Nicolas Dufresne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®