[Spice-devel] [PATCH VDAgent-win] Update the displays only when needed

Sameeh Jubran sameeh at daynix.com
Tue Aug 30 14:55:17 UTC 2016


That's true, I'll fix it thanks :)

On Tue, Aug 30, 2016 at 3:38 PM, Frediano Ziglio <fziglio at redhat.com> wrote:

> >
> > 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.
> >
>
> Patch looks fine however I tried to use it with one monitor on and one
> off and is still virt-manager is still flickering every second
>
> Frediano
>
> > Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
> > ---
> >  vdagent/vdagent.cpp | 20 +++++++++++++++-----
> >  1 file changed, 15 insertions(+), 5 deletions(-)
> >
> > diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
> > index b4a3426..9e16e1f 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,23 +657,32 @@ 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];
> >          vd_printf("%d. %u*%u*%u (%d,%d) %u", i, mon->width, mon->height,
> >          mon->depth, mon->x,
> >                    mon->y, !!(mon_config->flags &
> >                    VD_AGENT_CONFIG_MONITORS_FLAG_USE_POS));
> > -        if (mon->height == 0 && mon->depth == 0) {
> > +        if (mon->height == 0 && mon->depth == 0 &&
> mode->get_attached()) {
> >              vd_printf("%d. detaching", i);
> >              mode->set_attached(false);
> > +            update_displays = true;
> >              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();
> >      }
> >
> > --
> > 2.7.4
> >
> >
>



-- 
Respectfully,
*Sameeh Jubran*
*Linkedin <https://il.linkedin.com/pub/sameeh-jubran/87/747/a8a>*
*Junior Software Engineer @ Daynix <http://www.daynix.com>.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160830/483eac70/attachment.html>


More information about the Spice-devel mailing list