[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-ati: Changes to 'upstream-unstable'



 configure.ac          |    2 -
 src/drmmode_display.c |   89 ++++++++++++++++++++++++++++----------------------
 src/radeon_dri2.c     |   20 +++--------
 src/radeon_video.c    |   56 +++++++++++++------------------
 4 files changed, 81 insertions(+), 86 deletions(-)

New commits:
commit 99cb8c3faf1a4ce368b7500f17a2a7868c15e8e8
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Nov 12 13:38:14 2015 +0900

    Set version for 7.6.1 release

diff --git a/configure.ac b/configure.ac
index 0ff901b..c024d48 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-ati],
-        [7.6.99],
+        [7.6.1],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-ati])
 

commit 4a2114a717ec8d78cacd8fe158e132d62013faac
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Nov 12 13:32:25 2015 +0900

    Remove duplicate free(output_ids) call
    
    Fixes double-free regression introduced by commit 875ad48e ("Simplify
    drmmode_set_mode_major() and avoid leaking memory.").

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 17e5231..99dc08b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -788,7 +788,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		xf86_reload_cursors(pScrn->pScreen);
 
 done:
-	free(output_ids);
 	if (!ret) {
 		crtc->x = saved_x;
 		crtc->y = saved_y;

commit 960a9f37096b53ec9603a99c7b1f3679f915e03f
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Nov 12 13:20:18 2015 +0900

    Post 7.6.0 release version bump

diff --git a/configure.ac b/configure.ac
index 3a5b060..0ff901b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-ati],
-        [7.6.0],
+        [7.6.99],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-ati])
 

commit 9aae4b71fb402841439e3267fcb7f410d8429c3a
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Nov 12 11:56:48 2015 +0900

    Bump version for 7.6.0 release

diff --git a/configure.ac b/configure.ac
index c371829..3a5b060 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-ati],
-        [7.5.99],
+        [7.6.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-ati])
 

commit 98291869ac4a542a0b478920586407ff9d2c8ef0
Author: Tom St Denis <tom.stdenis@amd.com>
Date:   Wed Nov 11 16:01:41 2015 +0900

    Clean up radeon_dri2_create_buffer2()
    
    Remove the depth_pixmap variable from the function and clear
    out any dead/odd behaviour that results.
    
    Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
    (ported from amdgpu commit 6000aef4e2f0a121b94023484406fb6f04688f74)
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 466d700..d30bbd0 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -181,7 +181,7 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
     RADEONInfoPtr info = RADEONPTR(pScrn);
     BufferPtr buffers;
     struct dri2_buffer_priv *privates;
-    PixmapPtr pixmap, depth_pixmap;
+    PixmapPtr pixmap;
     int flags;
     unsigned front_width;
     uint32_t tiling = 0;
@@ -209,10 +209,9 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
 	cpp = drawable->bitsPerPixel / 8;
     }
 
-    pixmap = pScreen->GetScreenPixmap(pScreen);
-    front_width = pixmap->drawable.width;
+    front_width = pScreen->GetScreenPixmap(pScreen)->drawable.width;
 
-    pixmap = depth_pixmap = NULL;
+    pixmap = NULL;
 
     if (attachment == DRI2BufferFrontLeft) {
 	uint32_t handle;
@@ -227,9 +226,6 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
 	    pixmap = NULL;
 	} else
 	    pixmap->refcnt++;
