[PATCH xf86-video-ati 1/2] present: Check that flip and screen pixmap pitches match

Michel Dänzer michel at daenzer.net
Fri Mar 1 17:35:49 UTC 2019


From: Michel Dänzer <michel.daenzer at amd.com>

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

Test case:

* Run Xorg at 1920x1080 with no window manager
* glxgears -geometry 2048x1080

The Present extension code in xserver 1.21 will check for this.

(Ported from amdgpu commit a636f42b496b0604ca00a144690ece61d1a88a27)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/radeon_present.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/radeon_present.c b/src/radeon_present.c
index 0b55117eb..38a9a6b79 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -256,7 +256,7 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
     ScrnInfoPtr scrn = xf86_crtc->scrn;
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
     RADEONInfoPtr info = RADEONPTR(scrn);
-    PixmapPtr screen_pixmap;
+    PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
     int num_crtcs_on;
     int i;
 
@@ -272,10 +272,14 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
     if (info->drmmode.dri2_flipping)
 	return FALSE;
 
+#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1, 20, 99, 1, 0)
+    if (pixmap->devKind != screen_pixmap->devKind)
+	return FALSE;
+#endif
+
     /* The kernel driver doesn't handle flipping between BOs with different
      * tiling parameters correctly yet
      */
-    screen_pixmap = screen->GetScreenPixmap(screen);
     if (radeon_present_get_pixmap_tiling_flags(info, pixmap) !=
 	radeon_present_get_pixmap_tiling_flags(info, screen_pixmap))
 	return FALSE;
-- 
2.20.1



More information about the amd-gfx mailing list