linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] media: venus: vdec: fix error state assignment for zero bytesused
@ 2025-12-11  9:50 ` Renjiang Han
  2025-12-12  2:15   ` Bryan O'Donoghue
  2025-12-12  4:10   ` Vikash Garodia
  0 siblings, 2 replies; 4+ messages in thread
From: Renjiang Han @ 2025-12-11  9:50 UTC (permalink / raw)
  To: Vikash Garodia, Dikshita Agarwal, Bryan O'Donoghue,
	Mauro Carvalho Chehab
  Cc: linux-media, linux-arm-msm, linux-kernel, Renjiang Han

When hfi_session_flush is issued, all queued buffers are returned to
the V4L2 driver. Some of these buffers are not processed and have
bytesused = 0. Currently, the driver marks such buffers as error even
during drain operations, which can incorrectly flag EOS buffers.

Only capture buffers with zero payload (and not EOS) should be marked
with VB2_BUF_STATE_ERROR. The check is performed inside the non-EOS
branch to ensure correct handling.

Fixes: 51df3c81ba10b ("media: venus: vdec: Mark flushed buffers with error state")
Signed-off-by: Renjiang Han <renjiang.han@oss.qualcomm.com>
---
The error state assignment in the Venus vdec driver for Qualcomm
platforms is updated to ensure that VB2_BUF_STATE_ERROR is applied
only to non-EOS capture buffers with zero bytesused. Ensures false
error reports do not occur during drain operations.
---
Changes in v3:
- 1, Update commit message.
- 2, Move empty line between tags.
- 3, Update cover letter message.
- Link to v2: https://lore.kernel.org/r/20251208-fix-error-state-v2-1-255b62ee2eb6@oss.qualcomm.com

Changes in v2:
- 1. Update commit message.
- 2. Add a Fixes tag.
- Link to v1: https://lore.kernel.org/r/20251126-fix-error-state-v1-1-34f943a8b165@oss.qualcomm.com
---
 drivers/media/platform/qcom/venus/vdec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index 4a6641fdffcf79705893be58c7ec5cf485e2fab9..d0bd2d86a31f9a18cb68b08ba66affdf8fc5092d 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -1440,10 +1440,10 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
 				inst->drain_active = false;
 				inst->codec_state = VENUS_DEC_STATE_STOPPED;
 			}
+		} else {
+			if (!bytesused)
+				state = VB2_BUF_STATE_ERROR;
 		}
-
-		if (!bytesused)
-			state = VB2_BUF_STATE_ERROR;
 	} else {
 		vbuf->sequence = inst->sequence_out++;
 	}

---
base-commit: 663d0d1af3faefe673cabf4b6b077149a87ad71f
change-id: 20251126-fix-error-state-24183a8538cd

Best regards,
-- 
Renjiang Han <renjiang.han@oss.qualcomm.com>


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

* Re: [PATCH v3] media: venus: vdec: fix error state assignment for zero bytesused
  2025-12-11  9:50 ` [PATCH v3] media: venus: vdec: fix error state assignment for zero bytesused Renjiang Han