-    } else if (attachment == DRI2BufferStencil && depth_pixmap) {
-        pixmap = depth_pixmap;
-        pixmap->refcnt++;
     }
 
     if (!pixmap && (is_glamor_pixmap || attachment != DRI2BufferFrontLeft)) {
@@ -314,10 +310,6 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
     if (buffers == NULL)
         goto error;
 
-    if (attachment == DRI2BufferDepth) {
-        depth_pixmap = pixmap;
-    }
-
     if (pixmap) {
 	if (!info->use_glamor) {
 	    info->exa_force_create = TRUE;

commit c6fc7e309a8a922f94a1f5f3e8bfb9058cff7ad1
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Nov 11 15:59:06 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.
    
    (ported from amdgpu commit 21e72fb2418b5cc7fc849a9cf951186e209036b0)
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 22b84da..17e5231 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -555,8 +555,12 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
 			   pScrn->bitsPerPixel, rotate_pitch,
 			   scanout->bo->handle,
 			   &scanout->fb_id);
-	if (ret)
+	if (ret) {
 		ErrorF("failed to add scanout fb\n");
+		radeon_bo_unref(scanout->bo);
+		scanout->bo = NULL;
+		return NULL;
+	}
 
 	scanout->width = width;
 	scanout->height = height;

commit 4e4f4d53da0539ef9feb8766230a6e9927ae005b
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Nov 11 15:57:21 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.
    
    (ported from amdgpu commit 8da1d0c870e1081d77925807d6e3bbc61a23f54f)
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 4397c51..22b84da 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -565,7 +565,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;
@@ -579,8 +579,10 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout,
 		drmmode_crtc_scanout_destroy(drmmode, scanout);
 	}
 
-	if (!data)
-		data = drmmode_crtc_scanout_allocate(crtc, scanout, width, height);
+	if (!scanout->bo) {
+		if (!drmmode_crtc_scanout_allocate(crtc, scanout, width, height))
+			return NULL;
+	}
 
 	rotate_pitch = RADEON_ALIGN(width, drmmode_get_pitch_align(pScrn, drmmode->cpp, 0))
 		* drmmode->cpp;
@@ -713,7 +715,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) {
@@ -887,8 +889,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

commit 421a7e797bdd58d83e81af7a6512cc715a3df514
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Nov 11 15:51:58 2015 +0900

    Don't advertise rotation support without hardware acceleration v2
    
    Rotation currently doesn't work without acceleration (doesn't actually
    rotate with Option "NoAccel", crashes with Option "AccelMethod" "none"
    or when glamor fails to initialize) and would probably be too slow
    anyway.
    
    v2: Also remove now dead code checking for ShadowFB from
        drmmode_crtc_scanout_allocate().
    
    (ported from amdgpu commit dc40582d5ff94d812cbc08f95cf14b80cd0f410d)
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 561b55e..4397c51 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -522,7 +522,6 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
 			      int width, int height)
 {
 	ScrnInfoPtr pScrn = crtc->scrn;
-	RADEONInfoPtr info = RADEONPTR(pScrn);
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;
 	int aligned_height;
@@ -531,13 +530,6 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
 	unsigned long rotate_pitch;
 	int base_align;
 
-	/* rotation requires acceleration */
-	if (info->r600_shadow_fb) {
-		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-			   "Rotation requires acceleration!\n");
-		return NULL;
-	}
-
 	if (scanout->bo) {
 		if (scanout->width == width && scanout->height == height)
 			return scanout->bo->ptr;
@@ -983,7 +975,7 @@ drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 }
 #endif
 
