Blame 0014-spice-qxl-move-worker-wrappers.patch

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