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

Ilia Mirkin imirkin at alum.mit.edu
Tue Oct 9 18:10:38 UTC 2018


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