-static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
+static xf86CrtcFuncsRec drmmode_crtc_funcs = {
     .dpms = drmmode_crtc_dpms,
     .set_mode_major = drmmode_set_mode_major,
     .set_cursor_colors = drmmode_set_cursor_colors,
@@ -2066,6 +2058,7 @@ drm_wakeup_handler(pointer data, int err, pointer p)
 Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 {
 	RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
+	RADEONInfoPtr info = RADEONPTR(pScrn);
 	int i, num_dvi = 0, num_hdmi = 0;
 	drmModeResPtr mode_res;
 	unsigned int crtcs_needed = 0;
@@ -2086,8 +2079,16 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 	xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
 		       "%d crtcs needed for screen.\n", crtcs_needed);
 
+	if (info->r600_shadow_fb) {
+		/* Rotation requires hardware acceleration */
+		drmmode_crtc_funcs.shadow_allocate = NULL;
+		drmmode_crtc_funcs.shadow_create = NULL;
+		drmmode_crtc_funcs.shadow_destroy = NULL;
+	}
+
 	drmmode->count_crtcs = mode_res->count_crtcs;
 	xf86CrtcSetSizeRange(pScrn, 320, 200, mode_res->max_width, mode_res->max_height);
+
 	for (i = 0; i < mode_res->count_crtcs; i++)
 		if (!xf86IsEntityShared(pScrn->entityList[0]) ||
 		    (crtcs_needed && !(pRADEONEnt->assigned_crtcs & (1 << i))))

commit 875ad48e7b5cdb7beefbf18dddcbee3ed22b5446
Author: Tom St Denis <tom.stdenis@amd.com>
Date:   Wed Nov 11 15:51:19 2015 +0900

    Simplify drmmode_set_mode_major() and avoid leaking memory.
    
    The function would leak the memory allocated for output_ids.  This
    patch addresses that as well as simplifies the logic somewhat.
    
    Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
    (ported from amdgpu commit 460560502a1bdf26d06f3c30df46fa9f28ffb9e5)
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 3a3f407..561b55e 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -626,7 +626,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 	int saved_x, saved_y;
 	Rotation saved_rotation;
 	DisplayModeRec saved_mode;
-	uint32_t *output_ids;
+	uint32_t *output_ids = NULL;
 	int output_count = 0;
 	Bool ret = TRUE;
 	int i;
@@ -672,15 +672,13 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		crtc->y = y;
 		crtc->rotation = rotation;
 		crtc->transformPresent = FALSE;
-	}
 
-	output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
-	if (!output_ids) {
-		ret = FALSE;
-		goto done;
-	}
+		output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
+		if (!output_ids) {
+			ret = FALSE;
+			goto done;
+		}
 
