|
|
ad1357 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
ad1357 |
From: Frediano Ziglio <fziglio@redhat.com>
|
|
|
ad1357 |
Date: Sat, 21 Jan 2017 19:03:11 +0000
|
|
|
ad1357 |
Subject: [spice-server] stream-channel: Allows not fixed size
|
|
|
ad1357 |
|
|
|
ad1357 |
Remove the fixed size stream and support any display size.
|
|
|
ad1357 |
|
|
|
ad1357 |
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
|
|
|
ad1357 |
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
ad1357 |
---
|
|
|
ad1357 |
server/stream-channel.c | 31 +++++++++++++++++++++++++------
|
|
|
ad1357 |
1 file changed, 25 insertions(+), 6 deletions(-)
|
|
|
ad1357 |
|
|
|
ad1357 |
diff --git a/server/stream-channel.c b/server/stream-channel.c
|
|
|
ad1357 |
index 8931d8794..59f566f50 100644
|
|
|
ad1357 |
--- a/server/stream-channel.c
|
|
|
ad1357 |
+++ b/server/stream-channel.c
|
|
|
ad1357 |
@@ -68,6 +68,8 @@ struct StreamChannel {
|
|
|
ad1357 |
/* current video stream id, <0 if not initialized or
|
|
|
ad1357 |
* we are not sending a stream */
|
|
|
ad1357 |
int stream_id;
|
|
|
ad1357 |
+ /* size of the current video stream */
|
|
|
ad1357 |
+ unsigned width, height;
|
|
|
ad1357 |
};
|
|
|
ad1357 |
|
|
|
ad1357 |
struct StreamChannelClass {
|
|
|
ad1357 |
@@ -78,6 +80,7 @@ G_DEFINE_TYPE(StreamChannel, stream_channel, RED_TYPE_CHANNEL)
|
|
|
ad1357 |
|
|
|
ad1357 |
enum {
|
|
|
ad1357 |
RED_PIPE_ITEM_TYPE_SURFACE_CREATE = RED_PIPE_ITEM_TYPE_COMMON_LAST,
|
|
|
ad1357 |
+ RED_PIPE_ITEM_TYPE_SURFACE_DESTROY,
|
|
|
ad1357 |
RED_PIPE_ITEM_TYPE_FILL_SURFACE,
|
|
|
ad1357 |
RED_PIPE_ITEM_TYPE_STREAM_CREATE,
|
|
|
ad1357 |
RED_PIPE_ITEM_TYPE_STREAM_DATA,
|
|
|
ad1357 |
@@ -137,12 +140,12 @@ stream_channel_client_new(StreamChannel *channel, RedClient *client, RedsStream
|
|
|
ad1357 |
}
|
|
|
ad1357 |
|
|
|
ad1357 |
static void
|
|
|
ad1357 |
-fill_base(SpiceMarshaller *m)
|
|
|
ad1357 |
+fill_base(SpiceMarshaller *m, const StreamChannel *channel)
|
|
|
ad1357 |
{
|
|
|
ad1357 |
SpiceMsgDisplayBase base;
|
|
|
ad1357 |
|
|
|
ad1357 |
base.surface_id = PRIMARY_SURFACE_ID;
|
|
|
ad1357 |
- base.box = (SpiceRect) { 0, 0, 1024, 768 };
|
|
|
ad1357 |
+ base.box = (SpiceRect) { 0, 0, channel->width, channel->height };
|
|
|
ad1357 |
base.clip = (SpiceClip) { SPICE_CLIP_TYPE_NONE, NULL };
|
|
|
ad1357 |
|
|
|
ad1357 |
spice_marshall_DisplayBase(m, &base);
|
|
|
ad1357 |
@@ -153,22 +156,29 @@ stream_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
|
|
|
ad1357 |
{
|
|
|
ad1357 |
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
|
|
|
ad1357 |
StreamChannelClient *client = STREAM_CHANNEL_CLIENT(rcc);
|
|
|
ad1357 |
+ StreamChannel *channel = STREAM_CHANNEL(red_channel_client_get_channel(rcc));
|
|
|
ad1357 |
|
|
|
ad1357 |
switch (pipe_item->type) {
|
|
|
ad1357 |
case RED_PIPE_ITEM_TYPE_SURFACE_CREATE: {
|
|
|
ad1357 |
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_CREATE);
|
|
|
ad1357 |
SpiceMsgSurfaceCreate surface_create = {
|
|
|
ad1357 |
PRIMARY_SURFACE_ID,
|
|
|
ad1357 |
- 1024, 768,
|
|
|
ad1357 |
+ channel->width, channel->height,
|
|
|
ad1357 |
SPICE_SURFACE_FMT_32_xRGB, SPICE_SURFACE_FLAGS_PRIMARY
|
|
|
ad1357 |
};
|
|
|
ad1357 |
spice_marshall_msg_display_surface_create(m, &surface_create);
|
|
|
ad1357 |
break;
|
|
|
ad1357 |
}
|
|
|
ad1357 |
+ case RED_PIPE_ITEM_TYPE_SURFACE_DESTROY: {
|
|
|
ad1357 |
+ red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_DESTROY);
|
|
|
ad1357 |
+ SpiceMsgSurfaceDestroy surface_destroy = { PRIMARY_SURFACE_ID };
|
|
|
ad1357 |
+ spice_marshall_msg_display_surface_destroy(m, &surface_destroy);
|
|
|
ad1357 |
+ break;
|
|
|
ad1357 |
+ }
|
|
|
ad1357 |
case RED_PIPE_ITEM_TYPE_FILL_SURFACE: {
|
|
|
ad1357 |
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_FILL);
|
|
|
ad1357 |
|
|
|
ad1357 |
- fill_base(m);
|
|
|
ad1357 |
+ fill_base(m, channel);
|
|
|
ad1357 |
|
|
|
ad1357 |
SpiceFill fill;
|
|
|
ad1357 |
fill.brush = (SpiceBrush) { SPICE_BRUSH_TYPE_SOLID, { .color = 0 } };
|
|
|
ad1357 |
@@ -267,7 +277,7 @@ stream_channel_connect(RedChannel *red_channel, RedClient *red_client, RedsStrea
|
|
|
ad1357 |
// "emulate" dcc_start
|
|
|
ad1357 |
// TODO only if "surface"
|
|
|
ad1357 |
red_channel_client_pipe_add_empty_msg(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES);
|
|
|
ad1357 |
- // TODO pass proper data
|
|
|
ad1357 |
+ // pass proper data
|
|
|
ad1357 |
red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_SURFACE_CREATE);
|
|
|
ad1357 |
// surface data
|
|
|
ad1357 |
red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_FILL_SURFACE);
|
|
|
ad1357 |
@@ -312,6 +322,8 @@ static void
|
|
|
ad1357 |
stream_channel_init(StreamChannel *channel)
|
|
|
ad1357 |
{
|
|
|
ad1357 |
channel->stream_id = -1;
|
|
|
ad1357 |
+ channel->width = 1024;
|
|
|
ad1357 |
+ channel->height = 768;
|
|
|
ad1357 |
}
|
|
|
ad1357 |
|
|
|
ad1357 |
void
|
|
|
ad1357 |
@@ -322,7 +334,14 @@ stream_channel_change_format(StreamChannel *channel, const StreamMsgFormat *fmt)
|
|
|
ad1357 |
// send destroy old stream
|
|
|
ad1357 |
red_channel_pipes_add_type(red_channel, RED_PIPE_ITEM_TYPE_STREAM_DESTROY);
|
|
|
ad1357 |
|
|
|
ad1357 |
- // TODO send new create surface if required
|
|
|
ad1357 |
+ // send new create surface if required
|
|
|
ad1357 |
+ if (channel->width != fmt->width || channel->height != fmt->height) {
|
|
|
ad1357 |
+ channel->width = fmt->width;
|
|
|
ad1357 |
+ channel->height = fmt->height;
|
|
|
ad1357 |
+ red_channel_pipes_add_type(red_channel, RED_PIPE_ITEM_TYPE_SURFACE_DESTROY);
|
|
|
ad1357 |
+ red_channel_pipes_add_type(red_channel, RED_PIPE_ITEM_TYPE_SURFACE_CREATE);
|
|
|
ad1357 |
+ // TODO monitors config ??
|
|
|
ad1357 |
+ }
|
|
|
ad1357 |
|
|
|
ad1357 |
// allocate a new stream id
|
|
|
ad1357 |
channel->stream_id = (channel->stream_id + 1) % NUM_STREAMS;
|