xf86-video-ati: Branch 'master' - 3 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Wed Mar 23 07:58:26 UTC 2016


 configure.ac          |    6 +++++
 src/drmmode_display.c |   54 ++++++++++++++++++++++++++++++++++++++++----------
 src/radeon.h          |    5 ++++
 src/radeon_dri2.c     |    1 
 src/radeon_kms.c      |    7 ++++--
 src/radeon_present.c  |    3 ++
 6 files changed, 64 insertions(+), 12 deletions(-)

New commits:
commit d670c5c9851b4eff21c845d26c7d7e4eb5ee0fa9
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Fri Mar 18 16:46:08 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.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/configure.ac b/configure.ac
index f2bf57c..eb97a6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,6 +147,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 3c873dc..ad3de7f 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -873,8 +873,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:
 	if (!ret) {
commit 7f3d0780ca65a90117c2a61362dbc0899bd9c0b0
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Mar 9 18:28:47 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.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 3769e44..3c873dc 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -860,7 +860,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:
diff --git a/src/radeon.h b/src/radeon.h
index fe26df4..b9afd8e 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -547,6 +547,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;
+
 #ifdef USE_GLAMOR
     struct {
 	CreateGCProcPtr SavedCreateGC;
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 657e6a6..474611a 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -823,6 +823,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) &&
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 8048c95..d89c376 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1285,15 +1285,18 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TearFree enabled\n");
 
     if (info->dri2.pKernelDRMVersion->version_minor >= 8) {
+	Bool 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/radeon_present.c b/src/radeon_present.c
index e0a549d..3be3360 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -244,6 +244,9 @@ radeon_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;
 
commit 3de480e83c0a1824838d662d6d67c9fe85277298
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Mar 9 16:44:32 2016 +0900

    Factor out HW cursor checking code into drmmode_can_use_hw_cursor
    
    And add a check for RandR 1.4 multihead.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index eac37d8..3769e44 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -620,6 +620,33 @@ radeon_screen_damage_report(DamagePtr damage, RegionPtr region, void *closure)
 	damage->damage.data = NULL;
 }
 
+static Bool
+drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
+{
+	RADEONInfoPtr info = RADEONPTR(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
@@ -833,7 +860,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:
@@ -951,15 +978,7 @@ 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