#include "hw/qdev-core.h"
#include "qemu/timer.h"
#include "qmp-commands.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "trace.h"
#include "exec/memory.h"
} else {
if (s->nb_esc_params < MAX_ESC_PARAMS)
s->nb_esc_params++;
- if (ch == ';')
+ if (ch == ';' || ch == '?') {
break;
+ }
trace_console_putchar_csi(s->esc_params[0], s->esc_params[1],
ch, s->nb_esc_params);
s->state = TTY_STATE_NORM;
return con->gl != NULL;
}
+bool console_has_gl_dmabuf(QemuConsole *con)
+{
+ return con->gl != NULL && con->gl->ops->dpy_gl_scanout_dmabuf != NULL;
+}
+
void register_displaychangelistener(DisplayChangeListener *dcl)
{
static const char nodev[] =
static DisplaySurface *dummy;
QemuConsole *con;
+ assert(!dcl->ds);
+
if (dcl->ops->dpy_gl_ctx_create) {
/* display has opengl support */
assert(dcl->con);
dcl->con->dcls--;
}
QLIST_REMOVE(dcl, next);
+ dcl->ds = NULL;
gui_setup_refresh(ds);
}
DisplaySurface *old_surface = con->surface;
DisplayChangeListener *dcl;
+ assert(old_surface != surface || surface == NULL);
+
con->surface = surface;
QLIST_FOREACH(dcl, &s->listeners, next) {
if (con != (dcl->con ? dcl->con : active_console)) {
return true;
}
-/*
- * 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)
-{
- 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();
-}
-
static void dpy_refresh(DisplayState *s)
{
DisplayChangeListener *dcl;
QLIST_FOREACH(dcl, &s->listeners, next) {
if (dcl->ops->dpy_refresh) {
- if (tcg_enabled()) {
- do_safe_dpy_refresh(dcl);
- } else {
- dcl->ops->dpy_refresh(dcl);
- }
+ dcl->ops->dpy_refresh(dcl);
}
}
}
x, y, width, height);
}
+void dpy_gl_scanout_dmabuf(QemuConsole *con,
+ QemuDmaBuf *dmabuf)
+{
+ assert(con->gl);
+ con->gl->ops->dpy_gl_scanout_dmabuf(con->gl, dmabuf);
+}
+
+void dpy_gl_cursor_dmabuf(QemuConsole *con,
+ QemuDmaBuf *dmabuf,
+ uint32_t pos_x, uint32_t pos_y)
+{
+ assert(con->gl);
+
+ if (con->gl->ops->dpy_gl_cursor_dmabuf) {
+ con->gl->ops->dpy_gl_cursor_dmabuf(con->gl, dmabuf, pos_x, pos_y);
+ }
+}
+
+void dpy_gl_release_dmabuf(QemuConsole *con,
+ QemuDmaBuf *dmabuf)
+{
+ assert(con->gl);
+
+ if (con->gl->ops->dpy_gl_release_dmabuf) {
+ con->gl->ops->dpy_gl_release_dmabuf(con->gl, dmabuf);
+ }
+}
+
void dpy_gl_update(QemuConsole *con,
uint32_t x, uint32_t y, uint32_t w, uint32_t h)
{
if (DEVICE(obj) != dev) {
continue;
}
- h = object_property_get_int(OBJECT(consoles[i]),
- "head", &error_abort);
+ h = object_property_get_uint(OBJECT(consoles[i]),
+ "head", &error_abort);
if (h != head) {
continue;
}
s->t_attrib = s->t_attrib_default;
}
- qemu_chr_be_generic_open(chr);
+ qemu_chr_be_event(chr, CHR_EVENT_OPENED);
}
static void vc_chr_open(Chardev *chr,