[Spice-commits] 5 commits - gtk/channel-display.c gtk/channel-main.c gtk/channel-playback.c gtk/channel-record.c gtk/spice-channel.c gtk/spice-channel.h

Yonit Halperin yhalperi at kemper.freedesktop.org
Thu May 17 06:27:17 PDT 2012


 gtk/channel-display.c  |    9 ++++++++-
 gtk/channel-main.c     |   10 ++++++++--
 gtk/channel-playback.c |   12 +++++++++---
 gtk/channel-record.c   |   12 +++++++++---
 gtk/spice-channel.c    |   19 +++++++++++++++++--
 gtk/spice-channel.h    |    1 +
 6 files changed, 52 insertions(+), 11 deletions(-)

New commits:
commit 8603cc3e9edf8657e3633987011e78dc22579c2c
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Thu May 17 12:03:05 2012 +0300

    record channel: reseting channel caps

diff --git a/gtk/channel-record.c b/gtk/channel-record.c
index d93d908..0ae9e4c 100644
--- a/gtk/channel-record.c
+++ b/gtk/channel-record.c
@@ -89,15 +89,20 @@ static void channel_up(SpiceChannel *channel);
 
 /* ------------------------------------------------------------------ */
 
-static void spice_record_channel_init(SpiceRecordChannel *channel)
+static void spice_record_channel_reset_capabilities(SpiceChannel *channel)
 {
-    channel->priv = SPICE_RECORD_CHANNEL_GET_PRIVATE(channel);
-
     if (!g_getenv("SPICE_DISABLE_CELT"))
         spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_RECORD_CAP_CELT_0_5_1);
     spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_RECORD_CAP_VOLUME);
 }
 
+static void spice_record_channel_init(SpiceRecordChannel *channel)
+{
+    channel->priv = SPICE_RECORD_CHANNEL_GET_PRIVATE(channel);
+
+    spice_record_channel_reset_capabilities(SPICE_CHANNEL(channel));
+}
+
 static void spice_record_channel_finalize(GObject *obj)
 {
     SpiceRecordChannelPrivate *c = SPICE_RECORD_CHANNEL(obj)->priv;
@@ -195,6 +200,7 @@ static void spice_record_channel_class_init(SpiceRecordChannelClass *klass)
     channel_class->handle_msg   = spice_record_handle_msg;
     channel_class->channel_up   = channel_up;
     channel_class->channel_reset = channel_reset;
+    channel_class->channel_reset_capabilities = spice_record_channel_reset_capabilities;
 
     g_object_class_install_property
         (gobject_class, PROP_NCHANNELS,
commit cace46554b216cde5b908380428343ac3ca1db40
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Thu May 17 12:02:28 2012 +0300

    playback channel: reseting channel caps

diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c
index 37b260e..1485267 100644
--- a/gtk/channel-playback.c
+++ b/gtk/channel-playback.c
@@ -83,15 +83,20 @@ static void spice_playback_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg);
 
 /* ------------------------------------------------------------------ */
 
-static void spice_playback_channel_init(SpicePlaybackChannel *channel)
+static void spice_playback_channel_reset_capabilities(SpiceChannel *channel)
 {
-    channel->priv = SPICE_PLAYBACK_CHANNEL_GET_PRIVATE(channel);
-
     if (!g_getenv("SPICE_DISABLE_CELT"))
         spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_PLAYBACK_CAP_CELT_0_5_1);
     spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_PLAYBACK_CAP_VOLUME);
 }
 
+static void spice_playback_channel_init(SpicePlaybackChannel *channel)
+{
+    channel->priv = SPICE_PLAYBACK_CHANNEL_GET_PRIVATE(channel);
+
+    spice_playback_channel_reset_capabilities(SPICE_CHANNEL(channel));
+}
+
 static void spice_playback_channel_finalize(GObject *obj)
 {
     SpicePlaybackChannelPrivate *c = SPICE_PLAYBACK_CHANNEL(obj)->priv;
@@ -184,6 +189,7 @@ static void spice_playback_channel_class_init(SpicePlaybackChannelClass *klass)
 
     channel_class->handle_msg   = spice_playback_handle_msg;
     channel_class->channel_reset = spice_playback_channel_reset;
+    channel_class->channel_reset_capabilities = spice_playback_channel_reset_capabilities;
 
     g_object_class_install_property
         (gobject_class, PROP_NCHANNELS,
commit fb5f68b7eebc593a3c8f5625028eda4aaf7f1ebd
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Thu May 17 11:55:55 2012 +0300

    display channel: reseting channel caps

diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index 578cb03..801d867 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -103,6 +103,7 @@ static void clear_streams(SpiceChannel *channel);
 static display_surface *find_surface(SpiceDisplayChannelPrivate *c, int surface_id);
 static gboolean display_stream_render(display_stream *st);
 static void spice_display_channel_reset(SpiceChannel *channel, gboolean migrating);
+static void spice_display_channel_reset_capabilities(SpiceChannel *channel);
 static void destroy_canvas(display_surface *surface);
 
 /* ------------------------------------------------------------------ */
@@ -206,6 +207,7 @@ static void spice_display_channel_class_init(SpiceDisplayChannelClass *klass)
     channel_class->handle_msg   = spice_display_handle_msg;
     channel_class->channel_up   = spice_display_channel_up;
     channel_class->channel_reset = spice_display_channel_reset;
+    channel_class->channel_reset_capabilities = spice_display_channel_reset_capabilities;
 
     g_object_class_install_property
         (gobject_class, PROP_HEIGHT,
@@ -584,6 +586,11 @@ static HDC create_compatible_dc(void)
 }
 #endif
 
+static void spice_display_channel_reset_capabilities(SpiceChannel *channel)
+{
+    spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_SIZED_STREAM);
+}
+
 static void spice_display_channel_init(SpiceDisplayChannel *channel)
 {
     SpiceDisplayChannelPrivate *c;
@@ -597,7 +604,7 @@ static void spice_display_channel_init(SpiceDisplayChannel *channel)
 #if defined(WIN32)
     c->dc = create_compatible_dc();
 #endif
-    spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_SIZED_STREAM);
+    spice_display_channel_reset_capabilities(SPICE_CHANNEL(channel));
 }
 
 /* ------------------------------------------------------------------ */
commit 6c470ec40b5bdfe9937c34ab3a78ff35045bb770
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Thu May 17 11:29:44 2012 +0300

    main channel: reseting channel caps

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 6d5281e..fc6c97e 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -154,6 +154,12 @@ static const char *agent_caps[] = {
 
 /* ------------------------------------------------------------------ */
 
+static void spice_main_channel_reset_capabilties(SpiceChannel *channel)
+{
+    spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE);
+    spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_MAIN_CAP_NAME_AND_UUID);
+}
+
 static void spice_main_channel_init(SpiceMainChannel *channel)
 {
     SpiceMainChannelPrivate *c;
@@ -161,8 +167,7 @@ static void spice_main_channel_init(SpiceMainChannel *channel)
     c = channel->priv = SPICE_MAIN_CHANNEL_GET_PRIVATE(channel);
     c->agent_msg_queue = g_queue_new();
 
-    spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE);
-    spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_MAIN_CAP_NAME_AND_UUID);
+    spice_main_channel_reset_capabilties(SPICE_CHANNEL(channel));
 }
 
 static void spice_main_get_property(GObject    *object,
@@ -309,6 +314,7 @@ static void spice_main_channel_class_init(SpiceMainChannelClass *klass)
     channel_class->handle_msg    = spice_main_handle_msg;
     channel_class->iterate_write = spice_channel_iterate_write;
     channel_class->channel_reset = spice_main_channel_reset;
+    channel_class->channel_reset_capabilities = spice_main_channel_reset_capabilties;
 
     /**
      * SpiceMainChannel:mouse-mode:
commit abc56811de978ad336a651924a21b920cfe677f0
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Thu May 17 11:23:48 2012 +0300

    Fix not setting channel specific capabilities upon channel reset
    
    Related: rhbz#821795
    
    The capabilities have been zeroed after channel reset, which have lead to
    publish the wrong caps when both port and tls-port are given, and the
    channels are secured (first attempt to connect the channel with "port"
    has failed; the channel got reset, and then reconnected with "tls-port"
    and bad caps). Specifically, the bug causes semi-seamless migration not
    to work when part of the channels are secured.

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 574867c..3cd047d 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -48,6 +48,7 @@ static void spice_channel_write_msg(SpiceChannel *channel, SpiceMsgOut *out);
 static void spice_channel_send_link(SpiceChannel *channel);
 static void channel_disconnect(SpiceChannel *channel);
 static void channel_reset(SpiceChannel *channel, gboolean migrating);
+static void spice_channel_reset_capabilities(SpiceChannel *channel);
 
 /**
  * SECTION:spice-channel
@@ -1147,7 +1148,11 @@ static void spice_channel_send_link(SpiceChannel *channel)
         *(uint32_t *)p = g_array_index(c->caps, uint32_t, i);
         p += sizeof(uint32_t);
     }
-
+    SPICE_DEBUG("channel type %d id %d num common caps %d num caps %d",
+                c->link_msg.channel_type,
+                c->link_msg.channel_id,
+                c->link_msg.num_common_caps,
+                c->link_msg.num_channel_caps);
     spice_channel_write(channel, buffer, p - buffer);
     free(buffer);
 }
@@ -2390,10 +2395,10 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
     g_array_set_size(c->remote_common_caps, 0);
     g_array_set_size(c->remote_caps, 0);
     g_array_set_size(c->common_caps, 0);
-    g_array_set_size(c->caps, 0);
     /* Restore our default capabilities in case the channel gets re-used */
     spice_channel_set_common_capability(channel, SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION);
     spice_channel_set_common_capability(channel, SPICE_COMMON_CAP_MINI_HEADER);
+    spice_channel_reset_capabilities(channel);
 }
 
 /* system or coroutine context */
@@ -2632,3 +2637,13 @@ static void spice_channel_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg)
 
     base_handlers[type](channel, msg);
 }
+
+static void spice_channel_reset_capabilities(SpiceChannel *channel)
+{
+    SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
+    g_array_set_size(c->caps, 0);
+
+    if (SPICE_CHANNEL_GET_CLASS(channel)->channel_reset_capabilities) {
+        SPICE_CHANNEL_GET_CLASS(channel)->channel_reset_capabilities(channel);
+    }
+}
diff --git a/gtk/spice-channel.h b/gtk/spice-channel.h
index 2a8e7e7..f722c99 100644
--- a/gtk/spice-channel.h
+++ b/gtk/spice-channel.h
@@ -78,6 +78,7 @@ struct _SpiceChannelClass
     void (*channel_up)(SpiceChannel *channel);
     void (*iterate_write)(SpiceChannel *channel);
     void (*iterate_read)(SpiceChannel *channel);
+    void (*channel_reset_capabilities)(SpiceChannel *channel);
 
     /*< public >*/
     /* signals, main context */


More information about the Spice-commits mailing list