[Mesa-dev] [PATCH 3/3] st/va: return surface formats depending on config chroma format

Mark Thompson sw at jkqxz.net
Sun Sep 18 23:12:10 UTC 2016


Also allows NV12 to be returned as a supported format for video
processing.
---
The useful change is that we can now see that NV12 is supported by the video processor, so things like decode-scale-encode are known to be possible.

Again, there might be more supported things here which could be added.


 src/gallium/state_trackers/va/surface.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c
index 00df69d..5c0e7d5 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -408,11 +408,19 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config_id,
    /* vlVaCreateConfig returns PIPE_VIDEO_PROFILE_UNKNOWN
     * only for VAEntrypointVideoProc. */
    if (config->profile == PIPE_VIDEO_PROFILE_UNKNOWN) {
-      for (j = 0; j < ARRAY_SIZE(vpp_surface_formats); ++j) {
+      if (config->rt_format == VA_RT_FORMAT_RGB32) {
+         for (j = 0; j < ARRAY_SIZE(vpp_surface_formats); ++j) {
+            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 = PipeFormatToVaFourcc(vpp_surface_formats[j]);
+            i++;
+         }
+      } else if (config->rt_format == VA_RT_FORMAT_YUV420) {
          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 = PipeFormatToVaFourcc(vpp_surface_formats[j]);
+         attribs[i].value.value.i = VA_FOURCC_NV12;
          i++;
       }
    } else {
-- 
2.9.3



More information about the mesa-dev mailing list