mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-15 05:10:11 +00:00
qxl: Release QXL resources in red_put_surface_cmd
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
473656d58e
commit
1c32e68072
@ -286,7 +286,6 @@ static void stop_streams(DisplayChannel *display)
|
||||
void display_channel_surface_unref(DisplayChannel *display, uint32_t surface_id)
|
||||
{
|
||||
RedSurface *surface = &display->priv->surfaces[surface_id];
|
||||
QXLInstance *qxl = display->priv->qxl;
|
||||
DisplayChannelClient *dcc;
|
||||
|
||||
if (--surface->refs != 0) {
|
||||
@ -301,12 +300,10 @@ void display_channel_surface_unref(DisplayChannel *display, uint32_t surface_id)
|
||||
|
||||
surface->context.canvas->ops->destroy(surface->context.canvas);
|
||||
if (surface->create_cmd != NULL) {
|
||||
red_qxl_release_resource(qxl, surface->create_cmd->release_info_ext);
|
||||
red_surface_cmd_unref(surface->create_cmd);
|
||||
surface->create_cmd = NULL;
|
||||
}
|
||||
if (surface->destroy_cmd != NULL) {
|
||||
red_qxl_release_resource(qxl, surface->destroy_cmd->release_info_ext);
|
||||
red_surface_cmd_unref(surface->destroy_cmd);
|
||||
surface->destroy_cmd = NULL;
|
||||
}
|
||||
|
||||
@ -1444,8 +1444,9 @@ bool red_validate_surface(uint32_t width, uint32_t height,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool red_get_surface_cmd(RedMemSlotInfo *slots, int group_id,
|
||||
static bool red_get_surface_cmd(QXLInstance *qxl_instance, RedMemSlotInfo *slots, int group_id,
|
||||
RedSurfaceCmd *red, QXLPHYSICAL addr)
|
||||
|
||||
{
|
||||
QXLSurfaceCmd *qxl;
|
||||
uint64_t size;
|
||||
@ -1454,6 +1455,7 @@ static bool red_get_surface_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;
|
||||
|
||||
@ -1486,7 +1488,9 @@ static bool red_get_surface_cmd(RedMemSlotInfo *slots, int group_id,
|
||||
|
||||
static void red_put_surface_cmd(RedSurfaceCmd *red)
|
||||
{
|
||||
/* nothing yet */
|
||||
if (red->qxl) {
|
||||
red_qxl_release_resource(red->qxl, red->release_info_ext);
|
||||
}
|
||||
}
|
||||
|
||||
RedSurfaceCmd *red_surface_cmd_new(QXLInstance *qxl_instance, RedMemSlotInfo *slots,
|
||||
@ -1498,8 +1502,8 @@ RedSurfaceCmd *red_surface_cmd_new(QXLInstance *qxl_instance, RedMemSlotInfo *sl
|
||||
|
||||
cmd->refs = 1;
|
||||
|
||||
if (!red_get_surface_cmd(slots, group_id, cmd, addr)) {
|
||||
g_free(cmd);
|
||||
if (!red_get_surface_cmd(qxl_instance, slots, group_id, cmd, addr)) {
|
||||
red_surface_cmd_unref(cmd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -85,6 +85,7 @@ typedef struct RedSurfaceCreate {
|
||||
} RedSurfaceCreate;
|
||||
|
||||
typedef struct RedSurfaceCmd {
|
||||
QXLInstance *qxl;
|
||||
QXLReleaseInfoExt release_info_ext;
|
||||
int refs;
|
||||
uint32_t surface_id;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user