frontends/va: return proper error for unsupported profile

Return VA_STATUS_ERROR_UNSUPPORTED_PROFILE if given profile is not
supported for both decode and encode.

Return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT if given profile is
supported (for at lease one of decode or encode), but current given
entrypoint is not supported.

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20082>
This commit is contained in:
Boyuan Zhang 2022-12-02 07:45:13 -05:00 committed by Marge Bot
parent da32cbb5c6
commit 712fcaba1f

View file

@ -428,7 +428,10 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
supported_rt_formats = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422;
if (!vl_codec_supported(pscreen, p, false)) {
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
if (!vl_codec_supported(pscreen, p, true))
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
else
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
}
config->entrypoint = PIPE_VIDEO_ENTRYPOINT_BITSTREAM;
@ -438,7 +441,10 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
supported_rt_formats = VA_RT_FORMAT_YUV420;
if (!vl_codec_supported(pscreen, p, true)) {
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
if (!vl_codec_supported(pscreen, p, false))
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
else
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
}
config->entrypoint = PIPE_VIDEO_ENTRYPOINT_ENCODE;
@ -446,7 +452,11 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
default:
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
if (!vl_codec_supported(pscreen, p, false) &&
!vl_codec_supported(pscreen, p, true))
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
else
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
}
config->profile = p;