fc5c27b
>From 60257c766e7a39134a9db9f4d1111f2b9fea2f86 Mon Sep 17 00:00:00 2001
13f703f
From: Gerd Hoffmann <kraxel@redhat.com>
13f703f
Date: Wed, 29 Jun 2011 10:07:52 +0200
fc5c27b
Subject: [PATCH 14/28] spice/qxl: move worker wrappers
13f703f
13f703f
Move the wrapper functions which are used by qxl only to qxl.c.
13f703f
Rename them from qemu_spice_* to qxl_spice_*.  Also pass in a
13f703f
qxl state pointer instead of a SimpleSpiceDisplay pointer.
13f703f
13f703f
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13f703f
---
13f703f
 hw/qxl-render.c    |    4 +-
13f703f
 hw/qxl.c           |   67 ++++++++++++++++++++++++++++++++++++++++++++-------
13f703f
 hw/qxl.h           |   13 ++++++++++
13f703f
 ui/spice-display.c |   46 -----------------------------------
13f703f
 ui/spice-display.h |   12 ---------
13f703f
 5 files changed, 72 insertions(+), 70 deletions(-)
13f703f
13f703f
diff --git a/hw/qxl-render.c b/hw/qxl-render.c
13f703f
index bef5f14..60b822d 100644
13f703f
--- a/hw/qxl-render.c
13f703f
+++ b/hw/qxl-render.c
13f703f
@@ -124,8 +124,8 @@ void qxl_render_update(PCIQXLDevice *qxl)
13f703f
     update.bottom = qxl->guest_primary.surface.height;
13f703f
 
13f703f
     memset(dirty, 0, sizeof(dirty));
13f703f
-    qemu_spice_update_area(&qxl->ssd, 0, &update,
13f703f
-                           dirty, ARRAY_SIZE(dirty), 1);
13f703f
+    qxl_spice_update_area(qxl, 0, &update,
13f703f
+                          dirty, ARRAY_SIZE(dirty), 1);
13f703f
 
13f703f
     for (i = 0; i < ARRAY_SIZE(dirty); i++) {
13f703f
         if (qemu_spice_rect_is_empty(dirty+i)) {
13f703f
diff --git a/hw/qxl.c b/hw/qxl.c
13f703f
index 2127fa3..803a364 100644
13f703f
--- a/hw/qxl.c
13f703f
+++ b/hw/qxl.c
13f703f
@@ -125,6 +125,53 @@ static void qxl_reset_memslots(PCIQXLDevice *d);
13f703f
 static void qxl_reset_surfaces(PCIQXLDevice *d);
13f703f
 static void qxl_ring_set_dirty(PCIQXLDevice *qxl);
13f703f
 
13f703f
+
13f703f
+void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id,
13f703f
+                           struct QXLRect *area, struct QXLRect *dirty_rects,
13f703f
+                           uint32_t num_dirty_rects,
13f703f
+                           uint32_t clear_dirty_region)
13f703f
+{
13f703f
+    qxl->ssd.worker->update_area(qxl->ssd.worker, surface_id, area, dirty_rects,
13f703f
+                             num_dirty_rects, clear_dirty_region);
13f703f
+}
13f703f
+
13f703f
+void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id)
13f703f
+{
13f703f
+    qxl->ssd.worker->destroy_surface_wait(qxl->ssd.worker, id);
13f703f
+}
13f703f
+
13f703f
+void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext,
13f703f
+                               uint32_t count)
13f703f
+{
13f703f
+    qxl->ssd.worker->loadvm_commands(qxl->ssd.worker, ext, count);
13f703f
+}
13f703f
+
13f703f
+void qxl_spice_oom(PCIQXLDevice *qxl)
13f703f
+{
13f703f
+    qxl->ssd.worker->oom(qxl->ssd.worker);
13f703f
+}
13f703f
+
13f703f
+void qxl_spice_reset_memslots(PCIQXLDevice *qxl)
13f703f
+{
13f703f
+    qxl->ssd.worker->reset_memslots(qxl->ssd.worker);
13f703f
+}
13f703f
+
13f703f
+void qxl_spice_destroy_surfaces(PCIQXLDevice *qxl)
13f703f
+{
13f703f
+    qxl->ssd.worker->destroy_surfaces(qxl->ssd.worker);
13f703f
+}
13f703f
+
13f703f
+void qxl_spice_reset_image_cache(PCIQXLDevice *qxl)
13f703f
+{
13f703f
+    qxl->ssd.worker->reset_image_cache(qxl->ssd.worker);
13f703f
+}
13f703f
+
13f703f
+void qxl_spice_reset_cursor(PCIQXLDevice *qxl)
13f703f
+{
13f703f
+    qxl->ssd.worker->reset_cursor(qxl->ssd.worker);
13f703f
+}
13f703f
+
13f703f
+
13f703f
 static inline uint32_t msb_mask(uint32_t val)
