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

Michel Dänzer daenzer at kemper.freedesktop.org
Wed Oct 14 01:12:27 PDT 2015


 src/drmmode_display.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 21e72fb2418b5cc7fc849a9cf951186e209036b0
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Fri Oct 9 18:38:47 2015 +0900

    Properly handle drmModeAddFB failure in drmmode_crtc_scanout_allocate
    
    We were printing an error message, but not propagating the failure. That
    would probably lead to trouble down the road.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index f010919..4193be4 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -503,6 +503,9 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
 			   bo_handle.u32, &scanout->fb_id);
 	if (ret) {
 		ErrorF("failed to add rotate fb\n");
+		amdgpu_bo_unref(&scanout->bo);
+		scanout->bo = NULL;
+		return NULL;
 	}
 
 	scanout->width = width;
commit 8da1d0c870e1081d77925807d6e3bbc61a23f54f
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Fri Oct 9 18:59:16 2015 +0900

    Eliminate redundant data parameter from drmmode_crtc_scanout_create
    
    drmmode_crtc_scanout_create just needs to call
    drmmode_crtc_scanout_allocate when scanout->bo is NULL.
    
    This makes it clearer to the reader / compiler that
    drmmode_crtc_scanout_create doesn't dereference scanout->bo when it's
    NULL.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 94f273c..f010919 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -513,7 +513,7 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
 static PixmapPtr
 drmmode_crtc_scanout_create(xf86CrtcPtr crtc,
 			    struct drmmode_scanout *scanout,
-			    void *data, int width, int height)
+			    int width, int height)
 {
 	ScrnInfoPtr pScrn = crtc->scrn;
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
@@ -527,9 +527,8 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc,
 		drmmode_crtc_scanout_destroy(drmmode, scanout);
 	}
 
-	if (!data) {
-		data = drmmode_crtc_scanout_allocate(crtc, scanout, width, height);
-		if (!data)
+	if (!scanout->bo) {
+		if (!drmmode_crtc_scanout_allocate(crtc, scanout, width, height))
 			return NULL;
 	}
 
@@ -656,7 +655,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 			for (i = 0; i < (info->tear_free ? 2 : 1); i++) {
 				drmmode_crtc_scanout_create(crtc,
 							    &drmmode_crtc->scanout[i],
-							    NULL, mode->HDisplay,
+							    mode->HDisplay,
 							    mode->VDisplay);
 
 				if (drmmode_crtc->scanout[i].pixmap) {
@@ -819,8 +818,11 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
 {
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 
-	return drmmode_crtc_scanout_create(crtc, &drmmode_crtc->rotate, data,
-					   width, height);
+	/* Xorg passes in the return value of drmmode_crtc_shadow_allocate
+	 * for data, but that's redundant for drmmode_crtc_scanout_create.
+	 */
+	return drmmode_crtc_scanout_create(crtc, &drmmode_crtc->rotate, width,
+					   height);
 }
 
 static void


More information about the xorg-commit mailing list