From 7da8e7babee16f7d518cd9ee2a71c950fe2c3c3f Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Fri, 24 Jul 2020 12:21:37 +0200 Subject: [PATCH] present: Check valid region in window mode flips For Pixmap flips to have well defined outcomes the window must be contained by the valid region if such region was specified. The valid region is inserted as an argument to the check in window mode. Setting this argument is missing in screen mode as well but we ignore it for now and only add it to window mode. It seems there are none or only very few clients actually making use of valid regions at the moment. For simplicity we therefore just check if a valid region was set by the client and in this case do never flip, independently of the window being contained by the region or not. Signed-off-by: Roman Gilg (cherry picked from commit 591916ea9e7a77f68f436b4a541402d9deadfe64) --- present/present_wnmd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/present/present_wnmd.c b/present/present_wnmd.c index 82bae4022..32c4d55f1 100644 --- a/present/present_wnmd.c +++ b/present/present_wnmd.c @@ -278,7 +278,9 @@ present_wnmd_check_flip(RRCrtcPtr crtc, if (x_off || y_off) return FALSE; - // TODO: Check for valid region? + /* Valid area must contain window (for simplicity for now just never flip when one is set). */ + if (valid) + return FALSE; /* Flip pixmap must have same dimensions as window */ if (window->drawable.width != pixmap->drawable.width || @@ -325,11 +327,11 @@ present_wnmd_check_flip_window (WindowPtr window) if (flip_pending) { if (!present_wnmd_check_flip(flip_pending->crtc, flip_pending->window, flip_pending->pixmap, - flip_pending->sync_flip, NULL, 0, 0, NULL)) + flip_pending->sync_flip, flip_pending->valid, 0, 0, NULL)) present_wnmd_set_abort_flip(window); } else if (flip_active) { if (!present_wnmd_check_flip(flip_active->crtc, flip_active->window, flip_active->pixmap, - flip_active->sync_flip, NULL, 0, 0, NULL)) + flip_active->sync_flip, flip_active->valid, 0, 0, NULL)) present_wnmd_flips_stop(window); } @@ -337,7 +339,7 @@ present_wnmd_check_flip_window (WindowPtr window) xorg_list_for_each_entry(vblank, &window_priv->vblank, window_list) { if (vblank->queued && vblank->flip && !present_wnmd_check_flip(vblank->crtc, window, vblank->pixmap, - vblank->sync_flip, NULL, 0, 0, &reason)) { + vblank->sync_flip, vblank->valid, 0, 0, &reason)) { vblank->flip = FALSE; vblank->reason = reason; if (vblank->sync_flip)