mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-08 19:19:05 +00:00
Remove RED_CHANNEL where possible
Used Coccinelle: @@ expression E; @@ -RED_CHANNEL(E) +E Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
e204677a43
commit
3720e5a686
@ -271,11 +271,11 @@ void cursor_channel_process_cmd(CursorChannel *cursor, RedCursorCmd *cursor_cmd)
|
||||
return;
|
||||
}
|
||||
|
||||
if (red_channel_is_connected(RED_CHANNEL(cursor)) &&
|
||||
if (red_channel_is_connected(cursor) &&
|
||||
(cursor->mouse_mode == SPICE_MOUSE_MODE_SERVER
|
||||
|| cursor_cmd->type != QXL_CURSOR_MOVE
|
||||
|| cursor_show)) {
|
||||
red_channel_pipes_add(RED_CHANNEL(cursor), &cursor_pipe_item->base);
|
||||
red_channel_pipes_add(cursor, &cursor_pipe_item->base);
|
||||
} else {
|
||||
red_pipe_item_unref(&cursor_pipe_item->base);
|
||||
}
|
||||
@ -283,7 +283,7 @@ void cursor_channel_process_cmd(CursorChannel *cursor, RedCursorCmd *cursor_cmd)
|
||||
|
||||
void cursor_channel_reset(CursorChannel *cursor)
|
||||
{
|
||||
RedChannel *channel = RED_CHANNEL(cursor);
|
||||
RedChannel *channel = cursor;
|
||||
|
||||
spice_return_if_fail(cursor);
|
||||
|
||||
@ -305,7 +305,7 @@ static void cursor_channel_init_client(CursorChannel *cursor, CursorChannelClien
|
||||
{
|
||||
spice_return_if_fail(cursor);
|
||||
|
||||
if (!red_channel_is_connected(RED_CHANNEL(cursor))
|
||||
if (!red_channel_is_connected(cursor)
|
||||
|| common_graphics_channel_get_during_target_migrate(COMMON_GRAPHICS_CHANNEL(cursor))) {
|
||||
spice_debug("during_target_migrate: skip init");
|
||||
return;
|
||||
@ -315,7 +315,7 @@ static void cursor_channel_init_client(CursorChannel *cursor, CursorChannelClien
|
||||
red_channel_client_pipe_add_type(client,
|
||||
RED_PIPE_ITEM_TYPE_CURSOR_INIT);
|
||||
else
|
||||
red_channel_pipes_add_type(RED_CHANNEL(cursor), RED_PIPE_ITEM_TYPE_CURSOR_INIT);
|
||||
red_channel_pipes_add_type(cursor, RED_PIPE_ITEM_TYPE_CURSOR_INIT);
|
||||
}
|
||||
|
||||
void cursor_channel_do_init(CursorChannel *cursor)
|
||||
|
||||
@ -305,7 +305,7 @@ void dcc_create_surface(DisplayChannelClient *dcc, int surface_id)
|
||||
return;
|
||||
}
|
||||
surface = &display->priv->surfaces[surface_id];
|
||||
create = red_surface_create_item_new(RED_CHANNEL(display),
|
||||
create = red_surface_create_item_new(display,
|
||||
surface_id, surface->context.width,
|
||||
surface->context.height,
|
||||
surface->context.format, flags);
|
||||
|
||||
@ -134,7 +134,7 @@ struct DisplayChannelPrivate
|
||||
};
|
||||
|
||||
#define FOREACH_DCC(_channel, _data) \
|
||||
GLIST_FOREACH((_channel ? red_channel_get_clients(RED_CHANNEL(_channel)) : NULL), \
|
||||
GLIST_FOREACH((_channel ? red_channel_get_clients(_channel) : NULL), \
|
||||
DisplayChannelClient, _data)
|
||||
|
||||
typedef struct RedMonitorsConfigItem {
|
||||
|
||||
@ -336,7 +336,7 @@ static void streams_update_visible_region(DisplayChannel *display, Drawable *dra
|
||||
RingItem *item;
|
||||
DisplayChannelClient *dcc;
|
||||
|
||||
if (!red_channel_is_connected(RED_CHANNEL(display))) {
|
||||
if (!red_channel_is_connected(display)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -399,7 +399,7 @@ static void pipes_add_drawable_after(DisplayChannel *display,
|
||||
pipes_add_drawable(display, drawable);
|
||||
return;
|
||||
}
|
||||
if (num_other_linked != red_channel_get_n_clients(RED_CHANNEL(display))) {
|
||||
if (num_other_linked != red_channel_get_n_clients(display)) {
|
||||
spice_debug("TODO: not O(n^2)");
|
||||
FOREACH_DCC(display, dcc) {
|
||||
int sent = 0;
|
||||
@ -1465,9 +1465,9 @@ bool display_channel_wait_for_migrate_data(DisplayChannel *display)
|
||||
uint64_t end_time = spice_get_monotonic_time_ns() + DISPLAY_CLIENT_MIGRATE_DATA_TIMEOUT;
|
||||
RedChannelClient *rcc;
|
||||
int ret = FALSE;
|
||||
GList *clients = red_channel_get_clients(RED_CHANNEL(display));
|
||||
GList *clients = red_channel_get_clients(display);
|
||||
|
||||
if (!red_channel_is_waiting_for_migrate_data(RED_CHANNEL(display))) {
|
||||
if (!red_channel_is_waiting_for_migrate_data(display)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -2111,9 +2111,11 @@ void display_channel_destroy_surfaces(DisplayChannel *display)
|
||||
}
|
||||
spice_warn_if_fail(ring_is_empty(&display->priv->streams));
|
||||
|
||||
if (red_channel_is_connected(RED_CHANNEL(display))) {
|
||||
red_channel_pipes_add_type(RED_CHANNEL(display), RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE);
|
||||
red_channel_pipes_add_empty_msg(RED_CHANNEL(display), SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL);
|
||||
if (red_channel_is_connected(display)) {
|
||||
red_channel_pipes_add_type(display,
|
||||
RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE);
|
||||
red_channel_pipes_add_empty_msg(display,
|
||||
SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL);
|
||||
}
|
||||
|
||||
display_channel_free_glz_drawables(display);
|
||||
@ -2182,7 +2184,7 @@ void display_channel_create_surface(DisplayChannel *display, uint32_t surface_id
|
||||
|
||||
if (display->priv->renderer == RED_RENDERER_INVALID) {
|
||||
int i;
|
||||
RedsState *reds = red_channel_get_server(RED_CHANNEL(display));
|
||||
RedsState *reds = red_channel_get_server(display);
|
||||
GArray *renderers = reds_get_renderers(reds);
|
||||
for (i = 0; i < renderers->len; i++) {
|
||||
uint32_t renderer = g_array_index(renderers, uint32_t, i);
|
||||
@ -2293,7 +2295,7 @@ static void
|
||||
display_channel_constructed(GObject *object)
|
||||
{
|
||||
DisplayChannel *self = DISPLAY_CHANNEL(object);
|
||||
RedChannel *channel = RED_CHANNEL(self);
|
||||
RedChannel *channel = self;
|
||||
|
||||
G_OBJECT_CLASS(display_channel_parent_class)->constructed(object);
|
||||
|
||||
@ -2302,7 +2304,7 @@ display_channel_constructed(GObject *object)
|
||||
stat_init(&self->priv->add_stat, "add", CLOCK_THREAD_CPUTIME_ID);
|
||||
stat_init(&self->priv->exclude_stat, "exclude", CLOCK_THREAD_CPUTIME_ID);
|
||||
stat_init(&self->priv->__exclude_stat, "__exclude", CLOCK_THREAD_CPUTIME_ID);
|
||||
RedsState *reds = red_channel_get_server(RED_CHANNEL(self));
|
||||
RedsState *reds = red_channel_get_server(self);
|
||||
const RedStatNode *stat = red_channel_get_stat_node(channel);
|
||||
stat_init_counter(&self->priv->cache_hits_counter, reds, stat,
|
||||
"cache_hits", TRUE);
|
||||
@ -2391,7 +2393,7 @@ static void display_channel_update_compression(DisplayChannel *display, DisplayC
|
||||
|
||||
void display_channel_gl_scanout(DisplayChannel *display)
|
||||
{
|
||||
red_channel_pipes_new_add(RED_CHANNEL(display), dcc_gl_scanout_item_new, NULL);
|
||||
red_channel_pipes_new_add(display, dcc_gl_scanout_item_new, NULL);
|
||||
}
|
||||
|
||||
static void set_gl_draw_async_count(DisplayChannel *display, int num)
|
||||
@ -2409,7 +2411,7 @@ void display_channel_gl_draw(DisplayChannel *display, SpiceMsgDisplayGlDraw *dra
|
||||
|
||||
spice_return_if_fail(display->priv->gl_draw_async_count == 0);
|
||||
|
||||
num = red_channel_pipes_new_add(RED_CHANNEL(display), dcc_gl_draw_item_new, draw);
|
||||
num = red_channel_pipes_new_add(display, dcc_gl_draw_item_new, draw);
|
||||
set_gl_draw_async_count(display, num);
|
||||
}
|
||||
|
||||
@ -2544,7 +2546,7 @@ display_channel_class_init(DisplayChannelClass *klass)
|
||||
|
||||
void display_channel_debug_oom(DisplayChannel *display, const char *msg)
|
||||
{
|
||||
RedChannel *channel = RED_CHANNEL(display);
|
||||
RedChannel *channel = display;
|
||||
|
||||
spice_debug("%s #draw=%u, #glz_draw=%u current %u pipes %u",
|
||||
msg,
|
||||
@ -2579,7 +2581,7 @@ static void guest_set_client_capabilities(DisplayChannel *display)
|
||||
#define CLEAR_CAP(a,c) \
|
||||
((a)[(c) / 8] &= ~(1 << ((c) % 8)))
|
||||
|
||||
if ((red_channel_get_n_clients(RED_CHANNEL(display)) == 0)) {
|
||||
if ((red_channel_get_n_clients(display) == 0)) {
|
||||
red_qxl_set_client_capabilities(display->priv->qxl, FALSE, caps);
|
||||
} else {
|
||||
// Take least common denominator
|
||||
|
||||
@ -275,7 +275,7 @@ static bool inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
|
||||
InputsChannel *inputs_channel = INPUTS_CHANNEL(red_channel_client_get_channel(rcc));
|
||||
InputsChannelClient *icc = INPUTS_CHANNEL_CLIENT(rcc);
|
||||
uint32_t i;
|
||||
RedsState *reds = red_channel_get_server(RED_CHANNEL(inputs_channel));
|
||||
RedsState *reds = red_channel_get_server(inputs_channel);
|
||||
|
||||
switch (type) {
|
||||
case SPICE_MSGC_INPUTS_KEY_DOWN: {
|
||||
@ -499,11 +499,11 @@ static void inputs_migrate(RedChannelClient *rcc)
|
||||
|
||||
static void inputs_channel_push_keyboard_modifiers(InputsChannel *inputs, uint8_t modifiers)
|
||||
{
|
||||
if (!inputs || !red_channel_is_connected(RED_CHANNEL(inputs)) ||
|
||||
if (!inputs || !red_channel_is_connected(inputs) ||
|
||||
inputs->src_during_migrate) {
|
||||
return;
|
||||
}
|
||||
red_channel_pipes_add(RED_CHANNEL(inputs),
|
||||
red_channel_pipes_add(inputs,
|
||||
red_inputs_key_modifiers_item_new(modifiers));
|
||||
}
|
||||
|
||||
@ -574,13 +574,13 @@ static void
|
||||
inputs_channel_constructed(GObject *object)
|
||||
{
|
||||
InputsChannel *self = INPUTS_CHANNEL(object);
|
||||
RedsState *reds = red_channel_get_server(RED_CHANNEL(self));
|
||||
SpiceCoreInterfaceInternal *core = red_channel_get_core_interface(RED_CHANNEL(self));
|
||||
RedsState *reds = red_channel_get_server(self);
|
||||
SpiceCoreInterfaceInternal *core = red_channel_get_core_interface(self);
|
||||
|
||||
G_OBJECT_CLASS(inputs_channel_parent_class)->constructed(object);
|
||||
|
||||
red_channel_set_cap(RED_CHANNEL(self), SPICE_INPUTS_CAP_KEY_SCANCODE);
|
||||
reds_register_channel(reds, RED_CHANNEL(self));
|
||||
red_channel_set_cap(self, SPICE_INPUTS_CAP_KEY_SCANCODE);
|
||||
reds_register_channel(reds, self);
|
||||
|
||||
self->key_modifiers_timer = core->timer_add(core, key_modifiers_sender, self);
|
||||
if (!self->key_modifiers_timer) {
|
||||
@ -635,7 +635,7 @@ static SpiceKbdInstance* inputs_channel_get_keyboard(InputsChannel *inputs)
|
||||
int inputs_channel_set_keyboard(InputsChannel *inputs, SpiceKbdInstance *keyboard)
|
||||
{
|
||||
if (inputs->keyboard) {
|
||||
red_channel_warning(RED_CHANNEL(inputs), "already have keyboard");
|
||||
red_channel_warning(inputs, "already have keyboard");
|
||||
return -1;
|
||||
}
|
||||
inputs->keyboard = keyboard;
|
||||
@ -651,7 +651,7 @@ static SpiceMouseInstance* inputs_channel_get_mouse(InputsChannel *inputs)
|
||||
int inputs_channel_set_mouse(InputsChannel *inputs, SpiceMouseInstance *mouse)
|
||||
{
|
||||
if (inputs->mouse) {
|
||||
red_channel_warning(RED_CHANNEL(inputs), "already have mouse");
|
||||
red_channel_warning(inputs, "already have mouse");
|
||||
return -1;
|
||||
}
|
||||
inputs->mouse = mouse;
|
||||
@ -667,11 +667,11 @@ static SpiceTabletInstance* inputs_channel_get_tablet(InputsChannel *inputs)
|
||||
int inputs_channel_set_tablet(InputsChannel *inputs, SpiceTabletInstance *tablet)
|
||||
{
|
||||
if (inputs->tablet) {
|
||||
red_channel_warning(RED_CHANNEL(inputs), "already have tablet");
|
||||
red_channel_warning(inputs, "already have tablet");
|
||||
return -1;
|
||||
}
|
||||
inputs->tablet = tablet;
|
||||
inputs->tablet->st = spice_tablet_state_new(red_channel_get_server(RED_CHANNEL(inputs)));
|
||||
inputs->tablet->st = spice_tablet_state_new(red_channel_get_server(inputs));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -628,7 +628,7 @@ MainChannelClient *main_channel_client_create(MainChannel *main_chan, RedClient
|
||||
mcc = (MainChannelClient *)
|
||||
g_initable_new(TYPE_MAIN_CHANNEL_CLIENT,
|
||||
NULL, NULL,
|
||||
"channel", RED_CHANNEL(main_chan),
|
||||
"channel", main_chan,
|
||||
"client", client,
|
||||
"stream", stream,
|
||||
"caps", caps,
|
||||
|
||||
@ -42,7 +42,7 @@ G_DEFINE_TYPE(MainChannel, main_channel, RED_TYPE_CHANNEL)
|
||||
|
||||
int main_channel_is_connected(MainChannel *main_chan)
|
||||
{
|
||||
return red_channel_is_connected(RED_CHANNEL(main_chan));
|
||||
return red_channel_is_connected(main_chan);
|
||||
}
|
||||
|
||||
RedClient *main_channel_get_client_by_link_id(MainChannel *main_chan, uint32_t connection_id)
|
||||
@ -73,14 +73,14 @@ static void main_channel_push_channels(MainChannelClient *mcc)
|
||||
void main_channel_push_mouse_mode(MainChannel *main_chan, SpiceMouseMode current_mode,
|
||||
int is_client_mouse_allowed)
|
||||
{
|
||||
red_channel_pipes_add(RED_CHANNEL(main_chan),
|
||||
red_channel_pipes_add(main_chan,
|
||||
main_mouse_mode_item_new(current_mode, is_client_mouse_allowed));
|
||||
}
|
||||
|
||||
void main_channel_push_agent_connected(MainChannel *main_chan)
|
||||
{
|
||||
RedChannelClient *rcc;
|
||||
FOREACH_CLIENT(RED_CHANNEL(main_chan), rcc) {
|
||||
FOREACH_CLIENT(main_chan, rcc) {
|
||||
if (red_channel_client_test_remote_cap(rcc,
|
||||
SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS)) {
|
||||
red_channel_client_pipe_add_type(rcc,
|
||||
@ -93,12 +93,14 @@ void main_channel_push_agent_connected(MainChannel *main_chan)
|
||||
|
||||
void main_channel_push_agent_disconnected(MainChannel *main_chan)
|
||||
{
|
||||
red_channel_pipes_add_type(RED_CHANNEL(main_chan), RED_PIPE_ITEM_TYPE_MAIN_AGENT_DISCONNECTED);
|
||||
red_channel_pipes_add_type(main_chan,
|
||||
RED_PIPE_ITEM_TYPE_MAIN_AGENT_DISCONNECTED);
|
||||
}
|
||||
|
||||
static void main_channel_push_migrate_data_item(MainChannel *main_chan)
|
||||
{
|
||||
red_channel_pipes_add_type(RED_CHANNEL(main_chan), RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_DATA);
|
||||
red_channel_pipes_add_type(main_chan,
|
||||
RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_DATA);
|
||||
}
|
||||
|
||||
static bool main_channel_handle_migrate_data(RedChannelClient *rcc,
|
||||
@ -129,7 +131,7 @@ static bool main_channel_handle_migrate_data(RedChannelClient *rcc,
|
||||
|
||||
void main_channel_push_multi_media_time(MainChannel *main_chan, uint32_t time)
|
||||
{
|
||||
red_channel_pipes_add(RED_CHANNEL(main_chan), main_multi_media_time_item_new(time));
|
||||
red_channel_pipes_add(main_chan, main_multi_media_time_item_new(time));
|
||||
}
|
||||
|
||||
static void main_channel_fill_mig_target(MainChannel *main_channel, RedsMigSpice *mig_target)
|
||||
@ -150,13 +152,14 @@ static void main_channel_fill_mig_target(MainChannel *main_channel, RedsMigSpice
|
||||
void
|
||||
main_channel_registered_new_channel(MainChannel *main_chan, RedChannel *channel)
|
||||
{
|
||||
red_channel_pipes_add(RED_CHANNEL(main_chan), registered_channel_item_new(channel));
|
||||
red_channel_pipes_add(main_chan, registered_channel_item_new(channel));
|
||||
}
|
||||
|
||||
void main_channel_migrate_switch(MainChannel *main_chan, RedsMigSpice *mig_target)
|
||||
{
|
||||
main_channel_fill_mig_target(main_chan, mig_target);
|
||||
red_channel_pipes_add_type(RED_CHANNEL(main_chan), RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST);
|
||||
red_channel_pipes_add_type(main_chan,
|
||||
RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST);
|
||||
}
|
||||
|
||||
static bool main_channel_handle_message(RedChannelClient *rcc, uint16_t type,
|
||||
@ -262,8 +265,8 @@ main_channel_constructed(GObject *object)
|
||||
|
||||
G_OBJECT_CLASS(main_channel_parent_class)->constructed(object);
|
||||
|
||||
red_channel_set_cap(RED_CHANNEL(self), SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE);
|
||||
red_channel_set_cap(RED_CHANNEL(self), SPICE_MAIN_CAP_SEAMLESS_MIGRATE);
|
||||
red_channel_set_cap(self, SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE);
|
||||
red_channel_set_cap(self, SPICE_MAIN_CAP_SEAMLESS_MIGRATE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -307,7 +310,7 @@ static int main_channel_connect_seamless(MainChannel *main_channel)
|
||||
{
|
||||
RedChannelClient *rcc;
|
||||
|
||||
spice_assert(red_channel_get_n_clients(RED_CHANNEL(main_channel)) == 1);
|
||||
spice_assert(red_channel_get_n_clients(main_channel) == 1);
|
||||
|
||||
FOREACH_CLIENT(main_channel, rcc) {
|
||||
MainChannelClient *mcc = MAIN_CHANNEL_CLIENT(rcc);
|
||||
@ -331,7 +334,7 @@ int main_channel_migrate_connect(MainChannel *main_channel, RedsMigSpice *mig_ta
|
||||
return main_channel_connect_semi_seamless(main_channel);
|
||||
} else {
|
||||
RedChannelClient *rcc;
|
||||
GList *clients = red_channel_get_clients(RED_CHANNEL(main_channel));
|
||||
GList *clients = red_channel_get_clients(main_channel);
|
||||
|
||||
/* just test the first one */
|
||||
rcc = (RedChannelClient*) g_list_nth_data(clients, 0);
|
||||
@ -362,8 +365,8 @@ int main_channel_migrate_src_complete(MainChannel *main_chan, int success)
|
||||
int semi_seamless_count = 0;
|
||||
RedChannelClient *rcc;
|
||||
|
||||
if (!red_channel_get_clients(RED_CHANNEL(main_chan))) {
|
||||
red_channel_warning(RED_CHANNEL(main_chan), "no peer connected");
|
||||
if (!red_channel_get_clients(main_chan)) {
|
||||
red_channel_warning(main_chan, "no peer connected");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -381,7 +384,7 @@ void main_channel_on_migrate_connected(MainChannel *main_channel,
|
||||
spice_assert(main_channel->num_clients_mig_wait);
|
||||
spice_assert(!seamless || main_channel->num_clients_mig_wait == 1);
|
||||
if (!--main_channel->num_clients_mig_wait) {
|
||||
reds_on_main_migrate_connected(red_channel_get_server(RED_CHANNEL(main_channel)),
|
||||
reds_on_main_migrate_connected(red_channel_get_server(main_channel),
|
||||
seamless && success);
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ struct RedChannelClass
|
||||
};
|
||||
|
||||
#define FOREACH_CLIENT(_channel, _data) \
|
||||
GLIST_FOREACH((_channel ? red_channel_get_clients(RED_CHANNEL(_channel)) : NULL), \
|
||||
GLIST_FOREACH((_channel ? red_channel_get_clients(_channel) : NULL), \
|
||||
RedChannelClient, _data)
|
||||
|
||||
/* Red Channel interface */
|
||||
|
||||
@ -177,7 +177,7 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty)
|
||||
|
||||
worker->process_display_generation++;
|
||||
*ring_is_empty = FALSE;
|
||||
while (red_channel_max_pipe_size(RED_CHANNEL(worker->display_channel)) <= MAX_PIPE_SIZE) {
|
||||
while (red_channel_max_pipe_size(worker->display_channel) <= MAX_PIPE_SIZE) {
|
||||
if (!red_qxl_get_command(worker->qxl, &ext_cmd)) {
|
||||
*ring_is_empty = TRUE;
|
||||
if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
|
||||
@ -249,7 +249,7 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty)
|
||||
spice_error("bad command type");
|
||||
}
|
||||
n++;
|
||||
if (red_channel_all_blocked(RED_CHANNEL(worker->display_channel))
|
||||
if (red_channel_all_blocked(worker->display_channel)
|
||||
|| spice_get_monotonic_time_ns() - start > NSEC_PER_SEC / 100) {
|
||||
worker->event_timeout = 0;
|
||||
return n;
|
||||
@ -263,7 +263,7 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty)
|
||||
static bool red_process_is_blocked(RedWorker *worker)
|
||||
{
|
||||
return red_channel_max_pipe_size(RED_CHANNEL(worker->cursor_channel)) > MAX_PIPE_SIZE ||
|
||||
red_channel_max_pipe_size(RED_CHANNEL(worker->display_channel)) > MAX_PIPE_SIZE;
|
||||
red_channel_max_pipe_size(worker->display_channel) > MAX_PIPE_SIZE;
|
||||
}
|
||||
|
||||
typedef int (*red_process_t)(RedWorker *worker, int *ring_is_empty);
|
||||
@ -311,7 +311,7 @@ static void flush_commands(RedWorker *worker, RedChannel *red_channel,
|
||||
|
||||
static void flush_display_commands(RedWorker *worker)
|
||||
{
|
||||
flush_commands(worker, RED_CHANNEL(worker->display_channel),
|
||||
flush_commands(worker, worker->display_channel,
|
||||
red_process_display);
|
||||
}
|
||||
|
||||
@ -437,7 +437,7 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
|
||||
display_channel_set_monitors_config_to_primary(display);
|
||||
|
||||
CommonGraphicsChannel *common = COMMON_GRAPHICS_CHANNEL(display);
|
||||
RedChannel *channel = RED_CHANNEL(display);
|
||||
RedChannel *channel = display;
|
||||
if (red_channel_is_connected(channel) &&
|
||||
!common_graphics_channel_get_during_target_migrate(common)) {
|
||||
/* guest created primary, so it will (hopefully) send a monitors_config
|
||||
@ -530,7 +530,7 @@ static void handle_dev_stop(void *opaque, void *payload)
|
||||
* purge the pipe, send destroy_all_surfaces
|
||||
* to the client (there is no such message right now), and start
|
||||
* from scratch on the destination side */
|
||||
red_channel_wait_all_sent(RED_CHANNEL(worker->display_channel), COMMON_CLIENT_TIMEOUT);
|
||||
red_channel_wait_all_sent(worker->display_channel, COMMON_CLIENT_TIMEOUT);
|
||||
red_channel_wait_all_sent(RED_CHANNEL(worker->cursor_channel), COMMON_CLIENT_TIMEOUT);
|
||||
}
|
||||
|
||||
@ -566,7 +566,7 @@ static void handle_dev_oom(void *opaque, void *payload)
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
DisplayChannel *display = worker->display_channel;
|
||||
|
||||
RedChannel *display_red_channel = RED_CHANNEL(display);
|
||||
RedChannel *display_red_channel = display;
|
||||
int ring_is_empty;
|
||||
|
||||
spice_return_if_fail(red_qxl_is_running(worker->qxl));
|
||||
@ -1107,7 +1107,7 @@ RedWorker* red_worker_new(QXLInstance *qxl)
|
||||
reds_get_streaming_video(reds),
|
||||
reds_get_video_codecs(reds),
|
||||
init_info.n_surfaces);
|
||||
channel = RED_CHANNEL(worker->display_channel);
|
||||
channel = worker->display_channel;
|
||||
red_channel_init_stat_node(channel, &worker->stat, "display_channel");
|
||||
display_channel_set_image_compression(worker->display_channel,
|
||||
spice_server_get_image_compression(reds));
|
||||
@ -1124,7 +1124,7 @@ static void *red_worker_main(void *arg)
|
||||
MAX_PIPE_SIZE > NARROW_CLIENT_ACK_WINDOW); //ensure wakeup by ack message
|
||||
|
||||
red_channel_reset_thread_id(RED_CHANNEL(worker->cursor_channel));
|
||||
red_channel_reset_thread_id(RED_CHANNEL(worker->display_channel));
|
||||
red_channel_reset_thread_id(worker->display_channel);
|
||||
|
||||
GMainLoop *loop = g_main_loop_new(worker->core.main_context, FALSE);
|
||||
worker->loop = loop;
|
||||
@ -1181,7 +1181,7 @@ void red_worker_free(RedWorker *worker)
|
||||
|
||||
red_worker_close_channel(RED_CHANNEL(worker->cursor_channel));
|
||||
worker->cursor_channel = NULL;
|
||||
red_worker_close_channel(RED_CHANNEL(worker->display_channel));
|
||||
red_worker_close_channel(worker->display_channel);
|
||||
worker->display_channel = NULL;
|
||||
|
||||
if (worker->dispatch_watch) {
|
||||
|
||||
@ -4278,7 +4278,7 @@ SPICE_GNUC_VISIBLE int spice_server_migrate_connect(SpiceServer *reds, const cha
|
||||
*/
|
||||
try_seamless = reds->seamless_migration_enabled &&
|
||||
red_channel_test_remote_cap(RED_CHANNEL(reds->main_channel),
|
||||
SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS);
|
||||
SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS);
|
||||
/* main channel will take care of clients that are still during migration (at target)*/
|
||||
if (main_channel_migrate_connect(reds->main_channel, reds->config->mig_spice,
|
||||
try_seamless)) {
|
||||
|
||||
@ -541,11 +541,11 @@ static void
|
||||
red_smartcard_channel_constructed(GObject *object)
|
||||
{
|
||||
RedSmartcardChannel *self = RED_SMARTCARD_CHANNEL(object);
|
||||
RedsState *reds = red_channel_get_server(RED_CHANNEL(self));
|
||||
RedsState *reds = red_channel_get_server(self);
|
||||
|
||||
G_OBJECT_CLASS(red_smartcard_channel_parent_class)->constructed(object);
|
||||
|
||||
reds_register_channel(reds, RED_CHANNEL(self));
|
||||
reds_register_channel(reds, self);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -253,7 +253,7 @@ static void snd_send(SndChannelClient * client);
|
||||
/* sound channels only support a single client */
|
||||
static SndChannelClient *snd_channel_get_client(SndChannel *channel)
|
||||
{
|
||||
GList *clients = red_channel_get_clients(RED_CHANNEL(channel));
|
||||
GList *clients = red_channel_get_clients(channel);
|
||||
if (clients == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1000,7 +1000,7 @@ void snd_set_playback_latency(RedClient *client, uint32_t latency)
|
||||
SndChannel *now = (SndChannel*) l->data;
|
||||
SndChannelClient *scc = snd_channel_get_client(now);
|
||||
uint32_t type;
|
||||
g_object_get(RED_CHANNEL(now), "channel-type", &type, NULL);
|
||||
g_object_get(now, "channel-type", &type, NULL);
|
||||
if (type == SPICE_CHANNEL_PLAYBACK && scc &&
|
||||
red_channel_client_get_client(scc) == client) {
|
||||
|
||||
@ -1239,7 +1239,7 @@ SPICE_GNUC_VISIBLE uint32_t spice_server_record_get_samples(SpiceRecordInstance
|
||||
|
||||
static void snd_set_rate(SndChannel *channel, uint32_t frequency, uint32_t cap_opus)
|
||||
{
|
||||
RedChannel *red_channel = RED_CHANNEL(channel);
|
||||
RedChannel *red_channel = channel;
|
||||
channel->frequency = frequency;
|
||||
if (red_channel && snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_OPUS, frequency)) {
|
||||
red_channel_set_cap(red_channel, cap_opus);
|
||||
@ -1365,14 +1365,14 @@ static void
|
||||
playback_channel_constructed(GObject *object)
|
||||
{
|
||||
SndChannel *self = SND_CHANNEL(object);
|
||||
RedsState *reds = red_channel_get_server(RED_CHANNEL(self));
|
||||
RedsState *reds = red_channel_get_server(self);
|
||||
|
||||
G_OBJECT_CLASS(playback_channel_parent_class)->constructed(object);
|
||||
|
||||
red_channel_set_cap(RED_CHANNEL(self), SPICE_PLAYBACK_CAP_VOLUME);
|
||||
red_channel_set_cap(self, SPICE_PLAYBACK_CAP_VOLUME);
|
||||
|
||||
add_channel(self);
|
||||
reds_register_channel(reds, RED_CHANNEL(self));
|
||||
reds_register_channel(reds, self);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1411,14 +1411,14 @@ static void
|
||||
record_channel_constructed(GObject *object)
|
||||
{
|
||||
SndChannel *self = SND_CHANNEL(object);
|
||||
RedsState *reds = red_channel_get_server(RED_CHANNEL(self));
|
||||
RedsState *reds = red_channel_get_server(self);
|
||||
|
||||
G_OBJECT_CLASS(record_channel_parent_class)->constructed(object);
|
||||
|
||||
red_channel_set_cap(RED_CHANNEL(self), SPICE_RECORD_CAP_VOLUME);
|
||||
red_channel_set_cap(self, SPICE_RECORD_CAP_VOLUME);
|
||||
|
||||
add_channel(self);
|
||||
reds_register_channel(reds, RED_CHANNEL(self));
|
||||
reds_register_channel(reds, self);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1454,7 +1454,7 @@ static void snd_detach_common(SndChannel *channel)
|
||||
return;
|
||||
}
|
||||
|
||||
red_channel_destroy(RED_CHANNEL(channel));
|
||||
red_channel_destroy(channel);
|
||||
}
|
||||
|
||||
void snd_detach_playback(SpicePlaybackInstance *sin)
|
||||
@ -1475,7 +1475,7 @@ void snd_set_playback_compression(bool on)
|
||||
SndChannel *now = (SndChannel*) l->data;
|
||||
SndChannelClient *client = snd_channel_get_client(now);
|
||||
uint32_t type;
|
||||
g_object_get(RED_CHANNEL(now), "channel-type", &type, NULL);
|
||||
g_object_get(now, "channel-type", &type, NULL);
|
||||
if (type == SPICE_CHANNEL_PLAYBACK && client) {
|
||||
PlaybackChannelClient* playback = PLAYBACK_CHANNEL_CLIENT(client);
|
||||
RedChannelClient *rcc = playback;
|
||||
|
||||
@ -180,12 +180,12 @@ static void
|
||||
red_vmc_channel_constructed(GObject *object)
|
||||
{
|
||||
RedVmcChannel *self = RED_VMC_CHANNEL(object);
|
||||
RedsState *reds = red_channel_get_server(RED_CHANNEL(self));
|
||||
RedsState *reds = red_channel_get_server(self);
|
||||
|
||||
G_OBJECT_CLASS(red_vmc_channel_parent_class)->constructed(object);
|
||||
|
||||
red_channel_init_stat_node(RED_CHANNEL(self), NULL, "spicevmc");
|
||||
const RedStatNode *stat = red_channel_get_stat_node(RED_CHANNEL(self));
|
||||
red_channel_init_stat_node(self, NULL, "spicevmc");
|
||||
const RedStatNode *stat = red_channel_get_stat_node(self);
|
||||
stat_init_counter(&self->in_data, reds, stat, "in_data", TRUE);
|
||||
stat_init_counter(&self->in_compressed, reds, stat, "in_compressed", TRUE);
|
||||
stat_init_counter(&self->in_decompressed, reds, stat, "in_decompressed", TRUE);
|
||||
@ -194,10 +194,10 @@ red_vmc_channel_constructed(GObject *object)
|
||||
stat_init_counter(&self->out_uncompressed, reds, stat, "out_uncompressed", TRUE);
|
||||
|
||||
#ifdef USE_LZ4
|
||||
red_channel_set_cap(RED_CHANNEL(self), SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4);
|
||||
red_channel_set_cap(self, SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4);
|
||||
#endif
|
||||
|
||||
reds_register_channel(reds, RED_CHANNEL(self));
|
||||
reds_register_channel(reds, self);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -426,7 +426,7 @@ static void spicevmc_red_channel_client_on_disconnect(RedChannelClient *rcc)
|
||||
if (red_char_device_client_exists(channel->chardev, client)) {
|
||||
red_char_device_client_remove(channel->chardev, client);
|
||||
} else {
|
||||
red_channel_warning(RED_CHANNEL(channel),
|
||||
red_channel_warning(channel,
|
||||
"client %p have already been removed from char dev %p",
|
||||
client, channel->chardev);
|
||||
}
|
||||
@ -762,7 +762,7 @@ static void spicevmc_connect(RedChannel *channel, RedClient *client,
|
||||
sin = vmc_channel->chardev_sin;
|
||||
|
||||
if (vmc_channel->rcc) {
|
||||
red_channel_warning(RED_CHANNEL(channel),
|
||||
red_channel_warning(channel,
|
||||
"channel client (%p) already connected, refusing second connection",
|
||||
vmc_channel->rcc);
|
||||
// TODO: notify client in advance about the in use channel using
|
||||
@ -852,7 +852,7 @@ red_char_device_spicevmc_dispose(GObject *object)
|
||||
self->channel->chardev = NULL;
|
||||
|
||||
// close all current connections and drop the reference
|
||||
red_channel_destroy(RED_CHANNEL(self->channel));
|
||||
red_channel_destroy(self->channel);
|
||||
self->channel = NULL;
|
||||
}
|
||||
G_OBJECT_CLASS(red_char_device_spicevmc_parent_class)->dispose(object);
|
||||
|
||||
@ -515,7 +515,7 @@ stream_channel_init(StreamChannel *channel)
|
||||
void
|
||||
stream_channel_change_format(StreamChannel *channel, const StreamMsgFormat *fmt)
|
||||
{
|
||||
RedChannel *red_channel = RED_CHANNEL(channel);
|
||||
RedChannel *red_channel = channel;
|
||||
|
||||
// send destroy old stream
|
||||
red_channel_pipes_add_type(red_channel, RED_PIPE_ITEM_TYPE_STREAM_DESTROY);
|
||||
@ -585,7 +585,7 @@ stream_channel_send_data(StreamChannel *channel, const void *data, size_t size,
|
||||
return;
|
||||
}
|
||||
|
||||
RedChannel *red_channel = RED_CHANNEL(channel);
|
||||
RedChannel *red_channel = channel;
|
||||
|
||||
StreamDataItem *item = (StreamDataItem*) g_malloc(sizeof(*item) + size);
|
||||
red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_STREAM_DATA,
|
||||
@ -624,7 +624,7 @@ stream_channel_reset(StreamChannel *channel)
|
||||
uint8_t codecs_buffer[MAX_SUPPORTED_CODECS];
|
||||
} start_msg;
|
||||
StreamMsgStartStop *const start = &start_msg.base;
|
||||
RedChannel *red_channel = RED_CHANNEL(channel);
|
||||
RedChannel *red_channel = channel;
|
||||
|
||||
// send destroy old stream
|
||||
red_channel_pipes_add_type(red_channel, RED_PIPE_ITEM_TYPE_STREAM_DESTROY);
|
||||
|
||||
@ -349,7 +349,7 @@ static void before_reattach_stream(DisplayChannel *display,
|
||||
|
||||
spice_return_if_fail(stream->current);
|
||||
|
||||
if (!red_channel_is_connected(RED_CHANNEL(display))) {
|
||||
if (!red_channel_is_connected(display)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -930,7 +930,7 @@ void video_stream_detach_behind(DisplayChannel *display,
|
||||
Ring *ring = &display->priv->streams;
|
||||
RingItem *item = ring_get_head(ring);
|
||||
DisplayChannelClient *dcc;
|
||||
bool is_connected = red_channel_is_connected(RED_CHANNEL(display));
|
||||
bool is_connected = red_channel_is_connected(display);
|
||||
|
||||
while (item) {
|
||||
VideoStream *stream = SPICE_CONTAINEROF(item, VideoStream, link);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user