Xwayland on demand (Re: [PATCH xwayland 3/3] xwayland: Handle the case of windows being realized before redirection)

Olivier Fourdan ofourdan at redhat.com
Wed Jan 16 09:37:55 UTC 2019


On Wed, Jan 16, 2019 at 9:56 AM Olivier Fourdan <ofourdan at redhat.com> wrote:
> On Wed, Jan 16, 2019 at 9:55 AM Olivier Fourdan <ofourdan at redhat.com> wrote:
> >
> > Hi
> >
> > On Wed, Jan 16, 2019 at 9:35 AM Pekka Paalanen <ppaalanen at gmail.com> wrote:
> > >
> > > On Tue, 15 Jan 2019 23:21:05 +0100
> > > Carlos Garnacho <carlosg at gnome.org> wrote:
> > >
> > > > If Xwayland gets to realize a window meant for composition before the
> > > > compositor redirected windows (i.e. redirect mode is not RedirectDrawManual
> > > > yet), the window would stay "invisible" as we wouldn't create a
> > > > wl_surface/wl_shell_surface for it at any later point.
> > > >
> > > > This scenario may happen if the wayland compositor raises Xwayland on
> > > > demand for a X11 client being started. In this case the first data on
> > > > the socket is the client's, the compositor can hardly beat that in
> > > > order to redirect subwindows before the client realizes a Window.
> > > >
> > > > In order to handle this case, allow the late creation of a matching
> > > > (shell) surface for the WindowPtr on SetWindowPixmapProc, so it is ensured
> > > > to be created after the compositor set up redirection.
> > > >
> > > > Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
> > > > ---
> > > >  hw/xwayland/xwayland.c | 37 +++++++++++++++++++++++++++++++++++++
> > > >  hw/xwayland/xwayland.h |  1 +
> > > >  2 files changed, 38 insertions(+)
> > >
> > > Hi Carlos,
> > >
> > > this reminds me of other ordering issues with starting Xwayland on
> > > demand: xrdb. I presume the X resources should be merged before any app
> > > X11 client is processed, so that they see the user's resources at
> > > start-up. AFAIK, that cannot happen if Xwayland is started on-demand.
> > > Either it is too late if app start-up triggers it, or then you launch
> > > Xwayland at desktop start-up, essentially not doing on-demand anymore.
> > > Have you seen people complain about that?
> > >
> > > Could that be fixed somehow?
> > >
> > > Pass the X11 app socket to Xwayland later after the XWM init is
> > > complete? Stall non-XWM clients inside Xwayland by default until XWM is
> > > ready?
> >
> > I am not sure I understand what xwayland-on-demand changes there.
> >
> > Considering "xrdb" is a regular X11 client, it requires a display,
> > hence it must have Xwayland running.
> >
> > If Xwayland is not running (i.e. xrdb is the first X11 client to be
> > started), then Xwayland will be started (as there is a "demand" from a
> > client, the client being xrdb) and other following X11 clients will
> > connect to the same display and have the resources set in xrdb
> > available.
> >
> > I remember Ray (halfline) advocating for Xwayland running xrdb itself
> > at startup to avoid this issue. But that's a bit of a special case for
> > specific X11 client (xrdb) which could be considered as legacy...
> > (like, people may not want to slow down Xwayland startup waiting for
> > xrdb to complete when they don't actually use any X11 application
> > benefiting from the X11 resources database)
>
> There: https://bugzilla.gnome.org/show_bug.cgi?id=769644
>
> > Maybe a more general design of a script being run automatically by
> > Xwayland if present, so that users/distro-maintainers/sysadmins can
> > tailor that startup script at will?

Humm, thinking more about it, it would still be racy, because mutter
for example (and I think weston as well) reckons Xwayland is started
as soon as it writes to the displayfd, so it won't wait for a script
to complete...

So Xwayland would have to differ writing to displayfd until the
"startup" script is complete (while still accepting connections so
that the clients started from the script can run).

Problem, `NotifyParentProcess()` (which writes to the displayfd) is
invoked directly from `dix_main()` so Xwayland doesn't have much
control over that.

Cheers
Olivier


More information about the xorg-devel mailing list