[PATCH xserver] modesetting: Do not call drmModeSetCursor2() twice on every cursor change
Michael Thayer
michael.thayer at oracle.com
Fri Sep 23 12:15:30 UTC 2016
> 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 <hdegoede at redhat.com>
> ---
> Note this patch applies on top of Michael Thayer's
> "modesetting: allow switching from software to hardware cursors (v4)"
> series
Sorry about this, for some reason this and a few other messages did not
make it to my mailbox. Looks good to me, but if you like I can apply it
when I have time and check in gdb that it does what it says on the box.
Otherwise,
Reviewed-by: Michael Thayer <michael.thayer at oracle.com>
Regards,
Michael
> ---
> 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
--
Michael Thayer | VirtualBox engineer
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | D-71384 Weinstadt
ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstraße 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister
der Handelskammer Midden-Nederland, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher
More information about the xorg-devel
mailing list