From 5ade87efc7d5f4b0dbefd146e2cce555502073ef Mon Sep 17 00:00:00 2001 From: stefan11111 Date: Sat, 29 Nov 2025 16:10:54 +0200 Subject: [PATCH] modesetting: Use don't skip planes that are not on the current crtc This breaks on some nvidia cards. Fixes: https://github.com/X11Libre/xserver/commit/ed49ae8fe7f919998a3f6db64899cf2294b9d145 Signed-off-by: stefan11111 --- .../drivers/video/modesetting/drmmode_display.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/drivers/video/modesetting/drmmode_display.c b/hw/xfree86/drivers/video/modesetting/drmmode_display.c index d340b9818a..6681b63cf7 100644 --- a/hw/xfree86/drivers/video/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/video/modesetting/drmmode_display.c @@ -2692,9 +2692,21 @@ drmmode_crtc_create_planes(xf86CrtcPtr crtc, int num) } case DRMMODE_PLANE_TYPE_PRIMARY: { - /* If this plane is not on this crtc, skip it */ + /* Prefer planes that are on this CRTC already */ if (plane_crtc != drmmode_crtc->mode_crtc->crtc_id) { - drmModeFreePlane(kplane); + /* If this is the only plane we have, it's the best we have */ + if (!best_plane) { + best_plane = plane_id; + best_kplane = kplane; + blob_id = drmmode_prop_get_value(&tmp_props[DRMMODE_PLANE_IN_FORMATS], + props, 0); + async_blob_id = drmmode_prop_get_value(&tmp_props[DRMMODE_PLANE_IN_FORMATS_ASYNC], + props, 0); + drmmode_prop_info_copy(drmmode_crtc->props_plane, tmp_props, + DRMMODE_PLANE__COUNT, 1); + } else { + drmModeFreePlane(kplane); + } drmModeFreeObjectProperties(props); continue; }