diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-02-18 17:20:45 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-03-01 11:59:51 +0900 |
commit | 4611e902c291b8a789f374cff3300f74645bc2b2 (patch) | |
tree | 9ba44439a08aecf6436494a34aea8ac9ec79abde /present | |
parent | 72328e5eb98a3f27e1f0a0e17beae6db447bd87c (diff) |
present: Factor code for restoring screen pixmap out of present_unflip (v2)
The following fix will use the refactored function.
The logic in the refactored function is slightly simplified, exploiting
the fact that this function is only ever called with a valid flip
pixmap.
v2: Assert that flip_pixmap is non-NULL instead of testing and bailing
on NULL, preserve test for flip_window being non-NULL before calling
present_set_tree_pixmap for it (Keith Packard)
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
Reviewed-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'present')
-rw-r--r-- | present/present.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/present/present.c b/present/present.c index a9241d278..ffb7a4a67 100644 --- a/present/present.c +++ b/present/present.c @@ -414,6 +414,28 @@ present_set_tree_pixmap(WindowPtr window, } static void +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; + + assert (flip_pixmap); + + /* Update the screen pixmap with the current flip pixmap contents + * Only do this the first time for a particular unflip operation, or + * we'll probably scribble over other windows + */ + if (screen->GetWindowPixmap(screen->root) == flip_pixmap) + present_copy_region(&screen_pixmap->drawable, flip_pixmap, NULL, 0, 0); + + if (flip_window) + present_set_tree_pixmap(flip_window, flip_pixmap, screen_pixmap); + present_set_tree_pixmap(screen->root, NULL, screen_pixmap); +} + +static void present_set_abort_flip(ScreenPtr screen) { present_screen_priv_ptr screen_priv = present_screen_priv(screen); @@ -438,26 +460,11 @@ static void present_unflip(ScreenPtr screen) { present_screen_priv_ptr screen_priv = present_screen_priv(screen); - PixmapPtr pixmap = (*screen->GetScreenPixmap)(screen); assert (!screen_priv->unflip_event_id); assert (!screen_priv->flip_pending); - /* Update the screen pixmap with the current flip pixmap contents - * Only do this the first time for a particular unflip operation, or - * we'll probably scribble over other windows - */ - if (screen->GetWindowPixmap(screen->root) == screen_priv->flip_pixmap) { - present_copy_region(&pixmap->drawable, screen_priv->flip_pixmap, - NULL, 0, 0); - } - - if (screen_priv->flip_pixmap && screen_priv->flip_window) - present_set_tree_pixmap(screen_priv->flip_window, - screen_priv->flip_pixmap, - pixmap); - - present_set_tree_pixmap(screen->root, NULL, pixmap); + present_restore_screen_pixmap(screen); screen_priv->unflip_event_id = ++present_event_id; DebugPresent(("u %lld\n", screen_priv->unflip_event_id)); |