From: "John V. Baboval" <john.babo...@citrix.com> This is an optimization to allow the UI to show/hide the current cursor without setting it to a new bitmap.
In-guest screen sharing applications which show/hide the cursor when capturing the screen every frame (GoToMeeting, WebEx, etc.) cause high QEMU CPU usage if cursor hiding/restoring is implemented as setting a blank cursor and re-setting the original glyph. In-guest driver APIs typically have enable/disable called out as a separate operation to provide input for this optimization. Signed-off-by: John V. Baboval <john.babo...@citrix.com> --- include/ui/console.h | 3 +++ ui/console.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/ui/console.h b/include/ui/console.h index a7171cc..7efa119 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -182,6 +182,8 @@ typedef struct DisplayChangeListenerOps { int x, int y, int on); void (*dpy_cursor_define)(DisplayChangeListener *dcl, QEMUCursor *cursor); + void (*dpy_cursor_enable)(DisplayChangeListener *dcl, + bool state); } DisplayChangeListenerOps; struct DisplayChangeListener { @@ -232,6 +234,7 @@ void dpy_text_resize(QemuConsole *con, int w, int h); void dpy_mouse_set(QemuConsole *con, int x, int y, int on); void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor); bool dpy_cursor_define_supported(QemuConsole *con); +void dpy_cursor_enable(QemuConsole *con, bool state); void dpy_reset(QemuConsole *con); static inline int surface_stride(DisplaySurface *s) diff --git a/ui/console.c b/ui/console.c index 201e602..e9f74c9 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1560,6 +1560,17 @@ bool dpy_cursor_define_supported(QemuConsole *con) return false; } +void dpy_cursor_enable(QemuConsole *con, bool state) +{ + DisplayState *s = con->ds; + struct DisplayChangeListener *dcl; + QLIST_FOREACH(dcl, &s->listeners, next) { + if (dcl->ops->dpy_cursor_enable) { + dcl->ops->dpy_cursor_enable(dcl, state); + } + } +} + void dpy_reset(QemuConsole *con) { DisplayState *s = con->ds; -- 1.7.9.5