-	if (mode) {
 		ScreenPtr pScreen = pScrn->pScreen;
 
 		for (i = 0; i < xf86_config->num_output; i++) {
@@ -792,6 +790,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		xf86_reload_cursors(pScrn->pScreen);
 
 done:
+	free(output_ids);
 	if (!ret) {
 		crtc->x = saved_x;
 		crtc->y = saved_y;

commit 789d7d6a04cca6b36fb088a074027807ccb8dd61
Author: Tom St Denis <tom.stdenis@amd.com>
Date:   Wed Nov 11 15:48:51 2015 +0900

    Clean up allocation in RADEONInitVideo()
    
    The allocation of the adapters should use the correct sizeof (even if
    allocating an array of pointers).
    
    Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
    (ported from amdgpu commit db3bb2061b9ac16b0922d9afae99874820356a04)
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/radeon_video.c b/src/radeon_video.c
index 7abc2f6..48b06e2 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -145,7 +145,7 @@ void RADEONInitVideo(ScreenPtr pScreen)
 	    return;
 
     num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
-    newAdaptors = malloc((num_adaptors + 2) * sizeof(XF86VideoAdaptorPtr *));
+    newAdaptors = malloc((num_adaptors + 2) * sizeof(*newAdaptors));
     if (newAdaptors == NULL)
 	return;
 

commit d88fa0dd5d37604de8efb05853738cfaca6a3166
Author: Tom St Denis <tom.stdenis@amd.com>
Date:   Wed Nov 11 15:46:50 2015 +0900

    Simplify pick best crtc to fold two loops into one
    
    This patch folds the two for loops from radeon_pick_best_crtc() into
    one to reduce the LOC and make the routine easier to read.
    
    Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
    (ported from amdgpu commit 3055724aef76a624718f26d5f0f9e9d567ffbcfb)
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/radeon_video.c b/src/radeon_video.c
index 9b714e9..7abc2f6 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -79,7 +79,7 @@ radeon_pick_best_crtc(ScrnInfoPtr pScrn, Bool consider_disabled,
 		      int x1, int x2, int y1, int y2)
 {
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    int			coverage, best_coverage, c;
+    int			coverage, best_coverage, c, cd;
     BoxRec		box, crtc_box, cover_box;
     RROutputPtr         primary_output = NULL;
     xf86CrtcPtr         best_crtc = NULL, primary_crtc = NULL;
@@ -103,38 +103,30 @@ radeon_pick_best_crtc(ScrnInfoPtr pScrn, Bool consider_disabled,
     if (primary_output && primary_output->crtc)
 	primary_crtc = primary_output->crtc->devPrivate;
 
-    /* first consider only enabled CRTCs */
-    for (c = 0; c < xf86_config->num_crtc; c++) {
-	xf86CrtcPtr crtc = xf86_config->crtc[c];
-
-	if (!radeon_crtc_is_enabled(crtc))
-	    continue;
-
-	radeon_crtc_box(crtc, &crtc_box);
-	radeon_box_intersect(&cover_box, &crtc_box, &box);
-	coverage = radeon_box_area(&cover_box);
-	if (coverage > best_coverage ||
-	    (coverage == best_coverage && crtc == primary_crtc)) {
-	    best_crtc = crtc;
-	    best_coverage = coverage;
-	}
-    }
-    if (best_crtc || !consider_disabled)
-	return best_crtc;
-
-    /* if we found nothing, repeat the search including disabled CRTCs */
-    for (c = 0; c < xf86_config->num_crtc; c++) {
-	xf86CrtcPtr crtc = xf86_config->crtc[c];
-
-	radeon_crtc_box(crtc, &crtc_box);
-	radeon_box_intersect(&cover_box, &crtc_box, &box);
-	coverage = radeon_box_area(&cover_box);
-	if (coverage > best_coverage ||
-	    (coverage == best_coverage && crtc == primary_crtc)) {
-	    best_crtc = crtc;
-	    best_coverage = coverage;
+    /* first consider only enabled CRTCs
+     * then on second pass consider disabled ones
+     */
+    for (cd = 0; cd < (consider_disabled ? 2 : 1); cd++) {
+	for (c = 0; c < xf86_config->num_crtc; c++) {
+	    xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+	    if (!cd && !radeon_crtc_is_enabled(crtc))
+		continue;
+
+	    radeon_crtc_box(crtc, &crtc_box);
+	    radeon_box_intersect(&cover_box, &crtc_box, &box);
+	    coverage = radeon_box_area(&cover_box);
+	    if (coverage > best_coverage ||
+		(coverage == best_coverage &&
+		 crtc == primary_crtc)) {
+		best_crtc = crtc;
+		best_coverage = coverage;
+	    }
 	}
+	if (best_crtc)
+	    break;
     }
+
     return best_crtc;
 }
 

commit dbbcd75b3c80aba77673904d46bca97779fd8a8d
Author: Tom St Denis <tom.stdenis@amd.com>
Date:   Wed Nov 11 12:54:54 2015 +0900

    dri2: Avoid calculation with undefined msc value
    
    If the get_msc() call fails for any reason we should avoid updating the
    vblank counter delta with undefined data.
    
    Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
    Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (minor fixups)
    (ported from amdgpu commit 8823c3d4c6db70cff7699b31088f2d92db8faaf4)
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index b29d88b..466d700 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -641,9 +641,9 @@ xf86CrtcPtr radeon_dri2_drawable_crtc(DrawablePtr pDraw, Bool consider_disabled)
 	if (priv->crtc && priv->crtc != crtc) {
 	    CARD64 ust, mscold, mscnew;
 
-	    radeon_dri2_get_crtc_msc(priv->crtc, &ust, &mscold);
-	    radeon_dri2_get_crtc_msc(crtc, &ust, &mscnew);
-	    priv->vblank_delta += mscold - mscnew;
+	    if (radeon_dri2_get_crtc_msc(priv->crtc, &ust, &mscold) &&
+		radeon_dri2_get_crtc_msc(crtc, &ust, &mscnew))
+		priv->vblank_delta += mscold - mscnew;
 	}
 
 	priv->crtc = crtc;

commit 7186a8713ba004de4991f21c1a9fc4abc62aeff4
Author: Stephen Chandler Paul <cpaul@redhat.com>
Date:   Fri Oct 23 09:59:36 2015 -0400

    Handle failures in setting a CRTC to a DRM mode properly
    
    This fixes a bug where running the card out of PPLL's when hotplugging
    another monitor would result in all of the displays going blank and
    failing to work properly until X was restarted or the user switched to
    another VT.
    
    [Michel Dänzer: Pass errno instead of -ret to strerror()]
    
    Signed-off-by: Stephen Chandler Paul <cpaul@redhat.com>
    Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 64e79d4..3a3f407 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -760,12 +760,15 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 				radeon_bo_wait(drmmode_crtc->scanout[0].bo);
 			}
 		}
-		ret = drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
-				     fb_id, x, y, output_ids, output_count, &kmode);
-		if (ret)
+		if (drmModeSetCrtc(drmmode->fd,
+				   drmmode_crtc->mode_crtc->crtc_id,
+				   fb_id, x, y, output_ids,
+				   output_count, &kmode) != 0) {
 			xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
-				   "failed to set mode: %s", strerror(-ret));
-		else
+				   "failed to set mode: %s", strerror(errno));
+			ret = FALSE;
+			goto done;
+		} else
 			ret = TRUE;
 
 		if (crtc->scrn->pScreen)

commit 548e97b3b7d1e94075a54ca2bb4eb683025098a7
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Oct 16 16:26:58 2015 +0900

    Call xf86CrtcRotate from initial drmmode_set_desired_modes call
    
    Fixes various problems when rotation is specified in xorg.conf.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92475
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 623124e..64e79d4 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2240,6 +2240,8 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 			crtc->rotation = crtc->desiredRotation;
 			crtc->x = crtc->desiredX;
 			crtc->y = crtc->desiredY;
+			if (!xf86CrtcRotate(crtc))
+			    return FALSE;
 		}
 	}
 	return TRUE;

