From: Marc-André Lureau <[email protected]> Drop the bookkeeping, we can simply afford an empty "foreach".
Notice that dpy_gfx_update_texture() is now called even when there are no listeners. This is more correct, as the texture is not fully refreshed when a listener connects, so it may be outdated/garbaged. Reviewed-by: Daniel P. Berrangé <[email protected]> Signed-off-by: Marc-André Lureau <[email protected]> --- include/ui/console.h | 1 - ui/console-priv.h | 1 - ui/console.c | 29 ----------------------------- 3 files changed, 31 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index e2e5ff76ec1..f04844263b9 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -399,7 +399,6 @@ QemuConsole *qemu_console_lookup_by_device(DeviceState *dev, uint32_t head); QemuConsole *qemu_console_lookup_by_device_name(const char *device_id, uint32_t head, Error **errp); QEMUCursor *qemu_console_get_cursor(QemuConsole *con); -bool qemu_console_is_visible(QemuConsole *con); bool qemu_console_is_graphic(QemuConsole *con); bool qemu_console_is_fixedsize(QemuConsole *con); bool qemu_console_is_gl_blocked(QemuConsole *con); diff --git a/ui/console-priv.h b/ui/console-priv.h index 39798c3e9d7..2299898984d 100644 --- a/ui/console-priv.h +++ b/ui/console-priv.h @@ -16,7 +16,6 @@ struct QemuConsole { DisplayState *ds; DisplaySurface *surface; DisplayScanout scanout; - int dcls; DisplayGLCtx *gl; int gl_block; QEMUTimer *gl_unblock_timer; diff --git a/ui/console.c b/ui/console.c index 8f65308958a..abb6cba2826 100644 --- a/ui/console.c +++ b/ui/console.c @@ -648,9 +648,6 @@ void register_displaychangelistener(DisplayChangeListener *dcl) dcl->ds = get_alloc_displaystate(); QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next); gui_setup_refresh(dcl->ds); - if (dcl->con) { - dcl->con->dcls++; - } displaychangelistener_display_console(dcl, &error_fatal); if (QEMU_IS_GRAPHIC_CONSOLE(dcl->con)) { dcl_set_graphic_cursor(dcl, QEMU_GRAPHIC_CONSOLE(dcl->con)); @@ -678,9 +675,6 @@ void unregister_displaychangelistener(DisplayChangeListener *dcl) if (!ds) { return; } - if (dcl->con) { - dcl->con->dcls--; - } QLIST_REMOVE(dcl, next); dcl->ds = NULL; gui_setup_refresh(ds); @@ -745,9 +739,6 @@ void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h) w = MIN(w, width - x); h = MIN(h, height - y); - if (!qemu_console_is_visible(con)) { - return; - } dpy_gfx_update_texture(con, con->surface, x, y, w, h); QLIST_FOREACH(dcl, &s->listeners, next) { if (con != dcl->con) { @@ -846,9 +837,6 @@ void dpy_text_cursor(QemuConsole *con, int x, int y) DisplayState *s = con->ds; DisplayChangeListener *dcl; - if (!qemu_console_is_visible(con)) { - return; - } QLIST_FOREACH(dcl, &s->listeners, next) { if (con != dcl->con) { continue; @@ -864,9 +852,6 @@ void dpy_text_update(QemuConsole *con, int x, int y, int w, int h) DisplayState *s = con->ds; DisplayChangeListener *dcl; - if (!qemu_console_is_visible(con)) { - return; - } QLIST_FOREACH(dcl, &s->listeners, next) { if (con != dcl->con) { continue; @@ -882,9 +867,6 @@ void dpy_text_resize(QemuConsole *con, int w, int h) DisplayState *s = con->ds; DisplayChangeListener *dcl; - if (!qemu_console_is_visible(con)) { - return; - } QLIST_FOREACH(dcl, &s->listeners, next) { if (con != dcl->con) { continue; @@ -904,9 +886,6 @@ void dpy_mouse_set(QemuConsole *c, int x, int y, bool on) con->cursor_x = x; con->cursor_y = y; con->cursor_on = on; - if (!qemu_console_is_visible(c)) { - return; - } QLIST_FOREACH(dcl, &s->listeners, next) { if (c != dcl->con) { continue; @@ -925,9 +904,6 @@ void dpy_cursor_define(QemuConsole *c, QEMUCursor *cursor) cursor_unref(con->cursor); con->cursor = cursor_ref(cursor); - if (!qemu_console_is_visible(c)) { - return; - } QLIST_FOREACH(dcl, &s->listeners, next) { if (c != dcl->con) { continue; @@ -1285,11 +1261,6 @@ QEMUCursor *qemu_console_get_cursor(QemuConsole *con) return QEMU_IS_GRAPHIC_CONSOLE(con) ? QEMU_GRAPHIC_CONSOLE(con)->cursor : NULL; } -bool qemu_console_is_visible(QemuConsole *con) -{ - return con->dcls > 0; -} - bool qemu_console_is_graphic(QemuConsole *con) { return con && QEMU_IS_GRAPHIC_CONSOLE(con); -- 2.54.0
