xf86-video-ati: Branch 'master' - 2 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Tue May 22 16:32:34 UTC 2018


 src/radeon_dri2.c   |   40 +++++++++++++++++++---------------------
 src/radeon_glamor.c |    3 +++
 2 files changed, 22 insertions(+), 21 deletions(-)

New commits:
commit 65c9dfea4e841b7d6f795c7489fede58c5e9631f
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue May 15 18:59:30 2018 +0200

    glamor: Bail CreatePixmap on unsupported pixmap depth
    
    Fixes crash in that case.
    
    Bugzilla: https://bugs.freedesktop.org/106293
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index 7c09abba..10d513ea 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -214,6 +214,9 @@ radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 	struct radeon_pixmap *priv;
 	PixmapPtr pixmap, new_pixmap = NULL;
 
+	if (!xf86GetPixFormat(scrn, depth))
+		return NULL;
+
 	if (!RADEON_CREATE_PIXMAP_SHARED(usage)) {
 		if (info->shadow_primary) {
 			if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP)
commit 3dcfce8d0f495d09d7836caf98ef30d625b78a13
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu May 17 09:50:50 2018 +0200

    Bail from dri2_create_buffer2 if we can't get a pixmap
    
    We would store the NULL pointer and continue, which would lead to a
    crash down the road.
    
    Bugzilla: https://bugs.freedesktop.org/106293
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 9f373589..3b75f66f 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -233,37 +233,36 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
 					  flags | RADEON_CREATE_PIXMAP_DRI2);
     }
 
+    if (!pixmap)
+	return NULL;
+
     buffers = calloc(1, sizeof *buffers);
     if (buffers == NULL)
         goto error;
 
-    if (pixmap) {
-	if (!info->use_glamor) {
-	    info->exa_force_create = TRUE;
-	    exaMoveInPixmap(pixmap);
-	    info->exa_force_create = FALSE;
-	    if (exaGetPixmapDriverPrivate(pixmap) == NULL) {
-		/* this happen if pixmap is non accelerable */
-		goto error;
-	    }
-	} else if (is_glamor_pixmap) {
-	    pixmap = radeon_glamor_set_pixmap_bo(drawable, pixmap);
-	    pixmap->refcnt++;
-	}
-
-	if (!radeon_get_flink_name(pRADEONEnt, pixmap, &buffers->name))
+    if (!info->use_glamor) {
+	info->exa_force_create = TRUE;
+	exaMoveInPixmap(pixmap);
+	info->exa_force_create = FALSE;
+	if (exaGetPixmapDriverPrivate(pixmap) == NULL) {
+	    /* this happen if pixmap is non accelerable */
 	    goto error;
+	}
+    } else if (is_glamor_pixmap) {
+	pixmap = radeon_glamor_set_pixmap_bo(drawable, pixmap);
+	pixmap->refcnt++;
     }
 
+    if (!radeon_get_flink_name(pRADEONEnt, pixmap, &buffers->name))
+	goto error;
+
     privates = calloc(1, sizeof(struct dri2_buffer_priv));
     if (privates == NULL)
         goto error;
 
     buffers->attachment = attachment;
-    if (pixmap) {
-	buffers->pitch = pixmap->devKind;
-	buffers->cpp = cpp;
-    }
+    buffers->pitch = pixmap->devKind;
+    buffers->cpp = cpp;
     buffers->driverPrivate = privates;
     buffers->format = format;
     buffers->flags = 0; /* not tiled */
@@ -275,8 +274,7 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
 
 error:
     free(buffers);
-    if (pixmap)
-        (*pScreen->DestroyPixmap)(pixmap);
+    (*pScreen->DestroyPixmap)(pixmap);
     return NULL;
 }
 


More information about the xorg-commit mailing list