[Spice-devel] [PATCH spice-gtk] Send monitor config when enough display channels are connected

Marc-André Lureau mlureau at redhat.com
Thu Jun 11 03:09:38 PDT 2015


Hi Pavel,

The previous approach is better, since it waits until the monitor config is received. Just waiting for channels to be connected would be racy.

----- Original Message -----
> Fixes:
> https://bugs.freedesktop.org/show_bug.cgi?id=90914
> ---
>  src/channel-main.c       |  2 +-
>  src/spice-session-priv.h |  1 +
>  src/spice-session.c      | 25 +++++++++++++++++++++++++
>  3 files changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/src/channel-main.c b/src/channel-main.c
> index fbc41da..6344d0c 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -1425,7 +1425,7 @@ static gboolean timer_set_display(gpointer data)
>  
>      /* ensure we have an explicit monitor configuration at least for
>         number of display channels */
> -    for (i = 0; i < spice_session_get_n_display_channels(session); i++)
> +    for (i = 0; i < spice_session_get_n_connected_display_channels(session);
> i++)
>          if (!c->display[i].enabled_set) {
>              SPICE_DEBUG("Not sending monitors config, missing monitors");
>              return FALSE;
> diff --git a/src/spice-session-priv.h b/src/spice-session-priv.h
> index 049973a..203bbc0 100644
> --- a/src/spice-session-priv.h
> +++ b/src/spice-session-priv.h
> @@ -96,6 +96,7 @@ const guint8* spice_session_get_webdav_magic(SpiceSession
> *session);
>  PhodavServer *spice_session_get_webdav_server(SpiceSession *session);
>  PhodavServer* channel_webdav_server_new(SpiceSession *session);
>  guint spice_session_get_n_display_channels(SpiceSession *session);
> +guint spice_session_get_n_connected_display_channels(SpiceSession *session);
>  void spice_session_set_main_channel(SpiceSession *session, SpiceChannel
>  *channel);
>  gboolean spice_session_set_migration_session(SpiceSession *session,
>  SpiceSession *mig_session);
>  SpiceAudio *spice_audio_get(SpiceSession *session, GMainContext *context);
> diff --git a/src/spice-session.c b/src/spice-session.c
> index 778d82a..5154bcc 100644
> --- a/src/spice-session.c
> +++ b/src/spice-session.c
> @@ -2452,6 +2452,31 @@ guint
> spice_session_get_n_display_channels(SpiceSession *session)
>  }
>  
>  G_GNUC_INTERNAL
> +guint spice_session_get_n_connected_display_channels(SpiceSession *session)
> +{
> +    SpiceSessionPrivate *s;
> +    struct channel *item;
> +    RingItem *ring;
> +    guint channels = 0;
> +
> +    g_return_val_if_fail(SPICE_IS_SESSION(session), 0);
> +    g_return_val_if_fail(session->priv != NULL, 0);
> +
> +    s = session->priv;
> +
> +    for (ring = ring_get_head(&s->channels);
> +         ring != NULL;
> +         ring = ring_next(&s->channels, ring)) {
> +        item = SPICE_CONTAINEROF(ring, struct channel, link);
> +        if (SPICE_IS_DISPLAY_CHANNEL(item->channel) &&
> +            spice_channel_get_state(item->channel) !=
> SPICE_CHANNEL_STATE_UNCONNECTED) {
> +            channels++;
> +        }
> +    }
> +    return channels;
> +}
> +
> +G_GNUC_INTERNAL
>  void spice_session_set_uuid(SpiceSession *session, guint8 uuid[16])
>  {
>      g_return_if_fail(SPICE_IS_SESSION(session));
> --
> 2.4.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list