X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ui%2Fconsole.c;h=419b098c11f50f8ed2842fd9d50b7a3cab2f623f;hb=ca0b64e5ed5c60543ff4758c858f65cd090512f0;hp=22c3c7dd2d2e3c3b7f0c3b6059a5a56080bc83ad;hpb=f4c36bdab6a1ec1cfe6508e27c9c60a802b5d084;p=mirror_qemu.git diff --git a/ui/console.c b/ui/console.c index 22c3c7dd2d..419b098c11 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1575,34 +1575,36 @@ bool dpy_gfx_check_format(QemuConsole *con, return true; } -static void dpy_refresh(DisplayState *s) +/* + * Safe DPY refresh for TCG guests. We use the exclusive mechanism to + * ensure the TCG vCPUs are quiescent so we can avoid races between + * dirty page tracking for direct frame-buffer access by the guest. + * + * This is a temporary stopgap until we've fixed the dirty tracking + * races in display adapters. + */ +static void do_safe_dpy_refresh(DisplayChangeListener *dcl) { - DisplayChangeListener *dcl; - - QLIST_FOREACH(dcl, &s->listeners, next) { - if (dcl->ops->dpy_refresh) { - dcl->ops->dpy_refresh(dcl); - } - } + qemu_mutex_unlock_iothread(); + start_exclusive(); + qemu_mutex_lock_iothread(); + dcl->ops->dpy_refresh(dcl); + qemu_mutex_unlock_iothread(); + end_exclusive(); + qemu_mutex_lock_iothread(); } -void dpy_gfx_copy(QemuConsole *con, int src_x, int src_y, - int dst_x, int dst_y, int w, int h) +static void dpy_refresh(DisplayState *s) { - DisplayState *s = con->ds; DisplayChangeListener *dcl; - if (!qemu_console_is_visible(con)) { - return; - } QLIST_FOREACH(dcl, &s->listeners, next) { - if (con != (dcl->con ? dcl->con : active_console)) { - continue; - } - if (dcl->ops->dpy_gfx_copy) { - dcl->ops->dpy_gfx_copy(dcl, src_x, src_y, dst_x, dst_y, w, h); - } else { /* TODO */ - dcl->ops->dpy_gfx_update(dcl, dst_x, dst_y, w, h); + if (dcl->ops->dpy_refresh) { + if (tcg_enabled()) { + do_safe_dpy_refresh(dcl); + } else { + dcl->ops->dpy_refresh(dcl); + } } } } @@ -1735,6 +1737,17 @@ QEMUGLContext dpy_gl_ctx_get_current(QemuConsole *con) return con->gl->ops->dpy_gl_ctx_get_current(con->gl); } +void dpy_gl_scanout_disable(QemuConsole *con) +{ + assert(con->gl); + if (con->gl->ops->dpy_gl_scanout_disable) { + con->gl->ops->dpy_gl_scanout_disable(con->gl); + } else { + con->gl->ops->dpy_gl_scanout_texture(con->gl, 0, false, 0, 0, + 0, 0, 0, 0); + } +} + void dpy_gl_scanout_texture(QemuConsole *con, uint32_t backing_id, bool backing_y_0_top, @@ -2127,13 +2140,6 @@ void qemu_console_resize(QemuConsole *s, int width, int height) dpy_gfx_replace_surface(s, surface); } -void qemu_console_copy(QemuConsole *con, int src_x, int src_y, - int dst_x, int dst_y, int w, int h) -{ - assert(con->console_type == GRAPHIC_CONSOLE); - dpy_gfx_copy(con, src_x, src_y, dst_x, dst_y, w, h); -} - DisplaySurface *qemu_console_surface(QemuConsole *console) { return console->surface;