summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2011-06-17 12:51:31 +0200
committerAlon Levy <alevy@redhat.com>2011-07-13 17:36:12 +0300
commite35e035af4ac48752f276b728ab3f8d9dc7411b1 (patch)
tree29a4e67a9a5d9341b4382e07c5587a122fad6b52
parent3fbba883e57a37e255c6c8bcfd0f20cd37a49a9f (diff)
qxl: remove qxl_destroy_primary()
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 <kraxel@redhat.com>
-rw-r--r--hw/qxl-render.c4
-rw-r--r--hw/qxl.c95
-rw-r--r--hw/qxl.h13
-rw-r--r--ui/spice-display.c47
-rw-r--r--ui/spice-display.h12
5 files changed, 84 insertions, 87 deletions
diff --git a/hw/qxl-render.c b/hw/qxl-render.c
index bef5f148e..60b822d8c 100644
--- a/hw/qxl-render.c
+++ b/hw/qxl-render.c
@@ -124,8 +124,8 @@ void qxl_render_update(PCIQXLDevice *qxl)
update.bottom = qxl->guest_primary.surface.height;
memset(dirty, 0, sizeof(dirty));
- qemu_spice_update_area(&qxl->ssd, 0, &update,
- dirty, ARRAY_SIZE(dirty), 1);
+ qxl_spice_update_area(qxl, 0, &update,
+ dirty, ARRAY_SIZE(dirty), 1);
for (i = 0; i < ARRAY_SIZE(dirty); i++) {
if (qemu_spice_rect_is_empty(dirty+i)) {
diff --git a/hw/qxl.c b/hw/qxl.c
index 2d4681444..204a479fe 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -120,11 +120,57 @@ 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);
+
+void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id,
+ struct QXLRect *area, struct QXLRect *dirty_rects,
+ uint32_t num_dirty_rects,
+ uint32_t clear_dirty_region)
+{
+ qxl->ssd.worker->update_area(qxl->ssd.worker, surface_id, area, dirty_rects,
+ num_dirty_rects, clear_dirty_region);
+}
+
+void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id)
+{
+ qxl->ssd.worker->destroy_surface_wait(qxl->ssd.worker, id);
+}
+
+void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext,
+ uint32_t count)
+{
+ qxl->ssd.worker->loadvm_commands(qxl->ssd.worker, ext, count);
+}
+
+void qxl_spice_oom(PCIQXLDevice *qxl)
+{
+ qxl->ssd.worker->oom(qxl->ssd.worker);
+}
+
+void qxl_spice_reset_memslots(PCIQXLDevice *qxl)
+{
+ qxl->ssd.worker->reset_memslots(qxl->ssd.worker);
+}
+
+void qxl_spice_destroy_surfaces(PCIQXLDevice *qxl)
+{
+ qxl->ssd.worker->destroy_surfaces(qxl->ssd.worker);
+}
+
+void qxl_spice_reset_image_cache(PCIQXLDevice *qxl)
+{
+ qxl->ssd.worker->reset_image_cache(qxl->ssd.worker);
+}
+
+void qxl_spice_reset_cursor(PCIQXLDevice *qxl)
+{
+ qxl->ssd.worker->reset_cursor(qxl->ssd.worker);
+}
+
+
static inline uint32_t msb_mask(uint32_t val)
{
uint32_t mask;
@@ -617,7 +663,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)
@@ -690,8 +739,8 @@ static void qxl_hard_reset(PCIQXLDevice *d, int loadvm)
dprint(d, 1, "%s: start%s\n", __FUNCTION__,
loadvm ? " (loadvm)" : "");
- qemu_spice_reset_cursor(&d->ssd);
- qemu_spice_reset_image_cache(&d->ssd);
+ qxl_spice_reset_cursor(d);
+ qxl_spice_reset_image_cache(d);
qxl_reset_surfaces(d);
qxl_reset_memslots(d);
@@ -720,7 +769,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);
@@ -813,7 +865,7 @@ static void qxl_del_memslot(PCIQXLDevice *d, uint32_t slot_id)
static void qxl_reset_memslots(PCIQXLDevice *d)
{
dprint(d, 1, "%s:\n", __FUNCTION__);
- qemu_spice_reset_memslots(&d->ssd);
+ qxl_spice_reset_memslots(d);
memset(&d->guest_slots, 0, sizeof(d->guest_slots));
}
@@ -821,7 +873,7 @@ static void qxl_reset_surfaces(PCIQXLDevice *d)
{
dprint(d, 1, "%s:\n", __FUNCTION__);
d->mode = QXL_MODE_UNDEFINED;
- qemu_spice_destroy_surfaces(&d->ssd);
+ qxl_spice_destroy_surfaces(d);
memset(&d->guest_surfaces.cmds, 0, sizeof(d->guest_surfaces.cmds));
}
@@ -881,18 +933,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;
@@ -962,8 +1002,8 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val)
case QXL_IO_UPDATE_AREA:
{
QXLRect update = d->ram->update_area;
- qemu_spice_update_area(&d->ssd, d->ram->update_surface,
- &update, NULL, 0, 0);
+ qxl_spice_update_area(d, d->ram->update_surface,
+ &update, NULL, 0, 0);
break;
}
case QXL_IO_NOTIFY_CMD:
@@ -984,7 +1024,7 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val)
break;
}
d->oom_running = 1;
- qemu_spice_oom(&d->ssd);
+ qxl_spice_oom(d);
d->oom_running = 0;
break;
case QXL_IO_SET_MODE:
@@ -1019,13 +1059,16 @@ 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);
+ qxl_spice_destroy_surface_wait(d, val);
break;
case QXL_IO_DESTROY_ALL_SURFACES:
- qemu_spice_destroy_surfaces(&d->ssd);
+ qxl_spice_destroy_surfaces(d);
break;
default:
fprintf(stderr, "%s: ioport=0x%x, abort()\n", __FUNCTION__, io_port);
@@ -1425,7 +1468,7 @@ static int qxl_post_load(void *opaque, int version)
cmds[out].cmd.type = QXL_CMD_CURSOR;
cmds[out].group_id = MEMSLOT_GROUP_GUEST;
out++;
- qemu_spice_loadvm_commands(&d->ssd, cmds, out);
+ qxl_spice_loadvm_commands(d, cmds, out);
qemu_free(cmds);
break;
diff --git a/hw/qxl.h b/hw/qxl.h
index f6c450d32..e62b9d00b 100644
--- a/hw/qxl.h
+++ b/hw/qxl.h
@@ -98,6 +98,19 @@ typedef struct PCIQXLDevice {
/* qxl.c */
void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id);
+void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id,
+ struct QXLRect *area, struct QXLRect *dirty_rects,
+ uint32_t num_dirty_rects,
+ uint32_t clear_dirty_region);
+void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id);
+void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext,
+ uint32_t count);
+void qxl_spice_oom(PCIQXLDevice *qxl);
+void qxl_spice_reset_memslots(PCIQXLDevice *qxl);
+void qxl_spice_destroy_surfaces(PCIQXLDevice *qxl);
+void qxl_spice_reset_image_cache(PCIQXLDevice *qxl);
+void qxl_spice_reset_cursor(PCIQXLDevice *qxl);
+
/* qxl-logger.c */
void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id);
void qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext);
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 93e25bf1e..feb333c90 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -62,16 +62,6 @@ void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r)
dest->right = MAX(dest->right, r->right);
}
-
-void qemu_spice_update_area(SimpleSpiceDisplay *ssd, uint32_t surface_id,
- struct QXLRect *area, struct QXLRect *dirty_rects,
- uint32_t num_dirty_rects,
- uint32_t clear_dirty_region)
-{
- ssd->worker->update_area(ssd->worker, surface_id, area, dirty_rects,
- num_dirty_rects, clear_dirty_region);
-}
-
void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot)
{
ssd->worker->add_memslot(ssd->worker, memslot);
@@ -93,27 +83,11 @@ void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id)
ssd->worker->destroy_primary_surface(ssd->worker, id);
}
-void qemu_spice_destroy_surface_wait(SimpleSpiceDisplay *ssd, uint32_t id)
-{
- ssd->worker->destroy_surface_wait(ssd->worker, id);
-}
-
-void qemu_spice_loadvm_commands(SimpleSpiceDisplay *ssd,
- struct QXLCommandExt *ext, uint32_t count)
-{
- ssd->worker->loadvm_commands(ssd->worker, ext, count);
-}
-
void qemu_spice_wakeup(SimpleSpiceDisplay *ssd)
{
ssd->worker->wakeup(ssd->worker);
}
-void qemu_spice_oom(SimpleSpiceDisplay *ssd)
-{
- ssd->worker->oom(ssd->worker);
-}
-
void qemu_spice_start(SimpleSpiceDisplay *ssd)
{
ssd->worker->start(ssd->worker);
@@ -124,27 +98,6 @@ void qemu_spice_stop(SimpleSpiceDisplay *ssd)
ssd->worker->stop(ssd->worker);
}
-void qemu_spice_reset_memslots(SimpleSpiceDisplay *ssd)
-{
- ssd->worker->reset_memslots(ssd->worker);
-}
-
-void qemu_spice_destroy_surfaces(SimpleSpiceDisplay *ssd)
-{
- ssd->worker->destroy_surfaces(ssd->worker);
-}
-
-void qemu_spice_reset_image_cache(SimpleSpiceDisplay *ssd)
-{
- ssd->worker->reset_image_cache(ssd->worker);
-}
-
-void qemu_spice_reset_cursor(SimpleSpiceDisplay *ssd)
-{
- ssd->worker->reset_cursor(ssd->worker);
-}
-
-
static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
{
SimpleSpiceUpdate *update;
diff --git a/ui/spice-display.h b/ui/spice-display.h
index eb7a57385..abe99c7d3 100644
--- a/ui/spice-display.h
+++ b/ui/spice-display.h
@@ -82,24 +82,12 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
void qemu_spice_display_resize(SimpleSpiceDisplay *ssd);
void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd);
-void qemu_spice_update_area(SimpleSpiceDisplay *ssd, uint32_t surface_id,
- struct QXLRect *area, struct QXLRect *dirty_rects,
- uint32_t num_dirty_rects,
- uint32_t clear_dirty_region);
void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot);
void qemu_spice_del_memslot(SimpleSpiceDisplay *ssd, uint32_t gid,
uint32_t sid);
void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id,
QXLDevSurfaceCreate *surface);
void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id);
-void qemu_spice_destroy_surface_wait(SimpleSpiceDisplay *ssd, uint32_t id);
-void qemu_spice_loadvm_commands(SimpleSpiceDisplay *ssd,
- struct QXLCommandExt *ext, uint32_t count);
void qemu_spice_wakeup(SimpleSpiceDisplay *ssd);
-void qemu_spice_oom(SimpleSpiceDisplay *ssd);
void qemu_spice_start(SimpleSpiceDisplay *ssd);
void qemu_spice_stop(SimpleSpiceDisplay *ssd);
-void qemu_spice_reset_memslots(SimpleSpiceDisplay *ssd);
-void qemu_spice_destroy_surfaces(SimpleSpiceDisplay *ssd);
-void qemu_spice_reset_image_cache(SimpleSpiceDisplay *ssd);
-void qemu_spice_reset_cursor(SimpleSpiceDisplay *ssd);