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

Michel Dänzer daenzer at kemper.freedesktop.org
Fri Mar 25 01:46:11 UTC 2016


 configure.ac          |    8 ++++-
 src/amdgpu_dri2.c     |   15 ----------
 src/amdgpu_drv.h      |    5 +++
 src/amdgpu_glamor.c   |    8 -----
 src/amdgpu_kms.c      |   45 +++++++++++++++++++++----------
 src/amdgpu_list.h     |    1 
 src/amdgpu_pixmap.c   |    4 --
 src/amdgpu_pixmap.h   |    8 -----
 src/amdgpu_present.c  |    3 ++
 src/amdgpu_video.c    |    2 -
 src/drmmode_display.c |   71 +++++++++++++++++++++++++++++++++++++++++---------
 11 files changed, 106 insertions(+), 64 deletions(-)

New commits:
commit fbf9ae18cd241b8b78936aa30441e5fbfd9ba1c5
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Mar 24 19:05:15 2016 +0900

    Require xserver 1.9 or newer
    
    1.9.0 was released in August 2010.
    
    We were already unintentionally relying on things not available in 1.8
    for at least a year, and nobody has complained.
    
    (Ported from radeon commit e592f32f8b5f5873fcc18b10a69dd5e4ccf11073)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/configure.ac b/configure.ac
index 1deab68..58b79c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,7 +76,7 @@ PKG_CHECK_MODULES(LIBDRM_AMDGPU, [libdrm_amdgpu])
 PKG_CHECK_MODULES(GBM, [gbm])
 
 # Obtain compiler/linker options for the driver dependencies
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.8 xproto fontsproto xf86driproto $REQUIRED_MODULES])
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.9 xproto fontsproto xf86driproto $REQUIRED_MODULES])
 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
                   HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
                   HAVE_XEXTPROTO_71="no")
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index de628cd..4478b16 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -71,18 +71,9 @@ struct dri2_window_priv {
 	int vblank_delta;
 };
 
-#if HAS_DEVPRIVATEKEYREC
-
 static DevPrivateKeyRec dri2_window_private_key_rec;
 #define dri2_window_private_key (&dri2_window_private_key_rec)
 
-#else
-
-static int dri2_window_private_key_index;
-DevPrivateKey dri2_window_private_key = &dri2_window_private_key_index;
-
-#endif /* HAS_DEVPRIVATEKEYREC */
-
 #define get_dri2_window_priv(window) \
 	((struct dri2_window_priv*) \
 	 dixLookupPrivate(&(window)->devPrivates, dri2_window_private_key))
