[PATCH] modesetting: Don't re-enable the cursor when loading the image
Keith Packard
keithp at keithp.com
Tue Dec 16 23:18:19 PST 2014
Hidden cursors also have their image updated; re-enabling the cursor
each time the image is set will cause it to re-appear.
drm_mode_load_cursor_argb also checked for drmModeSetCursor failure
and switched to software cursors. That code has been rescused from
deletion and moved down into drmmode_show_cursor.
Signed-off-by: Keith Packard <keithp at keithp.com>
---
hw/xfree86/drivers/modesetting/drmmode_display.c | 30 ++++++++++--------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 13a96dc..ffd4e88 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -400,27 +400,12 @@ drmmode_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
int i;
uint32_t *ptr;
- uint32_t handle = drmmode_crtc->cursor_bo->handle;
- int ret;
/* cursor should be mapped already */
ptr = (uint32_t *) (drmmode_crtc->cursor_bo->ptr);
for (i = 0; i < ms->cursor_width * ms->cursor_height; i++)
ptr[i] = image[i]; // cpu_to_le32(image[i]);
-
- ret =
- drmModeSetCursor(drmmode_crtc->drmmode->fd,
- drmmode_crtc->mode_crtc->crtc_id, handle,
- ms->cursor_width, ms->cursor_height);
- if (ret) {
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
-
- cursor_info->MaxWidth = cursor_info->MaxHeight = 0;
- drmmode_crtc->drmmode->sw_cursor = TRUE;
- /* fallback to swcursor */
- }
}
static void
@@ -443,11 +428,11 @@ drmmode_show_cursor(xf86CrtcPtr crtc)
drmmode_ptr drmmode = drmmode_crtc->drmmode;
uint32_t handle = drmmode_crtc->cursor_bo->handle;
static Bool use_set_cursor2 = TRUE;
+ int ret;
if (use_set_cursor2) {
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
CursorPtr cursor = xf86_config->cursor;
- int ret;
ret =
drmModeSetCursor2(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
@@ -459,8 +444,17 @@ drmmode_show_cursor(xf86CrtcPtr crtc)
return;
}
- drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
- ms->cursor_width, ms->cursor_height);
+ ret = drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
+ ms->cursor_width, ms->cursor_height);
+
+ if (ret) {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+
+ cursor_info->MaxWidth = cursor_info->MaxHeight = 0;
+ drmmode_crtc->drmmode->sw_cursor = TRUE;
+ /* fallback to swcursor */
+ }
}
static void
--
2.1.3
More information about the xorg-devel
mailing list