frontends/va: Only report surface alignment when non-zero

Otherwise this means the alignment is 1x1 which is wrong.

Fixes: b24748a93a ("frontends/va: add surface alignment attribute")
Reviewed-by: Leo Liu <leo.liu@amd.com>
(cherry picked from commit c23df7e790)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33113>
This commit is contained in:
David Rosca
2025-01-07 11:48:42 +01:00
committed by Dylan Baker
parent 7f3b2c48cf
commit ded07d7161
2 changed files with 9 additions and 6 deletions

View File

@@ -1254,7 +1254,7 @@
"description": "frontends/va: Only report surface alignment when non-zero",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "b24748a93ab164c5c5884e49974de0902a42c3be",
"notes": null

View File

@@ -718,14 +718,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;