[Spice-devel] [RfC PATCH 6/7] remove qxl_destroy_primary
Gerd Hoffmann
kraxel at redhat.com
Wed Jun 22 01:46:05 PDT 2011
---
hw/qxl.c | 28 ++++++++++++----------------
1 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/hw/qxl.c b/hw/qxl.c
index 247c260..03c871a 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -120,7 +120,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);
@@ -601,7 +600,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)
@@ -698,7 +700,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);
@@ -857,18 +862,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;
@@ -1006,7 +999,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\n");
- 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.1
More information about the Spice-devel
mailing list