diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-09-14 16:50:36 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-09-14 17:26:34 +0900 |
commit | 7977f39d3c7847aeba2a06f4923f12eee27b4474 (patch) | |
tree | 4a019ccd4553acc8fe633118f46c82da6b571d27 | |
parent | 062a7b9b81473969e5ca6034e5369106bf3088c4 (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.
Reported-by: Qiang Yu <qiang.yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Qiang Yu <qiang.yu@amd.com>
(Cherry picked from commit 0007c2f018ba663303d91d847e7c085269a23062)
-rw-r--r-- | src/amdgpu_glamor.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c index 6fbe089..3f4b1af 100644 --- a/src/amdgpu_glamor.c +++ b/src/amdgpu_glamor.c @@ -327,10 +327,31 @@ amdgpu_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr slave, void **handle_p) { ScreenPtr screen = pixmap->drawable.pScreen; + uint64_t tiling_info; CARD16 stride; CARD32 size; int fd; + tiling_info = amdgpu_pixmap_get_tiling_info(pixmap); + if (AMDGPU_TILING_GET(tiling_info, ARRAY_MODE) != 0) { + 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; + + amdgpu_glamor_set_pixmap_bo(&pixmap->drawable, linear); + } + fd = glamor_fd_from_pixmap(screen, pixmap, &stride, &size); if (fd < 0) return FALSE; |