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: 899c87af1 ("modesetting: unflip before any setcrtc() calls")
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2025-02-15 17:45:54 -08:00
parent 6349773d5e
commit 048d3deb51
2 changed files with 3 additions and 2 deletions

View file

@ -1664,7 +1664,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

@ -444,6 +444,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;
@ -468,7 +470,6 @@ ms_present_unflip(ScreenPtr screen, uint64_t event_id)
}
present_event_notify(event_id, 0, 0);
ms->drmmode.present_flipping = FALSE;
}
#endif