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 <jax.lin@amd.com>
This commit is contained in:
Michel Dänzer
2019-02-27 18:43:27 +01:00
committed by Michel Dänzer
parent bd090f389f
commit a636f42b49

View File

@@ -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++) {