From fcdd3cf0ad84202f4ef41b055d3b36668ff6b642 Mon Sep 17 00:00:00 2001 From: Thong Thai Date: Mon, 8 May 2023 12:20:23 -0400 Subject: [PATCH] frontends/va/context: check min supported resolution when creating Fixes: c987eed9cd7 ("frontends/va: report min width and min height values if available") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8981 Signed-off-by: Thong Thai Reviewed-by: Ruijing Dong Part-of: --- src/gallium/frontends/va/context.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/va/context.c b/src/gallium/frontends/va/context.c index e37a143d67b..c733509dbb6 100644 --- a/src/gallium/frontends/va/context.c +++ b/src/gallium/frontends/va/context.c @@ -241,7 +241,8 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width, vlVaContext *context; vlVaConfig *config; int is_vpp; - int max_supported_width,max_supported_height; + int min_supported_width, min_supported_height; + int max_supported_width, max_supported_height; if (!ctx) return VA_STATUS_ERROR_INVALID_CONTEXT; @@ -271,6 +272,12 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width, context->decoder = NULL; } else { if (config->entrypoint != PIPE_VIDEO_ENTRYPOINT_PROCESSING) { + min_supported_width = drv->vscreen->pscreen->get_video_param(drv->vscreen->pscreen, + config->profile, config->entrypoint, + PIPE_VIDEO_CAP_MIN_WIDTH); + min_supported_height = drv->vscreen->pscreen->get_video_param(drv->vscreen->pscreen, + config->profile, config->entrypoint, + PIPE_VIDEO_CAP_MIN_HEIGHT); max_supported_width = drv->vscreen->pscreen->get_video_param(drv->vscreen->pscreen, config->profile, config->entrypoint, PIPE_VIDEO_CAP_MAX_WIDTH); @@ -278,7 +285,8 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width, config->profile, config->entrypoint, PIPE_VIDEO_CAP_MAX_HEIGHT); - if (picture_width > max_supported_width || picture_height > max_supported_height) { + if (picture_width < min_supported_width || picture_height < min_supported_height || + picture_width > max_supported_width || picture_height > max_supported_height) { FREE(context); return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED; }