summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2016-09-24 15:39:29 +0100
committerFrediano Ziglio <fziglio@redhat.com>2016-09-26 09:52:16 +0100
commit1c66093e52dee28e369e7765b8b730b298ff4e96 (patch)
tree8a45b387d78b50340d7df20956e3c8a12e4914f9
parentc676d6c2e33fed9ab6941972159b21dd90f9deb0 (diff)
OT FINISH try to avoid qxl pointer in CursorChannelvirgl_20160927virgl
-rw-r--r--server/cursor-channel.c7
-rw-r--r--server/dcc-send.c2
-rw-r--r--server/dcc.c2
-rw-r--r--server/display-channel.c9
-rw-r--r--server/display-channel.h2
-rw-r--r--server/red-worker.c2
6 files changed, 13 insertions, 11 deletions
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 52c8e2d6..370859f2 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -35,7 +35,6 @@ enum {
};
typedef struct CursorItem {
- QXLInstance *qxl;
int refs;
RedCursorCmd *red_cursor;
} CursorItem;
@@ -69,14 +68,13 @@ struct CursorChannel {
static void cursor_pipe_item_free(RedPipeItem *pipe_item);
-static CursorItem *cursor_item_new(QXLInstance *qxl, RedCursorCmd *cmd)
+static CursorItem *cursor_item_new(RedCursorCmd *cmd)
{
CursorItem *cursor_item;
spice_return_val_if_fail(cmd != NULL, NULL);
cursor_item = g_new0(CursorItem, 1);
- cursor_item->qxl = qxl;
cursor_item->refs = 1;
cursor_item->red_cursor = cmd;
@@ -103,7 +101,6 @@ static void cursor_item_unref(CursorItem *item)
return;
cursor_cmd = item->red_cursor;
- red_qxl_release_resource(item->qxl, cursor_cmd->release_info_ext);
red_put_cursor_cmd(cursor_cmd);
free(cursor_cmd);
@@ -343,7 +340,7 @@ void cursor_channel_process_cmd(CursorChannel *cursor, RedCursorCmd *cursor_cmd)
spice_return_if_fail(cursor);
spice_return_if_fail(cursor_cmd);
- cursor_item = cursor_item_new(cursor->common.qxl, cursor_cmd);
+ cursor_item = cursor_item_new(cursor_cmd);
switch (cursor_cmd->type) {
case QXL_CURSOR_SET:
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 00a408b4..3ef40423 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -2391,7 +2391,7 @@ static void marshall_gl_scanout(RedChannelClient *rcc,
{
DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
DisplayChannel *display_channel = DCC_TO_DC(dcc);
- QXLInstance* qxl = display_channel->common.qxl;
+ QXLInstance* qxl = display_channel->priv->qxl;
SpiceMsgDisplayGlScanoutUnix *scanout = red_qxl_get_gl_scanout(qxl);
if (scanout != NULL) {
diff --git a/server/dcc.c b/server/dcc.c
index d8df6a59..c14663cc 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -373,7 +373,7 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
num_caps, caps);
display->common.during_target_migrate = mig_target;
- dcc->priv->id = display->common.qxl->id;
+ dcc->priv->id = display->priv->qxl->id;
spice_return_val_if_fail(dcc, NULL);
spice_info("New display (client %p) dcc %p stream %p", client, dcc, stream);
diff --git a/server/display-channel.c b/server/display-channel.c
index 31ce551f..7fc1e37b 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -184,7 +184,7 @@ 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->common.qxl;
+ QXLInstance *qxl = display->priv->qxl;
DisplayChannelClient *dcc;
GList *link, *next;
@@ -1870,7 +1870,7 @@ void display_channel_create_surface(DisplayChannel *display, uint32_t surface_id
if (display->priv->renderer == RED_RENDERER_INVALID) {
int i;
- QXLInstance *qxl = display->common.qxl;
+ QXLInstance *qxl = display->priv->qxl;
RedsState *reds = red_qxl_get_server(qxl->st);
GArray *renderers = reds_get_renderers(reds);
for (i = 0; i < renderers->len; i++) {
@@ -1967,6 +1967,7 @@ DisplayChannel* display_channel_new(SpiceServer *reds, RedWorker *worker,
SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER,
&cbs, dcc_handle_message);
spice_return_val_if_fail(display, NULL);
+ display->priv->qxl = display->common.qxl;
display->priv->pub = display;
clockid_t stat_clock = CLOCK_THREAD_CPUTIME_ID;
@@ -2112,7 +2113,7 @@ void display_channel_gl_scanout(DisplayChannel *display)
static void set_gl_draw_async_count(DisplayChannel *display, int num)
{
- QXLInstance *qxl = display->common.qxl;
+ QXLInstance *qxl = display->priv->qxl;
display->priv->gl_draw_async_count = num;
@@ -2245,7 +2246,7 @@ static RedDrawable *get_dummy_drawable(DisplayChannel *display,
static RedDrawable *get_dummy_gl_drawable(DisplayChannel *display)
{
RedDrawable *red_drawable = NULL;
- QXLInstance* qxl = display->common.qxl;
+ QXLInstance* qxl = display->priv->qxl;
SpiceMsgDisplayGlScanoutUnix *scanout = red_qxl_get_gl_scanout(qxl);
if (scanout != NULL) {
diff --git a/server/display-channel.h b/server/display-channel.h
index 56d2d802..0613d54f 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -182,6 +182,8 @@ struct DisplayChannelPrivate
{
DisplayChannel *pub;
+ QXLInstance *qxl;
+
uint32_t bits_unique;
MonitorsConfig *monitors_config;
diff --git a/server/red-worker.c b/server/red-worker.c
index 9b22254f..de7daf77 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -176,6 +176,7 @@ static int red_process_cursor(RedWorker *worker, int *ring_is_empty)
free(cursor);
break;
}
+ red_qxl_release_resource(worker->qxl, cursor->release_info_ext);
cursor_channel_process_cmd(worker->cursor_channel, cursor);
break;
@@ -1099,6 +1100,7 @@ static int loadvm_command(RedWorker *worker, QXLCommandExt *ext)
free(cursor_cmd);
return FALSE;
}
+ red_qxl_release_resource(worker->qxl, cursor_cmd->release_info_ext);
cursor_channel_process_cmd(worker->cursor_channel, cursor_cmd);
break;
case QXL_CMD_SURFACE: