frontends/va/config: Fix check for packed header config
authorThong Thai <thong.thai@amd.com>
Fri, 12 Feb 2021 18:42:42 +0000 (13:42 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 16 Feb 2021 15:29:39 +0000 (15:29 +0000)
Fixes: b4651890be4 ("frontends/va: Update conditional checks for code stability.")
Signed-off-by: Thong Thai <thong.thai@amd.com>
Tested-by: James Zhu <James.Zhu@amd.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4285
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9020>

src/gallium/frontends/va/config.c

index e7172a3c7a538bf59984080b59130731ed5db893..e658867f6e093629be0690507379bc3a471347f0 100644 (file)
@@ -319,7 +319,8 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
          }
       }
       if (attrib_list[i].type == VAConfigAttribEncPackedHeaders) {
-         if (attrib_list[i].value != 0) {
+         if (attrib_list[i].value > 1 ||
+             config->entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE) {
             FREE(config);
             return VA_STATUS_ERROR_INVALID_VALUE;
          }