From 2e31b2fdc00fea7c27350e32ebe496c81fc07288 Mon Sep 17 00:00:00 2001 From: stefan11111 Date: Fri, 30 Jan 2026 18:33:54 +0200 Subject: [PATCH] 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 --- hw/xfree86/drivers/video/modesetting/present.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hw/xfree86/drivers/video/modesetting/present.c b/hw/xfree86/drivers/video/modesetting/present.c index 47a4b7977e..7280a873c7 100644 --- a/hw/xfree86/drivers/video/modesetting/present.c +++ b/hw/xfree86/drivers/video/modesetting/present.c @@ -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);