[PATCH 1/4] present: restore root window pixmap when aborting a flip

Frank Binns frank.binns at imgtec.com
Thu Apr 24 02:38:58 PDT 2014

If a 2D application is started on top of a fullscreen 3D application, which
is flipping, then we need to stop flipping and restore the root window to
using the screen pixmap. Normally this would be done as part of an unflip.
However, in the case that there is a pending flip there is no mechanism to
abort so the unflip is deferred until the pending flip completes. This
provides a window of opportunity for the 2D application to draw to the wrong

This problem is avoided by fixing up the root window pixmap immediately but
deferring the unflip as usual.

Signed-off-by: Frank Binns <frank.binns at imgtec.com>
 present/present.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/present/present.c b/present/present.c
index 73d5f69..2a96928 100644
--- a/present/present.c
+++ b/present/present.c
@@ -469,8 +469,14 @@ present_check_flip_window (WindowPtr window)
         if (flip_pending->window == window) {
             if (!present_check_flip(flip_pending->crtc, window, flip_pending->pixmap,
-                                    flip_pending->sync_flip, NULL, 0, 0))
+                                    flip_pending->sync_flip, NULL, 0, 0)) {
+                /* Switch the root window back to using the screen pixmap now
+                 * to avoid 2D applications drawing to the wrong pixmap.
+                 */
+                present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen));
                 flip_pending->abort_flip = TRUE;
+            }
     } else {

More information about the xorg-devel mailing list