@@ -1454,14 +1445,9 @@ Bool amdgpu_dri2_screen_init(ScreenPtr pScreen)
 		driverNames[0] = driverNames[1] = dri2_info.driverName;
 
 		if (DRI2InfoCnt == 0) {
-#if HAS_DIXREGISTERPRIVATEKEY
 			if (!dixRegisterPrivateKey(dri2_window_private_key,
 						   PRIVATE_WINDOW,
 						   sizeof(struct dri2_window_priv))) {
-#else
-			if (!dixRequestPrivate(dri2_window_private_key,
-					       sizeof(struct dri2_window_priv))) {
-#endif
 				xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 					   "Failed to get DRI2 window private\n");
 				return FALSE;
diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index efde2b0..52aa30d 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -38,11 +38,7 @@
 
 #include <GL/gl.h>
 
-#if HAS_DEVPRIVATEKEYREC
 DevPrivateKeyRec amdgpu_pixmap_index;
-#else
-int amdgpu_pixmap_index;
-#endif
 
 void amdgpu_glamor_exchange_buffers(PixmapPtr src, PixmapPtr dst)
 {
@@ -355,11 +351,7 @@ Bool amdgpu_glamor_init(ScreenPtr screen)
 			   "Failed to initialize textured pixmap of screen for glamor.\n");
 		return FALSE;
 	}
-#if HAS_DIXREGISTERPRIVATEKEY
 	if (!dixRegisterPrivateKey(&amdgpu_pixmap_index, PRIVATE_PIXMAP, 0))
-#else
-	if (!dixRequestPrivate(&amdgpu_pixmap_index, 0))
-#endif
 		return FALSE;
 
 	if (info->shadow_primary)
diff --git a/src/amdgpu_pixmap.c b/src/amdgpu_pixmap.c
index 0a1b0b1..f2008b5 100644
--- a/src/amdgpu_pixmap.c
+++ b/src/amdgpu_pixmap.c
@@ -103,11 +103,7 @@ static Bool amdgpu_pixmap_destroy(PixmapPtr pixmap)
 /* This should only be called when glamor is disabled */
 Bool amdgpu_pixmap_init(ScreenPtr screen)
 {
-#if HAS_DIXREGISTERPRIVATEKEY
 	if (!dixRegisterPrivateKey(&amdgpu_pixmap_index, PRIVATE_PIXMAP, 0))
-#else
-	if (!dixRequestPrivate(&amdgpu_pixmap_index, 0))
-#endif
 		return FALSE;
 
 	screen->CreatePixmap = amdgpu_pixmap_create;
diff --git a/src/amdgpu_pixmap.h b/src/amdgpu_pixmap.h
index 6d16628..1fba90e 100644
--- a/src/amdgpu_pixmap.h
+++ b/src/amdgpu_pixmap.h
@@ -39,19 +39,11 @@ struct amdgpu_pixmap {
 	uint32_t handle;
 };
 
-#if HAS_DEVPRIVATEKEYREC
 extern DevPrivateKeyRec amdgpu_pixmap_index;
-#else
-extern int amdgpu_pixmap_index;
-#endif
 
 static inline struct amdgpu_pixmap *amdgpu_get_pixmap_private(PixmapPtr pixmap)
 {
-#if HAS_DEVPRIVATEKEYREC
 	return dixGetPrivate(&pixmap->devPrivates, &amdgpu_pixmap_index);
-#else
-	return dixLookupPrivate(&pixmap->devPrivates, &amdgpu_pixmap_index);
-#endif
 }
 
 static inline void amdgpu_set_pixmap_private(PixmapPtr pixmap,
diff --git a/src/amdgpu_video.c b/src/amdgpu_video.c
index af34e10..8f9a2b9 100644
--- a/src/amdgpu_video.c
+++ b/src/amdgpu_video.c
@@ -90,9 +90,7 @@ amdgpu_pick_best_crtc(ScrnInfoPtr pScrn, Bool consider_disabled,
 	best_coverage = 0;
 
 	/* Prefer the CRTC of the primary output */
-#ifdef HAS_DIXREGISTERPRIVATEKEY
 	if (dixPrivateKeyRegistered(rrPrivKey))
-#endif
 	{
 		primary_output = RRFirstOutput(pScrn->pScreen);
 	}
commit 912db5fbbc6b9b1121c8a03168cb4bd870474376
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Mar 24 18:59:05 2016 +0900

    Fix build against older versions of xserver
    
    Also slightly clean up the error handling in amdgpu_scanout_do_update.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94614
    
    (Ported from radeon commit bde466e5d44cad64b4e4eceaa5de80fdbf86356e)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 51302e2..6dcec69 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -302,6 +302,7 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
 					      pDraw->height))
 		return FALSE;
 
+#if XF86_CRTC_VERSION >= 4
 	if (xf86_crtc->driverIsPerformingTransform) {
 		SourceValidateProcPtr SourceValidate = pScreen->SourceValidate;
 		PictFormatPtr format = PictureWindowFormat(pScreen->root);
@@ -324,13 +325,13 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
 		if (!dst) {
 			ErrorF("Failed to create destination picture for transformed scanout "
 			       "update\n");
-			goto out;
+			goto free_src;
 		}
 		error = SetPictureTransform(src, &xf86_crtc->crtc_to_framebuffer);
 		if (error) {
 			ErrorF("SetPictureTransform failed for transformed scanout "
 			       "update\n");
-			goto out;
+			goto free_dst;
 		}
 
 		if (xf86_crtc->filter)
@@ -351,9 +352,14 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
 				 extents.y2 - extents.y1);
 		pScreen->SourceValidate = SourceValidate;
 
-		FreePicture(src, None);
+ free_dst:
 		FreePicture(dst, None);
-	} else {
+ free_src:
+		FreePicture(src, None);
+	} else
+ out:
+#endif /* XF86_CRTC_VERSION >= 4 */
+	{
 		GCPtr gc = GetScratchGC(pDraw->depth, pScreen);
 
 		ValidateGC(pDraw, gc);
@@ -367,7 +373,6 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
 
 	amdgpu_glamor_flush(xf86_crtc->scrn);
 
-out:
 	return TRUE;
 }
 
@@ -517,8 +522,11 @@ static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 	for (c = 0; c < xf86_config->num_crtc; c++) {
 		if (info->tear_free)
 			amdgpu_scanout_flip(pScreen, info, xf86_config->crtc[c]);
-		else if (info->shadow_primary ||
-				 xf86_config->crtc[c]->driverIsPerformingTransform)
+		else if (info->shadow_primary
+#if XF86_CRTC_VERSION >= 4
+				 || xf86_config->crtc[c]->driverIsPerformingTransform
+#endif
+			)
 			amdgpu_scanout_update(xf86_config->crtc[c]);
 	}
 
diff --git a/src/amdgpu_list.h b/src/amdgpu_list.h
index c1e3516..a2b1d3c 100644
--- a/src/amdgpu_list.h
+++ b/src/amdgpu_list.h
@@ -30,6 +30,7 @@
 #if !HAVE_XORG_LIST
 #define xorg_list			list
 #define xorg_list_init			list_init
+#define xorg_list_is_empty		list_is_empty
 #define xorg_list_add			list_add
 #define xorg_list_del			list_del
 #define xorg_list_for_each_entry	list_for_each_entry
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 4240a43..2aea542 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -41,6 +41,7 @@
 #include "drmmode_display.h"
 #include "amdgpu_bo_helper.h"
 #include "amdgpu_glamor.h"
+#include "amdgpu_list.h"
 #include "amdgpu_pixmap.h"
 
 #ifdef AMDGPU_PIXMAP_SHARING
@@ -579,16 +580,20 @@ drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
 	if (crtc->transformPresent)
 		return FALSE;
 
+#if XF86_CRTC_VERSION >= 4
 	/* Xorg doesn't correctly handle cursor position transform in the
 	 * rotation case
 	 */
 	if (crtc->driverIsPerformingTransform &&
 	    (crtc->rotation & 0xf) != RR_Rotate_0)
 		return FALSE;
+#endif
 
+#ifdef AMDGPU_PIXMAP_SHARING
 	/* HW cursor not supported yet with RandR 1.4 multihead */
 	if (!xorg_list_is_empty(&crtc->scrn->pScreen->pixmap_dirty_list))
 		return FALSE;
+#endif
 
 	return TRUE;
 }
