Module: Mesa
Branch: main
Commit: 9bd11f65238ce101bf846f5528f9088630e983f7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9bd11f65238ce101bf846f5528f9088630e983f7

Author: Leo Liu <[email protected]>
Date:   Wed Nov 16 09:50:14 2022 -0500

frontends/va: Use YUV400 YUY2 444P for JPEG only

Since these formats are only for JPEG, and not all the backend driver
supports these format. Eg radeonsi does, virgl doesn't, they should
be used only for JPEG profile.

Fixes d2c0ff1caf (frontends/va: add support for yuv400 and yuv444)

Signed-off-by: Leo Liu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19787>

---

 src/gallium/frontends/va/surface.c | 44 +++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/src/gallium/frontends/va/surface.c 
b/src/gallium/frontends/va/surface.c
index 5679f3991d1..0ed135306bb 100644
--- a/src/gallium/frontends/va/surface.c
+++ b/src/gallium/frontends/va/surface.c
@@ -522,27 +522,31 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, 
VAConfigID config_id,
          attribs[i].value.value.i = VA_FOURCC_NV12;
          i++;
       }
-      if (config->rt_format & VA_RT_FORMAT_YUV400) {
-         attribs[i].type = VASurfaceAttribPixelFormat;
-         attribs[i].value.type = VAGenericValueTypeInteger;
-         attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | 
VA_SURFACE_ATTRIB_SETTABLE;
-         attribs[i].value.value.i = VA_FOURCC_Y800;
-         i++;
-      }
-      if (config->rt_format & VA_RT_FORMAT_YUV422) {
-         attribs[i].type = VASurfaceAttribPixelFormat;
-         attribs[i].value.type = VAGenericValueTypeInteger;
-         attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | 
VA_SURFACE_ATTRIB_SETTABLE;
-         attribs[i].value.value.i = VA_FOURCC_YUY2;
-         i++;
-      }
 
-      if (config->rt_format & VA_RT_FORMAT_YUV444) {
-         attribs[i].type = VASurfaceAttribPixelFormat;
-         attribs[i].value.type = VAGenericValueTypeInteger;
-         attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | 
VA_SURFACE_ATTRIB_SETTABLE;
-         attribs[i].value.value.i = VA_FOURCC_444P;
-         i++;
+      if (config->profile == PIPE_VIDEO_PROFILE_JPEG_BASELINE) {
+         if (config->rt_format & VA_RT_FORMAT_YUV400) {
+            attribs[i].type = VASurfaceAttribPixelFormat;
+            attribs[i].value.type = VAGenericValueTypeInteger;
+            attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | 
VA_SURFACE_ATTRIB_SETTABLE;
+            attribs[i].value.value.i = VA_FOURCC_Y800;
+            i++;
+         }
+
+         if (config->rt_format & VA_RT_FORMAT_YUV422) {
+            attribs[i].type = VASurfaceAttribPixelFormat;
+            attribs[i].value.type = VAGenericValueTypeInteger;
+            attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | 
VA_SURFACE_ATTRIB_SETTABLE;
+            attribs[i].value.value.i = VA_FOURCC_YUY2;
+            i++;
+         }
+
+         if (config->rt_format & VA_RT_FORMAT_YUV444) {
+            attribs[i].type = VASurfaceAttribPixelFormat;
+            attribs[i].value.type = VAGenericValueTypeInteger;
+            attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | 
VA_SURFACE_ATTRIB_SETTABLE;
+            attribs[i].value.value.i = VA_FOURCC_444P;
+            i++;
+         }
       }
    }
 

Reply via email to