commit ce9914af8d8d5243977023ec7b09c605f9cca8b4
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Oct 2 18:07:18 2015 +0900

    Only align screen / scanout pixmap height where necessary
    
    When using glamor acceleration, the pixmap's header has to have a height
    that matches exactly what the actual height is minus the GPU memory
    alignment. Otherwise CRTCs scanning out from the main scanout buffer
    (e.g. every CRTC that isn't rotated or transformed in some way) won't
    always work. This results in a bug where rotating one monitor in a
    multi-monitor setup won't always work properly. Easiest way to reproduce
    this:
    
    - Have two monitors (I've gotten this working with a 1920x1080 and
      1280x1024, along with two 1920x1080s)
    - Rotate one of them from 0° to 90°, then rotate the same monitor from
      90° to 180°. The monitor that hasn't been rotated won't properly
      update, and will stay on a blank screen
    
    This doesn't seem to make any difference when using EXA for
    acceleration.
    
    Compared to Stephen Chandler's patch, this drops the height alignment
    in most places and only keeps it where it's really necessary.
    
    Reported-and-Tested-by: Stephen Chandler Paul <cpaul@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index efc35f0..623124e 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -525,6 +525,7 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
 	RADEONInfoPtr info = RADEONPTR(pScrn);
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;
+	int aligned_height;
 	int size;
 	int ret;
 	unsigned long rotate_pitch;
@@ -547,9 +548,9 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
 	rotate_pitch =
 		RADEON_ALIGN(width, drmmode_get_pitch_align(pScrn, drmmode->cpp, 0))
 		* drmmode->cpp;
-	height = RADEON_ALIGN(height, drmmode_get_height_align(pScrn, 0));
+	aligned_height = RADEON_ALIGN(height, drmmode_get_height_align(pScrn, 0));
 	base_align = drmmode_get_base_align(pScrn, drmmode->cpp, 0);
-	size = RADEON_ALIGN(rotate_pitch * height, RADEON_GPU_PAGE_SIZE);
+	size = RADEON_ALIGN(rotate_pitch * aligned_height, RADEON_GPU_PAGE_SIZE);
 
 	scanout->bo = radeon_bo_open(drmmode->bufmgr, 0, size, base_align,
 				     RADEON_GEM_DOMAIN_VRAM, 0);
@@ -633,7 +634,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 	drmModeModeInfo kmode;
 	int pitch;
 	uint32_t tiling_flags = 0;
-	int height;
 
 	if (info->allowColorTiling) {
 		if (info->ChipFamily >= CHIP_FAMILY_R600)
@@ -644,14 +644,13 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 
 	pitch = RADEON_ALIGN(pScrn->displayWidth, drmmode_get_pitch_align(pScrn, info->pixel_bytes, tiling_flags)) *
 		info->pixel_bytes;
-	height = RADEON_ALIGN(pScrn->virtualY, drmmode_get_height_align(pScrn, tiling_flags));
 	if (info->ChipFamily >= CHIP_FAMILY_R600) {
 		pitch = info->front_surface.level[0].pitch_bytes;
 	}
 
 	if (drmmode->fb_id == 0) {
 		ret = drmModeAddFB(drmmode->fd,
-				   pScrn->virtualX, height,
+				   pScrn->virtualX, pScrn->virtualY,
                                    pScrn->depth, pScrn->bitsPerPixel,
 				   pitch,
 				   info->front_bo->handle,
@@ -1789,6 +1788,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 	ScreenPtr   screen = xf86ScrnToScreen(scrn);
 	uint32_t    old_fb_id;
 	int	    i, pitch, old_width, old_height, old_pitch;
+	int aligned_height;
 	uint32_t screen_size;
 	int cpp = info->pixel_bytes;
 	struct radeon_bo *front_bo;
@@ -1822,8 +1822,8 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 	}
 
 	pitch = RADEON_ALIGN(width, drmmode_get_pitch_align(scrn, cpp, tiling_flags)) * cpp;
-	height = RADEON_ALIGN(height, drmmode_get_height_align(scrn, tiling_flags));
-	screen_size = RADEON_ALIGN(pitch * height, RADEON_GPU_PAGE_SIZE);
+	aligned_height = RADEON_ALIGN(height, drmmode_get_height_align(scrn, tiling_flags));
+	screen_size = RADEON_ALIGN(pitch * aligned_height, RADEON_GPU_PAGE_SIZE);
 	base_align = 4096;
 	if (info->ChipFamily >= CHIP_FAMILY_R600) {
 		memset(&surface, 0, sizeof(struct radeon_surface));
@@ -2473,7 +2473,6 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 	unsigned int pitch;
 	int i;
 	uint32_t tiling_flags = 0;
-	int height;
 	drmmode_flipdata_ptr flipdata;
 	drmmode_flipevtcarrier_ptr flipcarrier = NULL;
 	struct radeon_drm_queue_entry *drm_queue = NULL;
@@ -2487,7 +2486,6 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 
 	pitch = RADEON_ALIGN(scrn->displayWidth, drmmode_get_pitch_align(scrn, info->pixel_bytes, tiling_flags)) *
 		info->pixel_bytes;
-	height = RADEON_ALIGN(scrn->virtualY, drmmode_get_height_align(scrn, tiling_flags));
 	if (info->ChipFamily >= CHIP_FAMILY_R600 && info->surf_man) {
 		pitch = info->front_surface.level[0].pitch_bytes;
 	}
@@ -2503,7 +2501,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 	 * Create a new handle for the back buffer
 	 */
 	flipdata->old_fb_id = drmmode->fb_id;
-	if (drmModeAddFB(drmmode->fd, scrn->virtualX, height,
+	if (drmModeAddFB(drmmode->fd, scrn->virtualX, scrn->virtualY,
 			 scrn->depth, scrn->bitsPerPixel, pitch,
 			 new_front_handle, &drmmode->fb_id))
 		goto error;


Reply to: