mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-30 09:46:50 +00:00
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>
This commit is contained in:
parent
79e50495fe
commit
fbdea0fa79
@ -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) {
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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));
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user