<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1487730539217_66637"><span id="yui_3_16_0_ym19_1_1487730539217_68816">Hi,</span></div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr"><span id="yui_3_16_0_ym19_1_1487730539217_66799"> I'll go against the fix as I don't see any reason for the "assumption".</span></div><div id="yui_3_16_0_ym19_1_1487730539217_66637"><span><br></span></div><div id="yui_3_16_0_ym19_1_1487730539217_66637"><span id="yui_3_16_0_ym19_1_1487730539217_67318"> Let's split the question into 2 things, max monitor number and which monitor is enabled. <br></span></div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr"> The max monitor number seems correct now, controlled by qemu together with qxl. And it's used to control the client menu for monitors.<br></div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr"> The monitor enable should be "remembered" only by the guest OS.while can be controlled by both client and qxl.<br></div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr"> They won't affect each other, and the init-boot/reboot process should be similar:</div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr"> 1. (Re)Boot with primary VGA -- qemu send maxim one monitor with it enabled -- client have 1 window (or close extra ones)<br></div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr"> 2. Qxl loaded (early in guest boot) -- qxl send maxim n monitor with one enabled -- client can have 4 window, but only one enabled<br></div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr"> 3. Guest enable some monitors -- qxl send maxim n monitor with x enabled -- client have corresponding windows enabled (and placed correctly, e.g. onto different monitors)<br></div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr"> Everything looks fine above, but why do we have the bug? The symptom looks as if the guest "forget" to enable the monitor or someone change it. Let's dig it out.</div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr">Regards,</div><div id="yui_3_16_0_ym19_1_1487730539217_66637" dir="ltr">Daimon</div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> On Tuesday, February 21, 2017 1:00 AM, Christophe de Dinechin <christophe@dinechin.org> wrote:<br></font></div> <br><br> <div class="y_msg_container"><div id="yiv5963780766"><div><div class="yiv5963780766">Is it possible to make the max number of monitors something persistent (e.g. set / get that using libvirt), so that the behavior would be consistent between a first boot and a reboot?</div><div class="yiv5963780766"><br class="yiv5963780766"></div><div class="yiv5963780766">Christophe</div><div class="yiv5963780766"><br class="yiv5963780766"></div><div><blockquote type="cite" class="yiv5963780766"><div class="yiv5963780766">On 20 Feb 2017, at 15:49, Jonathon Jongsma <<a rel="nofollow" ymailto="mailto:jjongsma@redhat.com" target="_blank" href="mailto:jjongsma@redhat.com" class="yiv5963780766">jjongsma@redhat.com</a>> wrote:</div><br class="yiv5963780766Apple-interchange-newline"><div class="yiv5963780766"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline;" class="yiv5963780766">On Thu, 2017-02-02 at 10:30 -0600, Jonathon Jongsma wrote:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766">On Thu, 2017-02-02 at 05:29 -0500, Frediano Ziglio wrote:<br class="yiv5963780766"><blockquote type="cite" class="yiv5963780766"><blockquote type="cite" class="yiv5963780766"><br class="yiv5963780766">When a guest is rebooted, the QXL driver gets unloaded at some<br class="yiv5963780766">point in<br class="yiv5963780766">the reboot process. When the driver is unloaded, the spice server<br class="yiv5963780766">sets a<br class="yiv5963780766">single flag to FALSE: RedWorker::driver_cap_monitors_config. This<br class="yiv5963780766">flag<br class="yiv5963780766">indicates whether the driver is capable of sending its own<br class="yiv5963780766">monitors<br class="yiv5963780766">config<br class="yiv5963780766">messages to the client.<br class="yiv5963780766"><br class="yiv5963780766">The only place this flag is used is when a new primary surface is<br class="yiv5963780766">created. If<br class="yiv5963780766">this flag is true, the server assumes that the driver will send<br class="yiv5963780766">its<br class="yiv5963780766">own<br class="yiv5963780766">monitors config very soon after the surface is created. If it's<br class="yiv5963780766">false, the<br class="yiv5963780766">server directly sends its own temporary monitors config message<br class="yiv5963780766">to<br class="yiv5963780766">the client<br class="yiv5963780766">since the driver cannot. This temporary monitors config message<br class="yiv5963780766">is<br class="yiv5963780766">based on<br class="yiv5963780766">the size of the just-created primary surface and always has a<br class="yiv5963780766">maximum monitor<br class="yiv5963780766">count of 1.<br class="yiv5963780766"><br class="yiv5963780766">This flag is initialized to false at startup so that in early<br class="yiv5963780766">boot<br class="yiv5963780766">(e.g. vga<br class="yiv5963780766">text mode), the server will send out these 'temporary' monitor<br class="yiv5963780766">config<br class="yiv5963780766">messages<br class="yiv5963780766">to the client whenever the primary surface is destroyed and re-<br class="yiv5963780766">created. This<br class="yiv5963780766">causes the client to resize its window to match the size of the<br class="yiv5963780766">guest. When<br class="yiv5963780766">the<br class="yiv5963780766">QXL driver is eventually loaded and starts taking over the<br class="yiv5963780766">monitors<br class="yiv5963780766">config<br class="yiv5963780766">responsibilities, we set this flag to true and the server stops<br class="yiv5963780766">sending<br class="yiv5963780766">monitors config messages out on its own.<br class="yiv5963780766"><br class="yiv5963780766">If we reboot and set this flag to false, it will result in the<br class="yiv5963780766">server sending<br class="yiv5963780766">a<br class="yiv5963780766">monitors config message to the client indicating that the guest<br class="yiv5963780766">now<br class="yiv5963780766">supports<br class="yiv5963780766">a<br class="yiv5963780766">maximum of 1 monitor. If the guest happens to have more than one<br class="yiv5963780766">display<br class="yiv5963780766">window<br class="yiv5963780766">open, it will destroy those extra windows because they exceed the<br class="yiv5963780766">maximum<br class="yiv5963780766">allowed number of monitors. This means that if you reboot a guest<br class="yiv5963780766">with 4<br class="yiv5963780766">monitors, after reboot it will only have 1 monitor.<br class="yiv5963780766"><br class="yiv5963780766"></blockquote><br class="yiv5963780766">After reading this paragraph and the bug I don't see the issue.<br class="yiv5963780766">I mean, if on my laptop I reboot when I reboot I get a single<br class="yiv5963780766">monitor<br class="yiv5963780766">till the OS and other stuff kick in. After a reboot the firmware<br class="yiv5963780766">use<br class="yiv5963780766">one monitor or if capable do the mirroring but always the same way.<br class="yiv5963780766"><br class="yiv5963780766">I think the issue is that on first boot the guest activate the<br class="yiv5963780766">additional monitors and the client do the same while on second<br class="yiv5963780766">boot (reboot) not so to me looks like more an issue of the client<br class="yiv5963780766">instead of the server.<br class="yiv5963780766"><br class="yiv5963780766"></blockquote><br class="yiv5963780766">Well, it could be considered a client issue to some extent, but not<br class="yiv5963780766">an<br class="yiv5963780766">easy one to fix. <br class="yiv5963780766"><br class="yiv5963780766"><blockquote type="cite" class="yiv5963780766">I would try to get a network capture to look at DisplayChannel<br class="yiv5963780766">messages if they are more or less the same for first boot and<br class="yiv5963780766">reboot. If they are the same I would look at the client state<br class="yiv5963780766">to check that while booting it's the same.<br class="yiv5963780766"></blockquote><br class="yiv5963780766">The initial boot and the reboot are the same, and that's basically<br class="yiv5963780766">why<br class="yiv5963780766">the problem exists. At initial boot, it brings up a single display.<br class="yiv5963780766">And<br class="yiv5963780766">on reboot, it also brings up a single display. The issue is that we<br class="yiv5963780766">want the reboot to behave differently.<br class="yiv5963780766"><br class="yiv5963780766">Initial boot:<br class="yiv5963780766">-------------<br class="yiv5963780766"> - In early boot, the server sends monitors config message when<br class="yiv5963780766">primary<br class="yiv5963780766">surface is created. monitors=1, max-monitors=1<br class="yiv5963780766"> - client only shows a single window, disables menu items for<br class="yiv5963780766">enabling<br class="yiv5963780766">additional displays because the guest doesn't support more than 1<br class="yiv5963780766"> - When QXL driver is loaded and takes over, it takes over sending<br class="yiv5963780766">monitors config messages. monitors=1, max-monitors=4<br class="yiv5963780766"> - client still shows a single window, but now the menu items for<br class="yiv5963780766">enabling additional menus are enabled<br class="yiv5963780766"> - client enables a second monitor. Client sends monitors-config<br class="yiv5963780766">request to server <br class="yiv5963780766"> - QXL driver enables the second monitor and sends a new monitors-<br class="yiv5963780766">config response to the client. monitors = 2, max-monitors=4<br class="yiv5963780766"><br class="yiv5963780766">Reboot:<br class="yiv5963780766">-------<br class="yiv5963780766"> - At some point in the reboot process while the QXL driver is still<br class="yiv5963780766">loaded, it disables all but the first monitor, but still claims to<br class="yiv5963780766">support more than one. monitors=1, max-monitors=4<br class="yiv5963780766"> - client keeps both display windows open, but the second one just<br class="yiv5963780766">says<br class="yiv5963780766">"Waiting for display 2..."<br class="yiv5963780766"> - eventually the QXL driver gets unloaded, and the<br class="yiv5963780766">RedWorker::driver_cap_monitors_config flag gets set to false<br class="yiv5963780766"> - The next time a primary surface is created (during early boot?)<br class="yiv5963780766">the<br class="yiv5963780766">server sends out a new monitors config message to match the size of<br class="yiv5963780766">the<br class="yiv5963780766">primary surface. monitors=1, max-monitors=1<br class="yiv5963780766"> - the client sees that the guest only supports a single monitor, so<br class="yiv5963780766">it<br class="yiv5963780766">closes that inactive second display window<br class="yiv5963780766"> - when the qxl driver is loaded and takes over, it takes over<br class="yiv5963780766">sending<br class="yiv5963780766">monitors-config messages. monitors=1, max-monitors=4.<br class="yiv5963780766"><br class="yiv5963780766"><br class="yiv5963780766">Before qemu commit 0a2b5e3a7899b40d05d7c6c1c41eb4e64dd2ed4b, the QXL<br class="yiv5963780766">driver never called _unload() during reboot. This meant that during<br class="yiv5963780766">early boot, the server would never send out monitors-config messages<br class="yiv5963780766">with max-monitors=1. So the client would have never closed its extra<br class="yiv5963780766">inactive display windows. They would have simply remained open with a<br class="yiv5963780766">"Waiting for display n..." message. And as soon as the vdagent was<br class="yiv5963780766">reconnected, the client would have sent a new monitors-config request<br class="yiv5963780766">attempting to enable displays for all open windows. But now that<br class="yiv5963780766">doesn't happen because those windows get closed during reboot.<br class="yiv5963780766"><br class="yiv5963780766">So my fix attempts to retain that behavior (while still fixing the<br class="yiv5963780766">bug<br class="yiv5963780766">that was addressed by 0a2b5e3a7899b40d05d7c6c1c41eb4e64dd2ed4b) by<br class="yiv5963780766">keeping the max-monitors value the same as it had been before<br class="yiv5963780766">rebooting. <br class="yiv5963780766"><br class="yiv5963780766">You could possibly argue that you should instead fix this issue in<br class="yiv5963780766">the<br class="yiv5963780766">client by refusing to close/destroy displays when we recieve a<br class="yiv5963780766">monitors-config message with a max-monitors value that is less than<br class="yiv5963780766">the<br class="yiv5963780766"> number of currently-open windows. But the design of the client is<br class="yiv5963780766">such<br class="yiv5963780766">that when we recieve a monitors-config message from the server, we<br class="yiv5963780766">automatically create N Display objects (where N is the value of max-<br class="yiv5963780766">monitors) even if these displays are not yet enabled. The existence<br class="yiv5963780766">of<br class="yiv5963780766">these Display objects determines whether or not the menu for enabling<br class="yiv5963780766">additional displays are enabled, etc. So if we change the client to<br class="yiv5963780766">not<br class="yiv5963780766">destroy extra displays when we receive max-monitors, I fear that we<br class="yiv5963780766">will introduce some additional bugs by violating some hidden<br class="yiv5963780766">assumptions. But we could try it if you think it's a better approach.<br class="yiv5963780766">It would be a more complicated fix, however.<br class="yiv5963780766"></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline;" class="yiv5963780766">Anybody have additional thoughts about this patch?</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766"><br class="yiv5963780766"><br class="yiv5963780766"><blockquote type="cite" class="yiv5963780766"><br class="yiv5963780766"><blockquote type="cite" class="yiv5963780766">To avoid this, we assume that if we had the ability to support<br class="yiv5963780766">multiple<br class="yiv5963780766">monitors at some point, that ability will return at some point.<br class="yiv5963780766">So<br class="yiv5963780766">when the<br class="yiv5963780766">server constructs its own temporary monitors config message to<br class="yiv5963780766">send<br class="yiv5963780766">to the<br class="yiv5963780766">client (when the driver_cap_monitors_config flag is false), we<br class="yiv5963780766">continue to<br class="yiv5963780766">send<br class="yiv5963780766">the previous maximum monitor count instead of always sending a<br class="yiv5963780766">maximum of 1.<br class="yiv5963780766"><br class="yiv5963780766">Resolves: rhbz#1274447<br class="yiv5963780766">---<br class="yiv5963780766"><br class="yiv5963780766">NOTE: this fix is a workaround that assumes some things that may<br class="yiv5963780766">not be valid<br class="yiv5963780766">in all cases. The main assumption is that if the QXL driver was<br class="yiv5963780766">used before<br class="yiv5963780766">the reboot, it will continue to be used after the reboot. If this<br class="yiv5963780766">assumption<br class="yiv5963780766">is<br class="yiv5963780766">violated, the server will continue to report that the guest<br class="yiv5963780766">supports e.g. 4<br class="yiv5963780766">displays even though the driver may only support 1. The client<br class="yiv5963780766">would then be<br class="yiv5963780766">able to attempt to enable additional displays, which would<br class="yiv5963780766">inevitably fail<br class="yiv5963780766">without explanation. This is not a huge problem, but maybe it's<br class="yiv5963780766">not<br class="yiv5963780766">acceptable. If it's not acceptable, I think that fixing this bug<br class="yiv5963780766">would<br class="yiv5963780766">require<br class="yiv5963780766">significantly more work and may not be worth the effort.<br class="yiv5963780766"><br class="yiv5963780766"> server/display-channel.c | 7 +++++--<br class="yiv5963780766"> 1 file changed, 5 insertions(+), 2 deletions(-)<br class="yiv5963780766"><br class="yiv5963780766">diff --git a/server/display-channel.c b/server/display-channel.c<br class="yiv5963780766">index a554bfd..88ee194 100644<br class="yiv5963780766">--- a/server/display-channel.c<br class="yiv5963780766">+++ b/server/display-channel.c<br class="yiv5963780766">@@ -2459,15 +2459,18 @@ void<br class="yiv5963780766">display_channel_set_monitors_config_to_primary(DisplayChannel<br class="yiv5963780766">*display)<br class="yiv5963780766"> {<br class="yiv5963780766"> DrawContext *context = &display->priv->surfaces[0].context;<br class="yiv5963780766"> QXLHead head = { 0, };<br class="yiv5963780766">+ uint16_t old_max = 1;<br class="yiv5963780766"> <br class="yiv5963780766"> spice_return_if_fail(display->priv-<br class="yiv5963780766"><blockquote type="cite" class="yiv5963780766">surfaces[0].context.canvas);<br class="yiv5963780766"></blockquote><br class="yiv5963780766"> <br class="yiv5963780766">- if (display->priv->monitors_config)<br class="yiv5963780766">+ if (display->priv->monitors_config) {<br class="yiv5963780766">+ old_max = display->priv->monitors_config->max_allowed;<br class="yiv5963780766"> monitors_config_unref(display->priv->monitors_config);<br class="yiv5963780766">+ }<br class="yiv5963780766"> <br class="yiv5963780766"> head.width = context->width;<br class="yiv5963780766"> head.height = context->height;<br class="yiv5963780766">- display->priv->monitors_config = monitors_config_new(&head,<br class="yiv5963780766">1,<br class="yiv5963780766">1);<br class="yiv5963780766">+ display->priv->monitors_config = monitors_config_new(&head,<br class="yiv5963780766">1,<br class="yiv5963780766">old_max);<br class="yiv5963780766"> }<br class="yiv5963780766"> <br class="yiv5963780766"> void display_channel_reset_image_cache(DisplayChannel *self)<br class="yiv5963780766"></blockquote><br class="yiv5963780766">Frediano<br class="yiv5963780766"></blockquote><br class="yiv5963780766">_______________________________________________<br class="yiv5963780766">Spice-devel mailing list<br class="yiv5963780766"><a rel="nofollow" ymailto="mailto:Spice-devel@lists.freedesktop.org" target="_blank" href="mailto:Spice-devel@lists.freedesktop.org" class="yiv5963780766">Spice-devel@lists.freedesktop.org</a><br class="yiv5963780766">https://lists.freedesktop.org/mailman/listinfo/spice-devel<br class="yiv5963780766"></blockquote><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline;" class="yiv5963780766">_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline;" class="yiv5963780766">Spice-devel mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766"><a rel="nofollow" ymailto="mailto:Spice-devel@lists.freedesktop.org" target="_blank" href="mailto:Spice-devel@lists.freedesktop.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766">Spice-devel@lists.freedesktop.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766"><a rel="nofollow" target="_blank" href="https://lists.freedesktop.org/mailman/listinfo/spice-devel" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" class="yiv5963780766">https://lists.freedesktop.org/mailman/listinfo/spice-devel</a></div></blockquote></div><br class="yiv5963780766"></div></div><br>_______________________________________________<br>Spice-devel mailing list<br><a ymailto="mailto:Spice-devel@lists.freedesktop.org" href="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.org</a><br><a href="https://lists.freedesktop.org/mailman/listinfo/spice-devel" target="_blank">https://lists.freedesktop.org/mailman/listinfo/spice-devel</a><br><br><br></div> </div> </div> </div></div></body></html>