[Spice-devel] [spice-server v4 07/11] qxl: Release QXL resources in red_put_update_cmd
Christophe Fergeau
cfergeau at redhat.com
Thu Nov 29 12:50:09 UTC 2018
---
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 e88e75096..1608caff2 100644
--- a/server/red-parse-qxl.c
+++ b/server/red-parse-qxl.c
@@ -1237,8 +1237,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;
@@ -1246,10 +1247,10 @@ bool red_get_update_cmd(RedMemSlotInfo *slots, int group_id,
if (qxl == NULL) {
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;
@@ -1258,7 +1259,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);
+ }
}
static 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 fad144071..f9013161d 100644
--- a/server/red-parse-qxl.h
+++ b/server/red-parse-qxl.h
@@ -60,6 +60,7 @@ typedef struct RedDrawable {
} RedDrawable;
typedef struct RedUpdateCmd {
+ QXLInstance *qxl;
QXLReleaseInfoExt release_info_ext;
SpiceRect area;
uint32_t update_id;
@@ -119,7 +120,7 @@ RedDrawable *red_drawable_new(QXLInstance *qxl, RedMemSlotInfo *slots,
RedDrawable *red_drawable_ref(RedDrawable *drawable);
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 70d596dd6..7c9076c46 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -215,7 +215,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;
}
@@ -225,7 +225,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.19.1
More information about the Spice-devel
mailing list