<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 29, 2015 at 9:53 AM, Julien Isorce <span dir="ltr"><<a href="mailto:j.isorce@samsung.com" target="_blank">j.isorce@samsung.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Also add RGBA, RGBX and BGRX.<br>
Also extend ChromaToPipe and implement PipeToYCbCr.<br>
<br>
Note that gstreamer-vaapi check all the VAImageFormat fields.<br>
<br>
Signed-off-by: Julien Isorce <<a href="mailto:j.isorce@samsung.com">j.isorce@samsung.com</a>><br></blockquote><div><br></div><div>Hi Julien,</div><div><br></div><div>Am I missing something here in terms of these patches?  I see gallium, state-tracker, etc.  I'm looking at Mesa patches right?</div><div><br></div><div>Thanks,</div><div><br></div><div>Sean</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
 src/gallium/state_trackers/va/image.c      | 18 +++++++++++---<br>
 src/gallium/state_trackers/va/va_private.h | 38 +++++++++++++++++++++++++++++-<br>
 2 files changed, 52 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/gallium/state_trackers/va/image.c b/src/gallium/state_trackers/va/image.c<br>
index b37a971..84d94c8 100644<br>
--- a/src/gallium/state_trackers/va/image.c<br>
+++ b/src/gallium/state_trackers/va/image.c<br>
@@ -37,14 +37,21 @@<br>
<br>
 #include "va_private.h"<br>
<br>
-static const VAImageFormat formats[VL_VA_MAX_IMAGE_FORMATS] =<br>
+static const VAImageFormat formats[] =<br>
 {<br>
    {VA_FOURCC('N','V','1','2')},<br>
    {VA_FOURCC('I','4','2','0')},<br>
    {VA_FOURCC('Y','V','1','2')},<br>
    {VA_FOURCC('Y','U','Y','V')},<br>
    {VA_FOURCC('U','Y','V','Y')},<br>
-   {VA_FOURCC('B','G','R','A')}<br>
+   {.fourcc = VA_FOURCC('B','G','R','A'), .byte_order = VA_LSB_FIRST, 32, 32,<br>
+    0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000},<br>
+   {.fourcc = VA_FOURCC('R','G','B','A'), .byte_order = VA_LSB_FIRST, 32, 32,<br>
+    0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000},<br>
+   {.fourcc = VA_FOURCC('B','G','R','X'), .byte_order = VA_LSB_FIRST, 32, 24,<br>
+    0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000},<br>
+   {.fourcc = VA_FOURCC('R','G','B','X'), .byte_order = VA_LSB_FIRST, 32, 24,<br>
+    0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000}<br>
 };<br>
<br>
 static void<br>
@@ -72,6 +79,8 @@ vlVaQueryImageFormats(VADriverContextP ctx, VAImageFormat *format_list, int *num<br>
    enum pipe_format format;<br>
    int i;<br>
<br>
+   STATIC_ASSERT(ARRAY_SIZE(formats) == VL_VA_MAX_IMAGE_FORMATS);<br>
+<br>
    if (!ctx)<br>
       return VA_STATUS_ERROR_INVALID_CONTEXT;<br>
<br>
@@ -80,7 +89,7 @@ vlVaQueryImageFormats(VADriverContextP ctx, VAImageFormat *format_list, int *num<br>
<br>
    *num_formats = 0;<br>
    pscreen = VL_VA_PSCREEN(ctx);<br>
-   for (i = 0; i < VL_VA_MAX_IMAGE_FORMATS; ++i) {<br>
+   for (i = 0; i < ARRAY_SIZE(formats); ++i) {<br>
       format = YCbCrToPipe(formats[i].fourcc);<br>
       if (pscreen->is_video_format_supported(pscreen, format,<br>
           PIPE_VIDEO_PROFILE_UNKNOWN,<br>
@@ -149,6 +158,9 @@ vlVaCreateImage(VADriverContextP ctx, VAImageFormat *format, int width, int heig<br>
       break;<br>
<br>
    case VA_FOURCC('B','G','R','A'):<br>
+   case VA_FOURCC('R','G','B','A'):<br>
+   case VA_FOURCC('B','G','R','X'):<br>
+   case VA_FOURCC('R','G','B','X'):<br>
       img->num_planes = 1;<br>
       img->pitches[0] = w * 4;<br>
       img->offsets[0] = 0;<br>
diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h<br>
index 93af1be..6a0bd41 100644<br>
--- a/src/gallium/state_trackers/va/va_private.h<br>
+++ b/src/gallium/state_trackers/va/va_private.h<br>
@@ -46,12 +46,14 @@<br>
 #define VL_VA_DRIVER(ctx) ((vlVaDriver *)ctx->pDriverData)<br>
 #define VL_VA_PSCREEN(ctx) (VL_VA_DRIVER(ctx)->vscreen->pscreen)<br>
<br>
-#define VL_VA_MAX_IMAGE_FORMATS 6<br>
+#define VL_VA_MAX_IMAGE_FORMATS 9<br>
<br>
 static inline enum pipe_video_chroma_format<br>
 ChromaToPipe(int format)<br>
 {<br>
    switch (format) {<br>
+   case VA_RT_FORMAT_YUV400:<br>
+      return PIPE_VIDEO_CHROMA_FORMAT_400;<br>
    case VA_RT_FORMAT_YUV420:<br>
       return PIPE_VIDEO_CHROMA_FORMAT_420;<br>
    case VA_RT_FORMAT_YUV422:<br>
@@ -80,12 +82,46 @@ YCbCrToPipe(unsigned format)<br>
       return PIPE_FORMAT_UYVY;<br>
    case VA_FOURCC('B','G','R','A'):<br>
       return PIPE_FORMAT_B8G8R8A8_UNORM;<br>
+   case VA_FOURCC('R','G','B','A'):<br>
+      return PIPE_FORMAT_R8G8B8A8_UNORM;<br>
+   case VA_FOURCC('B','G','R','X'):<br>
+      return PIPE_FORMAT_B8G8R8X8_UNORM;<br>
+   case VA_FOURCC('R','G','B','X'):<br>
+      return PIPE_FORMAT_R8G8B8X8_UNORM;<br>
    default:<br>
       assert(0);<br>
       return PIPE_FORMAT_NONE;<br>
    }<br>
 }<br>
<br>
+static inline unsigned<br>
+PipeToYCbCr(enum pipe_format p_format)<br>
+{<br>
+   switch (p_format) {<br>
+   case PIPE_FORMAT_NV12:<br>
+      return VA_FOURCC('N','V','1','2');<br>
+   case PIPE_FORMAT_IYUV:<br>
+      return VA_FOURCC('I','4','2','0');<br>
+   case PIPE_FORMAT_YV12:<br>
+      return VA_FOURCC('Y','V','1','2');<br>
+   case PIPE_FORMAT_UYVY:<br>
+      return VA_FOURCC('U','Y','V','Y');<br>
+   case PIPE_FORMAT_YUYV:<br>
+      return VA_FOURCC('Y','U','Y','V');<br>
+   case PIPE_FORMAT_B8G8R8A8_UNORM:<br>
+      return VA_FOURCC('B','G','R','A');<br>
+   case PIPE_FORMAT_R8G8B8A8_UNORM:<br>
+      return VA_FOURCC('R','G','B','A');<br>
+   case PIPE_FORMAT_B8G8R8X8_UNORM:<br>
+      return VA_FOURCC('B','G','R','X');<br>
+   case PIPE_FORMAT_R8G8B8X8_UNORM:<br>
+      return VA_FOURCC('R','G','B','X');<br>
+   default:<br>
+      assert(0);<br>
+      return -1;<br>
+   }<br>
+}<br>
+<br>
 static inline VAProfile<br>
 PipeToProfile(enum pipe_video_profile profile)<br>
 {<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
_______________________________________________<br>
Libva mailing list<br>
<a href="mailto:Libva@lists.freedesktop.org">Libva@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/libva" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/libva</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Sean V. Kelley <<a href="mailto:sean.v.kelley@intel.com" target="_blank">sean.v.kelley@intel.com</a>><br>Open Source Technology Center / SSG<br>Intel Corp.<br></div>
</div></div>