Add two new IOs. QXL_IO_FLUSH_SURFACES - equivalent to update area for all surfaces, used to reduce vmexits from NumSurfaces to 1 on guest S3, S4 and resolution change (windows driver implementation is such that this is done on each of those occasions). QXL_IO_FLUSH_RELEASE - used to ensure anything on last_release is put on the release ring for the client to free.
Cc: Yonit Halperin <yhalp...@redhat.com> --- hw/qxl.c | 27 +++++++++++++++++++++++++++ hw/qxl.h | 1 + 2 files changed, 28 insertions(+), 0 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 438c6ee..8c7b03b 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -196,6 +196,13 @@ void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id) qxl_spice_destroy_surface_wait_async(qxl, id, 0); } +void qxl_spice_flush_surfaces_async(PCIQXLDevice *qxl) +{ + qemu_mutex_lock(&qxl->ssd.wlock); + qxl->ssd.worker->flush_surfaces_async(qxl->ssd.worker); + qemu_mutex_unlock(&qxl->ssd.wlock); +} + void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext, uint32_t count) { @@ -1176,6 +1183,7 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) case QXL_IO_DESTROY_PRIMARY_ASYNC: case QXL_IO_DESTROY_SURFACE_ASYNC: case QXL_IO_DESTROY_ALL_SURFACES_ASYNC: + case QXL_IO_FLUSH_SURFACES_ASYNC: async = 1; if (d->current_async != QXL_UNDEFINED_IO) { qxl_guest_bug(d, "%d async started before last (%d) complete\n", @@ -1292,6 +1300,25 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) case QXL_IO_DESTROY_SURFACE_WAIT: qxl_spice_destroy_surface_wait_async(d, val, async); break; + case QXL_IO_FLUSH_RELEASE: { + QXLReleaseRing *ring = &d->ram->release_ring; + if (ring->prod - ring->cons + 1 == ring->num_items) { + fprintf(stderr, + "ERROR: no flush, full release ring [p%d,%dc]\n", + ring->prod, ring->cons); + } + qxl_push_free_res(d, 1 /* flush */); + dprint(d, 1, "QXL_IO_FLUSH_RELEASE exit (%s, s#=%d, res#=%d,%p)\n", + qxl_mode_to_string(d->mode), d->guest_surfaces.count, + d->num_free_res, d->last_release); + break; + } + case QXL_IO_FLUSH_SURFACES_ASYNC: + dprint(d, 1, "QXL_IO_FLUSH_SURFACES_ASYNC (%d) (%s, s#=%d, res#=%d)\n", + val, qxl_mode_to_string(d->mode), d->guest_surfaces.count, + d->num_free_res); + qxl_spice_flush_surfaces_async(d); + break; case QXL_IO_DESTROY_ALL_SURFACES_ASYNC: case QXL_IO_DESTROY_ALL_SURFACES: d->mode = QXL_MODE_UNDEFINED; diff --git a/hw/qxl.h b/hw/qxl.h index e4134b9..d0cf77d 100644 --- a/hw/qxl.h +++ b/hw/qxl.h @@ -123,6 +123,7 @@ void qxl_spice_destroy_surfaces(PCIQXLDevice *qxl); void qxl_spice_destroy_surfaces_async(PCIQXLDevice *qxl, int async); void qxl_spice_reset_image_cache(PCIQXLDevice *qxl); void qxl_spice_reset_cursor(PCIQXLDevice *qxl); +void qxl_spice_flush_surfaces_async(PCIQXLDevice *qxl); /* qxl-logger.c */ void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id); -- 1.7.5.4