modesetting: Don't recursively force present to unflip

Present calls drmmode_set_mode_major() as part of ms_present_unflip(),
which leads to a crash due to the recursive attempt to force present to
unflip when it already is.

Fix it by simply skipping the forced present unflip when present itself is
unflipping. This also speeds up drmmmode_prepare_modeset() when present
isn't even flipping to begin with.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1791

Fixes: 899c87af1f ("modesetting: unflip before any setcrtc() calls")
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1793>
This commit is contained in:
Sultan Alsawaf
2026-03-14 23:12:56 +02:00
committed by Enrico Weigelt
parent 9edc105abd
commit 7f7753dd87
2 changed files with 3 additions and 2 deletions

View File

@@ -1515,7 +1515,7 @@ static void drmmmode_prepare_modeset(ScrnInfoPtr scrn)
ScreenPtr pScreen = scrn->pScreen;
modesettingPtr ms = modesettingPTR(scrn);
if (ms->drmmode.pending_modeset)
if (!ms->drmmode.present_flipping || ms->drmmode.pending_modeset)
return;
/*

View File

@@ -481,6 +481,8 @@ ms_present_unflip(ScreenPtr screen, uint64_t event_id)
}
}
ms->drmmode.present_flipping = FALSE;
for (i = 0; i < config->num_crtc; i++) {
xf86CrtcPtr crtc = config->crtc[i];
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
@@ -504,7 +506,6 @@ ms_present_unflip(ScreenPtr screen, uint64_t event_id)
}
present_event_notify(event_id, 0, 0);
ms->drmmode.present_flipping = FALSE;
}
#endif