[Mesa-dev] [PATCH] st/va: use provided sizes and coords for getimage

Boyuan Zhang boyzhang at amd.com
Tue Oct 9 19:09:16 UTC 2018


Thanks for the explanation ilia.

I'm curious too here that if it's legal for player to not respect the 
image size when calling vlVaGetImage. If player already know the size of 
image is 100x100, then why should it still call vlVaGetImage with 
width/height=600?

I mean when VA-API player calls to create image and create surface, it 
should behave itself, or will be considered a player bug. If player 
calls something out of range, even the driver have the size 
clipped(driver trying to fix player bug), but player still won't get 
expected stuff, since the requested size have been clipped by driver. 
Does this make sense?


Regards,

Boyuan


On 2018-10-09 02:10 PM, Ilia Mirkin wrote:
> On Tue, Oct 9, 2018 at 1:59 PM Boyuan Zhang <boyzhang at amd.com> wrote:
>> Hi ilia,
>>
>> I saw the function
>> u_box_clip_2d(https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/auxiliary/util/u_box.h#n74).
>>
>> But I still don't quite understand why we need to do this? Or say, what
>> will happen if we don't do this box clipping here? Can you provide more
>> information about this please?
> Sure. Let's say you have:
>
> 1000x1000 video surface
> 500x500 image
>
> Then you call
>
> vlVaGetImage(surface, x=600, y=600, width=600, height=600, image)
>
> Ideally you would retrieve the 400x400 "valid" area (from 600x600 at
> the surface) and stick it into the image starting at 0,0.
>
> Then let's say you have
>
> 1000x1000 video surface
> 100x100 image
>
> Then you call
>
> vlVaGetImage(surface, x=600, y=600, width=600, height=600, image)
>
> Ideally the image would be filled with a 100x100 square from the
> surface starting at 600x600 and ending at 700x700.
>
> I haven't deeply dived into the VA docs. Perhaps some or all of these
> are illegal. In which case the x/y/w/h need to be checked and errors
> returned.
>
> Cheers,
>
>    -ilia



More information about the mesa-dev mailing list