[PATCH v2] Wait to send monitor config until agent caps are received

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When the first display is disabled and the vdagent is restarted in the guest,
it sometimes becomes enabled. This appears to be caused by a race condition
when an agent becomes connected. When the agent becomes connected, virt-viewer
triggers a display update (spice_main_send_monitor_config()). This display
update happens in a timeout handler, but the timeout interval is set to 0 (so
it behaves basically like an idle handler).

The race happens because spice_main_send_monitor_config() behaves slightly
differently depending on the agent's capabilities. And sometimes the idle
handler runs before the client and server have negotiated capabilities. In this
case, we have to assume that the server does not support sparse monitor
configurations. So instead of sending down an update where display #0 is off
and display #1 is WxH, we send down an update that only a single display:
display #0 is WxH. This results in the first display becoming enabled.

To solve the issue, we wait until the agent negotiates capabilities
before sending the display configuration message.

Resolves: rhbz#1043782, rhbz#1032923
---

Same as previous patch, but removed the fallback 5s timeout on Marc-Andre's
suggestion.

 gtk/channel-main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 7a299a4..905fdb5 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1508,7 +1508,6 @@ static void main_handle_mouse_mode(SpiceChannel *channel, SpiceMsgIn *in)
 static void main_handle_agent_connected(SpiceChannel *channel, SpiceMsgIn *in)
 {
     agent_start(SPICE_MAIN_CHANNEL(channel));
-    update_display_timer(SPICE_MAIN_CHANNEL(channel), 0);
 }
 
 /* coroutine context */
@@ -1519,7 +1518,6 @@ static void main_handle_agent_connected_tokens(SpiceChannel *channel, SpiceMsgIn
 
     c->agent_tokens = msg->num_tokens;
     agent_start(SPICE_MAIN_CHANNEL(channel));
-    update_display_timer(SPICE_MAIN_CHANNEL(channel), 0);
 }
 
 /* coroutine context */
@@ -1790,6 +1788,7 @@ static void main_agent_handle_msg(SpiceChannel *channel,
         }
         c->agent_caps_received = true;
         g_coroutine_signal_emit(self, signals[SPICE_MAIN_AGENT_UPDATE], 0);
+        update_display_timer(SPICE_MAIN_CHANNEL(channel), 0);
 
         if (caps->request)
             agent_announce_caps(self);
-- 
1.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]