@ 2025-12-12  2:15   ` Bryan O'Donoghue
  2025-12-12  4:16     ` Vikash Garodia
  2025-12-12  4:10   ` Vikash Garodia
  1 sibling, 1 reply; 4+ messages in thread
From: Bryan O'Donoghue @ 2025-12-12  2:15 UTC (permalink / raw)
  To: Renjiang Han, Vikash Garodia, Dikshita Agarwal,
	Mauro Carvalho Chehab
  Cc: linux-media, linux-arm-msm, linux-kernel

On 11/12/2025 09:50, Renjiang Han wrote:
> When hfi_session_flush is issued, all queued buffers are returned to
> the V4L2 driver. Some of these buffers are not processed and have
> bytesused = 0. Currently, the driver marks such buffers as error even
> during drain operations, which can incorrectly flag EOS buffers.
> 
> Only capture buffers with zero payload (and not EOS) should be marked
> with VB2_BUF_STATE_ERROR. The check is performed inside the non-EOS
> branch to ensure correct handling.
> 
> Fixes: 51df3c81ba10b ("media: venus: vdec: Mark flushed buffers with error state")
> Signed-off-by: Renjiang Han <renjiang.han@oss.qualcomm.com>
> ---
> The error state assignment in the Venus vdec driver for Qualcomm
> platforms is updated to ensure that VB2_BUF_STATE_ERROR is applied
> only to non-EOS capture buffers with zero bytesused. Ensures false
> error reports do not occur during drain operations.
> ---
> Changes in v3:
> - 1, Update commit message.
> - 2, Move empty line between tags.
> - 3, Update cover letter message.
> - Link to v2: https://lore.kernel.org/r/20251208-fix-error-state-v2-1-255b62ee2eb6@oss.qualcomm.com
> 
> Changes in v2:
> - 1. Update commit message.
> - 2. Add a Fixes tag.
> - Link to v1: https://lore.kernel.org/r/20251126-fix-error-state-v1-1-34f943a8b165@oss.qualcomm.com
> ---
>   drivers/media/platform/qcom/venus/vdec.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> index 4a6641fdffcf79705893be58c7ec5cf485e2fab9..d0bd2d86a31f9a18cb68b08ba66affdf8fc5092d 100644
> --- a/drivers/media/platform/qcom/venus/vdec.c
> +++ b/drivers/media/platform/qcom/venus/vdec.c
> @@ -1440,10 +1440,10 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
>   				inst->drain_active = false;
>   				inst->codec_state = VENUS_DEC_STATE_STOPPED;
>   			}
> +		} else {
> +			if (!bytesused)
> +				state = VB2_BUF_STATE_ERROR;
>   		}
> -
> -		if (!bytesused)
> -			state = VB2_BUF_STATE_ERROR;
>   	} else {
>   		vbuf->sequence = inst->sequence_out++;
>   	}
> 
> ---
> base-commit: 663d0d1af3faefe673cabf4b6b077149a87ad71f
> change-id: 20251126-fix-error-state-24183a8538cd
> 
> Best regards,
> --
> Renjiang Han <renjiang.han@oss.qualcomm.com>
> 

Dikshita, Vikash.

This change makes sense to me. If you are NAKing please do so now.

---
bod

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

* Re: [PATCH v3] media: venus: vdec: fix error state assignment for zero bytesused
  2025-12-11  9:50 ` [PATCH v3] media: venus: vdec: fix error state assignment for zero bytesused Renjiang Han
  2025-12-12  2:15   ` Bryan O'Donoghue
@ 2025-12-12  4:10   ` Vikash Garodia
  1 sibling, 0 replies; 4+ messages in thread
From: Vikash Garodia @ 2025-12-12  4:10 UTC (permalink / raw)
  To: Renjiang Han, Dikshita Agarwal, Bryan O'Donoghue,
	Mauro Carvalho Chehab
  Cc: linux-media, linux-arm-msm, linux-kernel


On 12/11/2025 3:20 PM, Renjiang Han wrote:
> When hfi_session_flush is issued, all queued buffers are returned to
> the V4L2 driver. Some of these buffers are not processed and have
> bytesused = 0. Currently, the driver marks such buffers as error even
> during drain operations, which can incorrectly flag EOS buffers.
> 
> Only capture buffers with zero payload (and not EOS) should be marked
> with VB2_BUF_STATE_ERROR. The check is performed inside the non-EOS
> branch to ensure correct handling.
> 
> Fixes: 51df3c81ba10b ("media: venus: vdec: Mark flushed buffers with error state")
> Signed-off-by: Renjiang Han <renjiang.han@oss.qualcomm.com>
> ---
> The error state assignment in the Venus vdec driver for Qualcomm
> platforms is updated to ensure that VB2_BUF_STATE_ERROR is applied
> only to non-EOS capture buffers with zero bytesused. Ensures false
> error reports do not occur during drain operations.
> ---
> Changes in v3:
> - 1, Update commit message.
> - 2, Move empty line between tags.
> - 3, Update cover letter message.
> - Link to v2: https://lore.kernel.org/r/20251208-fix-error-state-v2-1-255b62ee2eb6@oss.qualcomm.com
> 
> Changes in v2:
> - 1. Update commit message.
> - 2. Add a Fixes tag.
> - Link to v1: https://lore.kernel.org/r/20251126-fix-error-state-v1-1-34f943a8b165@oss.qualcomm.com
> ---
>   drivers/media/platform/qcom/venus/vdec.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> index 4a6641fdffcf79705893be58c7ec5cf485e2fab9..d0bd2d86a31f9a18cb68b08ba66affdf8fc5092d 100644
> --- a/drivers/media/platform/qcom/venus/vdec.c
> +++ b/drivers/media/platform/qcom/venus/vdec.c
> @@ -1440,10 +1440,10 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
>   				inst->drain_active = false;
>   				inst->codec_state = VENUS_DEC_STATE_STOPPED;
>   			}
> +		} else {
> +			if (!bytesused)
> +				state = VB2_BUF_STATE_ERROR;
>   		}
> -
> -		if (!bytesused)
> -			state = VB2_BUF_STATE_ERROR;
>   	} else {
>   		vbuf->sequence = inst->sequence_out++;
>   	}
> 
> ---

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


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

