[Libva] [PATCH v4 1/9] st/va: properly defines VAImageFormat formats and improve VaCreateImage
Sean V Kelley
sean.v.kelley at intel.com
Thu Oct 29 10:37:17 PDT 2015
Hi Julien,
On Thu, Oct 29, 2015 at 10:34 AM, Julien Isorce <julien.isorce at gmail.com>
wrote:
>
>
> On 29 October 2015 at 17:22, Sean V Kelley <sean.v.kelley at intel.com>
> wrote:
>
>>
>>
>> On Thu, Oct 29, 2015 at 9:53 AM, Julien Isorce <j.isorce at samsung.com>
>> wrote:
>>
>>> Also add RGBA, RGBX and BGRX.
>>> Also extend ChromaToPipe and implement PipeToYCbCr.
>>>
>>> Note that gstreamer-vaapi check all the VAImageFormat fields.
>>>
>>> Signed-off-by: Julien Isorce <j.isorce at samsung.com>
>>>
>>
>> Hi Julien,
>>
>
> Hi Sean,
>
>
>>
>> Am I missing something here in terms of these patches? I see gallium,
>> state-tracker, etc. I'm looking at Mesa patches right?
>>
>
> Yes these are patches to extend existing vaapi backend provided by mesa.
> Maybe at some point the efforts should be joined with
> http://cgit.freedesktop.org/vaapi/intel-driver/. I mean, it would be
> great if vaapi-intel-driver maintainers could start improving mesa-vaapi
> instead. To gradually move from this specific backend to the generic one in
> mesa. It is generic in a sense it does not use libdrm directly but a common
> wrapper in between. So the same vaapi backend in mesa is working for all
> gallium drivers.
>
> If this was your question behind :)
>
Yes, that is great to see you making contributions here. We will take a
look. Thanks by the way for copying this list. I'm not frequently
monitoring the Mesa list.
Cheers,
Sean
>
> Cheers
> Julien
>
>
>>
>> Thanks,
>>
>> Sean
>>
>>
>>
>>> ---
>>> src/gallium/state_trackers/va/image.c | 18 +++++++++++---
>>> src/gallium/state_trackers/va/va_private.h | 38
>>> +++++++++++++++++++++++++++++-
>>> 2 files changed, 52 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/src/gallium/state_trackers/va/image.c
>>> b/src/gallium/state_trackers/va/image.c
>>> index b37a971..84d94c8 100644
>>> --- a/src/gallium/state_trackers/va/image.c
>>> +++ b/src/gallium/state_trackers/va/image.c
>>> @@ -37,14 +37,21 @@
>>>
>>> #include "va_private.h"
>>>
>>> -static const VAImageFormat formats[VL_VA_MAX_IMAGE_FORMATS] =
>>> +static const VAImageFormat formats[] =
>>> {
>>> {VA_FOURCC('N','V','1','2')},
>>> {VA_FOURCC('I','4','2','0')},
>>> {VA_FOURCC('Y','V','1','2')},
>>> {VA_FOURCC('Y','U','Y','V')},
>>> {VA_FOURCC('U','Y','V','Y')},
>>> - {VA_FOURCC('B','G','R','A')}
>>> + {.fourcc = VA_FOURCC('B','G','R','A'), .byte_order = VA_LSB_FIRST,
>>> 32, 32,
>>> + 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000},
>>> + {.fourcc = VA_FOURCC('R','G','B','A'), .byte_order = VA_LSB_FIRST,
>>> 32, 32,
>>> + 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000},
>>> + {.fourcc = VA_FOURCC('B','G','R','X'), .byte_order = VA_LSB_FIRST,
>>> 32, 24,
>>> + 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000},
>>> + {.fourcc = VA_FOURCC('R','G','B','X'), .byte_order = VA_LSB_FIRST,
>>> 32, 24,
>>> + 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000}
>>> };
>>>
>>> static void
>>> @@ -72,6 +79,8 @@ vlVaQueryImageFormats(VADriverContextP ctx,
>>> VAImageFormat *format_list, int *num
>>> enum pipe_format format;
>>> int i;
>>>
>>> + STATIC_ASSERT(ARRAY_SIZE(formats) == VL_VA_MAX_IMAGE_FORMATS);
>>> +
>>> if (!ctx)
>>> return VA_STATUS_ERROR_INVALID_CONTEXT;
>>>
>>> @@ -80,7 +89,7 @@ vlVaQueryImageFormats(VADriverContextP ctx,
>>> VAImageFormat *format_list, int *num
>>>
>>> *num_formats = 0;
>>> pscreen = VL_VA_PSCREEN(ctx);
>>> - for (i = 0; i < VL_VA_MAX_IMAGE_FORMATS; ++i) {
>>> + for (i = 0; i < ARRAY_SIZE(formats); ++i) {
>>> format = YCbCrToPipe(formats[i].fourcc);
>>> if (pscreen->is_video_format_supported(pscreen, format,
>>> PIPE_VIDEO_PROFILE_UNKNOWN,
>>> @@ -149,6 +158,9 @@ vlVaCreateImage(VADriverContextP ctx, VAImageFormat
>>> *format, int width, int heig
>>> break;
>>>
>>> case VA_FOURCC('B','G','R','A'):
>>> + case VA_FOURCC('R','G','B','A'):
>>> + case VA_FOURCC('B','G','R','X'):
>>> + case VA_FOURCC('R','G','B','X'):
>>> img->num_planes = 1;
>>> img->pitches[0] = w * 4;
>>> img->offsets[0] = 0;
>>> diff --git a/src/gallium/state_trackers/va/va_private.h
>>> b/src/gallium/state_trackers/va/va_private.h
>>> index 93af1be..6a0bd41 100644
>>> --- a/src/gallium/state_trackers/va/va_private.h
>>> +++ b/src/gallium/state_trackers/va/va_private.h
>>> @@ -46,12 +46,14 @@
>>> #define VL_VA_DRIVER(ctx) ((vlVaDriver *)ctx->pDriverData)
>>> #define VL_VA_PSCREEN(ctx) (VL_VA_DRIVER(ctx)->vscreen->pscreen)
>>>
>>> -#define VL_VA_MAX_IMAGE_FORMATS 6
>>> +#define VL_VA_MAX_IMAGE_FORMATS 9
>>>
>>> static inline enum pipe_video_chroma_format
>>> ChromaToPipe(int format)
>>> {
>>> switch (format) {
>>> + case VA_RT_FORMAT_YUV400:
>>> + return PIPE_VIDEO_CHROMA_FORMAT_400;
>>> case VA_RT_FORMAT_YUV420:
>>> return PIPE_VIDEO_CHROMA_FORMAT_420;
>>> case VA_RT_FORMAT_YUV422:
>>> @@ -80,12 +82,46 @@ YCbCrToPipe(unsigned format)
>>> return PIPE_FORMAT_UYVY;
>>> case VA_FOURCC('B','G','R','A'):
>>> return PIPE_FORMAT_B8G8R8A8_UNORM;
>>> + case VA_FOURCC('R','G','B','A'):
>>> + return PIPE_FORMAT_R8G8B8A8_UNORM;
>>> + case VA_FOURCC('B','G','R','X'):
>>> + return PIPE_FORMAT_B8G8R8X8_UNORM;
>>> + case VA_FOURCC('R','G','B','X'):
>>> + return PIPE_FORMAT_R8G8B8X8_UNORM;
>>> default:
>>> assert(0);
>>> return PIPE_FORMAT_NONE;
>>> }
>>> }
>>>
>>> +static inline unsigned
>>> +PipeToYCbCr(enum pipe_format p_format)
>>> +{
>>> + switch (p_format) {
>>> + case PIPE_FORMAT_NV12:
>>> + return VA_FOURCC('N','V','1','2');
>>> + case PIPE_FORMAT_IYUV:
>>> + return VA_FOURCC('I','4','2','0');
>>> + case PIPE_FORMAT_YV12:
>>> + return VA_FOURCC('Y','V','1','2');
>>> + case PIPE_FORMAT_UYVY:
>>> + return VA_FOURCC('U','Y','V','Y');
>>> + case PIPE_FORMAT_YUYV:
>>> + return VA_FOURCC('Y','U','Y','V');
>>> + case PIPE_FORMAT_B8G8R8A8_UNORM:
>>> + return VA_FOURCC('B','G','R','A');
>>> + case PIPE_FORMAT_R8G8B8A8_UNORM:
>>> + return VA_FOURCC('R','G','B','A');
>>> + case PIPE_FORMAT_B8G8R8X8_UNORM:
>>> + return VA_FOURCC('B','G','R','X');
>>> + case PIPE_FORMAT_R8G8B8X8_UNORM:
>>> + return VA_FOURCC('R','G','B','X');
>>> + default:
>>> + assert(0);
>>> + return -1;
>>> + }
>>> +}
>>> +
>>> static inline VAProfile
>>> PipeToProfile(enum pipe_video_profile profile)
>>> {
>>> --
>>> 1.9.1
>>>
>>> _______________________________________________
>>> Libva mailing list
>>> Libva at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/libva
>>>
>>
>>
>>
>> --
>> Sean V. Kelley <sean.v.kelley at intel.com>
>> Open Source Technology Center / SSG
>> Intel Corp.
>>
>> _______________________________________________
>> Libva mailing list
>> Libva at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/libva
>>
>>
>
--
Sean V. Kelley <sean.v.kelley at intel.com>
Open Source Technology Center / SSG
Intel Corp.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libva/attachments/20151029/26e83177/attachment-0001.html>
More information about the Libva
mailing list