diff mbox series

[v1,5/5] media: venus: update number of bytes used field properly for EOS frames

Message ID 1538222432-25894-6-git-send-email-sgorle@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series Venus - Decode reconfig sequence | expand

Commit Message

Srinu Gorle Sept. 29, 2018, noon UTC
- In video decoder session, update number of bytes used for
  yuv buffers appropriately for EOS buffers.

Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
---
 drivers/media/platform/qcom/venus/vdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stanimir Varbanov Nov. 8, 2018, 10:16 a.m. UTC | #1
Hi,

On 9/29/18 3:00 PM, Srinu Gorle wrote:
> - In video decoder session, update number of bytes used for
>   yuv buffers appropriately for EOS buffers.
> 
> Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
> ---
>  drivers/media/platform/qcom/venus/vdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

NACK, that was already discussed see:

https://patchwork.kernel.org/patch/10630411/

> 
> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> index 311f209..a48eed1 100644
> --- a/drivers/media/platform/qcom/venus/vdec.c
> +++ b/drivers/media/platform/qcom/venus/vdec.c
> @@ -978,7 +978,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
>  
>  		if (vbuf->flags & V4L2_BUF_FLAG_LAST) {
>  			const struct v4l2_event ev = { .type = V4L2_EVENT_EOS };
> -
> +			vb->planes[0].bytesused = bytesused;
>  			v4l2_event_queue_fh(&inst->fh, &ev);
>  		}
>  	} else {
>
Alexandre Courbot Nov. 12, 2018, 8:12 a.m. UTC | #2
Hi Stan,

On Thu, Nov 8, 2018 at 7:16 PM Stanimir Varbanov
<stanimir.varbanov@linaro.org> wrote:
>
> Hi,
>
> On 9/29/18 3:00 PM, Srinu Gorle wrote:
> > - In video decoder session, update number of bytes used for
> >   yuv buffers appropriately for EOS buffers.
> >
> > Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
> > ---
> >  drivers/media/platform/qcom/venus/vdec.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> NACK, that was already discussed see:
>
> https://patchwork.kernel.org/patch/10630411/

I believe you are referring to this discussion?

https://lkml.org/lkml/2018/10/2/302

In this case, with https://patchwork.kernel.org/patch/10630411/
applied, I am seeing the troublesome case of having the last (empty)
buffer being returned with a payload of obs_sz, which I believe is
incorrect. The present patch seems to restore the correct behavior.

An alternative would be to set the payload as follows:

vb2_set_plane_payload(vb, 0, bytesused);

This works for SDM845, but IIRC we weren't sure that this would
display the correct behavior with all firmware versions?

>
> >
> > diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> > index 311f209..a48eed1 100644
> > --- a/drivers/media/platform/qcom/venus/vdec.c
> > +++ b/drivers/media/platform/qcom/venus/vdec.c
> > @@ -978,7 +978,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
> >
> >               if (vbuf->flags & V4L2_BUF_FLAG_LAST) {
> >                       const struct v4l2_event ev = { .type = V4L2_EVENT_EOS };
> > -
> > +                     vb->planes[0].bytesused = bytesused;
> >                       v4l2_event_queue_fh(&inst->fh, &ev);
> >               }
> >       } else {
> >
>
> --
> regards,
> Stan
Stanimir Varbanov Nov. 12, 2018, 12:20 p.m. UTC | #3
Hi Alex,

On 11/12/18 10:12 AM, Alexandre Courbot wrote:
> Hi Stan,
> 
> On Thu, Nov 8, 2018 at 7:16 PM Stanimir Varbanov
> <stanimir.varbanov@linaro.org> wrote:
>>
>> Hi,
>>
>> On 9/29/18 3:00 PM, Srinu Gorle wrote:
>>> - In video decoder session, update number of bytes used for
>>>   yuv buffers appropriately for EOS buffers.
>>>
>>> Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
>>> ---
>>>  drivers/media/platform/qcom/venus/vdec.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> NACK, that was already discussed see:
>>
>> https://patchwork.kernel.org/patch/10630411/
> 
> I believe you are referring to this discussion?
> 
> https://lkml.org/lkml/2018/10/2/302
> 
> In this case, with https://patchwork.kernel.org/patch/10630411/
> applied, I am seeing the troublesome case of having the last (empty)
> buffer being returned with a payload of obs_sz, which I believe is
> incorrect. The present patch seems to restore the correct behavior.

Sorry, I thought that this solution was suggested (and tested on Venus
v4) by you, right?

> 
> An alternative would be to set the payload as follows:
> 
> vb2_set_plane_payload(vb, 0, bytesused);
> 
> This works for SDM845, but IIRC we weren't sure that this would
> display the correct behavior with all firmware versions?

OK if you are still seeing issues I think we can switch to
vb2_set_plane_payload(vb, 0, bytesused); for all buffers? I.e. not only
for buffers with flag V4L2_BUF_FLAG_LAST set.

> 
>>
>>>
>>> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
>>> index 311f209..a48eed1 100644
>>> --- a/drivers/media/platform/qcom/venus/vdec.c
>>> +++ b/drivers/media/platform/qcom/venus/vdec.c
>>> @@ -978,7 +978,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
>>>
>>>               if (vbuf->flags & V4L2_BUF_FLAG_LAST) {
>>>                       const struct v4l2_event ev = { .type = V4L2_EVENT_EOS };
>>> -
>>> +                     vb->planes[0].bytesused = bytesused;

Is 'bytesused' != 0 in case of EoS ever?

i.e. shouldn't this be vb->planes[0].bytesused = 0 ?

>>>                       v4l2_event_queue_fh(&inst->fh, &ev);
>>>               }
>>>       } else {
>>>
>>
>> --
>> regards,
>> Stan
Alexandre Courbot Nov. 13, 2018, 9:31 a.m. UTC | #4
On Mon, Nov 12, 2018 at 9:20 PM Stanimir Varbanov
<stanimir.varbanov@linaro.org> wrote:
>
> Hi Alex,
>
> On 11/12/18 10:12 AM, Alexandre Courbot wrote:
> > Hi Stan,
> >
> > On Thu, Nov 8, 2018 at 7:16 PM Stanimir Varbanov
> > <stanimir.varbanov@linaro.org> wrote:
> >>
> >> Hi,
> >>
> >> On 9/29/18 3:00 PM, Srinu Gorle wrote:
> >>> - In video decoder session, update number of bytes used for
> >>>   yuv buffers appropriately for EOS buffers.
> >>>
> >>> Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
> >>> ---
> >>>  drivers/media/platform/qcom/venus/vdec.c | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> NACK, that was already discussed see:
> >>
> >> https://patchwork.kernel.org/patch/10630411/
> >
> > I believe you are referring to this discussion?
> >
> > https://lkml.org/lkml/2018/10/2/302
> >
> > In this case, with https://patchwork.kernel.org/patch/10630411/
> > applied, I am seeing the troublesome case of having the last (empty)
> > buffer being returned with a payload of obs_sz, which I believe is
> > incorrect. The present patch seems to restore the correct behavior.
>
> Sorry, I thought that this solution was suggested (and tested on Venus
> v4) by you, right?

That's correct. >_< Looks like I overlooked this case.

>
> >
> > An alternative would be to set the payload as follows:
> >
> > vb2_set_plane_payload(vb, 0, bytesused);
> >
> > This works for SDM845, but IIRC we weren't sure that this would
> > display the correct behavior with all firmware versions?
>
> OK if you are still seeing issues I think we can switch to
> vb2_set_plane_payload(vb, 0, bytesused); for all buffers? I.e. not only
> for buffers with flag V4L2_BUF_FLAG_LAST set.

That's the fix I am currently using in my source tree and it indeed
seems to be ok. I also agree it is better than special-casing EOS
buffers. I have sent a patch for this.

Thanks and sorry for the confusion.
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index 311f209..a48eed1 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -978,7 +978,7 @@  static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
 
 		if (vbuf->flags & V4L2_BUF_FLAG_LAST) {
 			const struct v4l2_event ev = { .type = V4L2_EVENT_EOS };
-
+			vb->planes[0].bytesused = bytesused;
 			v4l2_event_queue_fh(&inst->fh, &ev);
 		}
 	} else {