From c23df7e7906be3644dbe019510d4f7ba271314bb Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 7 Jan 2025 11:48:42 +0100 Subject: [PATCH] frontends/va: Only report surface alignment when non-zero Otherwise this means the alignment is 1x1 which is wrong. Fixes: b24748a93ab ("frontends/va: add surface alignment attribute") Reviewed-by: Leo Liu Part-of: --- src/gallium/frontends/va/surface.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gallium/frontends/va/surface.c b/src/gallium/frontends/va/surface.c index 577dc24c92b..4bc79008ae1 100644 --- a/src/gallium/frontends/va/surface.c +++ b/src/gallium/frontends/va/surface.c @@ -702,14 +702,17 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config_id, PIPE_VIDEO_CAP_MAX_HEIGHT); i++; #if VA_CHECK_VERSION(1, 21, 0) - attribs[i].type = VASurfaceAttribAlignmentSize; - attribs[i].value.type = VAGenericValueTypeInteger; - attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE; - attribs[i].value.value.i = + int surface_alignment = pscreen->get_video_param(pscreen, config->profile, config->entrypoint, PIPE_VIDEO_CAP_ENC_SURFACE_ALIGNMENT); - i++; + if (surface_alignment > 0) { + attribs[i].type = VASurfaceAttribAlignmentSize; + attribs[i].value.type = VAGenericValueTypeInteger; + attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE; + attribs[i].value.value.i = surface_alignment; + i++; + } #endif } else { attribs[i].type = VASurfaceAttribMaxWidth;