st/va: Return surface formats depending on config chroma format
authorMark Thompson <sw@jkqxz.net>
Wed, 12 Oct 2016 22:53:01 +0000 (23:53 +0100)
committerChristian König <christian.koenig@amd.com>
Fri, 14 Oct 2016 09:57:44 +0000 (11:57 +0200)
This makes the supported format actually match the configuration, and
allows the user to observe that NV12 is supported for video processing
where previously they couldn't (though it did always work if they
blindly tried to use it anyway).

Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/va/surface.c

index 173e7d91ac6bad61e7da68800d0086a1a4ddaeeb..5e929803b015776af90beee6aa79ddbf237c61cd 100644 (file)
@@ -419,11 +419,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 {