Skip to contentSkip to conversation

EXA: Handle NULL BO pointer in radeon_set_pixmap_bo

PATCH New Michel Dänzer 1 participant 4 messages Aug 24, 2018 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 EXA: Handle NULL BO pointer in radeon_set_pixmap_bo

From: Michel Dänzer <[email protected]>

---
 src/radeon.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
src/radeon.h +7 -3
index 1a1edb1ba..b1d5f5af4 100644
@@ -772,11 +772,15 @@ static inline Bool radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_buffer *bo
 	    radeon_buffer_unref(&driver_priv->bo);
 	    drmmode_fb_reference(pRADEONEnt->fd, &driver_priv->fb, NULL);
 
-	    radeon_buffer_ref(bo);
 	    driver_priv->bo = bo;
 
-	    radeon_bo_get_tiling(bo->bo.radeon, &driver_priv->tiling_flags,
-				 &pitch);
+	    if (bo) {
+		radeon_buffer_ref(bo);
+		radeon_bo_get_tiling(bo->bo.radeon, &driver_priv->tiling_flags,
+				     &pitch);
+	    } else
+		driver_priv->tiling_flags = 0;
+
 	    return TRUE;
 	}
 
Signature · 6 lines
2.18.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180824090244.16520-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

#2 lore raw

PATCH 2/4 Handle ihandle == -1 in radeon_set_shared_pixmap_backing

From: Michel Dänzer <[email protected]>

It means to stop using the shared pixmap backing.

Fixes crash when changing PRIME slave output configuration.

---
 src/radeon_bo_helper.c | 3 +++
 1 file changed, 3 insertions(+)
src/radeon_bo_helper.c +3 -0
index 79e8ff1bd..1a6d54b11 100644
@@ -454,6 +454,9 @@ Bool radeon_set_shared_pixmap_backing(PixmapPtr ppix, void *fd_handle,
     uint32_t size = ppix->devKind * ppix->drawable.height;
     Bool ret = FALSE;
 
+    if (ihandle == -1)
+	return radeon_set_pixmap_bo(ppix, NULL);
+	
     bo = (struct radeon_buffer *)calloc(1, sizeof(struct radeon_buffer));
     if (!bo)
 	goto error;
Signature · 6 lines
2.18.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

PATCH 3/4 EXA: Handle ihandle == -1 in RADEONEXASharePixmapBacking

In reply to a message not in the archive

From: Michel Dänzer <[email protected]>

---
 src/radeon_exa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/radeon_exa.c +2 -1
index 93c2f056c..268155ed7 100644
@@ -296,11 +296,12 @@ Bool RADEONEXASharePixmapBacking(PixmapPtr ppix, ScreenPtr slave, void **fd_hand
 Bool RADEONEXASetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle)
 {
     struct radeon_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(ppix);
+    int ihandle = (int)(long)fd_handle;
 
     if (!radeon_set_shared_pixmap_backing(ppix, fd_handle, &driver_priv->surface))
 	return FALSE;
 
-    driver_priv->shared = TRUE;
+    driver_priv->shared = ihandle != -1;
     return TRUE;
 }
 
Signature · 6 lines
2.18.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#4 lore raw

PATCH 4/4 glamor: Handle ihandle == -1 in radeon_glamor_set_shared_pixmap_backing

In reply to a message not in the archive

From: Michel Dänzer <[email protected]>

---
 src/radeon_glamor.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/radeon_glamor.c +3 -1
index c733d192d..bffc89ec6 100644
@@ -402,11 +402,13 @@ radeon_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, void *handle)
 {
 	ScreenPtr screen = pixmap->drawable.pScreen;
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+	int ihandle = (int)(long)handle;
 
 	if (!radeon_set_shared_pixmap_backing(pixmap, handle, NULL))
 		return FALSE;
 
-	if (!radeon_glamor_create_textured_pixmap(pixmap,
+	if (ihandle != -1 &&
+	    !radeon_glamor_create_textured_pixmap(pixmap,
 						  radeon_get_pixmap_bo(pixmap))) {
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
 			   "Failed to get PRIME drawable for glamor pixmap.\n");
Signature · 6 lines
2.18.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx