From a636f42b496b0604ca00a144690ece61d1a88a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 27 Feb 2019 18:43:27 +0100 Subject: [PATCH] present: Check that 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 The Present extension code in xserver 1.21 will check for this. Tested-by: Jax Lin --- src/amdgpu_present.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c index 2fbcd25..ce88bd8 100644 --- a/src/amdgpu_present.c +++ b/src/amdgpu_present.c @@ -255,6 +255,7 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, xf86CrtcPtr xf86_crtc = crtc->devPrivate; ScreenPtr screen = window->drawable.pScreen; ScrnInfoPtr scrn = xf86_crtc->scrn; + PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); AMDGPUInfoPtr info = AMDGPUPTR(scrn); int num_crtcs_on; @@ -272,11 +273,16 @@ amdgpu_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 */ if (amdgpu_pixmap_get_tiling_info(pixmap) != - amdgpu_pixmap_get_tiling_info(screen->GetScreenPixmap(screen))) + amdgpu_pixmap_get_tiling_info(screen_pixmap)) return FALSE; for (i = 0, num_crtcs_on = 0; i < config->num_crtc; i++) {