From: Michel Dänzer <michel.daen...@amd.com>

(Ported from radeon commit de88ea2755611bdcb18d91d8234d2ab5be8ff2e9)

Signed-off-by: Michel Dänzer <michel.daen...@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

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to