[PATCH xf86-video-amdgpu 6/6] glamor: Reallocate linear pixmap BO if necessary for DRI2 PRIME

Yu, Qiang Qiang.Yu at amd.com
Sun Jun 12 10:13:13 UTC 2016

Hi Michel,

I've tested your patches. There's one problem:

1. sudo service lightdm start

2. DRI_PRIME=1 glxgears

The glxgears window is shown black. But after resize or tap a 'Alt' key to

show the command bar, the gears come out. My platform is a A+A (two Tonga Pro)

with Ubuntu 16.04.

It seems not the DDX problem but the mesa client not handling DRI2InvalidateBuffers

event in the Compiz side for the glxgears window pixmap after the PixmapShareToSlave()




From: Michel Dänzer <michel at daenzer.net>
Sent: Wednesday, June 8, 2016 4:45:19 PM
To: xorg-driver-ati at lists.x.org
Cc: Yu, Qiang
Subject: [PATCH xf86-video-amdgpu 6/6] glamor: Reallocate linear pixmap BO if necessary for DRI2 PRIME

From: Michel Dänzer <michel.daenzer at amd.com>

Fixes corruption when using DRI2 PRIME render offloading with the master
screen using this driver.

Reported-by: Qiang Yu <qiang.yu at amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
 src/amdgpu_glamor.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index 1159e29..53ba277 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -328,10 +328,28 @@ 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);
+               amdgpu_glamor_set_pixmap_bo(&pixmap->drawable, linear);
+       }
         fd = glamor_fd_from_pixmap(screen, pixmap, &stride, &size);
         if (fd < 0)
                 return FALSE;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg-driver-ati/attachments/20160612/27ac6b83/attachment-0001.html>

More information about the xorg-driver-ati mailing list