[PATCH xserver] Switch to SW cursor right after HW cursor failure

Alexandre Courbot acourbot at nvidia.com
Fri Mar 18 08:19:58 UTC 2016


Modesetting currently signals a failure to display the HW cursor by
setting its size to 0 in drmmode_set_cursor(). xf86CursorSetCursor()
will then detect that condition and switch to the SW cursor upon the
next invokation.

The problem is that said invokation may not come before a while (i.e.
before the cursor changes shape), and thus the user may be left with an
invisible cursor for an undefined period of time. Therefore, check
whether the HW cursor size has been set to 0 after calling
xf86SetCursor(), and fall through the SW cursor fallback if this is the
case in order to display the cursor immediately.

Signed-off-by: Alexandre Courbot <acourbot at nvidia.com>
---
 hw/xfree86/ramdac/xf86Cursor.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index c061b8028ca8..08868ffb2459 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -357,7 +357,15 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
                 ScreenPriv->isUp = TRUE;
 
                 miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse);
-                return;
+
+		/* even if xf86SetCursor returns success, modesetting may
+		 * have set the cursor size to 0 in order to switch to software
+		 * cursor. If this happens, just fall through to switch to
+		 * software cursor. If we don't do it here, the cursor will
+		 * remain invisible until the next call to this function, which
+		 * may not happen before a while */
+                if (!(infoPtr->MaxWidth == 0 || infoPtr->MaxHeight == 0))
+                    return;
             }
         }
 
-- 
2.7.3



More information about the xorg-devel mailing list