linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] venus: vdec: fix decoded data size
@ 2018-10-08 11:09 Vikash Garodia
  2018-10-08 12:21 ` Stanimir Varbanov
  2018-10-10  7:01 ` Alexandre Courbot
  0 siblings, 2 replies; 3+ messages in thread
From: Vikash Garodia @ 2018-10-08 11:09 UTC (permalink / raw)
  To: stanimir.varbanov, hverkuil, mchehab
  Cc: linux-media, linux-kernel, linux-arm-msm, acourbot, vgarodia

Existing code returns the max of the decoded size and buffer size.
It turns out that buffer size is always greater due to hardware
alignment requirement. As a result, payload size given to client
is incorrect. This change ensures that the bytesused is assigned
to actual payload size, when available.

Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
---
 drivers/media/platform/qcom/venus/vdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index 991e158..189ec97 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -888,8 +888,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
 		unsigned int opb_sz = venus_helper_get_opb_size(inst);
 
 		vb = &vbuf->vb2_buf;
-		vb->planes[0].bytesused =
-			max_t(unsigned int, opb_sz, bytesused);
+		vb2_set_plane_payload(vb, 0, bytesused ? : opb_sz);
 		vb->planes[0].data_offset = data_offset;
 		vb->timestamp = timestamp_us * NSEC_PER_USEC;
 		vbuf->sequence = inst->sequence_cap++;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* Re: [PATCH v2] venus: vdec: fix decoded data size
  2018-10-08 11:09 [PATCH v2] venus: vdec: fix decoded data size Vikash Garodia
@ 2018-10-08 12:21 ` Stanimir Varbanov
  2018-10-10  7:01 ` Alexandre Courbot
  1 sibling, 0 replies; 3+ messages in thread
From: Stanimir Varbanov @ 2018-10-08 12:21 UTC (permalink / raw)
  To: Vikash Garodia, stanimir.varbanov, hverkuil, mchehab
  Cc: linux-media, linux-kernel, linux-arm-msm, acourbot

Hi Vikash,

On 10/08/2018 02:09 PM, Vikash Garodia wrote:
> Existing code returns the max of the decoded size and buffer size.
> It turns out that buffer size is always greater due to hardware
> alignment requirement. As a result, payload size given to client
> is incorrect. This change ensures that the bytesused is assigned
> to actual payload size, when available.
> 
> Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
> ---
>  drivers/media/platform/qcom/venus/vdec.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> index 991e158..189ec97 100644
> --- a/drivers/media/platform/qcom/venus/vdec.c
> +++ b/drivers/media/platform/qcom/venus/vdec.c
> @@ -888,8 +888,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
>  		unsigned int opb_sz = venus_helper_get_opb_size(inst);
>  
>  		vb = &vbuf->vb2_buf;
> -		vb->planes[0].bytesused =
> -			max_t(unsigned int, opb_sz, bytesused);
> +		vb2_set_plane_payload(vb, 0, bytesused ? : opb_sz);
>  		vb->planes[0].data_offset = data_offset;
>  		vb->timestamp = timestamp_us * NSEC_PER_USEC;
>  		vbuf->sequence = inst->sequence_cap++;
> 

Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

-- 
regards,
Stan

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

* Re: [PATCH v2] venus: vdec: fix decoded data size
  2018-10-08 11:09 [PATCH v2] venus: vdec: fix decoded data size Vikash Garodia
  2018-10-08 12:21 ` Stanimir Varbanov
@ 2018-10-10  7:01 ` Alexandre Courbot
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Courbot @ 2018-10-10  7:01 UTC (permalink / raw)
  To: vgarodia
  Cc: Stanimir Varbanov, Hans Verkuil, Mauro Carvalho Chehab,
	Linux Media Mailing List, LKML, linux-arm-msm

On Mon, Oct 8, 2018 at 8:09 PM Vikash Garodia <vgarodia@codeaurora.org> wrote:
>
> Existing code returns the max of the decoded size and buffer size.
> It turns out that buffer size is always greater due to hardware
> alignment requirement. As a result, payload size given to client
> is incorrect. This change ensures that the bytesused is assigned
> to actual payload size, when available.
>
> Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>

Tested-by: Alexandre Courbot <acourbot@chromium.org>

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

end of thread, other threads:[~2018-10-10  7:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-08 11:09 [PATCH v2] venus: vdec: fix decoded data size Vikash Garodia
2018-10-08 12:21 ` Stanimir Varbanov
2018-10-10  7:01 ` Alexandre Courbot

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).