@@ -715,8 +720,11 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 
 			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[0]);
 			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[1]);
-		} else if (info->tear_free || info->shadow_primary ||
-			   crtc->driverIsPerformingTransform) {
+		} else if (info->tear_free ||
+#if XF86_CRTC_VERSION >= 4
+			   crtc->driverIsPerformingTransform ||
+#endif
+			   info->shadow_primary) {
 			for (i = 0; i < (info->tear_free ? 2 : 1); i++) {
 				drmmode_crtc_scanout_create(crtc,
 							    &drmmode_crtc->scanout[i],
@@ -2410,7 +2418,12 @@ restart_destroy:
 	}
 
 	if (changed) {
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0)
 		RRSetChanged(xf86ScrnToScreen(scrn));
+#else
+		rrScrPrivPtr rrScrPriv = rrGetScrPriv(scrn->pScreen);
+		rrScrPriv->changed = TRUE;
+#endif
 		RRTellChanged(xf86ScrnToScreen(scrn));
 	}
 
commit 3fb6280ab3b104b02841c7cab8ed68c1d463c834
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Mar 24 18:56:44 2016 +0900

    DRI3 only works with acceleration
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94214
    
    (Ported from radeon commit d21ac4669a8b2cdd4eec5e5a94d1950b7423b8b5)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index f814dc0..51302e2 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1221,13 +1221,16 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 
 	value = FALSE;
 	from = X_DEFAULT;
-	if (xf86GetOptValBool(info->Options, OPTION_DRI3, &value))
-		from = X_CONFIG;
 
-	if (xf86GetOptValInteger(info->Options, OPTION_DRI, &driLevel) &&
-	    (driLevel == 2 || driLevel == 3)) {
-		from = X_CONFIG;
-		value = driLevel == 3;
+	if (info->use_glamor) {
+		if (xf86GetOptValBool(info->Options, OPTION_DRI3, &value))
+			from = X_CONFIG;
+
+		if (xf86GetOptValInteger(info->Options, OPTION_DRI, &driLevel) &&
+			(driLevel == 2 || driLevel == 3)) {
+			from = X_CONFIG;
+			value = driLevel == 3;
+		}
 	}
 
 	if (value) {
commit 3177fe817a5f2de4ed10860866a0dd6d6c6ba816
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Mar 24 18:51:59 2016 +0900

    Check for xf86CursorResetCursor
    
    If it's available, Xorg calls it on each mode configuration change. It
    does what xf86_reload_cursors does (and more), so we don't need to call
    the latter anymore.
    
    (Ported from radeon commit d670c5c9851b4eff21c845d26c7d7e4eb5ee0fa9)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/configure.ac b/configure.ac
index fb07e89..1deab68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,6 +163,12 @@ AC_CHECK_DECL(fbGlyphs,
 	       #include <glyphstr.h>
 	       #include <fbpict.h>])
 
+AC_CHECK_DECL(xf86CursorResetCursor,
+	      [AC_DEFINE(HAVE_XF86_CURSOR_RESET_CURSOR, 1,
+	      [Have xf86CursorResetCursor API])], [],
+	      [#include <xorg-server.h>
+	       #include <xf86Cursor.h>])
+
 AC_CHECK_DECL(xorg_list_init,
 	      [AC_DEFINE(HAVE_XORG_LIST, 1, [Have xorg_list API])], [],
 	      [#include <X11/Xdefs.h>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2406959..4240a43 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -812,8 +812,10 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		break;
 	}
 
+#ifndef HAVE_XF86_CURSOR_RESET_CURSOR
 	if (!info->hwcursor_disabled)
 		xf86_reload_cursors(pScreen);
+#endif
 
 done:
 	free(output_ids);
commit a3dfce7b24e1ea01c1aa62926025a545312cbe13
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Mar 24 18:45:46 2016 +0900

    Don't try DRI2/Present flipping while the HW cursor can't be used
    
    Flipping doesn't interact correctly with SW cursor: A flip makes the SW
    cursor disappear. It will only appear again when the cursor is moved,
    but it will be surrounded by corruption, because the SW cursor code
    will restore stale screen contents at the old cursor location before
    drawing the cursor at the new location.
    
    (Ported from radeon commit 7f3d0780ca65a90117c2a61362dbc0899bd9c0b0)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 5778268..de628cd 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -697,6 +697,7 @@ can_flip(ScrnInfoPtr pScrn, DrawablePtr draw,
 
 	return draw->type == DRAWABLE_WINDOW &&
 	    info->allowPageFlip &&
+	    !info->hwcursor_disabled &&
 	    !info->drmmode.present_flipping &&
 	    pScrn->vtSema &&
 	    DRI2CanFlip(draw) && can_exchange(pScrn, draw, front, back);
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 3b074fc..60aa0be 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -248,6 +248,11 @@ typedef struct {
 	int cursor_w;
 	int cursor_h;
 
+	/* If bit n of this field is set, xf86_config->crtc[n] currently can't
+	 * use the HW cursor
+	 */
+	unsigned hwcursor_disabled;
+
 	struct {
 		CreateGCProcPtr SavedCreateGC;
 		RegionPtr (*SavedCopyArea)(DrawablePtr, DrawablePtr, GCPtr,
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index f840e10..f814dc0 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -793,6 +793,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	int cpp;
 	uint64_t heap_size = 0;
 	uint64_t max_allocation = 0;
+	Bool sw_cursor;
 
 	if (flags & PROBE_DETECT)
 		return TRUE;
@@ -889,15 +890,18 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 			xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShadowPrimary enabled\n");
 	}
 
+	sw_cursor = xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE);
+
 	info->allowPageFlip = xf86ReturnOptValBool(info->Options,
 						   OPTION_PAGE_FLIP,
 						   TRUE);
-	if (info->tear_free || info->shadow_primary) {
+	if (sw_cursor || info->tear_free || info->shadow_primary) {
 		    xf86DrvMsg(pScrn->scrnIndex,
 			       info->allowPageFlip ? X_WARNING : X_DEFAULT,
 			       "KMS Pageflipping: disabled%s\n",
 			       info->allowPageFlip ?
-			       " because of ShadowPrimary/TearFree" : "");
+			       (sw_cursor ? " because of SWcursor" :
+				" because of ShadowPrimary/TearFree") : "");
 		    info->allowPageFlip = FALSE;
 	} else {
 		xf86DrvMsg(pScrn->scrnIndex, X_INFO,
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index 67b59b7..4b33ce2 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -229,6 +229,9 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
 	if (!info->allowPageFlip)
 		return FALSE;
 
+	if (info->hwcursor_disabled)
+		return FALSE;
+
 	if (!sync_flip)
 		return FALSE;
 
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 1cbea6e..2406959 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -799,7 +799,20 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		}
 	}
 
-	if (drmmode_can_use_hw_cursor(crtc))
+	/* Compute index of this CRTC into xf86_config->crtc */
+	for (i = 0; i < xf86_config->num_crtc; i++) {
+		if (xf86_config->crtc[i] != crtc)
+			continue;
+
+		if (!crtc->enabled || drmmode_can_use_hw_cursor(crtc))
+			info->hwcursor_disabled &= ~(1 << i);
+		else
+			info->hwcursor_disabled |= 1 << i;
+
+		break;
+	}
+
+	if (!info->hwcursor_disabled)
 		xf86_reload_cursors(pScreen);
 
 done:
commit ba9be8f32f0321689133e17c1681809dec8c6cf1
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Mar 24 18:44:30 2016 +0900

    Factor out HW cursor checking code into drmmode_can_use_hw_cursor
    
    And add a check for RandR 1.4 multihead.
    
    (Ported from radeon commit 3de480e83c0a1824838d662d6d67c9fe85277298)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 56b025a..1cbea6e 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -566,6 +566,33 @@ amdgpu_screen_damage_report(DamagePtr damage, RegionPtr region, void *closure)
 	damage->damage.data = NULL;
 }
 
+static Bool
+drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
+{
+	AMDGPUInfoPtr info = AMDGPUPTR(crtc->scrn);
+
+	/* Check for Option "SWcursor" */
+	if (xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE))
+		return FALSE;
+
+	/* Fall back to SW cursor if the CRTC is transformed */
+	if (crtc->transformPresent)
+		return FALSE;
+
+	/* Xorg doesn't correctly handle cursor position transform in the
+	 * rotation case
+	 */
+	if (crtc->driverIsPerformingTransform &&
+	    (crtc->rotation & 0xf) != RR_Rotate_0)
+		return FALSE;
+
+	/* HW cursor not supported yet with RandR 1.4 multihead */
+	if (!xorg_list_is_empty(&crtc->scrn->pScreen->pixmap_dirty_list))
+		return FALSE;
+
+	return TRUE;
+}
+
 #if XF86_CRTC_VERSION >= 4
 
 static Bool
@@ -772,7 +799,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		}
 	}
 
-	if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE))
+	if (drmmode_can_use_hw_cursor(crtc))
 		xf86_reload_cursors(pScreen);
 
 done:
@@ -901,15 +928,7 @@ static void drmmode_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
 
 static Bool drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 * image)
 {
-	/* Fall back to SW cursor if the CRTC is transformed */
-	if (crtc->transformPresent)
-		return FALSE;
-
-	/* Xorg doesn't correctly handle cursor position transform in the
-	 * rotation case
-	 */
-	if (crtc->driverIsPerformingTransform &&
-	    (crtc->rotation & 0xf) != RR_Rotate_0)
+	if (!drmmode_can_use_hw_cursor(crtc))
 		return FALSE;
 
 	drmmode_load_cursor_argb(crtc, image);


More information about the xorg-commit mailing list