13f703f
 {
13f703f
     uint32_t mask;
13f703f
@@ -684,8 +731,8 @@ static void qxl_hard_reset(PCIQXLDevice *d, int loadvm)
13f703f
     dprint(d, 1, "%s: start%s\n", __FUNCTION__,
13f703f
            loadvm ? " (loadvm)" : "");
13f703f
 
13f703f
-    qemu_spice_reset_cursor(&d->ssd);
13f703f
-    qemu_spice_reset_image_cache(&d->ssd);
13f703f
+    qxl_spice_reset_cursor(d);
13f703f
+    qxl_spice_reset_image_cache(d);
13f703f
     qxl_reset_surfaces(d);
13f703f
     qxl_reset_memslots(d);
13f703f
 
13f703f
@@ -807,7 +854,7 @@ static void qxl_del_memslot(PCIQXLDevice *d, uint32_t slot_id)
13f703f
 static void qxl_reset_memslots(PCIQXLDevice *d)
13f703f
 {
13f703f
     dprint(d, 1, "%s:\n", __FUNCTION__);
13f703f
-    qemu_spice_reset_memslots(&d->ssd);
13f703f
+    qxl_spice_reset_memslots(d);
13f703f
     memset(&d->guest_slots, 0, sizeof(d->guest_slots));
13f703f
 }
13f703f
 
13f703f
@@ -815,7 +862,7 @@ static void qxl_reset_surfaces(PCIQXLDevice *d)
13f703f
 {
13f703f
     dprint(d, 1, "%s:\n", __FUNCTION__);
13f703f
     d->mode = QXL_MODE_UNDEFINED;
13f703f
-    qemu_spice_destroy_surfaces(&d->ssd);
13f703f
+    qxl_spice_destroy_surfaces(d);
13f703f
     memset(&d->guest_surfaces.cmds, 0, sizeof(d->guest_surfaces.cmds));
13f703f
 }
13f703f
 
13f703f
@@ -956,8 +1003,8 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val)
13f703f
     case QXL_IO_UPDATE_AREA:
13f703f
     {
13f703f
         QXLRect update = d->ram->update_area;
13f703f
-        qemu_spice_update_area(&d->ssd, d->ram->update_surface,
13f703f
-                               &update, NULL, 0, 0);
13f703f
+        qxl_spice_update_area(d, d->ram->update_surface,
13f703f
+                              &update, NULL, 0, 0);
13f703f
         break;
13f703f
     }
13f703f
     case QXL_IO_NOTIFY_CMD:
13f703f
@@ -978,7 +1025,7 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val)
13f703f
             break;
13f703f
         }
13f703f
         d->oom_running = 1;
13f703f
-        qemu_spice_oom(&d->ssd);
13f703f
+        qxl_spice_oom(d);
13f703f
         d->oom_running = 0;
13f703f
         break;
13f703f
     case QXL_IO_SET_MODE:
13f703f
@@ -1016,10 +1063,10 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val)
13f703f
         qxl_destroy_primary(d);
13f703f
         break;
13f703f
     case QXL_IO_DESTROY_SURFACE_WAIT:
13f703f
-        qemu_spice_destroy_surface_wait(&d->ssd, val);
13f703f
+        qxl_spice_destroy_surface_wait(d, val);
13f703f
         break;
