[spice-server v3 05/14] qxl: Release QXL resource in red_put_message

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

 



Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
---
 server/red-parse-qxl.c | 7 +++++--
 server/red-parse-qxl.h | 3 ++-
 server/red-worker.c    | 3 +--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c
index ac612dd5d..24d3b838f 100644
--- a/server/red-parse-qxl.c
+++ b/server/red-parse-qxl.c
@@ -1267,7 +1267,7 @@ void red_put_update_cmd(RedUpdateCmd *red)
     /* nothing yet */
 }
 
-bool red_get_message(RedMemSlotInfo *slots, int group_id,
+bool red_get_message(QXLInstance *qxl_instance, RedMemSlotInfo *slots, int group_id,
                      RedMessage *red, QXLPHYSICAL addr)
 {
     QXLMessage *qxl;
@@ -1286,6 +1286,7 @@ bool red_get_message(RedMemSlotInfo *slots, int group_id,
     if (error) {
         return false;
     }
+    red->qxl = qxl_instance;
     red->release_info_ext.info      = &qxl->release_info;
     red->release_info_ext.group_id  = group_id;
     red->data                       = qxl->data;
@@ -1302,7 +1303,9 @@ bool red_get_message(RedMemSlotInfo *slots, int group_id,
 
 void red_put_message(RedMessage *red)
 {
-    /* nothing yet */
+    if (red->qxl != NULL) {
+        red_qxl_release_resource(red->qxl, red->release_info_ext);
+    }
 }
 
 static unsigned int surface_format_to_bpp(uint32_t format)
diff --git a/server/red-parse-qxl.h b/server/red-parse-qxl.h
index cb1c1b9fa..ecf7b1577 100644
--- a/server/red-parse-qxl.h
+++ b/server/red-parse-qxl.h
@@ -67,6 +67,7 @@ typedef struct RedUpdateCmd {
 } RedUpdateCmd;
 
 typedef struct RedMessage {
+    QXLInstance *qxl;
     QXLReleaseInfoExt release_info_ext;
     int len;
     uint8_t *data;
@@ -121,7 +122,7 @@ bool red_get_update_cmd(RedMemSlotInfo *slots, int group_id,
                         RedUpdateCmd *red, QXLPHYSICAL addr);
 void red_put_update_cmd(RedUpdateCmd *red);
 
-bool red_get_message(RedMemSlotInfo *slots, int group_id,
+bool red_get_message(QXLInstance *qxl, RedMemSlotInfo *slots, int group_id,
                      RedMessage *red, QXLPHYSICAL addr);
 void red_put_message(RedMessage *red);
 
diff --git a/server/red-worker.c b/server/red-worker.c
index 83e699ed3..8cf80b8a7 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -239,14 +239,13 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty)
         case QXL_CMD_MESSAGE: {
             RedMessage message;
 
-            if (!red_get_message(&worker->mem_slots, ext_cmd.group_id,
+            if (!red_get_message(worker->qxl, &worker->mem_slots, ext_cmd.group_id,
                                  &message, ext_cmd.cmd.data)) {
                 break;
             }
 #ifdef DEBUG
             spice_warning("MESSAGE: %.*s", message.len, message.data);
 #endif
-            red_qxl_release_resource(worker->qxl, message.release_info_ext);
             red_put_message(&message);
             break;
         }
-- 
2.14.3

_______________________________________________
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]