Each xf86ScreenSetCursor() call calls: xf86DriverLoadCursorARGB() infoPtr->ShowCursor()
In succession, ending up in 2 drmModeSetCursor2() calls, with the second effectively being a no-op. Keep track of having set the cursor already in drmmode_load_cursor_argb_check() and unless hide() was called in the mean time make drmmode_show_cursor() a no-op. Signed-off-by: Hans de Goede <[email protected]> --- Note this patch applies on top of Michael Thayer's "modesetting: allow switching from software to hardware cursors (v4)" series --- hw/xfree86/drivers/modesetting/drmmode_display.c | 7 ++++++- hw/xfree86/drivers/modesetting/drmmode_display.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index 46e981b..23c1db1 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -783,6 +783,8 @@ drmmode_set_cursor(xf86CrtcPtr crtc) if (ret) /* fallback to swcursor */ return FALSE; + + drmmode_crtc->cursor_up = TRUE; return TRUE; } @@ -817,6 +819,7 @@ drmmode_hide_cursor(xf86CrtcPtr crtc) drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; + drmmode_crtc->cursor_up = FALSE; drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, 0, ms->cursor_width, ms->cursor_height); } @@ -825,7 +828,9 @@ static void drmmode_show_cursor(xf86CrtcPtr crtc) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - drmmode_set_cursor(crtc); + + if (!drmmode_crtc->cursor_up) + drmmode_set_cursor(crtc); } static void diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h index f979b99..f774250 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.h +++ b/hw/xfree86/drivers/modesetting/drmmode_display.h @@ -91,6 +91,7 @@ typedef struct { uint32_t vblank_pipe; int dpms_mode; struct dumb_bo *cursor_bo; + Bool cursor_up; uint16_t lut_r[256], lut_g[256], lut_b[256]; drmmode_bo rotate_bo; -- 2.9.3 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
