[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 21/24] console: graphic_hw_update return true if asy
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH 21/24] console: graphic_hw_update return true if async |
Date: |
Mon, 10 Oct 2016 13:22:58 +0400 |
qxl_render_update() returns true if the update is deferred.
Let the caller know if the update is immediate or async.
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/display/qxl-render.c | 5 +++--
hw/display/qxl.c | 8 ++++----
ui/console.c | 14 ++++++++++++--
hw/display/qxl.h | 2 +-
include/ui/console.h | 3 ++-
5 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
index 9ad9d9e..50a0191 100644
--- a/hw/display/qxl-render.c
+++ b/hw/display/qxl-render.c
@@ -163,7 +163,7 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice
*qxl)
* callbacks are called by spice_server thread, deferring to bh called from the
* io thread.
*/
-void qxl_render_update(PCIQXLDevice *qxl)
+bool qxl_render_update(PCIQXLDevice *qxl)
{
QXLCookie *cookie;
@@ -172,7 +172,7 @@ void qxl_render_update(PCIQXLDevice *qxl)
if (!runstate_is_running() || !qxl->guest_primary.commands) {
qxl_render_update_area_unlocked(qxl);
qemu_mutex_unlock(&qxl->ssd.lock);
- return;
+ return false;
}
qxl->guest_primary.commands = 0;
@@ -183,6 +183,7 @@ void qxl_render_update(PCIQXLDevice *qxl)
qxl_set_rect_to_surface(qxl, &cookie->u.render.area);
qxl_spice_update_area(qxl, 0, &cookie->u.render.area, NULL,
0, 1 /* clear_dirty_region */, QXL_ASYNC, cookie);
+ return true;
}
void qxl_render_update_area_bh(void *opaque)
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 0e2682d..7dc08ca 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -134,7 +134,7 @@ static void qxl_reset_memslots(PCIQXLDevice *d);
static void qxl_reset_surfaces(PCIQXLDevice *d);
static void qxl_ring_set_dirty(PCIQXLDevice *qxl);
-static void qxl_hw_update(void *opaque);
+static bool qxl_hw_update_async(void *opaque);
void qxl_set_guest_bug(PCIQXLDevice *qxl, const char *msg, ...)
{
@@ -1091,7 +1091,7 @@ static const QXLInterface qxl_interface = {
};
static const GraphicHwOps qxl_ops = {
- .gfx_update = qxl_hw_update,
+ .gfx_update_async = qxl_hw_update_async,
};
static void qxl_enter_vga_mode(PCIQXLDevice *d)
@@ -1806,11 +1806,11 @@ static void qxl_send_events(PCIQXLDevice *d, uint32_t
events)
/* graphics console */
-static void qxl_hw_update(void *opaque)
+static bool qxl_hw_update_async(void *opaque)
{
PCIQXLDevice *qxl = opaque;
- qxl_render_update(qxl);
+ return qxl_render_update(qxl);
}
static void qxl_dirty_one_surface(PCIQXLDevice *qxl, QXLPHYSICAL pqxl,
diff --git a/ui/console.c b/ui/console.c
index fa3e658..392d7c7 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -253,14 +253,24 @@ static void gui_setup_refresh(DisplayState *ds)
ds->have_text = have_text;
}
-void graphic_hw_update(QemuConsole *con)
+bool graphic_hw_update(QemuConsole *con)
{
if (!con) {
con = active_console;
}
- if (con && con->hw_ops->gfx_update) {
+
+ if (!con) {
+ return false;
+ }
+
+ if (con->hw_ops->gfx_update_async) {
+ return con->hw_ops->gfx_update_async(con->hw);
+ } else if (con->hw_ops->gfx_update) {
con->hw_ops->gfx_update(con->hw);
+ return false;
}
+
+ return false;
}
void graphic_hw_gl_block(QemuConsole *con, bool block)
diff --git a/hw/display/qxl.h b/hw/display/qxl.h
index d2d49dd..7ac31fc 100644
--- a/hw/display/qxl.h
+++ b/hw/display/qxl.h
@@ -167,7 +167,7 @@ int qxl_log_command(PCIQXLDevice *qxl, const char *ring,
QXLCommandExt *ext);
/* qxl-render.c */
void qxl_render_resize(PCIQXLDevice *qxl);
-void qxl_render_update(PCIQXLDevice *qxl);
+bool qxl_render_update(PCIQXLDevice *qxl);
int qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext);
void qxl_render_update_area_done(PCIQXLDevice *qxl, QXLCookie *cookie);
void qxl_render_update_area_bh(void *opaque);
diff --git a/include/ui/console.h b/include/ui/console.h
index e2589e2..772b9db 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -362,6 +362,7 @@ static inline void console_write_ch(console_ch_t *dest,
uint32_t ch)
typedef struct GraphicHwOps {
void (*invalidate)(void *opaque);
void (*gfx_update)(void *opaque);
+ bool (*gfx_update_async)(void *opaque);
void (*text_update)(void *opaque, console_ch_t *text);
void (*update_interval)(void *opaque, uint64_t interval);
int (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info);
@@ -375,7 +376,7 @@ void graphic_console_set_hwops(QemuConsole *con,
const GraphicHwOps *hw_ops,
void *opaque);
-void graphic_hw_update(QemuConsole *con);
+bool graphic_hw_update(QemuConsole *con);
void graphic_hw_invalidate(QemuConsole *con);
void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata);
void graphic_hw_gl_block(QemuConsole *con, bool block);
--
2.10.0
- [Qemu-devel] [PATCH 11/24] scripts: learn 'async' qapi commands, (continued)
- [Qemu-devel] [PATCH 11/24] scripts: learn 'async' qapi commands, Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 12/24] tests: add dispatch async tests, Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 13/24] monitor: add 'async' capability, Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 14/24] monitor: add !qmp pre-conditions, Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 15/24] monitor: suspend when running async and client has no async, Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 16/24] qmp: update qmp-spec about async capability, Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 17/24] qtest: add qtest-timeout, Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 19/24] tests: add tests for async and non-async clients, Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 18/24] qtest: add qtest_init_qmp_caps(), Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 20/24] qapi: improve 'screendump' documentation, Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 21/24] console: graphic_hw_update return true if async,
Marc-André Lureau <=
- [Qemu-devel] [PATCH 22/24] console: add graphic_hw_update_done(), Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 23/24] console: make screendump async, Marc-André Lureau, 2016/10/10
- [Qemu-devel] [PATCH 24/24] qmp: move json-message-parser to QmpClient, Marc-André Lureau, 2016/10/10