From: Gerd Hoffmann <kra...@redhat.com> We'll have to move qemu_spice_destroy_primary_surface() out of qxl_destroy_primary(). That makes the function pretty pointless, so zap it and open code the two lines instead.
Signed-off-by: Gerd Hoffmann <kra...@redhat.com> --- hw/qxl.c | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 22714bb..018ed54 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -135,7 +135,6 @@ static QXLMode qxl_modes[] = { static PCIQXLDevice *qxl0; static void qxl_send_events(PCIQXLDevice *d, uint32_t events); -static void qxl_destroy_primary(PCIQXLDevice *d); static void qxl_reset_memslots(PCIQXLDevice *d); static void qxl_reset_surfaces(PCIQXLDevice *d); static void qxl_ring_set_dirty(PCIQXLDevice *qxl); @@ -632,7 +631,10 @@ static void qxl_exit_vga_mode(PCIQXLDevice *d) return; } dprint(d, 1, "%s\n", __FUNCTION__); - qxl_destroy_primary(d); + if (d->mode != QXL_MODE_UNDEFINED) { + d->mode = QXL_MODE_UNDEFINED; + qemu_spice_destroy_primary_surface(&d->ssd, 0); + } } static void qxl_set_irq(PCIQXLDevice *d) @@ -729,7 +731,10 @@ static void qxl_vga_ioport_write(void *opaque, uint32_t addr, uint32_t val) if (qxl->mode != QXL_MODE_VGA) { dprint(qxl, 1, "%s\n", __FUNCTION__); - qxl_destroy_primary(qxl); + if (qxl->mode != QXL_MODE_UNDEFINED) { + qxl->mode = QXL_MODE_UNDEFINED; + qemu_spice_destroy_primary_surface(&qxl->ssd, 0); + } qxl_soft_reset(qxl); } vga_ioport_write(opaque, addr, val); @@ -888,18 +893,6 @@ static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm, qxl_render_resize(qxl); } -static void qxl_destroy_primary(PCIQXLDevice *d) -{ - if (d->mode == QXL_MODE_UNDEFINED) { - return; - } - - dprint(d, 1, "%s\n", __FUNCTION__); - - d->mode = QXL_MODE_UNDEFINED; - qemu_spice_destroy_primary_surface(&d->ssd, 0); -} - static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm) { pcibus_t start = d->pci.io_regions[QXL_RAM_RANGE_INDEX].addr; @@ -1040,7 +1033,10 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) case QXL_IO_DESTROY_PRIMARY: PANIC_ON(val != 0); dprint(d, 1, "QXL_IO_DESTROY_PRIMARY (%s)\n", qxl_mode_to_string(d->mode)); - qxl_destroy_primary(d); + if (d->mode != QXL_MODE_UNDEFINED) { + d->mode = QXL_MODE_UNDEFINED; + qemu_spice_destroy_primary_surface(&d->ssd, 0); + } break; case QXL_IO_DESTROY_SURFACE_WAIT: qemu_spice_destroy_surface_wait(&d->ssd, val); -- 1.7.5.4