From 0c6cb9532b95251eb74c87dc0ab5fe2902cb28de Mon Sep 17 00:00:00 2001 From: notbabaisyou Date: Fri, 24 Oct 2025 09:58:50 +0200 Subject: [PATCH] modesetting: Omit DRM_FORMAT_MOD_INVALID. Previously it was possible for the invalid modifier to be placed in the IN_FORMATS or IN_FORMATS_ASYNC arrays, this is of course not wanted as this can cause problems with devices that lack support for explicit modifiers. --- hw/xfree86/drivers/video/modesetting/drmmode_display.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xfree86/drivers/video/modesetting/drmmode_display.c b/hw/xfree86/drivers/video/modesetting/drmmode_display.c index 4b967417d4..1d884b36d6 100644 --- a/hw/xfree86/drivers/video/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/video/modesetting/drmmode_display.c @@ -2452,9 +2452,13 @@ populate_format_modifiers(xf86CrtcPtr crtc, const drmModePlane *kplane, if ((i < mod->offset) || (i > mod->offset + 63)) continue; + if (!(mod->formats & (1 << (i - mod->offset)))) continue; + if (mod->modifier == DRM_FORMAT_MOD_INVALID) + continue; + num_modifiers++; tmp = realloc(modifiers, num_modifiers * sizeof(modifiers[0])); if (!tmp) {