sna: Try to reuse the current cursor if we fail to update
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 13 Jun 2014 09:52:47 +0000 (10:52 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 13 Jun 2014 09:52:47 +0000 (10:52 +0100)
As a last resort, continue to display the old cursor if we tried and
failed to create a new cursor.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/sna_display.c

index 251d305..5e6de55 100644 (file)
@@ -4226,7 +4226,9 @@ sna_set_cursor_position(ScrnInfoPtr scrn, int x, int y)
                if (arg.x < crtc->mode.HDisplay && arg.x > -sna->cursor.size &&
                    arg.y < crtc->mode.VDisplay && arg.y > -sna->cursor.size) {
                        cursor = __sna_get_cursor(sna, crtc);
-                       if (cursor == NULL) {
+                       if (cursor == NULL)
+                               cursor = sna_crtc->cursor;
+                       if (cursor == NULL || cursor->size > sna->cursor.size) {
                                __DBG(("%s: failed to grab cursor, disabling\n",
                                       __FUNCTION__));
                                goto disable;
@@ -4241,8 +4243,8 @@ sna_set_cursor_position(ScrnInfoPtr scrn, int x, int y)
                        arg.flags |= DRM_MODE_CURSOR_MOVE;
                        crtc->cursor_in_range = true;
                } else {
-disable:
                        crtc->cursor_in_range = false;
+disable:
                        if (sna_crtc->cursor) {
                                arg.flags = DRM_MODE_CURSOR_BO;
                                arg.width = arg.height = 0;