From 712fcaba1f46efb9f9dc22903bd9c8c48032fbe3 Mon Sep 17 00:00:00 2001 From: Boyuan Zhang Date: Fri, 2 Dec 2022 07:45:13 -0500 Subject: [PATCH] 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 Reviewed-by: Ruijing Dong Part-of: --- src/gallium/frontends/va/config.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gallium/frontends/va/config.c b/src/gallium/frontends/va/config.c index 05937657e13..bdbfe6342b7 100644 --- a/src/gallium/frontends/va/config.c +++ b/src/gallium/frontends/va/config.c @@ -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;