From 5921ba4ca705a0d919515626088f3948cc4848c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 31 Mar 2015 15:14:52 +0900 Subject: present: Don't flip between BOs with different tiling parameters The kernel driver doesn't handle that correctly yet. Fixes or at least avoids issues with OpenGL fullscreen apps with DRI3 enabled and using PRIME or with (2D) tiling disabled. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89720 Reviewed-by: Alex Deucher --- src/radeon_present.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/radeon_present.c') diff --git a/src/radeon_present.c b/src/radeon_present.c index b4021107..52ca03eb 100644 --- a/src/radeon_present.c +++ b/src/radeon_present.c @@ -218,6 +218,21 @@ get_drmmode_crtc(ScrnInfoPtr scrn, RRCrtcPtr crtc) return NULL; } +static uint32_t +radeon_present_get_pixmap_tiling_flags(RADEONInfoPtr info, PixmapPtr pixmap) +{ + uint32_t tiling_flags = radeon_get_pixmap_tiling_flags(pixmap); + + /* Micro tiling is always enabled with macro tiling on >= R600, so we + * can ignore the micro tiling bit in that case + */ + if ((tiling_flags & RADEON_TILING_MACRO) && + info->ChipFamily >= CHIP_FAMILY_R600) + tiling_flags &= ~RADEON_TILING_MICRO; + + return tiling_flags; +} + /* * Test to see if page flipping is possible on the target crtc */ @@ -228,6 +243,7 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, ScreenPtr screen = window->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); RADEONInfoPtr info = RADEONPTR(scrn); + PixmapPtr screen_pixmap; if (!scrn->vtSema) return FALSE; @@ -235,6 +251,14 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, if (!info->allowPageFlip) return FALSE; + /* 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; + if (crtc) { drmmode_crtc_private_ptr drmmode_crtc = get_drmmode_crtc(scrn, crtc); -- cgit v1.2.3