[PATCH 4/4] modesetting: Default to sw cursor when we suspect it's needed

Adam Jackson ajax at redhat.com
Wed Jul 22 09:14:09 PDT 2015


... because the runtime fallback doesn't seem to work right, or at least
not right away.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/drivers/modesetting/driver.c | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 58ac420..729cb29 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -688,6 +688,30 @@ msShouldDoubleShadow(ScrnInfoPtr pScrn, modesettingPtr ms)
 #endif
 
 static Bool
+msDefaultSoftwareCursor(modesettingPtr ms)
+{
+    Bool ret = FALSE;
+    drmVersionPtr v = drmGetVersion(ms->fd);
+
+    /*
+     * This is horrific, don't hate me.  The _runtime_ fallback to software
+     * cursor doesn't seem to take on the first try; you get no cursor in
+     * gdm, but it works once you log in.  However just bombing out at
+     * init time seems to work fine.  So for drivers without hardware cursors
+     * (or for G200SE, where they're basically unusable) just default to sw.
+     */
+    if (!strcmp(v->name, "udl") ||
+	!strcmp(v->name, "mgag200") ||
+	!strcmp(v->name, "cirrus") ||
+	!strcmp(v->name, "ast"))
+	ret = TRUE;
+
+    drmFreeVersion(v);
+
+    return ret;
+}
+
+static Bool
 PreInit(ScrnInfoPtr pScrn, int flags)
 {
     modesettingPtr ms;
@@ -839,9 +863,9 @@ PreInit(ScrnInfoPtr pScrn, int flags)
     if (!xf86SetDefaultVisual(pScrn, -1))
         return FALSE;
 
-    if (xf86ReturnOptValBool(ms->Options, OPTION_SW_CURSOR, FALSE)) {
-        ms->drmmode.sw_cursor = TRUE;
-    }
+    if (!xf86GetOptValBool(ms->Options, OPTION_SW_CURSOR,
+			   &ms->drmmode.sw_cursor))
+	ms->drmmode.sw_cursor = msDefaultSoftwareCursor(ms);
 
     ms->cursor_width = 64;
     ms->cursor_height = 64;
-- 
2.4.3



More information about the xorg-devel mailing list