* Re: [PATCH v3] media: venus: vdec: fix error state assignment for zero bytesused
  2025-12-12  2:15   ` Bryan O'Donoghue
@ 2025-12-12  4:16     ` Vikash Garodia
  0 siblings, 0 replies; 4+ messages in thread
From: Vikash Garodia @ 2025-12-12  4:16 UTC (permalink / raw)
  To: Bryan O'Donoghue, Renjiang Han, Dikshita Agarwal,
	Mauro Carvalho Chehab
  Cc: linux-media, linux-arm-msm, linux-kernel

Hi Bryan,

On 12/12/2025 7:45 AM, Bryan O'Donoghue wrote:
> On 11/12/2025 09:50, Renjiang Han wrote:
>> When hfi_session_flush is issued, all queued buffers are returned to
>> the V4L2 driver. Some of these buffers are not processed and have
>> bytesused = 0. Currently, the driver marks such buffers as error even
>> during drain operations, which can incorrectly flag EOS buffers.
>>
>> Only capture buffers with zero payload (and not EOS) should be marked
>> with VB2_BUF_STATE_ERROR. The check is performed inside the non-EOS
>> branch to ensure correct handling.
>>
>> Fixes: 51df3c81ba10b ("media: venus: vdec: Mark flushed buffers with 
>> error state")
>> Signed-off-by: Renjiang Han <renjiang.han@oss.qualcomm.com>
>> ---
>> The error state assignment in the Venus vdec driver for Qualcomm
>> platforms is updated to ensure that VB2_BUF_STATE_ERROR is applied
>> only to non-EOS capture buffers with zero bytesused. Ensures false
>> error reports do not occur during drain operations.
>> ---
>> Changes in v3:
>> - 1, Update commit message.
>> - 2, Move empty line between tags.
>> - 3, Update cover letter message.
>> - Link to v2: https://lore.kernel.org/r/20251208-fix-error-state- 
>> v2-1-255b62ee2eb6@oss.qualcomm.com
>>
>> Changes in v2:
>> - 1. Update commit message.
>> - 2. Add a Fixes tag.
>> - Link to v1: https://lore.kernel.org/r/20251126-fix-error-state- 
>> v1-1-34f943a8b165@oss.qualcomm.com
>> ---
>>   drivers/media/platform/qcom/venus/vdec.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/ 
>> platform/qcom/venus/vdec.c
>> index 
>> 4a6641fdffcf79705893be58c7ec5cf485e2fab9..d0bd2d86a31f9a18cb68b08ba66affdf8fc5092d 100644
>> --- a/drivers/media/platform/qcom/venus/vdec.c
>> +++ b/drivers/media/platform/qcom/venus/vdec.c
>> @@ -1440,10 +1440,10 @@ static void vdec_buf_done(struct venus_inst 
>> *inst, unsigned int buf_type,
>>                   inst->drain_active = false;
>>                   inst->codec_state = VENUS_DEC_STATE_STOPPED;
>>               }
>> +        } else {
>> +            if (!bytesused)
>> +                state = VB2_BUF_STATE_ERROR;
>>           }
>> -
>> -        if (!bytesused)
>> -            state = VB2_BUF_STATE_ERROR;
>>       } else {
>>           vbuf->sequence = inst->sequence_out++;
>>       }
>>
>> ---
>> base-commit: 663d0d1af3faefe673cabf4b6b077149a87ad71f
>> change-id: 20251126-fix-error-state-24183a8538cd
>>
>> Best regards,
>> -- 
>> Renjiang Han <renjiang.han@oss.qualcomm.com>
>>
> 
> Dikshita, Vikash.
> 
> This change makes sense to me. If you are NAKing please do so now.
> 

This is good to go.

Regards,
Vikash

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

end of thread, other threads:[~2025-12-12  4:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <ZnqX0ohHNwseFNet2fDemk0YpzeQraqTE3Qsd8r2HhjD-eG8CDMirTjuQ70kKtSs3NkgGOaPrxgChDdVu0wTpQ==@protonmail.internalid>
2025-12-11  9:50 ` [PATCH v3] media: venus: vdec: fix error state assignment for zero bytesused Renjiang Han
2025-12-12  2:15   ` Bryan O'Donoghue
2025-12-12  4:16     ` Vikash Garodia
2025-12-12  4:10   ` Vikash Garodia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).