[PATCH xf86-video-ati 1/4] glamor: Fix radeon_glamor_share_pixmap_backing for priv->bo == NULL

Michel Dänzer michel at daenzer.net
Tue Sep 13 08:55:53 UTC 2016


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

Fixes crash when running a compositor and DRI_PRIME client via DRI2.

Reported-by: Qiang Yu <qiang.yu at amd.com>
(Ported from amdgpu commit b36c77695ba77b59a0ccd868454e3af4fc04d5ff)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/radeon_glamor.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index f94e0fd..5c4191b 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -289,12 +289,17 @@ static Bool
 radeon_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr slave,
 				   void **handle_p)
 {
-	struct radeon_pixmap *priv = radeon_get_pixmap_private(pixmap);
+	ScreenPtr screen = pixmap->drawable.pScreen;
+	CARD16 stride;
+	CARD32 size;
+	int fd;
 
-	if (!priv)
+	fd = glamor_fd_from_pixmap(screen, pixmap, &stride, &size);
+	if (fd < 0)
 		return FALSE;
 
-	return radeon_share_pixmap_backing(priv->bo, handle_p);
+	*handle_p = (void *)(long)fd;
+	return TRUE;
 }
 
 static Bool
-- 
2.9.3



More information about the amd-gfx mailing list