Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH] media: iris: Fix ffmpeg corrupted frame error
@ 2025-10-06  9:18 ` Vishnu Reddy
  2025-10-06 14:09   ` Vikash Garodia
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Vishnu Reddy @ 2025-10-06  9:18 UTC (permalink / raw)
  To: vikash.garodia, dikshita.agarwal, abhinav.kumar, bod, mchehab,
	hverkuil, stefan.schmidt
  Cc: linux-media, linux-arm-msm, linux-kernel, Vishnu Reddy, stable

When the ffmpeg decoder is running, the driver receives the
V4L2_BUF_FLAG_KEYFRAME flag in the input buffer. The driver then forwards
this flag information to the firmware. The firmware, in turn, copies the
input buffer flags directly into the output buffer flags. Upon receiving
the output buffer from the firmware, the driver observes that the buffer
contains the HFI_BUFFERFLAG_DATACORRUPT flag. The root cause is that both
V4L2_BUF_FLAG_KEYFRAME and HFI_BUFFERFLAG_DATACORRUPT are the same value.
As a result, the driver incorrectly interprets the output frame as
corrupted, even though the frame is actually valid. This misinterpretation
causes the driver to report an error and skip good frames, leading to
missing frames in the final video output and triggering ffmpeg's "corrupt
decoded frame" error.

To resolve this issue, the input buffer flags should not be sent to the
firmware during decoding, since the firmware does not require this
information.

Fixes: 17f2a485ca67 ("media: iris: implement vb2 ops for buf_queue and firmware response")
Cc: stable@vger.kernel.org
Signed-off-by: Vishnu Reddy <quic_bvisredd@quicinc.com>
---
 drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
