summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2016-02-08 19:57:58 +0000
committerFrediano Ziglio <fziglio@redhat.com>2016-02-11 23:51:46 +0000
commitfbdea0fa790ba3f836fe0c6d60441b716c7d0bd3 (patch)
tree94eaed791f1a01280973e08988e864c45c3c60b6
parent79e50495fe53a34cdbf2e524da2dcac4e11ee811 (diff)
CommonChannel: hold a reference to QXLInstance instead of RedWorker
CommonChannel does not need to know about RedWorker. This reduce a bit dependencies between objects. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
-rw-r--r--server/cursor-channel.c2
-rw-r--r--server/dcc-encoders.c3
-rw-r--r--server/dcc-send.c3
-rw-r--r--server/dcc.c2
-rw-r--r--server/display-channel.c8
-rw-r--r--server/red-worker.c12
-rw-r--r--server/red-worker.h5
7 files changed, 16 insertions, 19 deletions
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index bbaac345..197376a6 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -489,7 +489,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(red_worker_get_qxl(cursor->common.worker),
+ cursor_item = cursor_item_new(cursor->common.qxl,
cursor_cmd, group_id);
switch (cursor_cmd->type) {
diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index 0923c9c9..c810b8ea 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -456,7 +456,6 @@ void dcc_free_glz_drawable_instance(DisplayChannelClient *dcc,
GlzDrawableInstanceItem *instance)
{
DisplayChannel *display_channel = DCC_TO_DC(dcc);
- RedWorker *worker = display_channel->common.worker;
RedGlzDrawable *glz_drawable;
spice_assert(instance);
@@ -484,7 +483,7 @@ void dcc_free_glz_drawable_instance(DisplayChannelClient *dcc,
if (drawable) {
ring_remove(&glz_drawable->drawable_link);
}
- red_drawable_unref(worker, glz_drawable->red_drawable,
+ red_drawable_unref(display_channel, glz_drawable->red_drawable,
glz_drawable->group_id);
display_channel->glz_drawable_count--;
if (ring_item_is_linked(&glz_drawable->link)) {
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 3af5760f..ab076345 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -2305,8 +2305,7 @@ static void marshall_gl_scanout(RedChannelClient *rcc,
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
DisplayChannel *display_channel = DCC_TO_DC(dcc);
- RedWorker *worker = display_channel->common.worker;
- QXLInstance* qxl = red_worker_get_qxl(worker);
+ QXLInstance* qxl = display_channel->common.qxl;
SpiceMsgDisplayGlScanoutUnix *so = &qxl->st->scanout;
pthread_mutex_lock(&qxl->st->scanout_mutex);
diff --git a/server/dcc.c b/server/dcc.c
index d28c4ee8..dd02d3ea 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -445,7 +445,7 @@ void dcc_start(DisplayChannelClient *dcc)
{
DisplayChannel *display = DCC_TO_DC(dcc);
RedChannelClient *rcc = RED_CHANNEL_CLIENT(dcc);
- QXLInstance *qxl = red_worker_get_qxl(COMMON_CHANNEL(display)->worker);
+ QXLInstance *qxl = display->common.qxl;
red_channel_client_push_set_ack(RED_CHANNEL_CLIENT(dcc));
diff --git a/server/display-channel.c b/server/display-channel.c
index 78c984fd..28304b3e 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -241,8 +241,7 @@ static void stop_streams(DisplayChannel *display)
void display_channel_surface_unref(DisplayChannel *display, uint32_t surface_id)
{
RedSurface *surface = &display->surfaces[surface_id];
- RedWorker *worker = COMMON_CHANNEL(display)->worker;
- QXLInstance *qxl = red_worker_get_qxl(worker);
+ QXLInstance *qxl = display->common.qxl;
DisplayChannelClient *dcc;
RingItem *link, *next;
@@ -1445,7 +1444,7 @@ void display_channel_drawable_unref(DisplayChannel *display, Drawable *drawable)
ring_remove(item);
}
if (drawable->red_drawable) {
- red_drawable_unref(COMMON_CHANNEL(display)->worker, drawable->red_drawable, drawable->group_id);
+ red_drawable_unref(display, drawable->red_drawable, drawable->group_id);
}
drawable_free(display, drawable);
display->drawable_count--;
@@ -2155,8 +2154,7 @@ void display_channel_gl_scanout(DisplayChannel *display)
static void set_gl_draw_async_count(DisplayChannel *display, int num)
{
- RedWorker *worker = COMMON_CHANNEL(display)->worker;
- QXLInstance *qxl = red_worker_get_qxl(worker);
+ QXLInstance *qxl = display->common.qxl;
display->gl_draw_async_count = num;
diff --git a/server/red-worker.c b/server/red-worker.c
index f6223ef2..ff684992 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -129,7 +129,7 @@ static void common_release_recv_buf(RedChannelClient *rcc, uint16_t type, uint32
}
}
-void red_drawable_unref(RedWorker *worker, RedDrawable *red_drawable,
+void red_drawable_unref(DisplayChannel *display, RedDrawable *red_drawable,
uint32_t group_id)
{
QXLReleaseInfoExt release_info_ext;
@@ -137,10 +137,10 @@ void red_drawable_unref(RedWorker *worker, RedDrawable *red_drawable,
if (--red_drawable->refs) {
return;
}
- worker->display_channel->red_drawable_count--;
+ display->red_drawable_count--;
release_info_ext.group_id = group_id;
release_info_ext.info = red_drawable->release_info;
- worker->qxl->st->qif->release_resource(worker->qxl, release_info_ext);
+ display->common.qxl->st->qif->release_resource(display->common.qxl, release_info_ext);
red_put_drawable(red_drawable);
free(red_drawable);
}
@@ -243,7 +243,7 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty)
worker->process_display_generation);
}
// release the red_drawable
- red_drawable_unref(worker, red_drawable, ext_cmd.group_id);
+ red_drawable_unref(worker->display_channel, red_drawable, ext_cmd.group_id);
break;
}
case QXL_CMD_UPDATE: {
@@ -469,7 +469,7 @@ CommonChannelClient *common_channel_new_client(CommonChannel *common,
return NULL;
}
CommonChannelClient *common_cc = (CommonChannelClient*)rcc;
- common_cc->id = common->worker->qxl->id;
+ common_cc->id = common->qxl->id;
common->during_target_migrate = mig_target;
// TODO: move wide/narrow ack setting to red_channel.
@@ -510,7 +510,7 @@ CommonChannel *red_worker_new_channel(RedWorker *worker, int size,
red_channel_set_stat_node(channel, stat_add_node(worker->stat, name, TRUE));
common = (CommonChannel *)channel;
- common->worker = worker;
+ common->qxl = worker->qxl;
return common;
}
diff --git a/server/red-worker.h b/server/red-worker.h
index 005c15f4..12859428 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -38,7 +38,7 @@ typedef struct CommonChannelClient {
typedef struct CommonChannel {
RedChannel base; // Must be the first thing
- struct RedWorker *worker;
+ QXLInstance *qxl;
uint8_t recv_buf[CHANNEL_RECEIVE_BUF_SIZE];
uint32_t id_alloc; // bitfield. TODO - use this instead of shift scheme.
int during_target_migrate; /* TRUE when the client that is associated with the channel
@@ -97,7 +97,8 @@ QXLInstance* red_worker_get_qxl(RedWorker *worker);
RedChannel* red_worker_get_cursor_channel(RedWorker *worker);
RedChannel* red_worker_get_display_channel(RedWorker *worker);
-void red_drawable_unref(RedWorker *worker, RedDrawable *red_drawable,
+struct DisplayChannel;
+void red_drawable_unref(struct DisplayChannel *display, RedDrawable *red_drawable,
uint32_t group_id);
CommonChannel *red_worker_new_channel(RedWorker *worker, int size,