summaryrefslogtreecommitdiff
path: root/src/amdgpu_dri3.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-02-24 17:06:43 +0900
committerMichel Dänzer <michel@daenzer.net>2016-02-27 15:24:51 +0900
commitdf60c635e1e632233de9dd4b01d63c2b963003f8 (patch)
tree9eaa6cad5fbb594b108991719191fc8ff2f0e5ed /src/amdgpu_dri3.c
parente463b849f3e9d7b69e64a65619a22e00e78d297b (diff)
glamor: Avoid generating GEM flink names for BOs shared via DRI3 (v2)
We can't create our own struct amdgpu_buffer representation in this case because destroying that would make the GEM handle inaccessible to glamor as well. So just get the handle directly via dma-buf. (ported from radeon commit 391900a670addec39515f924265bfa9f8bfa9ec0, extended to cache BO handles in the private for non-DRI3 pixmaps as well) v2: Swap whole pixmap privates instead of just BOs in amdgpu_dri2_exchange_buffers to avoid invalidating cached BO handles Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/amdgpu_dri3.c')
-rw-r--r--src/amdgpu_dri3.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/amdgpu_dri3.c b/src/amdgpu_dri3.c
index c4b40d0..65d4899 100644
--- a/src/amdgpu_dri3.c
+++ b/src/amdgpu_dri3.c
@@ -125,6 +125,16 @@ static PixmapPtr amdgpu_dri3_pixmap_from_fd(ScreenPtr screen,
{
PixmapPtr pixmap;
+#ifdef USE_GLAMOR
+ /* Avoid generating a GEM flink name if possible */
+ if (AMDGPUPTR(xf86ScreenToScrn(screen))->use_glamor) {
+ pixmap = glamor_pixmap_from_fd(screen, fd, width, height,
+ stride, depth, bpp);
+ if (pixmap)
+ return pixmap;
+ }
+#endif
+
if (depth < 8)
return NULL;