modesetting: Check for unaligned pixmaps in modesetting's check_flip2 proc

If we do this in the generic present `check_flip`, we would have to
do it before we call the driver's `check_flip`.
This means that we wouldn't get a reason for the flip failure,
which we still need to report if we are in the middle of a flip.

Thanks to @nkalkhof For helping bisect this in
https://github.com/X11Libre/xserver/issues/1812

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111
2026-01-30 18:33:54 +02:00
committed by Enrico Weigelt
parent 1762a02331
commit 2e31b2fdc0

View File

@@ -332,6 +332,24 @@ ms_present_check_flip(RRCrtcPtr crtc,
if (ms->drmmode.pending_modeset)
goto no_flip;
/**
* Does the window match the pixmap exactly?
*
* We need to check here too, despite also
* checking in the generic present check_flip,
* because we need to be able to give info
* about tearfree, even if we can't flip.
*
* See: https://github.com/X11Libre/xserver/issues/1812
* See: https://github.com/X11Libre/xserver/issues/1754
*/
if (window->drawable.x != 0 || window->drawable.y != 0 ||
window->drawable.x != pixmap->screen_x || window->drawable.y != pixmap->screen_y ||
window->drawable.width != pixmap->drawable.width ||
window->drawable.height != pixmap->drawable.height) {
goto no_flip;
}
if (!ms_present_check_unflip(crtc, window, pixmap, sync_flip, reason)) {
if (reason && *reason == PRESENT_FLIP_REASON_BUFFER_FORMAT)
ms_window_update_async_flip(window, async_flip);