13f703f
     case QXL_IO_DESTROY_ALL_SURFACES:
13f703f
-        qemu_spice_destroy_surfaces(&d->ssd);
13f703f
+        qxl_spice_destroy_surfaces(d);
13f703f
         break;
13f703f
     default:
13f703f
         fprintf(stderr, "%s: ioport=0x%x, abort()\n", __FUNCTION__, io_port);
13f703f
@@ -1419,7 +1466,7 @@ static int qxl_post_load(void *opaque, int version)
13f703f
         cmds[out].cmd.type = QXL_CMD_CURSOR;
13f703f
         cmds[out].group_id = MEMSLOT_GROUP_GUEST;
13f703f
         out++;
13f703f
-        qemu_spice_loadvm_commands(&d->ssd, cmds, out);
13f703f
+        qxl_spice_loadvm_commands(d, cmds, out);
13f703f
         qemu_free(cmds);
13f703f
 
13f703f
         break;
13f703f
diff --git a/hw/qxl.h b/hw/qxl.h
13f703f
index f6c450d..e62b9d0 100644
13f703f
--- a/hw/qxl.h
13f703f
+++ b/hw/qxl.h
13f703f
@@ -98,6 +98,19 @@ typedef struct PCIQXLDevice {
13f703f
 /* qxl.c */
13f703f
 void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id);
13f703f
 
13f703f
+void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id,
13f703f
+                           struct QXLRect *area, struct QXLRect *dirty_rects,
13f703f
+                           uint32_t num_dirty_rects,
13f703f
+                           uint32_t clear_dirty_region);
13f703f
+void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id);
13f703f
+void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext,
13f703f
+                               uint32_t count);
13f703f
+void qxl_spice_oom(PCIQXLDevice *qxl);
13f703f
+void qxl_spice_reset_memslots(PCIQXLDevice *qxl);
13f703f
+void qxl_spice_destroy_surfaces(PCIQXLDevice *qxl);
13f703f
+void qxl_spice_reset_image_cache(PCIQXLDevice *qxl);
13f703f
+void qxl_spice_reset_cursor(PCIQXLDevice *qxl);
13f703f
+
13f703f
 /* qxl-logger.c */
13f703f
 void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id);
13f703f
 void qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext);
13f703f
diff --git a/ui/spice-display.c b/ui/spice-display.c
13f703f
index 93e25bf..af10ae8 100644
13f703f
--- a/ui/spice-display.c
13f703f
+++ b/ui/spice-display.c
13f703f
@@ -63,15 +63,6 @@ void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r)
13f703f
 }
13f703f
 
13f703f
 
13f703f
-void qemu_spice_update_area(SimpleSpiceDisplay *ssd, uint32_t surface_id,
13f703f
-                            struct QXLRect *area, struct QXLRect *dirty_rects,
13f703f
-                            uint32_t num_dirty_rects,
13f703f
-                            uint32_t clear_dirty_region)
13f703f
-{
13f703f
-    ssd->worker->update_area(ssd->worker, surface_id, area, dirty_rects,
13f703f
-                             num_dirty_rects, clear_dirty_region);
13f703f
-}
13f703f
-
13f703f
 void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot)
13f703f
 {
13f703f
     ssd->worker->add_memslot(ssd->worker, memslot);
13f703f
@@ -93,27 +84,11 @@ void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id)
13f703f
     ssd->worker->destroy_primary_surface(ssd->worker, id);
13f703f
 }
13f703f
 
13f703f
-void qemu_spice_destroy_surface_wait(SimpleSpiceDisplay *ssd, uint32_t id)
13f703f
-{
13f703f
-    ssd->worker->destroy_surface_wait(ssd->worker, id);
13f703f
-}
13f703f
-
13f703f
-void qemu_spice_loadvm_commands(SimpleSpiceDisplay *ssd,
13f703f
-                                struct QXLCommandExt *ext, uint32_t count)
13f703f
-{
13f703f
-    ssd->worker->loadvm_commands(ssd->worker, ext, count);
13f703f
-}
13f703f
-
13f703f
 void qemu_spice_wakeup(SimpleSpiceDisplay *ssd)
