summaryrefslogtreecommitdiff
path: root/src/radeon_glamor.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-09-12 18:26:57 +0900
committerMichel Dänzer <michel@daenzer.net>2016-09-14 16:31:30 +0900
commitcc2555835cd4c5fd2ae4f999a4bf7c18cdb1dda4 (patch)
treee02b97dee788044327daabff138cb36011d29b1f /src/radeon_glamor.c
parentb3e5259e60157fdbdf46ee59b1b78995c2b15f72 (diff)
glamor: Reallocate linear pixmap BO if necessary for DRI2 PRIME
Fixes corruption when using DRI2 PRIME render offloading with the master screen using this driver. (Ported from amdgpu commit 0007c2f018ba663303d91d847e7c085269a23062) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/radeon_glamor.c')
-rw-r--r--src/radeon_glamor.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index f46e8bad..7a6bf534 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -342,6 +342,26 @@ radeon_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr slave,
CARD32 size;
int fd;
+ if ((radeon_get_pixmap_tiling_flags(pixmap) &
+ RADEON_TILING_MASK) != RADEON_TILING_LINEAR) {
+ PixmapPtr linear;
+
+ /* We don't want to re-allocate the screen pixmap as
+ * linear, to avoid trouble with page flipping
+ */
+ if (screen->GetScreenPixmap(screen) == pixmap)
+ return FALSE;
+
+ linear = screen->CreatePixmap(screen, pixmap->drawable.width,
+ pixmap->drawable.height,
+ pixmap->drawable.depth,
+ CREATE_PIXMAP_USAGE_SHARED);
+ if (!linear)
+ return FALSE;
+
+ radeon_glamor_set_pixmap_bo(&pixmap->drawable, linear);
+ }
+
fd = glamor_fd_from_pixmap(screen, pixmap, &stride, &size);
if (fd < 0)
return FALSE;