[Spice-devel] [PATCH] RFC: client/x11: reuse existing platform_win

Christophe Fergeau cfergeau at redhat.com
Wed Aug 10 07:03:39 PDT 2011


I reproduced this bug, the patch indeed fixes it (though I'm under the
impression that X uses 100% CPU for several seconds on resolution changes).
What it does also makes sense to me even if I'm no X expert, so ACK from
me.

Christophe

On Thu, Jul 28, 2011 at 06:01:53PM +0200, Marc-André Lureau wrote:
> Each time a {Dynamic,MultyMon}Scren is created, a new platform_win is
> created to receive the notifications from X11. This looks very
> suspicious already. Since I am not a xlib expert, I suppose that each
> window will receive X11 events.
> 
> Whenever XRR ScreenChangeNotify event is received (caused by external
> process), init_monitors() is called and this will recreate new
> platform_wins. And sometime, this event happen in a loop and Xorg
> takes 100% cpu. If only one platform_win is used, the loop doesn't
> happen for me, but seem to still happen for others.
> 
> Related bug:
> https://bugzilla.redhat.com/show_bug.cgi?id=692833
> ---
>  client/x11/platform.cpp |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
> index fe98eae..609898a 100644
> --- a/client/x11/platform.cpp
> +++ b/client/x11/platform.cpp
> @@ -84,7 +84,7 @@ static GLXFBConfig **fb_config = NULL;
>  static XIM x_input_method = NULL;
>  static XIC x_input_context = NULL;
>  
> -static Window platform_win;
> +static Window platform_win = 0;
>  static XContext win_proc_context;
>  static ProcessLoop* main_loop = NULL;
>  static int focus_count = 0;
> @@ -925,6 +925,9 @@ DynamicScreen::DynamicScreen(Display* display, int screen, int& next_mon_id)
>      , _saved_height (get_height())
>      , _out_of_sync (false)
>  {
> +    if (platform_win != 0)
> +        return;
> +
>      X_DEBUG_SYNC(display);
>      //FIXME: replace RootWindow() in other refs as well?
>      XLockDisplay(display);
> @@ -1229,6 +1232,9 @@ MultyMonScreen::MultyMonScreen(Display* display, int screen, int& next_mon_id)
>          throw;
>      }
>  
> +    if (platform_win != 0)
> +        return;
> +
>      XLockDisplay(display);
>      platform_win = XCreateSimpleWindow(display, RootWindow(display, screen), 0, 0, 1, 1, 0, 0, 0);
>      XUnlockDisplay(display);
> -- 
> 1.7.6
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20110810/a96604a4/attachment-0001.pgp>


More information about the Spice-devel mailing list