Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > f5b163ee2c12188dc7265e5e48602f04 > files > 8

x11-server-1.20.4-7.mga7.src.rpm

From 87491ced98705a14be2bb5a3ce7e41cb5ffc11d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
Date: Mon, 25 Mar 2019 12:32:48 +0100
Subject: [PATCH 103/105] present/scmd: Check that the flip and screen pixmap
 pitches match

If they don't, flipping will result in corrupted display.

Test case:

* Run Xorg at 1920x1080 with no window manager
* glxgears -geometry 2048x1080
(Cherry picked from commit ef91da2757050652c724f6e674e8b1acf5d0cb31)
---
 present/present_scmd.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/present/present_scmd.c b/present/present_scmd.c
index 6a580cb7a..3b7fbd832 100644
--- a/present/present_scmd.c
+++ b/present/present_scmd.c
@@ -78,7 +78,7 @@ present_check_flip(RRCrtcPtr            crtc,
                    PresentFlipReason   *reason)
 {
     ScreenPtr                   screen = window->drawable.pScreen;
-    PixmapPtr                   window_pixmap;
+    PixmapPtr                   screen_pixmap, window_pixmap;
     WindowPtr                   root = screen->root;
     present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
 
@@ -99,8 +99,9 @@ present_check_flip(RRCrtcPtr            crtc,
         return FALSE;
 
     /* Make sure the window hasn't been redirected with Composite */
+    screen_pixmap = screen->GetScreenPixmap(screen);
     window_pixmap = screen->GetWindowPixmap(window);
-    if (window_pixmap != screen->GetScreenPixmap(screen) &&
+    if (window_pixmap != screen_pixmap &&
         window_pixmap != screen_priv->flip_pixmap &&
         window_pixmap != present_flip_pending_pixmap(screen))
         return FALSE;
@@ -126,7 +127,8 @@ present_check_flip(RRCrtcPtr            crtc,
         window->drawable.x != pixmap->screen_x || window->drawable.y != pixmap->screen_y ||
 #endif
         window->drawable.width != pixmap->drawable.width ||
-        window->drawable.height != pixmap->drawable.height) {
+        window->drawable.height != pixmap->drawable.height ||
+        pixmap->devKind != screen_pixmap->devKind) {
         return FALSE;
     }
 
-- 
2.21.0