From 1283f4352716a6c4e083d01505c5bb1dee3bb996 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Mon, 15 Jul 2024 16:46:40 +0200 Subject: [PATCH] frontends/va: Assert maximum number of temporal layers There is a hardcoded limit of 4 layers in all structs, so make sure drivers will not return more. Reviewed-By: Sil Vilerino Reviewed-by: Ruijing Dong Part-of: --- src/gallium/frontends/va/config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/frontends/va/config.c b/src/gallium/frontends/va/config.c index 68655eb0b7d..e1dd3d34ffc 100644 --- a/src/gallium/frontends/va/config.c +++ b/src/gallium/frontends/va/config.c @@ -281,6 +281,7 @@ vlVaGetConfigAttributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint en value = pscreen->get_video_param(pscreen, ProfileToPipe(profile), PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_MAX_TEMPORAL_LAYERS); + assert(value <= 4); if (value > 0) { value -= 1; value |= (1 << 8); /* temporal_layer_bitrate_control_flag */