[PATCH] Set pixmap height to unaligned value when rotating screen

cpaul at redhat.com cpaul at redhat.com
Thu Oct 1 10:01:01 PDT 2015


From: Stephen Chandler Paul <cpaul at redhat.com>

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.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1076758

Signed-off-by: Stephen Chandler Paul <cpaul at redhat.com>
---
 src/drmmode_display.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index efc35f0..0d9adc4 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1789,6 +1789,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 unaligned_height = height;
 	uint32_t screen_size;
 	int cpp = info->pixel_bytes;
 	struct radeon_bo *front_bo;
@@ -1928,7 +1929,8 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 		psurface = radeon_get_pixmap_surface(ppix);
 		*psurface = info->front_surface;
 		screen->ModifyPixmapHeader(ppix,
-					   width, height, -1, -1, pitch, NULL);
+					   width, unaligned_height, -1, -1,
+					   pitch, NULL);
 	} else {
 		if (radeon_bo_map(info->front_bo, 1))
 			goto fail;
@@ -1938,8 +1940,8 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 		free(info->fb_shadow);
 		info->fb_shadow = fb_shadow;
 		screen->ModifyPixmapHeader(ppix,
-					   width, height, -1, -1, pitch,
-					   info->fb_shadow);
+					   width, unaligned_height, -1, -1,
+					   pitch, info->fb_shadow);
 	}
 #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,9,99,1,0)
 	scrn->pixmapPrivate.ptr = ppix->devPrivate.ptr;
-- 
2.4.3



More information about the xorg-devel mailing list