[PATCH v2 xserver 3/3] present: Call present_restore_screen_pixmap from present_set_abort_flip
Michel Dänzer
michel at daenzer.net
Mon Feb 22 09:16:52 UTC 2016
From: Michel Dänzer <michel.daenzer at amd.com>
After present_set_abort_flip, the screen pixmap will be used for all
screen drawing, so we need to restore the current flip pixmap contents
to the screen pixmap here as well.
Improves flashing / stutter e.g. when something like a popup menu appears
on top of a flipping fullscreen window or when switching out of
fullscreen.
Note that this means present_set_abort_flip now relies on screen->root
being non-NULL, but that's already the case in other present code.
Reviewed-by: Keith Packard <keithp at keithp.com>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
v2: Rebased on top of v2 of patch 2.
present/present.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/present/present.c b/present/present.c
index 63ad275..f96ea94 100644
--- a/present/present.c
+++ b/present/present.c
@@ -396,8 +396,16 @@ present_restore_screen_pixmap(ScreenPtr screen)
{
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
PixmapPtr screen_pixmap = (*screen->GetScreenPixmap)(screen);
- PixmapPtr flip_pixmap = screen_priv->flip_pixmap;
- WindowPtr flip_window = screen_priv->flip_window;
+ PixmapPtr flip_pixmap;
+ WindowPtr flip_window;
+
+ if (screen_priv->flip_pending) {
+ flip_window = screen_priv->flip_pending->window;
+ flip_pixmap = screen_priv->flip_pending->pixmap;
+ } else {
+ flip_window = screen_priv->flip_window;
+ flip_pixmap = screen_priv->flip_pixmap;
+ }
assert (flip_pixmap);
@@ -408,6 +416,9 @@ present_restore_screen_pixmap(ScreenPtr screen)
if (screen->GetWindowPixmap(screen->root) == flip_pixmap)
present_copy_region(&screen_pixmap->drawable, flip_pixmap, NULL, 0, 0);
+ /* Switch back to using the screen pixmap now to avoid
+ * 2D applications drawing to the wrong pixmap.
+ */
if (flip_window)
present_set_tree_pixmap(flip_window, flip_pixmap, screen_pixmap);
present_set_tree_pixmap(screen->root, NULL, screen_pixmap);
@@ -417,19 +428,8 @@ static void
present_set_abort_flip(ScreenPtr screen)
{
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
- PixmapPtr pixmap = (*screen->GetScreenPixmap)(screen);
- /* Switch back to using the screen pixmap now to avoid
- * 2D applications drawing to the wrong pixmap.
- */
-
- if (screen_priv->flip_window)
- present_set_tree_pixmap(screen_priv->flip_window,
- screen_priv->flip_pixmap,
- pixmap);
-
- if (screen->root)
- present_set_tree_pixmap(screen->root, NULL, pixmap);
+ present_restore_screen_pixmap(screen);
screen_priv->flip_pending->abort_flip = TRUE;
}
--
2.7.0
More information about the xorg-devel
mailing list