File U_07-Adapt-to-XF86_CRTC_VERSION-7.patch of Package xf86-video-ati

From: Michel Dänzer <michel.daenzer@amd.com>
Date: Mon Mar 28 18:49:15 2016 +0900
Subject: [PATCH 7/20]Adapt to XF86_CRTC_VERSION 7
Patch-mainline: Upstream
Git-repo: git://anongit.freedesktop.org/xorg/driver/xf86-video-ati
Git-commit: 7835558acdce318130ba4a09ef936fd675e3197d
References: bsc#990066
Signed-off-by: Max Staudt <mstaudt@suse.de>

Now the HW cursor can be used with TearFree rotation.

This also allows always using the separate scanout pixmap mechanism for
rotation, so that should be much smoother even without TearFree enabled.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
---
 src/drmmode_display.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 34b76e9..e32791d 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -643,7 +643,7 @@ drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
 	if (crtc->transformPresent)
 		return FALSE;

-#if XF86_CRTC_VERSION >= 4
+#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7
 	/* Xorg doesn't correctly handle cursor position transform in the
 	 * rotation case
 	 */
@@ -666,11 +666,19 @@ drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
 static Bool
 drmmode_handle_transform(xf86CrtcPtr crtc)
 {
-	RADEONInfoPtr info = RADEONPTR(crtc->scrn);
 	Bool ret;

+#if XF86_CRTC_VERSION >= 7
+	if (!crtc->transformPresent && crtc->rotation != RR_Rotate_0)
+	    crtc->driverIsPerformingTransform = XF86DriverTransformOutput;
+	else
+	    crtc->driverIsPerformingTransform = XF86DriverTransformNone;
+#else
+	RADEONInfoPtr info = RADEONPTR(crtc->scrn);
+
 	crtc->driverIsPerformingTransform = info->tear_free &&
 		!crtc->transformPresent && crtc->rotation != RR_Rotate_0;
+#endif

 	ret = xf86CrtcRotate(crtc);

@@ -921,7 +929,7 @@ drmmode_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;

-#if XF86_CRTC_VERSION >= 4
+#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7
 	if (crtc->driverIsPerformingTransform) {
 		x += crtc->x;
 		y += crtc->y;
@@ -932,7 +940,7 @@ drmmode_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
 	drmModeMoveCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, x, y);
 }

-#if XF86_CRTC_VERSION >= 4
+#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7

 static int
 drmmode_cursor_src_offset(Rotation rotation, int width, int height,
@@ -978,7 +986,7 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
 	/* cursor should be mapped already */
 	ptr = (uint32_t *)(drmmode_crtc->cursor_bo->ptr);

-#if XF86_CRTC_VERSION >= 4
+#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7
 	if (crtc->driverIsPerformingTransform) {
 		uint32_t cursor_w = info->cursor_w, cursor_h = info->cursor_h;
 		int dstx, dsty;