[Spice-devel] [spice-server 04/10] Add group_id to RedDrawable

Christophe Fergeau cfergeau at redhat.com
Fri Feb 12 17:51:03 UTC 2016


Storing a QXLReleaseInfoExt rather than a QXLReleaseInfo in RedDrawable
gives us a place to store group_id for free. Since we are building a
QXLReleaseInfoExt from QXLReleaseInfo and group_id when destroying a
RedDrawable instance, this is a move in the right direction.
---
 server/red-parse-qxl.c | 6 ++++--
 server/red-parse-qxl.h | 2 +-
 server/red-worker.c    | 7 ++-----
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c
index dd1a09c..0270ae5 100644
--- a/server/red-parse-qxl.c
+++ b/server/red-parse-qxl.c
@@ -1027,7 +1027,8 @@ static int red_get_native_drawable(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_get_rect_ptr(&red->bbox, &qxl->bbox);
     red_get_clip_ptr(slots, group_id, &red->clip, &qxl->clip);
@@ -1110,7 +1111,8 @@ static int red_get_compat_drawable(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_get_rect_ptr(&red->bbox, &qxl->bbox);
     red_get_clip_ptr(slots, group_id, &red->clip, &qxl->clip);
diff --git a/server/red-parse-qxl.h b/server/red-parse-qxl.h
index 179d45c..6bb0d4e 100644
--- a/server/red-parse-qxl.h
+++ b/server/red-parse-qxl.h
@@ -26,7 +26,7 @@
 typedef struct RedDrawable {
     int refs;
     QXLInstance *qxl;
-    QXLReleaseInfo *release_info;
+    QXLReleaseInfoExt release_info_ext;
     uint32_t surface_id;
     uint8_t effect;
     uint8_t type;
diff --git a/server/red-worker.c b/server/red-worker.c
index 7ce09bf..5937b00 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -132,14 +132,11 @@ static void common_release_recv_buf(RedChannelClient *rcc, uint16_t type, uint32
 void red_drawable_unref(DisplayChannel *display, RedDrawable *red_drawable,
                         uint32_t group_id)
 {
-    QXLReleaseInfoExt release_info_ext;
-
     if (--red_drawable->refs) {
         return;
     }
-    release_info_ext.group_id = group_id;
-    release_info_ext.info = red_drawable->release_info;
-    red_drawable->qxl->st->qif->release_resource(red_drawable->qxl, release_info_ext);
+    red_drawable->qxl->st->qif->release_resource(red_drawable->qxl,
+                                                 red_drawable->release_info_ext);
     red_put_drawable(red_drawable);
     free(red_drawable);
 }
-- 
2.5.0



More information about the Spice-devel mailing list