[spice-server 08/10] red-parse-qxl: Use QXLReleaseInfoExt instead of QXLReleaseInfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This should allow to avoid moving the group_id separately from the QXL
commands all over the code.
---
 server/cursor-channel.c  |  5 +----
 server/display-channel.c | 11 ++---------
 server/red-parse-qxl.c   | 15 ++++++++++-----
 server/red-parse-qxl.h   |  8 ++++----
 server/red-worker.c      | 10 ++--------
 5 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 197376a..d9b6faa 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -109,7 +109,6 @@ static CursorItem *cursor_item_ref(CursorItem *item)
 
 static void cursor_item_unref(CursorItem *item)
 {
-    QXLReleaseInfoExt release_info_ext;
     RedCursorCmd *cursor_cmd;
 
     spice_return_if_fail(item != NULL);
@@ -118,9 +117,7 @@ static void cursor_item_unref(CursorItem *item)
         return;
 
     cursor_cmd = item->red_cursor;
-    release_info_ext.group_id = item->group_id;
-    release_info_ext.info = cursor_cmd->release_info;
-    item->qxl->st->qif->release_resource(item->qxl, release_info_ext);
+    item->qxl->st->qif->release_resource(item->qxl, cursor_cmd->release_info_ext);
     red_put_cursor_cmd(cursor_cmd);
     free(cursor_cmd);
 
diff --git a/server/display-channel.c b/server/display-channel.c
index bae0dcc..b4b46a6 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -2073,13 +2073,6 @@ DisplayChannel* display_channel_new(RedWorker *worker, int migrate, int stream_v
     return display;
 }
 
-static inline void set_surface_release_info(QXLReleaseInfoExt *release_info_ext,
-                                            QXLReleaseInfo *release_info, uint32_t group_id)
-{
-    release_info_ext->info = release_info;
-    release_info_ext->group_id = group_id;
-}
-
 void display_channel_process_surface_cmd(DisplayChannel *display, RedSurfaceCmd *surface,
                                          uint32_t group_id, int loadvm)
 {
@@ -2113,7 +2106,7 @@ void display_channel_process_surface_cmd(DisplayChannel *display, RedSurfaceCmd
                                        reloaded_surface,
                                        // reloaded surfaces will be sent on demand
                                        !reloaded_surface);
-        set_surface_release_info(&red_surface->create, surface->release_info, group_id);
+        red_surface->create = surface->release_info_ext;
         break;
     }
     case QXL_SURFACE_CMD_DESTROY:
@@ -2121,7 +2114,7 @@ void display_channel_process_surface_cmd(DisplayChannel *display, RedSurfaceCmd
             spice_warning("avoiding destroying a surface twice");
             break;
         }
-        set_surface_release_info(&red_surface->destroy, surface->release_info, group_id);
+        red_surface->destroy = surface->release_info_ext;
         display_channel_destroy_surface(display, surface_id);
         break;
     default:
diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c
index 0270ae5..4d2cc72 100644
--- a/server/red-parse-qxl.c
+++ b/server/red-parse-qxl.c
@@ -1260,7 +1260,9 @@ int red_get_update_cmd(RedMemSlotInfo *slots, int group_id,
     if (error) {
         return 1;
     }
-    red->release_info     = &qxl->release_info;
+    red->release_info_ext.info     = &qxl->release_info;
+    red->release_info_ext.group_id = group_id;
+
 
     red_get_rect_ptr(&red->area, &qxl->area);
     red->update_id  = qxl->update_id;
@@ -1289,8 +1291,9 @@ int red_get_message(RedMemSlotInfo *slots, int group_id,
     if (error) {
         return 1;
     }
-    red->release_info  = &qxl->release_info;
-    red->data          = qxl->data;
+    red->release_info_ext.info      = &qxl->release_info;
+    red->release_info_ext.group_id  = group_id;
+    red->data                       = qxl->data;
     return 0;
 }
 
@@ -1329,7 +1332,8 @@ int red_get_surface_cmd(RedMemSlotInfo *slots, int group_id,
     if (error) {
         return 1;
     }
-    red->release_info     = &qxl->release_info;
+    red->release_info_ext.info      = &qxl->release_info;
+    red->release_info_ext.group_id  = group_id;
 
     red->surface_id = qxl->surface_id;
     red->type       = qxl->type;
@@ -1433,7 +1437,8 @@ int red_get_cursor_cmd(RedMemSlotInfo *slots, int group_id,
     if (error) {
         return error;
     }
-    red->release_info     = &qxl->release_info;
+    red->release_info_ext.info      = &qxl->release_info;
+    red->release_info_ext.group_id  = group_id;
 
     red->type = qxl->type;
     switch (red->type) {
diff --git a/server/red-parse-qxl.h b/server/red-parse-qxl.h
index 6bb0d4e..b5f95e6 100644
--- a/server/red-parse-qxl.h
+++ b/server/red-parse-qxl.h
@@ -65,14 +65,14 @@ static inline RedDrawable *red_drawable_ref(RedDrawable *drawable)
 }
 
 typedef struct RedUpdateCmd {
-    QXLReleaseInfo *release_info;
+    QXLReleaseInfoExt release_info_ext;
     SpiceRect area;
     uint32_t update_id;
     uint32_t surface_id;
 } RedUpdateCmd;
 
 typedef struct RedMessage {
-    QXLReleaseInfo *release_info;
+    QXLReleaseInfoExt release_info_ext;
     uint8_t *data;
 } RedMessage;
 
@@ -93,7 +93,7 @@ typedef struct RedSurfaceCreate {
 } RedSurfaceCreate;
 
 typedef struct RedSurfaceCmd {
-    QXLReleaseInfo *release_info;
+    QXLReleaseInfoExt release_info_ext;
     uint32_t surface_id;
     uint8_t type;
     uint32_t flags;
@@ -103,7 +103,7 @@ typedef struct RedSurfaceCmd {
 } RedSurfaceCmd;
 
 typedef struct RedCursorCmd {
-    QXLReleaseInfo *release_info;
+    QXLReleaseInfoExt release_info_ext;
     uint8_t type;
     union {
         struct {
diff --git a/server/red-worker.c b/server/red-worker.c
index 3acab24..2b5a06d 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -243,7 +243,6 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty)
         }
         case QXL_CMD_UPDATE: {
             RedUpdateCmd update;
-            QXLReleaseInfoExt release_info_ext;
 
             if (red_get_update_cmd(&worker->mem_slots, ext_cmd.group_id,
                                    &update, ext_cmd.cmd.data)) {
@@ -255,15 +254,12 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty)
                 display_channel_draw(worker->display_channel, &update.area, update.surface_id);
                 worker->qxl->st->qif->notify_update(worker->qxl, update.update_id);
             }
-            release_info_ext.group_id = ext_cmd.group_id;
-            release_info_ext.info = update.release_info;
-            worker->qxl->st->qif->release_resource(worker->qxl, release_info_ext);
+            worker->qxl->st->qif->release_resource(worker->qxl, update.release_info_ext);
             red_put_update_cmd(&update);
             break;
         }
         case QXL_CMD_MESSAGE: {
             RedMessage message;
-            QXLReleaseInfoExt release_info_ext;
 
             if (red_get_message(&worker->mem_slots, ext_cmd.group_id,
                                 &message, ext_cmd.cmd.data)) {
@@ -273,9 +269,7 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty)
             /* alert: accessing message.data is insecure */
             spice_warning("MESSAGE: %s", message.data);
 #endif
-            release_info_ext.group_id = ext_cmd.group_id;
-            release_info_ext.info = message.release_info;
-            worker->qxl->st->qif->release_resource(worker->qxl, release_info_ext);
+            worker->qxl->st->qif->release_resource(worker->qxl, message.release_info_ext);
             red_put_message(&message);
             break;
         }
-- 
2.5.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]