st/va: add check for P010 and P016 encode/decode support
authorThong Thai <thong.thai@amd.com>
Tue, 3 Mar 2020 19:08:23 +0000 (14:08 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 6 Mar 2020 16:10:40 +0000 (16:10 +0000)
Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4033>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4033>

src/gallium/state_trackers/va/config.c

index 617ca6944c43f6275c56b71404453ddcecb56435..294cbcc64182be6a64eabdd98581a2ca357ba4aa 100644 (file)
@@ -127,10 +127,13 @@ vlVaGetConfigAttributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint en
          switch (attrib_list[i].type) {
          case VAConfigAttribRTFormat:
             value = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422;
-           if (pscreen->is_video_format_supported(pscreen, PIPE_FORMAT_P016,
+            if (pscreen->is_video_format_supported(pscreen, PIPE_FORMAT_P010,
+                                                   ProfileToPipe(profile),
+                                                   PIPE_VIDEO_ENTRYPOINT_BITSTREAM) ||
+                pscreen->is_video_format_supported(pscreen, PIPE_FORMAT_P016,
                                                    ProfileToPipe(profile),
                                                    PIPE_VIDEO_ENTRYPOINT_BITSTREAM))
-               value |= VA_RT_FORMAT_YUV420_10BPP;
+               value |= VA_RT_FORMAT_YUV420_10BPP;
             break;
          default:
             value = VA_ATTRIB_NOT_SUPPORTED;
@@ -142,6 +145,13 @@ vlVaGetConfigAttributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint en
          switch (attrib_list[i].type) {
          case VAConfigAttribRTFormat:
             value = VA_RT_FORMAT_YUV420;
+            if (pscreen->is_video_format_supported(pscreen, PIPE_FORMAT_P010,
+                                                   ProfileToPipe(profile),
+                                                   PIPE_VIDEO_ENTRYPOINT_BITSTREAM) ||
+                pscreen->is_video_format_supported(pscreen, PIPE_FORMAT_P016,
+                                                   ProfileToPipe(profile),
+                                                   PIPE_VIDEO_ENTRYPOINT_BITSTREAM))
+               value |= VA_RT_FORMAT_YUV420_10BPP;
             break;
          case VAConfigAttribRateControl:
             value = VA_RC_CQP | VA_RC_CBR | VA_RC_VBR;
@@ -261,8 +271,10 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
 
    config->profile = p;
    supported_rt_formats = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422;
-   if (pscreen->is_video_format_supported(pscreen, PIPE_FORMAT_P016, p,
-                                         config->entrypoint))
+   if (pscreen->is_video_format_supported(pscreen, PIPE_FORMAT_P010, p,
+         config->entrypoint) ||
+       pscreen->is_video_format_supported(pscreen, PIPE_FORMAT_P016, p,
+         config->entrypoint))
       supported_rt_formats |= VA_RT_FORMAT_YUV420_10BPP;
 
    for (int i = 0; i <num_attribs ; i++) {