[Spice-devel] [spice-server v2 8/9] qxl: Release QXL resources in red_put_update_cmd
Christophe Fergeau
cfergeau at redhat.com
Tue Apr 17 16:19:23 UTC 2018
Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
server/red-parse-qxl.c | 11 +++++++----
server/red-parse-qxl.h | 3 ++-
server/red-worker.c | 3 +--
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c
index a5e363579..afd136e43 100644
--- a/server/red-parse-qxl.c
+++ b/server/red-parse-qxl.c
@@ -1241,8 +1241,9 @@ static void red_put_drawable(RedDrawable *red)
}
}
-bool red_get_update_cmd(RedMemSlotInfo *slots, int group_id,
- RedUpdateCmd *red, QXLPHYSICAL addr)
+bool red_get_update_cmd(QXLInstance *qxl_instance, RedMemSlotInfo *slots,
+ int group_id, RedUpdateCmd *red,
+ QXLPHYSICAL addr)
{
QXLUpdateCmd *qxl;
int error;
@@ -1251,10 +1252,10 @@ bool red_get_update_cmd(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_get_rect_ptr(&red->area, &qxl->area);
red->update_id = qxl->update_id;
red->surface_id = qxl->surface_id;
@@ -1263,7 +1264,9 @@ bool red_get_update_cmd(RedMemSlotInfo *slots, int group_id,
void red_put_update_cmd(RedUpdateCmd *red)
{
- /* nothing yet */
+ if (red->qxl != NULL) {
+ red_qxl_release_resource(red->qxl, red->release_info_ext);
+ }
}
bool red_get_message(QXLInstance *qxl_instance, RedMemSlotInfo *slots, int group_id,
diff --git a/server/red-parse-qxl.h b/server/red-parse-qxl.h
index c73462e0e..c3ad39ea7 100644
--- a/server/red-parse-qxl.h
+++ b/server/red-parse-qxl.h
@@ -68,6 +68,7 @@ static inline RedDrawable *red_drawable_ref(RedDrawable *drawable)
void red_drawable_unref(RedDrawable *red_drawable);
typedef struct RedUpdateCmd {
+ QXLInstance *qxl;
QXLReleaseInfoExt release_info_ext;
SpiceRect area;
uint32_t update_id;
@@ -124,7 +125,7 @@ RedDrawable *red_drawable_new(QXLInstance *qxl, RedMemSlotInfo *slots,
uint32_t flags);
void red_drawable_unref(RedDrawable *red_drawable);
-bool red_get_update_cmd(RedMemSlotInfo *slots, int group_id,
+bool red_get_update_cmd(QXLInstance *qxl, RedMemSlotInfo *slots, int group_id,
RedUpdateCmd *red, QXLPHYSICAL addr);
void red_put_update_cmd(RedUpdateCmd *red);
diff --git a/server/red-worker.c b/server/red-worker.c
index 762443f7c..62ee357ab 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -221,7 +221,7 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty)
case QXL_CMD_UPDATE: {
RedUpdateCmd update;
- if (!red_get_update_cmd(&worker->mem_slots, ext_cmd.group_id,
+ if (!red_get_update_cmd(worker->qxl, &worker->mem_slots, ext_cmd.group_id,
&update, ext_cmd.cmd.data)) {
break;
}
@@ -231,7 +231,6 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty)
display_channel_draw(worker->display_channel, &update.area, update.surface_id);
red_qxl_notify_update(worker->qxl, update.update_id);
}
- red_qxl_release_resource(worker->qxl, update.release_info_ext);
red_put_update_cmd(&update);
break;
}
--
2.14.3
More information about the Spice-devel
mailing list