LWN.net Logo

You betray your ignorance of wayland

You betray your ignorance of wayland

Posted May 26, 2012 23:51 UTC (Sat) by butlerm (subscriber, #13312)
In reply to: You betray your ignorance of wayland by sdalley
Parent article: Announcing printerd

>This doesn't mean that remote rendering won't be possible with Wayland, it just means that you will have to put a remote rendering server on top of Wayland. One such server could be the X.org server, but other options include an RDP server, a VNC server or somebody could even invent their own new remote rendering model

This is where I get confused. Presumably, the use of direct-to-Wayland backends with toolkits like GTK and QT will normally make things worse (if not impossible) for remote operation. So are the advantages of Wayland with X layered on top substantial enough that it is a major improvement over the status quo? Or do the real advantages of Wayland only come when you eliminate the X layer in-between?

Furthermore, if Wayland does the compositing and the input arbitration, is it really necessary for X to run out of process in this case? Couldn't you just have libXCB or whatever have multiple backends, one a stub for remote operation using the X protocol, and the other an in-process rasterizer for use with Wayland, etc?


(Log in to post comments)

You betray your ignorance of wayland

Posted May 27, 2012 10:25 UTC (Sun) by Jonno (subscriber, #49613) [Link]

With Wayland (the protocol) there are two possible ways to do remote operation:

Option 1: Remote rendering *on top of* Wayland. In this scenario clients (applications) don't do rendering themselves, but sends rendering commands to the display server, which render the windows and ask the Wayland compositor to display them. This will ofcourse require changes to the clients, or to the toolkit they use. You can use the standard compositor (e.g. Weston) on the display server, but will need a rendering server and protocol as well. One existing solution is to use xserver and X11, but developing a better protocol is a possible future improvement.

Option 2: Remote composition *below* Wayland. In this scenario clients render the windows themselves and ask the local compositor to display them. The local compositor, however, does not, but instead compress the windows and sends them over the network to the display server, which in turn asks its Wayland compositor to display them. This will work with all Wayland clients without modification. You can use the standard compositor (e.g. Weston) on the display server, but will need a proxy compositor and client to forward the windows over the network. This is not yet implemented in production-ready code (though there are abandoned proof-of-concept code for older Wayland versions), but is expected to be the default once done.

Option 2 is often called VNC-like because you send pre-rendered images over the network, but unlike actual VNC, you will get rootless windows that integrate just as well as remote X11 windows, so a better description would be Xpra-like. For most (but not all) applications option 2 will require more bandwidth than option 1, but option 2 will require less roundtrips and are thus not as sensitive to lag (a.k.a. poor ping times).

User of dial-up connections and users on over-saturated local networks might want to deploy option 1 (i.e. no change from today), but most use cases will be better served by option 2 (i.e. better performance than today).

You betray your ignorance of wayland

Posted May 27, 2012 21:12 UTC (Sun) by raven667 (subscriber, #5198) [Link]

Option 2 is probably the better architecture, every client will get it for free and it is the technique that has the most research and work behind it. As far as I know the main protocols (ICA, RDP, PCoIP, SPICE, VNC) are all designed this way at the core and are all using similar optimization techniques and research to reduce bandwidth usage and reduce lag. What kind of rendering protocol is the OnLive service using?

You betray your ignorance of wayland

Posted May 28, 2012 5:52 UTC (Mon) by butlerm (subscriber, #13312) [Link]

RDP is based on T.128, which has the usual set of rendering operations, font and image caching, and so on. I understand that ICA is similar, and so is SPICE. Of course actual implementations may rely more on bitmap updates then the supported rendering commands these days for relatively obvious reasons.

You betray your ignorance of wayland

Posted May 28, 2012 6:43 UTC (Mon) by raven667 (subscriber, #5198) [Link]

> RDP is based on T.128

I'm not sure if that's the chicken or the egg, these protocols (RDP, ICA) have been deployed for more than 20 years and I'm not sure that the standards you references aren't just ex post facto documentation of existing practice.

> the usual set of rendering operations, font and image caching, and so on

One more thing to point out is that all the protocols I listed are add-ons to an existing system (mostly MS Windows) that isn't designed around remoting applications and so has to integrate with an infrastructure designed around local display, the same kind of problems that would need to be solved to remote native Wayland applications.

The methods for local display and remote display have little relation to one another and I think experience has shown that this is a good arrangement, trying to do both with the same method leads to a design that is poor for both cases.

Does any of that sound similar to your understanding of the situation? 8-)

You betray your ignorance of wayland

Posted May 28, 2012 6:33 UTC (Mon) by raven667 (subscriber, #5198) [Link]

> Presumably, the use of direct-to-Wayland backends with toolkits like GTK and QT will normally make things worse (if not impossible) for remote operation.

The existing robust X backends aren't just going to evaporate, the toolkits are already multi-platform and Wayland is just an additional backend.

> So are the advantages of Wayland with X layered on top substantial enough that it is a major improvement over the status quo?

Yes, it takes the hardware handling out of X and leaves it with just the protocol to support existing apps. The hardware handling can be much better done outside of the X framework than within it. X can be much simpler and more robust if it isn't trying to handle the underlying hardware.

> Or do the real advantages of Wayland only come when you eliminate the X layer in-between?

There is probably sufficient advantage even if the only native Wayland client was the X server although in practice toolkits are going to have a direct Wayland option and eliminate the middleman for local display (only).

> Couldn't you just have libXCB or whatever have multiple backends, one a stub for remote operation using the X protocol, and the other an in-process rasterizer for use with Wayland, etc?

I may be talking above my knowledge level but my guess is that X apps and toolkits just aren't architected in a way where that makes any sense. The people who are designing and implementing Wayland are also the ones who designed and maintain X so my guess is that they are aware of the different architectural options and are picking the best ones.

You betray your ignorance of wayland

Posted May 28, 2012 15:59 UTC (Mon) by butlerm (subscriber, #13312) [Link]

>The existing robust X backends aren't just going to evaporate, the toolkits are already multi-platform and Wayland is just an additional backend.

My question here is basically can the toolkit switch dynamically so that the same application binary be run in both X mode or Wayland mode, depending on the runtime environment?

If so, that would be outstanding, if not that could put a major impediment in the deployment of such applications until some form of remote operation is working. I can't see a server distribution standardizing on applications that can't be accessed remotely.

You betray your ignorance of wayland

Posted May 28, 2012 16:19 UTC (Mon) by raven667 (subscriber, #5198) [Link]

I thought the way this was being implemented in the toolkits was to check for environment variables to know which output to use.

You betray your ignorance of wayland

Posted May 28, 2012 17:40 UTC (Mon) by Jonno (subscriber, #49613) [Link]

I don't know about GTK+, but Qt 4.8 and 5.0 autodetects backend at runtime, which can be overridden by a command line argument to the application (i.e. if you have both Wayland and X11 running).

NB: For Qt 4.8 you need to explicitly configure Qt with -qpa to get the new modular backends, the default is X11 only. In Qt 5.0 the hard-coded X11 port will be gone and replaced with a modular xcb backend.

You betray your ignorance of wayland

Posted May 29, 2012 7:51 UTC (Tue) by butlerm (subscriber, #13312) [Link]

Thanks, that is excellent news. Perhaps a little more work than running everything through a generalized version of the XCB API, but accomplishing the same thing nonetheless, and probably more flexible too.

You betray your ignorance of wayland

Posted May 29, 2012 21:53 UTC (Tue) by nix (subscriber, #2304) [Link]

Yeah. If Gtk does that too, most objections to Wayland basically fall away: nobody's likely to implement Wayland-only programs (just as people don't write against raw Xlib these days), and if the toolkits can switch based on an env var or something, the user can choose with whatever granularity is desired between insane blazing performance and remotability (which means I can turn remotability on and forget about Wayland completely).

You betray your ignorance of wayland

Posted May 30, 2012 5:47 UTC (Wed) by aquasync (subscriber, #26654) [Link]

I would expect so, using the GDK_BACKEND environment variable (see the gtk broadway demos).

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds