summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-02-18 17:33:19 +0900
committerMichel Dänzer <michel@daenzer.net>2016-03-01 11:59:51 +0900
commit1bee4e254ca0305cb23e574b4c8b250d276ee998 (patch)
tree4272d6f4ec7cc40e47848a07771e9f4c064fcd0d
parent4611e902c291b8a789f374cff3300f74645bc2b2 (diff)
present: Call present_restore_screen_pixmap from present_set_abort_flip
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@keithp.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--present/present.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/present/present.c b/present/present.c
index ffb7a4a67..1ce16afab 100644
--- a/present/present.c
+++ b/present/present.c
@@ -418,8 +418,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);
@@ -430,6 +438,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);
@@ -439,19 +450,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;
}