index e1788c266bb1..4de03f31eaf3 100644
--- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
+++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
@@ -282,7 +282,7 @@ static int iris_hfi_gen1_queue_input_buffer(struct iris_inst *inst, struct iris_
 		com_ip_pkt.shdr.session_id = inst->session_id;
 		com_ip_pkt.time_stamp_hi = upper_32_bits(buf->timestamp);
 		com_ip_pkt.time_stamp_lo = lower_32_bits(buf->timestamp);
-		com_ip_pkt.flags = buf->flags;
+		com_ip_pkt.flags = 0;
 		com_ip_pkt.mark_target = 0;
 		com_ip_pkt.mark_data = 0;
 		com_ip_pkt.offset = buf->data_offset;
-- 
2.34.1


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

* Re: [PATCH] media: iris: Fix ffmpeg corrupted frame error
  2025-10-06  9:18 ` [PATCH] media: iris: Fix ffmpeg corrupted frame error Vishnu Reddy
@ 2025-10-06 14:09   ` Vikash Garodia
  2025-10-07 11:32   ` Bryan O'Donoghue
  2025-10-07 11:38   ` Dikshita Agarwal
  2 siblings, 0 replies; 5+ messages in thread
From: Vikash Garodia @ 2025-10-06 14:09 UTC (permalink / raw)
  To: Vishnu Reddy, dikshita.agarwal, abhinav.kumar, bod, mchehab,
	hverkuil, stefan.schmidt
  Cc: linux-media, linux-arm-msm, linux-kernel, stable


On 10/6/2025 2:48 PM, Vishnu Reddy wrote:
> When the ffmpeg decoder is running, the driver receives the
> V4L2_BUF_FLAG_KEYFRAME flag in the input buffer. The driver then forwards
> this flag information to the firmware. The firmware, in turn, copies the
> input buffer flags directly into the output buffer flags. Upon receiving
> the output buffer from the firmware, the driver observes that the buffer
> contains the HFI_BUFFERFLAG_DATACORRUPT flag. The root cause is that both
> V4L2_BUF_FLAG_KEYFRAME and HFI_BUFFERFLAG_DATACORRUPT are the same value.
> As a result, the driver incorrectly interprets the output frame as
> corrupted, even though the frame is actually valid. This misinterpretation
> causes the driver to report an error and skip good frames, leading to
> missing frames in the final video output and triggering ffmpeg's "corrupt
> decoded frame" error.
> 
> To resolve this issue, the input buffer flags should not be sent to the
> firmware during decoding, since the firmware does not require this
> information.
> 
> Fixes: 17f2a485ca67 ("media: iris: implement vb2 ops for buf_queue and firmware response")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vishnu Reddy <quic_bvisredd@quicinc.com>
> ---
>  drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> index e1788c266bb1..4de03f31eaf3 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> @@ -282,7 +282,7 @@ static int iris_hfi_gen1_queue_input_buffer(struct iris_inst *inst, struct iris_
>  		com_ip_pkt.shdr.session_id = inst->session_id;
>  		com_ip_pkt.time_stamp_hi = upper_32_bits(buf->timestamp);
>  		com_ip_pkt.time_stamp_lo = lower_32_bits(buf->timestamp);
> -		com_ip_pkt.flags = buf->flags;
> +		com_ip_pkt.flags = 0;
>  		com_ip_pkt.mark_target = 0;
>  		com_ip_pkt.mark_data = 0;
>  		com_ip_pkt.offset = buf->data_offset;

Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>

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

* Re: [PATCH] media: iris: Fix ffmpeg corrupted frame error
  2025-10-06  9:18 ` [PATCH] media: iris: Fix ffmpeg corrupted frame error Vishnu Reddy
  2025-10-06 14:09   ` Vikash Garodia
@ 2025-10-07 11:32   ` Bryan O'Donoghue
  2025-11-18  5:19     ` Dikshita Agarwal
  2025-10-07 11:38   ` Dikshita Agarwal
  2 siblings, 1 reply; 5+ messages in thread
From: Bryan O'Donoghue @ 2025-10-07 11:32 UTC (permalink / raw)
  To: Vishnu Reddy, vikash.garodia, dikshita.agarwal, abhinav.kumar,
	mchehab, hverkuil, stefan.schmidt
  Cc: linux-media, linux-arm-msm, linux-kernel, stable

On 06/10/2025 10:18, Vishnu Reddy wrote:
> When the ffmpeg decoder is running, the driver receives the
> V4L2_BUF_FLAG_KEYFRAME flag in the input buffer. The driver then forwards
> this flag information to the firmware. The firmware, in turn, copies the
> input buffer flags directly into the output buffer flags. Upon receiving
> the output buffer from the firmware, the driver observes that the buffer
> contains the HFI_BUFFERFLAG_DATACORRUPT flag. The root cause is that both
> V4L2_BUF_FLAG_KEYFRAME and HFI_BUFFERFLAG_DATACORRUPT are the same value.
> As a result, the driver incorrectly interprets the output frame as
> corrupted, even though the frame is actually valid. This misinterpretation
> causes the driver to report an error and skip good frames, leading to
> missing frames in the final video output and triggering ffmpeg's "corrupt
> decoded frame" error.
> 
> To resolve this issue, the input buffer flags should not be sent to the
> firmware during decoding, since the firmware does not require this
> information.
> 
> Fixes: 17f2a485ca67 ("media: iris: implement vb2 ops for buf_queue and firmware response")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vishnu Reddy <quic_bvisredd@quicinc.com>
> ---
>   drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> index e1788c266bb1..4de03f31eaf3 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> @@ -282,7 +282,7 @@ static int iris_hfi_gen1_queue_input_buffer(struct iris_inst *inst, struct iris_
>   		com_ip_pkt.shdr.session_id = inst->session_id;
>   		com_ip_pkt.time_stamp_hi = upper_32_bits(buf->timestamp);
>   		com_ip_pkt.time_stamp_lo = lower_32_bits(buf->timestamp);
> -		com_ip_pkt.flags = buf->flags;
> +		com_ip_pkt.flags = 0;
>   		com_ip_pkt.mark_target = 0;
>   		com_ip_pkt.mark_data = 0;
>   		com_ip_pkt.offset = buf->data_offset;
> --
> 2.34.1
> 

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

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

* Re: [PATCH] media: iris: Fix ffmpeg corrupted frame error
  2025-10-06  9:18 ` [PATCH] media: iris: Fix ffmpeg corrupted frame error Vishnu Reddy
  2025-10-06 14:09   ` Vikash Garodia
  2025-10-07 11:32   ` Bryan O'Donoghue
@ 2025-10-07 11:38   ` Dikshita Agarwal
  2 siblings, 0 replies; 5+ messages in thread
From: Dikshita Agarwal @ 2025-10-07 11:38 UTC (permalink / raw)
  To: Vishnu Reddy, vikash.garodia, abhinav.kumar, bod, mchehab,
	hverkuil, stefan.schmidt
  Cc: linux-media, linux-arm-msm, linux-kernel, stable



On 10/6/2025 2:48 PM, Vishnu Reddy wrote:
> When the ffmpeg decoder is running, the driver receives the
> V4L2_BUF_FLAG_KEYFRAME flag in the input buffer. The driver then forwards
> this flag information to the firmware. The firmware, in turn, copies the
> input buffer flags directly into the output buffer flags. Upon receiving
> the output buffer from the firmware, the driver observes that the buffer
> contains the HFI_BUFFERFLAG_DATACORRUPT flag. The root cause is that both
> V4L2_BUF_FLAG_KEYFRAME and HFI_BUFFERFLAG_DATACORRUPT are the same value.
> As a result, the driver incorrectly interprets the output frame as
> corrupted, even though the frame is actually valid. This misinterpretation
> causes the driver to report an error and skip good frames, leading to
> missing frames in the final video output and triggering ffmpeg's "corrupt
> decoded frame" error.
> 
> To resolve this issue, the input buffer flags should not be sent to the
> firmware during decoding, since the firmware does not require this
> information.
> 
> Fixes: 17f2a485ca67 ("media: iris: implement vb2 ops for buf_queue and firmware response")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vishnu Reddy <quic_bvisredd@quicinc.com>
> ---
>  drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> index e1788c266bb1..4de03f31eaf3 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> @@ -282,7 +282,7 @@ static int iris_hfi_gen1_queue_input_buffer(struct iris_inst *inst, struct iris_
>  		com_ip_pkt.shdr.session_id = inst->session_id;
>  		com_ip_pkt.time_stamp_hi = upper_32_bits(buf->timestamp);
>  		com_ip_pkt.time_stamp_lo = lower_32_bits(buf->timestamp);
> -		com_ip_pkt.flags = buf->flags;
> +		com_ip_pkt.flags = 0;
>  		com_ip_pkt.mark_target = 0;
>  		com_ip_pkt.mark_data = 0;
>  		com_ip_pkt.offset = buf->data_offset;

Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>

Thanks,
Dikshita

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

* Re: [PATCH] media: iris: Fix ffmpeg corrupted frame error
  2025-10-07 11:32   ` Bryan O'Donoghue
@ 2025-11-18  5:19     ` Dikshita Agarwal
  0 siblings, 0 replies; 5+ messages in thread
From: Dikshita Agarwal @ 2025-11-18  5:19 UTC (permalink / raw)
  To: Bryan O'Donoghue, Vishnu Reddy, vikash.garodia, abhinav.kumar,
	mchehab, hverkuil, stefan.schmidt
  Cc: linux-media, linux-arm-msm, linux-kernel, stable

Hi Bryan,

On 10/7/2025 5:02 PM, Bryan O'Donoghue wrote:
> On 06/10/2025 10:18, Vishnu Reddy wrote:
>> When the ffmpeg decoder is running, the driver receives the
>> V4L2_BUF_FLAG_KEYFRAME flag in the input buffer. The driver then forwards
>> this flag information to the firmware. The firmware, in turn, copies the
>> input buffer flags directly into the output buffer flags. Upon receiving
>> the output buffer from the firmware, the driver observes that the buffer
>> contains the HFI_BUFFERFLAG_DATACORRUPT flag. The root cause is that both
>> V4L2_BUF_FLAG_KEYFRAME and HFI_BUFFERFLAG_DATACORRUPT are the same value.
>> As a result, the driver incorrectly interprets the output frame as
>> corrupted, even though the frame is actually valid. This misinterpretation
>> causes the driver to report an error and skip good frames, leading to
>> missing frames in the final video output and triggering ffmpeg's "corrupt
>> decoded frame" error.
>>
>> To resolve this issue, the input buffer flags should not be sent to the
>> firmware during decoding, since the firmware does not require this
>> information.
>>
>> Fixes: 17f2a485ca67 ("media: iris: implement vb2 ops for buf_queue and
>> firmware response")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Vishnu Reddy <quic_bvisredd@quicinc.com>
>> ---
>>   drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
>> b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
>> index e1788c266bb1..4de03f31eaf3 100644
>> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
>> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
>> @@ -282,7 +282,7 @@ static int iris_hfi_gen1_queue_input_buffer(struct
>> iris_inst *inst, struct iris_
>>           com_ip_pkt.shdr.session_id = inst->session_id;
>>           com_ip_pkt.time_stamp_hi = upper_32_bits(buf->timestamp);
>>           com_ip_pkt.time_stamp_lo = lower_32_bits(buf->timestamp);
>> -        com_ip_pkt.flags = buf->flags;
>> +        com_ip_pkt.flags = 0;
>>           com_ip_pkt.mark_target = 0;
>>           com_ip_pkt.mark_data = 0;
>>           com_ip_pkt.offset = buf->data_offset;
>> -- 
>> 2.34.1
>>
> 
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

Can you please pull this fix for 6.19.

Thanks,
Dikshita


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

end of thread, other threads:[~2025-11-18  5:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <9UYDQ7nzBQ9Uqb5q4mG8WWKGLEZNPSvgV1vw6mmYS0wY2VKS5F11n8IaesvJsKYBvndy99tKFqGoak5MzQVZIA==@protonmail.internalid>
2025-10-06  9:18 ` [PATCH] media: iris: Fix ffmpeg corrupted frame error Vishnu Reddy
2025-10-06 14:09   ` Vikash Garodia
2025-10-07 11:32   ` Bryan O'Donoghue
2025-11-18  5:19     ` Dikshita Agarwal
2025-10-07 11:38   ` Dikshita Agarwal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox