[Spice-devel] [RFC/POC PATCH spice-gtk 08/16] Remove the n_display_channels check when sending monitors_config

Lukáš Hrázký lhrazky at redhat.com
Tue Jun 5 15:30:34 UTC 2018


We're now always sending the number monitors that we received from all
the display channels' monitors_configs, so this check no longer makes
sense.
---
 src/channel-main.c       | 22 +---------------------
 src/spice-session-priv.h |  3 +--
 src/spice-session.c      | 13 +------------
 3 files changed, 3 insertions(+), 35 deletions(-)

diff --git a/src/channel-main.c b/src/channel-main.c
index a35e9b9..549b4f5 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1493,8 +1493,6 @@ static gboolean timer_set_display(gpointer data)
 {
     SpiceMainChannel *channel = data;
     SpiceMainChannelPrivate *c = channel->priv;
-    SpiceSession *session;
-    gint i;
 
     c->timer_id = 0;
     if (!c->agent_connected)
@@ -1505,24 +1503,6 @@ static gboolean timer_set_display(gpointer data)
         return FALSE;
     }
 
-    session = spice_channel_get_session(SPICE_CHANNEL(channel));
-    GArray *monitor_configs = spice_session_get_monitor_configs(session);
-
-    if (!spice_main_channel_agent_test_capability(channel, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) {
-        /* ensure we have an explicit monitor configuration at least for
-           number of display channels */
-
-        guint n_display_channels = spice_session_get_n_display_channels(session);
-        if (n_display_channels < monitor_configs->len) {
-            SPICE_DEBUG("Not sending monitors config, missing monitors");
-            return FALSE;
-        }
-        for (i = 0; i < n_display_channels; i++)
-            if (g_array_index(monitor_configs, SpiceMonitorConfig, i).display_state == DISPLAY_UNDEFINED) {
-                SPICE_DEBUG("Not sending monitors config, missing monitors");
-                return FALSE;
-            }
-    }
     spice_main_channel_send_monitor_config(channel);
 
     return FALSE;
@@ -1676,7 +1656,7 @@ static void main_handle_init(SpiceChannel *channel, SpiceMsgIn *in)
                    init->current_mouse_mode);
 
     spice_session_set_mm_time(session, init->multi_media_time);
-    spice_session_set_caches_hints(session, init->ram_hint, init->display_channels_hint);
+    spice_session_set_caches_hints(session, init->ram_hint);
 
     c->agent_tokens = init->agent_tokens;
     if (init->agent_connected)
diff --git a/src/spice-session-priv.h b/src/spice-session-priv.h
index 12b0764..104137c 100644
--- a/src/spice-session-priv.h
+++ b/src/spice-session-priv.h
@@ -71,8 +71,7 @@ const gchar* spice_session_get_ca_file(SpiceSession *session);
 void spice_session_get_ca(SpiceSession *session, guint8 **ca, guint *size);
 
 void spice_session_set_caches_hints(SpiceSession *session,
-                                    uint32_t pci_ram_size,
-                                    uint32_t n_display_channels);
+                                    uint32_t pci_ram_size);
 void spice_session_get_caches(SpiceSession *session,
                               display_cache **images,
                               SpiceGlzDecoderWindow **glz_window);
diff --git a/src/spice-session.c b/src/spice-session.c
index c170110..4d60c3f 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -120,7 +120,6 @@ struct _SpiceSessionPrivate {
     int               images_cache_size;
     int               glz_window_size;
     uint32_t          pci_ram_size;
-    uint32_t          n_display_channels;
     guint8            uuid[16];
     gchar             *name;
     SpiceImageCompression preferred_compression;
@@ -2512,15 +2511,13 @@ void spice_session_get_caches(SpiceSession *session,
 
 G_GNUC_INTERNAL
 void spice_session_set_caches_hints(SpiceSession *session,
-                                    uint32_t pci_ram_size,
-                                    uint32_t n_display_channels)
+                                    uint32_t pci_ram_size)
 {
     g_return_if_fail(SPICE_IS_SESSION(session));
 
     SpiceSessionPrivate *s = session->priv;
 
     s->pci_ram_size = pci_ram_size;
-    s->n_display_channels = n_display_channels;
 
     /* TODO: when setting cache and window size, we should consider the client's
      *       available memory and the number of display channels */
@@ -2534,14 +2531,6 @@ void spice_session_set_caches_hints(SpiceSession *session,
     }
 }
 
-G_GNUC_INTERNAL
-guint spice_session_get_n_display_channels(SpiceSession *session)
-{
-    g_return_val_if_fail(session != NULL, 0);
-
-    return session->priv->n_display_channels;
-}
-
 G_GNUC_INTERNAL
 void spice_session_set_uuid(SpiceSession *session, guint8 uuid[16])
 {
-- 
2.17.1



More information about the Spice-devel mailing list