From c987eed9cd7ccf7836eb18ad8950a035ae002bbc Mon Sep 17 00:00:00 2001 From: Thong Thai Date: Thu, 13 Apr 2023 10:22:21 -0400 Subject: [PATCH] frontends/va: report min width and min height values if available Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8756 Signed-off-by: Thong Thai Reviewed-by: Sil Vilerino Reviewed-by: Ruijing Dong Reviewed-by: Boyuan Zhang Part-of: --- src/gallium/frontends/va/surface.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/gallium/frontends/va/surface.c b/src/gallium/frontends/va/surface.c index 21cf8adee63..546f3a16246 100644 --- a/src/gallium/frontends/va/surface.c +++ b/src/gallium/frontends/va/surface.c @@ -633,6 +633,28 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config_id, PIPE_VIDEO_ENTRYPOINT_PROCESSING, PIPE_VIDEO_CAP_SUPPORTED)) { + unsigned min_width, min_height; + min_width = pscreen->get_video_param(pscreen, + config->profile, config->entrypoint, + PIPE_VIDEO_CAP_MIN_WIDTH); + min_height = pscreen->get_video_param(pscreen, + config->profile, config->entrypoint, + PIPE_VIDEO_CAP_MIN_HEIGHT); + + if (min_width > 0 && min_height > 0) { + attribs[i].type = VASurfaceAttribMinWidth; + attribs[i].value.type = VAGenericValueTypeInteger; + attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE; + attribs[i].value.value.i = min_width; + i++; + + attribs[i].type = VASurfaceAttribMinHeight; + attribs[i].value.type = VAGenericValueTypeInteger; + attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE; + attribs[i].value.value.i = min_height; + i++; + } + attribs[i].type = VASurfaceAttribMaxWidth; attribs[i].value.type = VAGenericValueTypeInteger; attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE;