xf86-video-amdgpu: Branch 'master' - 3 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Wed Jul 11 16:29:32 UTC 2018


 src/amdgpu_dri2.c     |   26 ++++++++++++--------------
 src/amdgpu_glamor.c   |    3 +++
 src/amdgpu_kms.c      |    8 +++++---
 src/drmmode_display.c |    1 +
 4 files changed, 21 insertions(+), 17 deletions(-)

New commits:
commit 9dfbae76b179285d142b97852211b900ebfae51d
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Jul 10 18:13:39 2018 +0200

    Move flush from radeon_scanout_do_update to its callers
    
    No functional change intended.
    
    (Ported from radeon commit 90b94d40449f665f2d12874598062a5e5e5b64cd)
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index c357ab6..39e047e 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -882,8 +882,6 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
 		FreeScratchGC(gc);
 	}
 
-	amdgpu_glamor_flush(xf86_crtc->scrn);
-
 	return TRUE;
 }
 
@@ -908,8 +906,10 @@ amdgpu_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec,
 	    drmmode_crtc->dpms_mode == DPMSModeOn) {
 		if (amdgpu_scanout_do_update(crtc, drmmode_crtc->scanout_id,
 					     screen->GetWindowPixmap(screen->root),
-					     region->extents))
+					     region->extents)) {
+			amdgpu_glamor_flush(crtc->scrn);
 			RegionEmpty(region);
+		}
 	}
 
 	amdgpu_scanout_update_abort(crtc, event_data);
@@ -991,6 +991,8 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,
 				      pScreen->GetWindowPixmap(pScreen->root),
 				      region->extents))
 		return;
+
+	amdgpu_glamor_flush(scrn);
 	RegionEmpty(region);
 
 	drm_queue_seq = amdgpu_drm_queue_alloc(xf86_crtc,
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fee6fed..f6cafcc 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -3978,6 +3978,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 
 			amdgpu_scanout_do_update(crtc, scanout_id, new_front,
 						 extents);
+			amdgpu_glamor_flush(crtc->scrn);
 
 			if (drmmode_crtc->scanout_update_pending) {
 				drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
commit ace6ea016ce0013a34e1d4637aeacbf4d0e83c79
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Jul 10 18:11:04 2018 +0200

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

diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index 44cdbcf..8b83910 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -185,6 +185,9 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 	struct amdgpu_pixmap *priv;
 	PixmapPtr pixmap, new_pixmap = NULL;
 
+	if (!xf86GetPixFormat(scrn, depth))
+		return NULL;
+
 	if (!AMDGPU_CREATE_PIXMAP_SHARED(usage)) {
 		if (info->shadow_primary) {
 			if (usage != CREATE_PIXMAP_USAGE_BACKING_PIXMAP)
commit c160302abcdb18eec35c377d80e34f5bd857df45
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
    (Ported from radeon commit 3dcfce8d0f495d09d7836caf98ef30d625b78a13)
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index a9e2819..a9238e5 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -161,29 +161,28 @@ amdgpu_dri2_create_buffer2(ScreenPtr pScreen,
 						   AMDGPU_CREATE_PIXMAP_DRI2);
 	}
 
+	if (!pixmap)
+		return NULL;
+
 	buffers = calloc(1, sizeof *buffers);
 	if (!buffers)
 		goto error;
 
-	if (pixmap) {
-		if (is_glamor_pixmap) {
-			pixmap = amdgpu_glamor_set_pixmap_bo(drawable, pixmap);
-			pixmap->refcnt++;
-		}
-
-		if (!amdgpu_get_flink_name(pAMDGPUEnt, pixmap, &buffers->name))
-			goto error;
+	if (is_glamor_pixmap) {
+		pixmap = amdgpu_glamor_set_pixmap_bo(drawable, pixmap);
+		pixmap->refcnt++;
 	}
 
+	if (!amdgpu_get_flink_name(pAMDGPUEnt, pixmap, &buffers->name))
+		goto error;
+
 	privates = calloc(1, sizeof(struct dri2_buffer_priv));
 	if (!privates)
 		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 */
@@ -195,8 +194,7 @@ amdgpu_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