[Spice-devel] [PATCH 02/26] server/red_channel (all): change send_pipe_item to add marshaller to sig
Alon Levy
alevy at redhat.com
Fri Feb 11 09:48:47 PST 2011
No more direct usage of RedChannel.send_data.marshaller by channels.
---
server/inputs_channel.c | 5 +-
server/main_channel.c | 94 +++++++--------
server/red_channel.c | 2 +-
server/red_channel.h | 2 +-
server/red_tunnel_worker.c | 2 +-
server/red_worker.c | 280 ++++++++++++++++++++++++-------------------
server/smartcard.c | 2 +-
7 files changed, 204 insertions(+), 183 deletions(-)
diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index b61d1f9..79fe2a3 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -252,11 +252,8 @@ static void inputs_channel_release_pipe_item(RedChannel *channel,
free(base);
}
-static void inputs_channel_send_item(RedChannel *channel, PipeItem *base)
+static void inputs_channel_send_item(RedChannel *channel, SpiceMarshaller *m, PipeItem *base)
{
- InputsChannel *inputs_channel = (InputsChannel *)channel;
- SpiceMarshaller *m = inputs_channel->base.send_data.marshaller;
-
red_channel_init_send_data(channel, base->type, base);
switch (base->type) {
case PIPE_ITEM_KEY_MODIFIERS:
diff --git a/server/main_channel.c b/server/main_channel.c
index 695f7f2..96eef75 100644
--- a/server/main_channel.c
+++ b/server/main_channel.c
@@ -280,15 +280,14 @@ static void main_channel_push_channels(MainChannel *main_chan)
red_channel_pipe_add_push(&main_chan->base, &item->base);
}
-static void main_channel_marshall_channels(MainChannel *main_chan)
+static void main_channel_marshall_channels(SpiceMarshaller *m)
{
SpiceMsgChannels* channels_info;
channels_info = (SpiceMsgChannels *)spice_malloc(sizeof(SpiceMsgChannels)
+ reds_num_of_channels() * sizeof(SpiceChannelId));
reds_fill_channels(channels_info);
- spice_marshall_msg_main_channels_list(
- main_chan->base.send_data.marshaller, channels_info);
+ spice_marshall_msg_main_channels_list(m, channels_info);
free(channels_info);
}
@@ -305,13 +304,12 @@ int main_channel_push_ping(Channel *channel, int size)
return TRUE;
}
-static void main_channel_marshall_ping(MainChannel *main_chan, int size)
+static void main_channel_marshall_ping(SpiceMarshaller *m, int size, int ping_id)
{
struct timespec time_space;
SpiceMsgPing ping;
- SpiceMarshaller *m = main_chan->base.send_data.marshaller;
- ping.id = ++main_chan->ping_id;
+ ping.id = ping_id;
clock_gettime(CLOCK_MONOTONIC, &time_space);
ping.timestamp = time_space.tv_sec * 1000000LL + time_space.tv_nsec / 1000LL;
spice_marshall_msg_ping(m, &ping);
@@ -334,7 +332,7 @@ void main_channel_push_mouse_mode(Channel *channel, int current_mode,
red_channel_pipe_add_push(&main_chan->base, &item->base);
}
-static void main_channel_marshall_mouse_mode(MainChannel *main_chan, int current_mode, int is_client_mouse_allowed)
+static void main_channel_marshall_mouse_mode(SpiceMarshaller *m, int current_mode, int is_client_mouse_allowed)
{
SpiceMsgMainMouseMode mouse_mode;
mouse_mode.supported_modes = SPICE_MOUSE_MODE_SERVER;
@@ -342,8 +340,7 @@ static void main_channel_marshall_mouse_mode(MainChannel *main_chan, int current
mouse_mode.supported_modes |= SPICE_MOUSE_MODE_CLIENT;
}
mouse_mode.current_mode = current_mode;
- spice_marshall_msg_main_mouse_mode(main_chan->base.send_data.marshaller,
- &mouse_mode);
+ spice_marshall_msg_main_mouse_mode(m, &mouse_mode);
}
void main_channel_push_agent_connected(Channel *channel)
@@ -364,13 +361,12 @@ void main_channel_push_agent_disconnected(Channel *channel)
red_channel_pipe_add_push(&main_chan->base, &item->base);
}
-static void main_channel_marshall_agent_disconnected(MainChannel *main_chan)
+static void main_channel_marshall_agent_disconnected(SpiceMarshaller *m)
{
SpiceMsgMainAgentDisconnect disconnect;
disconnect.error_code = SPICE_LINK_ERR_OK;
- spice_marshall_msg_main_agent_disconnected(
- main_chan->base.send_data.marshaller, &disconnect);
+ spice_marshall_msg_main_agent_disconnected(m, &disconnect);
}
void main_channel_push_tokens(Channel *channel, uint32_t num_tokens)
@@ -381,13 +377,12 @@ void main_channel_push_tokens(Channel *channel, uint32_t num_tokens)
red_channel_pipe_add_push(&main_chan->base, &item->base);
}
-static void main_channel_marshall_tokens(MainChannel *main_chan, uint32_t num_tokens)
+static void main_channel_marshall_tokens(SpiceMarshaller *m, uint32_t num_tokens)
{
SpiceMsgMainAgentTokens tokens;
tokens.num_tokens = num_tokens;
- spice_marshall_msg_main_agent_token(
- main_chan->base.send_data.marshaller, &tokens);
+ spice_marshall_msg_main_agent_token(m, &tokens);
}
void main_channel_push_agent_data(Channel *channel, uint8_t* data, size_t len,
@@ -400,10 +395,10 @@ void main_channel_push_agent_data(Channel *channel, uint8_t* data, size_t len,
red_channel_pipe_add_push(&main_chan->base, &item->base);
}
-static void main_channel_marshall_agent_data(MainChannel *main_chan,
+static void main_channel_marshall_agent_data(SpiceMarshaller *m,
AgentDataPipeItem *item)
{
- spice_marshaller_add_ref_full(main_chan->base.send_data.marshaller,
+ spice_marshaller_add_ref_full(m,
item->data, item->len, item->free_data, item->opaque);
}
@@ -414,14 +409,13 @@ static void main_channel_push_migrate_data_item(MainChannel *main_chan)
red_channel_pipe_add_push(&main_chan->base, &item->base);
}
-static void main_channel_marshall_migrate_data_item(MainChannel *main_chan)
+static void main_channel_marshall_migrate_data_item(SpiceMarshaller *m, int serial, int ping_id)
{
- SpiceMarshaller *m = main_chan->base.send_data.marshaller;
MainMigrateData *data = (MainMigrateData *)spice_marshaller_reserve_space(m, sizeof(MainMigrateData));
reds_marshall_migrate_data_item(m, data); // TODO: from reds split. ugly separation.
- data->serial = red_channel_get_message_serial(&main_chan->base);
- data->ping_id = main_chan->ping_id;
+ data->serial = serial;
+ data->ping_id = ping_id;
}
static void main_channel_receive_migrate_data(MainChannel *main_chan,
@@ -445,7 +439,7 @@ void main_channel_push_init(Channel *channel, int connection_id,
red_channel_pipe_add_push(&main_chan->base, &item->base);
}
-static void main_channel_marshall_init(MainChannel *main_chan,
+static void main_channel_marshall_init(SpiceMarshaller *m,
InitPipeItem *item)
{
SpiceMsgMainInit init;
@@ -461,7 +455,7 @@ static void main_channel_marshall_init(MainChannel *main_chan,
init.agent_tokens = REDS_AGENT_WINDOW_SIZE;
init.multi_media_time = item->multi_media_time;
init.ram_hint = item->ram_hint;
- spice_marshall_msg_main_init(main_chan->base.send_data.marshaller, &init);
+ spice_marshall_msg_main_init(m, &init);
}
void main_channel_push_notify(Channel *channel, uint8_t *mess, const int mess_len)
@@ -472,10 +466,9 @@ void main_channel_push_notify(Channel *channel, uint8_t *mess, const int mess_le
red_channel_pipe_add_push(&main_chan->base, &item->base);
}
-static void main_channel_marshall_notify(MainChannel *main_chan, NotifyPipeItem *item)
+static void main_channel_marshall_notify(SpiceMarshaller *m, NotifyPipeItem *item)
{
SpiceMsgNotify notify;
- SpiceMarshaller *m = main_chan->base.send_data.marshaller;
notify.time_stamp = get_time_stamp(); // TODO - move to main_new_notify_item
notify.severity = SPICE_NOTIFY_SEVERITY_WARN;
@@ -497,7 +490,7 @@ void main_channel_push_migrate_begin(Channel *channel, int port, int sport,
red_channel_pipe_add_push(&main_chan->base, &item->base);
}
-static void main_channel_marshall_migrate_begin(MainChannel *main_chan,
+static void main_channel_marshall_migrate_begin(SpiceMarshaller *m,
MigrateBeginPipeItem *item)
{
SpiceMsgMainMigrationBegin migrate;
@@ -509,8 +502,7 @@ static void main_channel_marshall_migrate_begin(MainChannel *main_chan,
migrate.pub_key_type = item->cert_pub_key_type;
migrate.pub_key_size = item->cert_pub_key_len;
migrate.pub_key_data = item->cert_pub_key;
- spice_marshall_msg_main_migrate_begin(main_chan->base.send_data.marshaller,
- &migrate);
+ spice_marshall_msg_main_migrate_begin(m, &migrate);
}
void main_channel_push_migrate(Channel *channel)
@@ -521,12 +513,12 @@ void main_channel_push_migrate(Channel *channel)
red_channel_pipe_add_push(&main_chan->base, &item->base);
}
-static void main_channel_marshall_migrate(MainChannel *main_chan)
+static void main_channel_marshall_migrate(SpiceMarshaller *m)
{
SpiceMsgMigrate migrate;
migrate.flags = SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER;
- spice_marshall_msg_migrate(main_chan->base.send_data.marshaller, &migrate);
+ spice_marshall_msg_migrate(m, &migrate);
}
void main_channel_push_migrate_cancel(Channel *channel)
@@ -564,85 +556,85 @@ void main_channel_push_migrate_switch(Channel *channel)
main_migrate_switch_item_new(main_chan));
}
-static void main_channel_marshall_migrate_switch(MainChannel *main_chan)
+static void main_channel_marshall_migrate_switch(SpiceMarshaller *m)
{
SpiceMsgMainMigrationSwitchHost migrate;
red_printf("");
reds_fill_mig_switch(&migrate);
- spice_marshall_msg_main_migrate_switch_host(
- main_chan->base.send_data.marshaller, &migrate);
+ spice_marshall_msg_main_migrate_switch_host(m, &migrate);
reds_mig_release();
}
-static void main_channel_marshall_multi_media_time(MainChannel *main_chan,
+static void main_channel_marshall_multi_media_time(SpiceMarshaller *m,
MultiMediaTimePipeItem *item)
{
SpiceMsgMainMultiMediaTime time_mes;
time_mes.time = item->time;
- spice_marshall_msg_main_multi_media_time(
- main_chan->base.send_data.marshaller, &time_mes);
+ spice_marshall_msg_main_multi_media_time(m, &time_mes);
}
-static void main_channel_send_item(RedChannel *channel, PipeItem *base)
+static void main_channel_send_item(RedChannel *channel, SpiceMarshaller *m, PipeItem *base)
{
MainChannel *main_chan = SPICE_CONTAINEROF(channel, MainChannel, base);
red_channel_init_send_data(channel, base->type, base);
switch (base->type) {
case SPICE_MSG_MAIN_CHANNELS_LIST:
- main_channel_marshall_channels(main_chan);
+ main_channel_marshall_channels(m);
break;
case SPICE_MSG_PING:
- main_channel_marshall_ping(main_chan,
- SPICE_CONTAINEROF(base, PingPipeItem, base)->size);
+ main_channel_marshall_ping(m,
+ SPICE_CONTAINEROF(base, PingPipeItem, base)->size, ++main_chan->ping_id);
break;
case SPICE_MSG_MAIN_MOUSE_MODE:
{
MouseModePipeItem *item =
SPICE_CONTAINEROF(base, MouseModePipeItem, base);
- main_channel_marshall_mouse_mode(main_chan,
+ main_channel_marshall_mouse_mode(m,
item->current_mode, item->is_client_mouse_allowed);
break;
}
case SPICE_MSG_MAIN_AGENT_DISCONNECTED:
- main_channel_marshall_agent_disconnected(main_chan);
+ main_channel_marshall_agent_disconnected(m);
break;
case SPICE_MSG_MAIN_AGENT_TOKEN:
- main_channel_marshall_tokens(main_chan,
+ main_channel_marshall_tokens(m,
SPICE_CONTAINEROF(base, TokensPipeItem, base)->tokens);
break;
case SPICE_MSG_MAIN_AGENT_DATA:
- main_channel_marshall_agent_data(main_chan,
+ main_channel_marshall_agent_data(m,
SPICE_CONTAINEROF(base, AgentDataPipeItem, base));
break;
case SPICE_MSG_MIGRATE_DATA:
- main_channel_marshall_migrate_data_item(main_chan);
+ main_channel_marshall_migrate_data_item(m,
+ red_channel_get_message_serial(&main_chan->base),
+ main_chan->ping_id);
break;
case SPICE_MSG_MAIN_INIT:
- main_channel_marshall_init(main_chan,
+ main_channel_marshall_init(m,
SPICE_CONTAINEROF(base, InitPipeItem, base));
break;
case SPICE_MSG_NOTIFY:
- main_channel_marshall_notify(main_chan,
+ main_channel_marshall_notify(m,
SPICE_CONTAINEROF(base, NotifyPipeItem, base));
break;
case SPICE_MSG_MIGRATE:
- main_channel_marshall_migrate(main_chan);
+ main_channel_marshall_migrate(m);
break;
case SPICE_MSG_MAIN_MIGRATE_BEGIN:
- main_channel_marshall_migrate_begin(main_chan,
+ main_channel_marshall_migrate_begin(m,
SPICE_CONTAINEROF(base, MigrateBeginPipeItem, base));
break;
case SPICE_MSG_MAIN_MULTI_MEDIA_TIME:
- main_channel_marshall_multi_media_time(main_chan,
+ main_channel_marshall_multi_media_time(m,
SPICE_CONTAINEROF(base, MultiMediaTimePipeItem, base));
break;
case SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST:
- main_channel_marshall_migrate_switch(main_chan);
+ main_channel_marshall_migrate_switch(m);
break;
};
red_channel_begin_send_message(channel);
diff --git a/server/red_channel.c b/server/red_channel.c
index fc18b09..b13454a 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -280,7 +280,7 @@ static void red_channel_send_item(RedChannel *channel, PipeItem *item)
return;
}
/* only reached if not handled here */
- channel->send_item(channel, item);
+ channel->send_item(channel, channel->send_data.marshaller, item);
}
static void red_channel_release_item(RedChannel *channel, PipeItem *item, int item_pushed)
diff --git a/server/red_channel.h b/server/red_channel.h
index 8367ff7..299a34c 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -116,7 +116,7 @@ typedef void (*channel_release_msg_recv_buf_proc)(RedChannel *channel,
SpiceDataHeader *msg_header, uint8_t *msg);
typedef void (*channel_disconnect_proc)(RedChannel *channel);
typedef int (*channel_configure_socket_proc)(RedChannel *channel);
-typedef void (*channel_send_pipe_item_proc)(RedChannel *channel, PipeItem *item);
+typedef void (*channel_send_pipe_item_proc)(RedChannel *channel, SpiceMarshaller *m, PipeItem *item);
typedef void (*channel_hold_pipe_item_proc)(RedChannel *channel, PipeItem *item);
typedef void (*channel_release_pipe_item_proc)(RedChannel *channel,
PipeItem *item, int item_pushed);
diff --git a/server/red_tunnel_worker.c b/server/red_tunnel_worker.c
index d481a38..8208086 100644
--- a/server/red_tunnel_worker.c
+++ b/server/red_tunnel_worker.c
@@ -2794,7 +2794,7 @@ static void tunnel_worker_release_socket_out_data(TunnelWorker *worker, PipeItem
}
}
-static void tunnel_channel_send_item(RedChannel *channel, PipeItem *item)
+static void tunnel_channel_send_item(RedChannel *channel, SpiceMarshaller *m, PipeItem *item)
{
TunnelChannel *tunnel_channel = (TunnelChannel *)channel;
diff --git a/server/red_worker.c b/server/red_worker.c
index 57a4cc7..0354b39 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4454,16 +4454,15 @@ static inline void fill_rects_clip(SpiceMarshaller *m, SpiceClipRects *data)
}
}
-static void fill_base(DisplayChannel *display_channel, Drawable *drawable)
+static void fill_base(SpiceMarshaller *base_marshaller, Drawable *drawable)
{
- RedChannel *channel = &display_channel->common.base;
SpiceMsgDisplayBase base;
base.surface_id = drawable->surface_id;
base.box = drawable->red_drawable->bbox;
base.clip = drawable->red_drawable->clip;
- spice_marshall_DisplayBase(channel->send_data.marshaller, &base);
+ spice_marshall_DisplayBase(base_marshaller, &base);
}
static inline void fill_palette(DisplayChannel *display_channel,
@@ -6293,6 +6292,7 @@ static void red_add_lossless_drawable_dependencies(RedWorker *worker,
static void red_send_qxl_draw_fill(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedChannel *channel = &display_channel->common.base;
@@ -6302,9 +6302,9 @@ static void red_send_qxl_draw_fill(RedWorker *worker,
SpiceFill fill;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_FILL, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
fill = drawable->u.fill;
- spice_marshall_Fill(channel->send_data.marshaller,
+ spice_marshall_Fill(base_marshaller,
&fill,
&brush_pat_out,
&mask_bitmap_out);
@@ -6319,6 +6319,7 @@ static void red_send_qxl_draw_fill(RedWorker *worker,
static void red_lossy_send_qxl_draw_fill(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *m,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6347,7 +6348,7 @@ static void red_lossy_send_qxl_draw_fill(RedWorker *worker,
!(brush_is_lossy && (brush_bitmap_data.type == BITMAP_DATA_TYPE_SURFACE))) {
int has_mask = !!drawable->u.fill.mask.bitmap;
- red_send_qxl_draw_fill(worker, display_channel, item);
+ red_send_qxl_draw_fill(worker, display_channel, m, item);
// either the brush operation is opaque, or the dest is not lossy
surface_lossy_region_update(worker, display_channel, item, has_mask, FALSE);
@@ -6375,6 +6376,7 @@ static void red_lossy_send_qxl_draw_fill(RedWorker *worker,
static FillBitsType red_send_qxl_draw_opaque(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item, int src_allowed_lossy)
{
RedChannel *channel = &display_channel->common.base;
@@ -6386,9 +6388,9 @@ static FillBitsType red_send_qxl_draw_opaque(RedWorker *worker,
FillBitsType src_send_type;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_OPAQUE, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
opaque = drawable->u.opaque;
- spice_marshall_Opaque(channel->send_data.marshaller,
+ spice_marshall_Opaque(base_marshaller,
&opaque,
&src_bitmap_out,
&brush_pat_out,
@@ -6407,6 +6409,7 @@ static FillBitsType red_send_qxl_draw_opaque(RedWorker *worker,
static void red_lossy_send_qxl_draw_opaque(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *m,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6438,7 +6441,7 @@ static void red_lossy_send_qxl_draw_opaque(RedWorker *worker,
FillBitsType src_send_type;
int has_mask = !!drawable->u.opaque.mask.bitmap;
- src_send_type = red_send_qxl_draw_opaque(worker, display_channel, item, src_allowed_lossy);
+ src_send_type = red_send_qxl_draw_opaque(worker, display_channel, m, item, src_allowed_lossy);
if (src_send_type == FILL_BITS_TYPE_COMPRESS_LOSSY) {
src_is_lossy = TRUE;
@@ -6471,6 +6474,7 @@ static void red_lossy_send_qxl_draw_opaque(RedWorker *worker,
static FillBitsType red_send_qxl_draw_copy(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item, int src_allowed_lossy)
{
RedChannel *channel = &display_channel->common.base;
@@ -6481,9 +6485,9 @@ static FillBitsType red_send_qxl_draw_copy(RedWorker *worker,
FillBitsType src_send_type;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_COPY, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
copy = drawable->u.copy;
- spice_marshall_Copy(channel->send_data.marshaller,
+ spice_marshall_Copy(base_marshaller,
©,
&src_bitmap_out,
&mask_bitmap_out);
@@ -6496,6 +6500,7 @@ static FillBitsType red_send_qxl_draw_copy(RedWorker *worker,
static void red_lossy_send_qxl_draw_copy(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6507,7 +6512,7 @@ static void red_lossy_send_qxl_draw_copy(RedWorker *worker,
src_is_lossy = is_bitmap_lossy(display_channel, drawable->u.copy.src_bitmap,
&drawable->u.copy.src_area, item, &src_bitmap_data);
- src_send_type = red_send_qxl_draw_copy(worker, display_channel, item, TRUE);
+ src_send_type = red_send_qxl_draw_copy(worker, display_channel, base_marshaller, item, TRUE);
if (src_send_type == FILL_BITS_TYPE_COMPRESS_LOSSY) {
src_is_lossy = TRUE;
@@ -6521,6 +6526,7 @@ static void red_lossy_send_qxl_draw_copy(RedWorker *worker,
static void red_send_qxl_draw_transparent(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedChannel *channel = &display_channel->common.base;
@@ -6529,9 +6535,9 @@ static void red_send_qxl_draw_transparent(RedWorker *worker,
SpiceTransparent transparent;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_TRANSPARENT, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
transparent = drawable->u.transparent;
- spice_marshall_Transparent(channel->send_data.marshaller,
+ spice_marshall_Transparent(base_marshaller,
&transparent,
&src_bitmap_out);
fill_bits(display_channel, src_bitmap_out, transparent.src_bitmap, item, FALSE);
@@ -6539,6 +6545,7 @@ static void red_send_qxl_draw_transparent(RedWorker *worker,
static void red_lossy_send_qxl_draw_transparent(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6549,7 +6556,7 @@ static void red_lossy_send_qxl_draw_transparent(RedWorker *worker,
&drawable->u.transparent.src_area, item, &src_bitmap_data);
if (!src_is_lossy || (src_bitmap_data.type != BITMAP_DATA_TYPE_SURFACE)) {
- red_send_qxl_draw_transparent(worker, display_channel, item);
+ red_send_qxl_draw_transparent(worker, display_channel, base_marshaller, item);
// don't update surface lossy region since transperent areas might be lossy
} else {
@@ -6566,6 +6573,7 @@ static void red_lossy_send_qxl_draw_transparent(RedWorker *worker,
static FillBitsType red_send_qxl_draw_alpha_blend(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item,
int src_allowed_lossy)
{
@@ -6576,9 +6584,9 @@ static FillBitsType red_send_qxl_draw_alpha_blend(RedWorker *worker,
FillBitsType src_send_type;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
alpha_blend = drawable->u.alpha_blend;
- spice_marshall_AlphaBlend(channel->send_data.marshaller,
+ spice_marshall_AlphaBlend(base_marshaller,
&alpha_blend,
&src_bitmap_out);
src_send_type = fill_bits(display_channel, src_bitmap_out, alpha_blend.src_bitmap, item, src_allowed_lossy);
@@ -6588,6 +6596,7 @@ static FillBitsType red_send_qxl_draw_alpha_blend(RedWorker *worker,
static void red_lossy_send_qxl_draw_alpha_blend(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6598,7 +6607,7 @@ static void red_lossy_send_qxl_draw_alpha_blend(RedWorker *worker,
src_is_lossy = is_bitmap_lossy(display_channel, drawable->u.alpha_blend.src_bitmap,
&drawable->u.alpha_blend.src_area, item, &src_bitmap_data);
- src_send_type = red_send_qxl_draw_alpha_blend(worker, display_channel, item, TRUE);
+ src_send_type = red_send_qxl_draw_alpha_blend(worker, display_channel, base_marshaller, item, TRUE);
if (src_send_type == FILL_BITS_TYPE_COMPRESS_LOSSY) {
src_is_lossy = TRUE;
@@ -6613,6 +6622,7 @@ static void red_lossy_send_qxl_draw_alpha_blend(RedWorker *worker,
static void red_send_qxl_copy_bits(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedChannel *channel = &display_channel->common.base;
@@ -6620,14 +6630,15 @@ static void red_send_qxl_copy_bits(RedWorker *worker,
SpicePoint copy_bits;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_COPY_BITS, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
copy_bits = drawable->u.copy_bits.src_pos;
- spice_marshall_Point(channel->send_data.marshaller,
+ spice_marshall_Point(base_marshaller,
©_bits);
}
static void red_lossy_send_qxl_copy_bits(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6637,7 +6648,7 @@ static void red_lossy_send_qxl_copy_bits(RedWorker *worker,
int src_is_lossy;
SpiceRect src_lossy_area;
- red_send_qxl_copy_bits(worker, display_channel, item);
+ red_send_qxl_copy_bits(worker, display_channel, base_marshaller, item);
horz_offset = drawable->u.copy_bits.src_pos.x - drawable->bbox.left;
vert_offset = drawable->u.copy_bits.src_pos.y - drawable->bbox.top;
@@ -6656,6 +6667,7 @@ static void red_lossy_send_qxl_copy_bits(RedWorker *worker,
static void red_send_qxl_draw_blend(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedChannel *channel = &display_channel->common.base;
@@ -6665,9 +6677,9 @@ static void red_send_qxl_draw_blend(RedWorker *worker,
SpiceBlend blend;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_BLEND, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
blend = drawable->u.blend;
- spice_marshall_Blend(channel->send_data.marshaller,
+ spice_marshall_Blend(base_marshaller,
&blend,
&src_bitmap_out,
&mask_bitmap_out);
@@ -6679,6 +6691,7 @@ static void red_send_qxl_draw_blend(RedWorker *worker,
static void red_lossy_send_qxl_draw_blend(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6694,7 +6707,7 @@ static void red_lossy_send_qxl_draw_blend(RedWorker *worker,
if (!dest_is_lossy &&
(!src_is_lossy || (src_bitmap_data.type != BITMAP_DATA_TYPE_SURFACE))) {
- red_send_qxl_draw_blend(worker, display_channel, item);
+ red_send_qxl_draw_blend(worker, display_channel, base_marshaller, item);
} else {
int resend_surface_ids[2];
SpiceRect *resend_areas[2];
@@ -6719,6 +6732,7 @@ static void red_lossy_send_qxl_draw_blend(RedWorker *worker,
static void red_send_qxl_draw_blackness(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedChannel *channel = &display_channel->common.base;
@@ -6727,10 +6741,10 @@ static void red_send_qxl_draw_blackness(RedWorker *worker,
SpiceBlackness blackness;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_BLACKNESS, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
blackness = drawable->u.blackness;
- spice_marshall_Blackness(channel->send_data.marshaller,
+ spice_marshall_Blackness(base_marshaller,
&blackness,
&mask_bitmap_out);
@@ -6739,18 +6753,20 @@ static void red_send_qxl_draw_blackness(RedWorker *worker,
static void red_lossy_send_qxl_draw_blackness(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
int has_mask = !!drawable->u.blackness.mask.bitmap;
- red_send_qxl_draw_blackness(worker, display_channel, item);
+ red_send_qxl_draw_blackness(worker, display_channel, base_marshaller, item);
surface_lossy_region_update(worker, display_channel, item, has_mask, FALSE);
}
static void red_send_qxl_draw_whiteness(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedChannel *channel = &display_channel->common.base;
@@ -6759,10 +6775,10 @@ static void red_send_qxl_draw_whiteness(RedWorker *worker,
SpiceWhiteness whiteness;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_WHITENESS, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
whiteness = drawable->u.whiteness;
- spice_marshall_Whiteness(channel->send_data.marshaller,
+ spice_marshall_Whiteness(base_marshaller,
&whiteness,
&mask_bitmap_out);
@@ -6771,18 +6787,20 @@ static void red_send_qxl_draw_whiteness(RedWorker *worker,
static void red_lossy_send_qxl_draw_whiteness(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
int has_mask = !!drawable->u.whiteness.mask.bitmap;
- red_send_qxl_draw_whiteness(worker, display_channel, item);
+ red_send_qxl_draw_whiteness(worker, display_channel, base_marshaller, item);
surface_lossy_region_update(worker, display_channel, item, has_mask, FALSE);
}
static void red_send_qxl_draw_inverse(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6791,10 +6809,10 @@ static void red_send_qxl_draw_inverse(RedWorker *worker,
SpiceInvers inverse;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_INVERS, NULL);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
inverse = drawable->u.invers;
- spice_marshall_Invers(channel->send_data.marshaller,
+ spice_marshall_Invers(base_marshaller,
&inverse,
&mask_bitmap_out);
@@ -6803,13 +6821,15 @@ static void red_send_qxl_draw_inverse(RedWorker *worker,
static void red_lossy_send_qxl_draw_inverse(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
- red_send_qxl_draw_inverse(worker, display_channel, item);
+ red_send_qxl_draw_inverse(worker, display_channel, base_marshaller, item);
}
static void red_send_qxl_draw_rop3(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6820,9 +6840,9 @@ static void red_send_qxl_draw_rop3(RedWorker *worker,
SpiceMarshaller *mask_bitmap_out;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_ROP3, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
rop3 = drawable->u.rop3;
- spice_marshall_Rop3(channel->send_data.marshaller,
+ spice_marshall_Rop3(base_marshaller,
&rop3,
&src_bitmap_out,
&brush_pat_out,
@@ -6838,6 +6858,7 @@ static void red_send_qxl_draw_rop3(RedWorker *worker,
static void red_lossy_send_qxl_draw_rop3(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6859,7 +6880,7 @@ static void red_lossy_send_qxl_draw_rop3(RedWorker *worker,
(!brush_is_lossy || (brush_bitmap_data.type != BITMAP_DATA_TYPE_SURFACE)) &&
!dest_is_lossy) {
int has_mask = !!drawable->u.rop3.mask.bitmap;
- red_send_qxl_draw_rop3(worker, display_channel, item);
+ red_send_qxl_draw_rop3(worker, display_channel, base_marshaller, item);
surface_lossy_region_update(worker, display_channel, item, has_mask, FALSE);
} else {
@@ -6892,6 +6913,7 @@ static void red_lossy_send_qxl_draw_rop3(RedWorker *worker,
static void red_send_qxl_draw_stroke(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6901,9 +6923,9 @@ static void red_send_qxl_draw_stroke(RedWorker *worker,
SpiceMarshaller *style_out;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_STROKE, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
stroke = drawable->u.stroke;
- spice_marshall_Stroke(channel->send_data.marshaller,
+ spice_marshall_Stroke(base_marshaller,
&stroke,
&style_out,
&brush_pat_out);
@@ -6916,6 +6938,7 @@ static void red_send_qxl_draw_stroke(RedWorker *worker,
static void red_lossy_send_qxl_draw_stroke(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6943,7 +6966,7 @@ static void red_lossy_send_qxl_draw_stroke(RedWorker *worker,
if (!dest_is_lossy &&
(!brush_is_lossy || (brush_bitmap_data.type != BITMAP_DATA_TYPE_SURFACE)))
{
- red_send_qxl_draw_stroke(worker, display_channel, item);
+ red_send_qxl_draw_stroke(worker, display_channel, base_marshaller, item);
} else {
int resend_surface_ids[2];
SpiceRect *resend_areas[2];
@@ -6970,6 +6993,7 @@ static void red_lossy_send_qxl_draw_stroke(RedWorker *worker,
static void red_send_qxl_draw_text(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -6979,9 +7003,9 @@ static void red_send_qxl_draw_text(RedWorker *worker,
SpiceMarshaller *back_brush_pat_out;
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_DRAW_TEXT, &item->pipe_item);
- fill_base(display_channel, item);
+ fill_base(base_marshaller, item);
text = drawable->u.text;
- spice_marshall_Text(channel->send_data.marshaller,
+ spice_marshall_Text(base_marshaller,
&text,
&brush_pat_out,
&back_brush_pat_out);
@@ -6996,6 +7020,7 @@ static void red_send_qxl_draw_text(RedWorker *worker,
static void red_lossy_send_qxl_draw_text(RedWorker *worker,
DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
@@ -7031,7 +7056,7 @@ static void red_lossy_send_qxl_draw_text(RedWorker *worker,
if (!dest_is_lossy &&
(!fg_is_lossy || (fg_bitmap_data.type != BITMAP_DATA_TYPE_SURFACE)) &&
(!bg_is_lossy || (bg_bitmap_data.type != BITMAP_DATA_TYPE_SURFACE))) {
- red_send_qxl_draw_text(worker, display_channel, item);
+ red_send_qxl_draw_text(worker, display_channel, base_marshaller, item);
} else {
int resend_surface_ids[3];
SpiceRect *resend_areas[3];
@@ -7060,47 +7085,47 @@ static void red_lossy_send_qxl_draw_text(RedWorker *worker,
}
static void red_lossy_send_qxl_drawable(RedWorker *worker, DisplayChannel *display_channel,
- Drawable *item)
+ SpiceMarshaller *base_marshaller, Drawable *item)
{
switch (item->red_drawable->type) {
case QXL_DRAW_FILL:
- red_lossy_send_qxl_draw_fill(worker, display_channel, item);
+ red_lossy_send_qxl_draw_fill(worker, display_channel, base_marshaller, item);
break;
case QXL_DRAW_OPAQUE:
- red_lossy_send_qxl_draw_opaque(worker, display_channel, item);
+ red_lossy_send_qxl_draw_opaque(worker, display_channel, base_marshaller, item);
break;
case QXL_DRAW_COPY:
- red_lossy_send_qxl_draw_copy(worker, display_channel, item);
+ red_lossy_send_qxl_draw_copy(worker, display_channel, base_marshaller, item);
break;
case QXL_DRAW_TRANSPARENT:
- red_lossy_send_qxl_draw_transparent(worker, display_channel, item);
+ red_lossy_send_qxl_draw_transparent(worker, display_channel, base_marshaller, item);
break;
case QXL_DRAW_ALPHA_BLEND:
- red_lossy_send_qxl_draw_alpha_blend(worker, display_channel, item);
+ red_lossy_send_qxl_draw_alpha_blend(worker, display_channel, base_marshaller, item);
break;
case QXL_COPY_BITS:
- red_lossy_send_qxl_copy_bits(worker, display_channel, item);
+ red_lossy_send_qxl_copy_bits(worker, display_channel, base_marshaller, item);
break;
case QXL_DRAW_BLEND:
- red_lossy_send_qxl_draw_blend(worker, display_channel, item);
+ red_lossy_send_qxl_draw_blend(worker, display_channel, base_marshaller, item);
break;
case QXL_DRAW_BLACKNESS:
- red_lossy_send_qxl_draw_blackness(worker, display_channel, item);
+ red_lossy_send_qxl_draw_blackness(worker, display_channel, base_marshaller, item);
break;
case QXL_DRAW_WHITENESS:
- red_lossy_send_qxl_draw_whiteness(worker, display_channel, item);
+ red_lossy_send_qxl_draw_whiteness(worker, display_channel, base_marshaller, item);
break;
case QXL_DRAW_INVERS:
- red_lossy_send_qxl_draw_inverse(worker, display_channel, item);
+ red_lossy_send_qxl_draw_inverse(worker, display_channel, base_marshaller, item);
break;
case QXL_DRAW_ROP3:
- red_lossy_send_qxl_draw_rop3(worker, display_channel, item);
+ red_lossy_send_qxl_draw_rop3(worker, display_channel, base_marshaller, item);
break;
case QXL_DRAW_STROKE:
- red_lossy_send_qxl_draw_stroke(worker, display_channel, item);
+ red_lossy_send_qxl_draw_stroke(worker, display_channel, base_marshaller, item);
break;
case QXL_DRAW_TEXT:
- red_lossy_send_qxl_draw_text(worker, display_channel, item);
+ red_lossy_send_qxl_draw_text(worker, display_channel, base_marshaller, item);
break;
default:
red_error("invalid type");
@@ -7113,49 +7138,49 @@ static void red_lossy_send_qxl_drawable(RedWorker *worker, DisplayChannel *displ
}
static inline void red_send_qxl_drawable(RedWorker *worker, DisplayChannel *display_channel,
- Drawable *item)
+ SpiceMarshaller *m, Drawable *item)
{
RedDrawable *drawable = item->red_drawable;
switch (drawable->type) {
case QXL_DRAW_FILL:
- red_send_qxl_draw_fill(worker, display_channel, item);
+ red_send_qxl_draw_fill(worker, display_channel, m, item);
break;
case QXL_DRAW_OPAQUE:
- red_send_qxl_draw_opaque(worker, display_channel, item, FALSE);
+ red_send_qxl_draw_opaque(worker, display_channel, m, item, FALSE);
break;
case QXL_DRAW_COPY:
- red_send_qxl_draw_copy(worker, display_channel, item, FALSE);
+ red_send_qxl_draw_copy(worker, display_channel, m, item, FALSE);
break;
case QXL_DRAW_TRANSPARENT:
- red_send_qxl_draw_transparent(worker, display_channel, item);
+ red_send_qxl_draw_transparent(worker, display_channel, m, item);
break;
case QXL_DRAW_ALPHA_BLEND:
- red_send_qxl_draw_alpha_blend(worker, display_channel, item, FALSE);
+ red_send_qxl_draw_alpha_blend(worker, display_channel, m, item, FALSE);
break;
case QXL_COPY_BITS:
- red_send_qxl_copy_bits(worker, display_channel, item);
+ red_send_qxl_copy_bits(worker, display_channel, m, item);
break;
case QXL_DRAW_BLEND:
- red_send_qxl_draw_blend(worker, display_channel, item);
+ red_send_qxl_draw_blend(worker, display_channel, m, item);
break;
case QXL_DRAW_BLACKNESS:
- red_send_qxl_draw_blackness(worker, display_channel, item);
+ red_send_qxl_draw_blackness(worker, display_channel, m, item);
break;
case QXL_DRAW_WHITENESS:
- red_send_qxl_draw_whiteness(worker, display_channel, item);
+ red_send_qxl_draw_whiteness(worker, display_channel, m, item);
break;
case QXL_DRAW_INVERS:
- red_send_qxl_draw_inverse(worker, display_channel, item);
+ red_send_qxl_draw_inverse(worker, display_channel, m, item);
break;
case QXL_DRAW_ROP3:
- red_send_qxl_draw_rop3(worker, display_channel, item);
+ red_send_qxl_draw_rop3(worker, display_channel, m, item);
break;
case QXL_DRAW_STROKE:
- red_send_qxl_draw_stroke(worker, display_channel, item);
+ red_send_qxl_draw_stroke(worker, display_channel, m, item);
break;
case QXL_DRAW_TEXT:
- red_send_qxl_draw_text(worker, display_channel, item);
+ red_send_qxl_draw_text(worker, display_channel, m, item);
break;
default:
red_error("invalid type");
@@ -7444,7 +7469,8 @@ static int red_rgb16bpp_to_24 (RedWorker *worker, const SpiceRect *src,
return TRUE;
}
-static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable *drawable)
+static inline int red_send_stream_data(DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller, Drawable *drawable)
{
Stream *stream = drawable->stream;
SpiceImage *image;
@@ -7525,8 +7551,8 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
stream_data.id = stream - worker->streams_buf;
stream_data.multi_media_time = drawable->red_drawable->mm_time;
stream_data.data_size = n;
- spice_marshall_msg_display_stream_data(channel->send_data.marshaller, &stream_data);
- spice_marshaller_add_ref(channel->send_data.marshaller,
+ spice_marshall_msg_display_stream_data(base_marshaller, &stream_data);
+ spice_marshaller_add_ref(base_marshaller,
display_channel->send_data.stream_outbuf, n);
display_begin_send_message(display_channel);
@@ -7534,16 +7560,18 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
return TRUE;
}
-static inline void send_qxl_drawable(DisplayChannel *display_channel, Drawable *item)
+static inline void send_qxl_drawable(DisplayChannel *display_channel,
+ SpiceMarshaller *m, Drawable *item)
{
ASSERT(display_channel);
- if (item->stream && red_send_stream_data(display_channel, item)) {
+
+ if (item->stream && red_send_stream_data(display_channel, m, item)) {
return;
}
if (!display_channel->enable_jpeg)
- red_send_qxl_drawable(display_channel->common.worker, display_channel, item);
+ red_send_qxl_drawable(display_channel->common.worker, display_channel, m, item);
else
- red_lossy_send_qxl_drawable(display_channel->common.worker, display_channel, item);
+ red_lossy_send_qxl_drawable(display_channel->common.worker, display_channel, m, item);
}
static inline void red_send_verb(RedChannel *channel, uint16_t verb)
@@ -7560,35 +7588,38 @@ static inline void display_send_verb(DisplayChannel *channel, uint16_t verb)
display_begin_send_message(channel);
}
-static inline void __red_send_inval(RedChannel *channel, CacheItem *cach_item)
+static inline void __red_send_inval(RedChannel *channel,
+ SpiceMarshaller *base_marshaller, CacheItem *cach_item)
{
SpiceMsgDisplayInvalOne inval_one;
red_channel_init_send_data(channel, cach_item->inval_type, NULL);
inval_one.id = *(uint64_t *)&cach_item->id;
- spice_marshall_msg_cursor_inval_one(channel->send_data.marshaller, &inval_one);
+ spice_marshall_msg_cursor_inval_one(base_marshaller, &inval_one);
}
-static void red_send_inval(RedChannel *channel, CacheItem *cach_item)
+static void red_send_inval(RedChannel *channel,
+ SpiceMarshaller *base_marshaller, CacheItem *cach_item)
{
- __red_send_inval(channel, cach_item);
+ __red_send_inval(channel, base_marshaller, cach_item);
red_channel_begin_send_message(channel);
}
-static void red_display_send_inval(DisplayChannel *display_channel, CacheItem *cach_item)
+static void red_display_send_inval(DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller, CacheItem *cach_item)
{
- __red_send_inval((RedChannel *)display_channel, cach_item);
+ __red_send_inval((RedChannel *)display_channel, base_marshaller, cach_item);
display_begin_send_message(display_channel);
}
-static void display_channel_send_migrate(DisplayChannel *display_channel)
+static void display_channel_send_migrate(DisplayChannel *display_channel, SpiceMarshaller *base_marshaller)
{
SpiceMsgMigrate migrate;
red_channel_init_send_data(&display_channel->common.base, SPICE_MSG_MIGRATE, NULL);
migrate.flags = SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER;
- spice_marshall_msg_migrate(display_channel->common.base.send_data.marshaller, &migrate);
+ spice_marshall_msg_migrate(base_marshaller, &migrate);
display_channel->expect_migrate_mark = TRUE;
display_begin_send_message(display_channel);
}
@@ -7662,7 +7693,7 @@ static void display_channel_reset_cache(DisplayChannel *display_channel)
display_begin_send_message(display_channel);
}
-static void red_send_image(DisplayChannel *display_channel, ImageItem *item)
+static void red_send_image(DisplayChannel *display_channel, SpiceMarshaller *m, ImageItem *item)
{
RedChannel *channel;
SpiceImage red_image;
@@ -7723,8 +7754,6 @@ static void red_send_image(DisplayChannel *display_channel, ImageItem *item)
copy.data.mask.pos.y = 0;
copy.data.mask.bitmap = 0;
- SpiceMarshaller *m = channel->send_data.marshaller;
-
spice_marshall_msg_display_draw_copy(m, ©,
&src_bitmap_out, &mask_bitmap_out);
@@ -7800,7 +7829,7 @@ static void red_send_image(DisplayChannel *display_channel, ImageItem *item)
spice_chunks_destroy(chunks);
}
-static void red_display_send_upgrade(DisplayChannel *display_channel, UpgradeItem *item)
+static void red_display_send_upgrade(DisplayChannel *display_channel, SpiceMarshaller *m, UpgradeItem *item)
{
RedChannel *channel;
RedDrawable *red_drawable;
@@ -7823,8 +7852,6 @@ static void red_display_send_upgrade(DisplayChannel *display_channel, UpgradeIte
copy.base.clip.rects = item->rects;
copy.data = red_drawable->u.copy;
- SpiceMarshaller *m = channel->send_data.marshaller;
-
spice_marshall_msg_display_draw_copy(m, ©,
&src_bitmap_out, &mask_bitmap_out);
@@ -7833,7 +7860,8 @@ static void red_display_send_upgrade(DisplayChannel *display_channel, UpgradeIte
display_begin_send_message(display_channel);
}
-static void red_display_send_stream_start(DisplayChannel *display_channel, StreamAgent *agent)
+static void red_display_send_stream_start(DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller, StreamAgent *agent)
{
RedChannel *channel = &display_channel->common.base;
Stream *stream = agent->stream;
@@ -7865,13 +7893,14 @@ static void red_display_send_stream_start(DisplayChannel *display_channel, Strea
stream_create.clip.rects = &clip_rects;
}
- spice_marshall_msg_display_stream_create(channel->send_data.marshaller, &stream_create);
+ spice_marshall_msg_display_stream_create(base_marshaller, &stream_create);
display_begin_send_message(display_channel);
}
static void red_display_send_stream_clip(DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller,
StreamClipItem *item)
{
RedChannel *channel = &display_channel->common.base;
@@ -7888,12 +7917,13 @@ static void red_display_send_stream_clip(DisplayChannel *display_channel,
stream_clip.clip.type = item->clip_type;
stream_clip.clip.rects = item->rects;
- spice_marshall_msg_display_stream_clip(channel->send_data.marshaller, &stream_clip);
+ spice_marshall_msg_display_stream_clip(base_marshaller, &stream_clip);
display_begin_send_message(display_channel);
}
-static void red_display_send_stream_end(DisplayChannel *display_channel, StreamAgent* agent)
+static void red_display_send_stream_end(DisplayChannel *display_channel,
+ SpiceMarshaller *base_marshaller, StreamAgent* agent)
{
RedChannel *channel = &display_channel->common.base;
SpiceMsgDisplayStreamDestroy destroy;
@@ -7901,15 +7931,16 @@ static void red_display_send_stream_end(DisplayChannel *display_channel, StreamA
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_STREAM_DESTROY, NULL);
destroy.id = agent - display_channel->stream_agents;
- spice_marshall_msg_display_stream_destroy(channel->send_data.marshaller, &destroy);
+ spice_marshall_msg_display_stream_destroy(base_marshaller, &destroy);
display_begin_send_message(display_channel);
}
-static void red_cursor_send_inval(CursorChannel *channel, CacheItem *cach_item)
+static void red_cursor_send_inval(CursorChannel *channel,
+ SpiceMarshaller *m, CacheItem *cach_item)
{
ASSERT(channel);
- red_send_inval((RedChannel *)channel, cach_item);
+ red_send_inval((RedChannel *)channel, m, cach_item);
}
static void red_send_cursor_init(CursorChannel *channel)
@@ -7935,7 +7966,8 @@ static void red_send_cursor_init(CursorChannel *channel)
red_channel_begin_send_message(&channel->common.base);
}
-static void red_send_local_cursor(CursorChannel *cursor_channel, LocalCursor *cursor)
+static void red_send_local_cursor(CursorChannel *cursor_channel,
+ SpiceMarshaller *base_marshaller, LocalCursor *cursor)
{
RedChannel *channel;
SpiceMsgCursorSet cursor_set;
@@ -7950,8 +7982,8 @@ static void red_send_local_cursor(CursorChannel *cursor_channel, LocalCursor *cu
cursor_set.visible = worker->cursor_visible;
fill_cursor(cursor_channel, &cursor_set.cursor, &cursor->base, &info);
- spice_marshall_msg_cursor_set(channel->send_data.marshaller, &cursor_set);
- add_buf_from_info(channel, channel->send_data.marshaller, &info);
+ spice_marshall_msg_cursor_set(base_marshaller, &cursor_set);
+ add_buf_from_info(channel, base_marshaller, &info);
red_channel_begin_send_message(channel);
@@ -7969,18 +8001,17 @@ static void cursor_channel_send_migrate(CursorChannel *cursor_channel)
red_channel_begin_send_message((RedChannel*)cursor_channel);
}
-static void red_send_cursor(CursorChannel *cursor_channel, CursorItem *cursor)
+static void red_send_cursor(CursorChannel *cursor_channel,
+ SpiceMarshaller *m, CursorItem *cursor)
{
RedChannel *channel;
RedCursorCmd *cmd;
- SpiceMarshaller *m;
RedWorker *worker;
ASSERT(cursor_channel);
channel = &cursor_channel->common.base;
worker = cursor_channel->common.worker;
- m = channel->send_data.marshaller;
cmd = cursor->red_cursor;
switch (cmd->type) {
@@ -8028,7 +8059,8 @@ static void red_send_cursor(CursorChannel *cursor_channel, CursorItem *cursor)
red_release_cursor(worker, cursor);
}
-static void red_send_surface_create(DisplayChannel *display, SpiceMsgSurfaceCreate *surface_create)
+static void red_send_surface_create(DisplayChannel *display,
+ SpiceMarshaller *base_marshaller, SpiceMsgSurfaceCreate *surface_create)
{
RedChannel *channel;
@@ -8038,12 +8070,13 @@ static void red_send_surface_create(DisplayChannel *display, SpiceMsgSurfaceCrea
region_init(&display->surface_client_lossy_region[surface_create->surface_id]);
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_SURFACE_CREATE, NULL);
- spice_marshall_msg_display_surface_create(channel->send_data.marshaller, surface_create);
+ spice_marshall_msg_display_surface_create(base_marshaller, surface_create);
red_channel_begin_send_message(channel);
}
-static void red_send_surface_destroy(DisplayChannel *display, uint32_t surface_id)
+static void red_send_surface_destroy(DisplayChannel *display,
+ SpiceMarshaller *base_marshaller, uint32_t surface_id)
{
RedChannel *channel;
SpiceMsgSurfaceDestroy surface_destroy;
@@ -8056,12 +8089,12 @@ static void red_send_surface_destroy(DisplayChannel *display, uint32_t surface_i
surface_destroy.surface_id = surface_id;
- spice_marshall_msg_display_surface_destroy(channel->send_data.marshaller, &surface_destroy);
+ spice_marshall_msg_display_surface_destroy(base_marshaller, &surface_destroy);
red_channel_begin_send_message(channel);
}
-static void display_channel_send_item(RedChannel *base, PipeItem *pipe_item)
+static void display_channel_send_item(RedChannel *base, SpiceMarshaller *m, PipeItem *pipe_item)
{
DisplayChannel *display_channel = (DisplayChannel *)red_ref_channel(base);
RedWorker *worker = display_channel->common.worker;
@@ -8070,34 +8103,34 @@ static void display_channel_send_item(RedChannel *base, PipeItem *pipe_item)
switch (pipe_item->type) {
case PIPE_ITEM_TYPE_DRAW: {
Drawable *drawable = SPICE_CONTAINEROF(pipe_item, Drawable, pipe_item);
- send_qxl_drawable(display_channel, drawable);
+ send_qxl_drawable(display_channel, m, drawable);
release_drawable(worker, drawable);
break;
}
case PIPE_ITEM_TYPE_INVAL_ONE:
- red_display_send_inval(display_channel, (CacheItem *)pipe_item);
+ red_display_send_inval(display_channel, m, (CacheItem *)pipe_item);
free(pipe_item);
break;
case PIPE_ITEM_TYPE_STREAM_CREATE: {
StreamAgent *agent = SPICE_CONTAINEROF(pipe_item, StreamAgent, create_item);
- red_display_send_stream_start(display_channel, agent);
+ red_display_send_stream_start(display_channel, m, agent);
red_display_release_stream(display_channel, agent);
break;
}
case PIPE_ITEM_TYPE_STREAM_CLIP: {
StreamClipItem* clip_item = (StreamClipItem *)pipe_item;
- red_display_send_stream_clip(display_channel, clip_item);
+ red_display_send_stream_clip(display_channel, m, clip_item);
red_display_release_stream_clip(display_channel, clip_item);
break;
}
case PIPE_ITEM_TYPE_STREAM_DESTROY: {
StreamAgent *agent = SPICE_CONTAINEROF(pipe_item, StreamAgent, destroy_item);
- red_display_send_stream_end(display_channel, agent);
+ red_display_send_stream_end(display_channel, m, agent);
red_display_release_stream(display_channel, agent);
break;
}
case PIPE_ITEM_TYPE_UPGRADE:
- red_display_send_upgrade(display_channel, (UpgradeItem *)pipe_item);
+ red_display_send_upgrade(display_channel, m, (UpgradeItem *)pipe_item);
release_upgrade_item(worker, (UpgradeItem *)pipe_item);
break;
case PIPE_ITEM_TYPE_VERB:
@@ -8106,7 +8139,7 @@ static void display_channel_send_item(RedChannel *base, PipeItem *pipe_item)
break;
case PIPE_ITEM_TYPE_MIGRATE:
red_printf("PIPE_ITEM_TYPE_MIGRATE");
- display_channel_send_migrate(display_channel);
+ display_channel_send_migrate(display_channel, m);
free(pipe_item);
break;
case PIPE_ITEM_TYPE_MIGRATE_DATA:
@@ -8114,7 +8147,7 @@ static void display_channel_send_item(RedChannel *base, PipeItem *pipe_item)
free(pipe_item);
break;
case PIPE_ITEM_TYPE_IMAGE:
- red_send_image(display_channel, (ImageItem *)pipe_item);
+ red_send_image(display_channel, m, (ImageItem *)pipe_item);
release_image_item((ImageItem *)pipe_item);
break;
case PIPE_ITEM_TYPE_PIXMAP_SYNC:
@@ -8133,14 +8166,14 @@ static void display_channel_send_item(RedChannel *base, PipeItem *pipe_item)
case PIPE_ITEM_TYPE_CREATE_SURFACE: {
SurfaceCreateItem *surface_create = SPICE_CONTAINEROF(pipe_item, SurfaceCreateItem,
pipe_item);
- red_send_surface_create(display_channel, &surface_create->surface_create);
+ red_send_surface_create(display_channel, m, &surface_create->surface_create);
free(surface_create);
break;
}
case PIPE_ITEM_TYPE_DESTROY_SURFACE: {
SurfaceDestroyItem *surface_destroy = SPICE_CONTAINEROF(pipe_item, SurfaceDestroyItem,
pipe_item);
- red_send_surface_destroy(display_channel, surface_destroy->surface_destroy.surface_id);
+ red_send_surface_destroy(display_channel, m, surface_destroy->surface_destroy.surface_id);
free(surface_destroy);
break;
}
@@ -8150,20 +8183,20 @@ static void display_channel_send_item(RedChannel *base, PipeItem *pipe_item)
red_unref_channel(&display_channel->common.base);
}
-static void cursor_channel_send_item(RedChannel *channel, PipeItem *pipe_item)
+static void cursor_channel_send_item(RedChannel *channel, SpiceMarshaller *m, PipeItem *pipe_item)
{
CursorChannel *cursor_channel = SPICE_CONTAINEROF(channel, CursorChannel, common.base);
red_ref_channel(channel);
switch (pipe_item->type) {
case PIPE_ITEM_TYPE_CURSOR:
- red_send_cursor(cursor_channel, (CursorItem *)pipe_item);
+ red_send_cursor(cursor_channel, m, (CursorItem *)pipe_item);
break;
case PIPE_ITEM_TYPE_LOCAL_CURSOR:
- red_send_local_cursor(cursor_channel, (LocalCursor *)pipe_item);
+ red_send_local_cursor(cursor_channel, m, (LocalCursor *)pipe_item);
break;
case PIPE_ITEM_TYPE_INVAL_ONE:
- red_cursor_send_inval(cursor_channel, (CacheItem *)pipe_item);
+ red_cursor_send_inval(cursor_channel, m, (CacheItem *)pipe_item);
free(pipe_item);
break;
case PIPE_ITEM_TYPE_VERB:
@@ -8279,7 +8312,6 @@ static void red_disconnect_channel(RedChannel *channel)
channel->peer = NULL;
channel->send_data.blocked = FALSE;
channel->send_data.size = 0;
- spice_marshaller_reset(channel->send_data.marshaller);
red_unref_channel(channel);
}
diff --git a/server/smartcard.c b/server/smartcard.c
index 8a60711..6d00f08 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -305,7 +305,7 @@ static void smartcard_channel_send_msg(
smartcard_channel_send_data(&smartcard_channel->base, item, msg_item->vheader);
}
-static void smartcard_channel_send_item(RedChannel *channel, PipeItem *item)
+static void smartcard_channel_send_item(RedChannel *channel, SpiceMarshaller *m, PipeItem *item)
{
SmartCardChannel *smartcard_channel = (SmartCardChannel *)channel;
--
1.7.4
More information about the Spice-devel
mailing list