[PATCH xf86-video-amdgpu 2/2] glamor: Handle ihandle == -1 in amdgpu_glamor_set_shared_pixmap_backing

Michel Dänzer michel at daenzer.net
Wed Aug 29 15:38:37 UTC 2018


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

(Ported from radeon commit de88ea2755611bdcb18d91d8234d2ab5be8ff2e9)

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

diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index 13d68fe36..699861f73 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -384,6 +384,7 @@ amdgpu_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, void *handle)
 {
 	ScreenPtr screen = pixmap->drawable.pScreen;
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+	int ihandle = (int)(long)handle;
 	struct amdgpu_pixmap *priv;
 
 	if (!amdgpu_set_shared_pixmap_backing(pixmap, handle))
@@ -391,7 +392,8 @@ amdgpu_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, void *handle)
 
 	priv = amdgpu_get_pixmap_private(pixmap);
 
-	if (!amdgpu_glamor_create_textured_pixmap(pixmap, priv->bo)) {
+	if (ihandle != -1 &&
+	    !amdgpu_glamor_create_textured_pixmap(pixmap, priv->bo)) {
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
 			   "Failed to get PRIME drawable for glamor pixmap.\n");
 		return FALSE;
-- 
2.18.0



More information about the amd-gfx mailing list