> > This patch updates the display configurations only when needed. > Currently vdagent updates the display configurations almost on every > "VD_AGENT_MONITORS_CONFIG" request, this approach is redundant as some > "VD_AGENT_MONITORS_CONFIG" requests don't apply any change to the > display configurations. > > A good example of why this is needed, is the 'resize-guest' feature of > the spice-widget which when enabled causes the client to send periodic > "VD_AGENT_MONITORS_CONFIG" requests in order to resize the guest even > when no change is required. Prior to this patch the screen would > periodically flicker when using Virt-manager or Spicy due to this issue. > > Signed-off-by: Sameeh Jubran <sameeh@xxxxxxxxxx> Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > vdagent/vdagent.cpp | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp > index b4a3426..cde29e6 100644 > --- a/vdagent/vdagent.cpp > +++ b/vdagent/vdagent.cpp > @@ -644,6 +644,7 @@ bool VDAgent::handle_mon_config(VDAgentMonitorsConfig* > mon_config, uint32_t port > VDAgentMessage* reply_msg; > VDAgentReply* reply; > size_t display_count; > + bool update_displays(false); > > _updating_display_config = true; > > @@ -656,6 +657,7 @@ bool VDAgent::handle_mon_config(VDAgentMonitorsConfig* > mon_config, uint32_t port > if (i >= mon_config->num_of_monitors) { > vd_printf("%d. detached", i); > mode->set_attached(false); > + update_displays = true; > continue; > } > VDAgentMonConfig* mon = &mon_config->monitors[i]; > @@ -663,16 +665,24 @@ bool VDAgent::handle_mon_config(VDAgentMonitorsConfig* > mon_config, uint32_t port > mon->y, !!(mon_config->flags & > VD_AGENT_CONFIG_MONITORS_FLAG_USE_POS)); > if (mon->height == 0 && mon->depth == 0) { > vd_printf("%d. detaching", i); > + update_displays = mode->get_attached() ? true : update_displays; > mode->set_attached(false); > continue; > } > - mode->set_res(mon->width, mon->height, mon->depth); > - if (mon_config->flags & VD_AGENT_CONFIG_MONITORS_FLAG_USE_POS) { > + if (mode->get_height() != mon->height || mode->get_width() != > mon->width || mode->get_depth() != mon->depth) { > + mode->set_res(mon->width, mon->height, mon->depth); > + update_displays = true; > + } > + if (mon_config->flags & VD_AGENT_CONFIG_MONITORS_FLAG_USE_POS && > (mode->get_pos_x() != mon->x || mode->get_pos_y() != mon->y)) { > mode->set_pos(mon->x, mon->y); > + update_displays = true; > + } > + if (!mode->get_attached()) { > + mode->set_attached(true); > + update_displays = true; > } > - mode->set_attached(true); > } > - if (display_count) { > + if (update_displays) { > _desktop_layout->set_displays(); > } > Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel