[Mesa-dev] [PATCH 1/2] st/va: don't re-allocate interlaced buffer with pakced YUV format

Leo Liu leo.liu at amd.com
Mon Oct 2 00:08:30 UTC 2017


Hi Andy,


On 2017-10-01 07:13 PM, Andy Furniss wrote:
> Hmm, maybe this could be extended to allow bgrx which works with vdpau 
> but not -
>
> mpv --vo=vaapi lines-576.png

Thanks for testing.

RGB raw data video output is totally separated case from YUYV for both 
vdpau and vaapi, it goes to different code path.

There is no CSC involved for RGB, so it goes to output buffer, not like 
YUYV raw data, which goes to decode buffer.

For vdpau, raw RGB is working because the function 
vlVdpOutputSurfacePutBitsNative() is there handling the case.

For vaapi, it doesn't work, unfortunately because there is no handling 
RGB case from output buffer, vaPutSurface only handles YUV to RGB.

But it should be straightforward to add on.


Regards,
Leo


>
> Andy Furniss wrote:
>> Tested-by: Andy Furniss <adf.lists at gmail.com>
>>
>> Leo Liu wrote:
>>> It caused corruption, when vlVaPutImage putting YUV to the fields
>>>
>>> Cc: mesa-stable at lists.freedesktop.org
>>> Cc: Andy Furniss <adf.lists at gmail.com>
>>> ---
>>>   src/gallium/state_trackers/va/image.c | 8 ++++----
>>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/src/gallium/state_trackers/va/image.c 
>>> b/src/gallium/state_trackers/va/image.c
>>> index f87de8e5c4..84990d8a3d 100644
>>> --- a/src/gallium/state_trackers/va/image.c
>>> +++ b/src/gallium/state_trackers/va/image.c
>>> @@ -487,10 +487,11 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID 
>>> surface, VAImageID image,
>>>            ((format != PIPE_FORMAT_YV12) || 
>>> (surf->buffer->buffer_format != PIPE_FORMAT_NV12)) &&
>>>            ((format != PIPE_FORMAT_IYUV) || 
>>> (surf->buffer->buffer_format != PIPE_FORMAT_NV12))) {
>>>         struct pipe_video_buffer *tmp_buf;
>>> -      struct pipe_video_buffer templat = surf->templat;
>>> -      templat.buffer_format = format;
>>> -      tmp_buf = drv->pipe->create_video_buffer(drv->pipe, &templat);
>>> +      surf->templat.buffer_format = format;
>>> +      if (format == PIPE_FORMAT_YUYV || format == PIPE_FORMAT_UYVY)
>>> +         surf->templat.interlaced = false;
>>> +      tmp_buf = drv->pipe->create_video_buffer(drv->pipe, 
>>> &surf->templat);
>>>         if (!tmp_buf) {
>>>            mtx_unlock(&drv->mutex);
>>> @@ -499,7 +500,6 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID 
>>> surface, VAImageID image,
>>>         surf->buffer->destroy(surf->buffer);
>>>         surf->buffer = tmp_buf;
>>> -      surf->templat.buffer_format = format;
>>>      }
>>>      views = surf->buffer->get_sampler_view_planes(surf->buffer);
>>>
>>
>



More information about the mesa-dev mailing list