13f703f
 {
13f703f
     ssd->worker->wakeup(ssd->worker);
13f703f
 }
13f703f
 
13f703f
-void qemu_spice_oom(SimpleSpiceDisplay *ssd)
13f703f
-{
13f703f
-    ssd->worker->oom(ssd->worker);
13f703f
-}
13f703f
-
13f703f
 void qemu_spice_start(SimpleSpiceDisplay *ssd)
13f703f
 {
13f703f
     ssd->worker->start(ssd->worker);
13f703f
@@ -124,27 +99,6 @@ void qemu_spice_stop(SimpleSpiceDisplay *ssd)
13f703f
     ssd->worker->stop(ssd->worker);
13f703f
 }
13f703f
 
13f703f
-void qemu_spice_reset_memslots(SimpleSpiceDisplay *ssd)
13f703f
-{
13f703f
-    ssd->worker->reset_memslots(ssd->worker);
13f703f
-}
13f703f
-
13f703f
-void qemu_spice_destroy_surfaces(SimpleSpiceDisplay *ssd)
13f703f
-{
13f703f
-    ssd->worker->destroy_surfaces(ssd->worker);
13f703f
-}
13f703f
-
13f703f
-void qemu_spice_reset_image_cache(SimpleSpiceDisplay *ssd)
13f703f
-{
13f703f
-    ssd->worker->reset_image_cache(ssd->worker);
13f703f
-}
13f703f
-
13f703f
-void qemu_spice_reset_cursor(SimpleSpiceDisplay *ssd)
13f703f
-{
13f703f
-    ssd->worker->reset_cursor(ssd->worker);
13f703f
-}
13f703f
-
13f703f
-
13f703f
 static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
13f703f
 {
13f703f
     SimpleSpiceUpdate *update;
13f703f
diff --git a/ui/spice-display.h b/ui/spice-display.h
13f703f
index eb7a573..abe99c7 100644
13f703f
--- a/ui/spice-display.h
13f703f
+++ b/ui/spice-display.h
13f703f
@@ -82,24 +82,12 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
13f703f
 void qemu_spice_display_resize(SimpleSpiceDisplay *ssd);
13f703f
 void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd);
13f703f
 
13f703f
-void qemu_spice_update_area(SimpleSpiceDisplay *ssd, uint32_t surface_id,
13f703f
-                            struct QXLRect *area, struct QXLRect *dirty_rects,
13f703f
-                            uint32_t num_dirty_rects,
13f703f
-                            uint32_t clear_dirty_region);
13f703f
 void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot);
13f703f
 void qemu_spice_del_memslot(SimpleSpiceDisplay *ssd, uint32_t gid,
13f703f
                             uint32_t sid);
13f703f
 void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id,
13f703f
                                        QXLDevSurfaceCreate *surface);
13f703f
 void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id);
13f703f
-void qemu_spice_destroy_surface_wait(SimpleSpiceDisplay *ssd, uint32_t id);
13f703f
-void qemu_spice_loadvm_commands(SimpleSpiceDisplay *ssd,
13f703f
-                                struct QXLCommandExt *ext, uint32_t count);
13f703f
 void qemu_spice_wakeup(SimpleSpiceDisplay *ssd);
13f703f
-void qemu_spice_oom(SimpleSpiceDisplay *ssd);
13f703f
 void qemu_spice_start(SimpleSpiceDisplay *ssd);
13f703f
 void qemu_spice_stop(SimpleSpiceDisplay *ssd);
13f703f
-void qemu_spice_reset_memslots(SimpleSpiceDisplay *ssd);
13f703f
-void qemu_spice_destroy_surfaces(SimpleSpiceDisplay *ssd);
13f703f
-void qemu_spice_reset_image_cache(SimpleSpiceDisplay *ssd);
13f703f
-void qemu_spice_reset_cursor(SimpleSpiceDisplay *ssd);
13f703f
-- 
13f703f
1.7.5.1
13f703f