Live data from Hacker News

Facts about Wayland vs X

phoronix.com

111–120 of 131 posts

Re: Facts about Wayland vs X

#111

What a load of bollocks. Let's tear this apart: > Versioning is handled per client, not per bind. So if your app supports one version of a given extension but your toolkit supports another, you can't predict which version of that extension you will get. Easy solution: open multiple connections. Resources can be shared between connections. (You missed the actual problem with X11 here, which is its current limit of 256…

""Mechanism, not policy" means the X11 core protocol leaves things like window managers and clipboard selection unspecified. (The ICCCM spec takes care of this.) This is sound design." XRotateProperties() XCirculateWindow() XRotateBuffers() XStoreBytes() XStoreBuffer() XFetchBytes() XFetchBuffer() and everything to do about window borders, including how they metastasized into the Shapes extension. http://www.art.net/…

Hey, am I actually arguing with the Don Hopkins? Great!

> If you sit down at a friend's Macintosh, with its single mouse button, you can use it with no problems. If you sit down at a friend's Windows box, with two buttons, you can use it, again with no problems. But just try making sense of a friend's X terminal: three buttons, each one programmed a different way to perform a different function on each different day of the week

Beside that this hasn't been true since the mid '90s, I don't buy this argument, especially from you. Uniformity in interface design begets mediocrity, the same way inbreeding begets genetic disorders. I appreciate X's configurability for the same reason I prefer Linux over Windows: I don't like the Windows GUI model. I find it slow and archaic. I don't want to use a Windows GUI clone when I'm trying to code.

The great thing about X's separation of concerns is that I don't have to: I can run a tiling window manager until my friend comes over, at which point I can switch to GNOME or whatever he prefers, and after he's done, I can switch back.

With Wayland, well, either I have to reboot the entire display compositor (does Wayland do this gracefully?) to replace it with a new one, or I better hope I'm running one of the several compositors that have no doubt been developed which allow pluggable window managers, and that my window manager and his both run on it.

Re: Facts about Wayland vs X

#112

What a load of bollocks. Let's tear this apart: > Versioning is handled per client, not per bind. So if your app supports one version of a given extension but your toolkit supports another, you can't predict which version of that extension you will get. Easy solution: open multiple connections. Resources can be shared between connections. (You missed the actual problem with X11 here, which is its current limit of 256…

I think I'm going to take Daniel Stone's word over yours.

Or you could, y'know, judge the arguments on their face.

Re: Facts about Wayland vs X

#113

Earlier quoted context omitted.

Just put a JavaScript (or whatever) interpreter in the window server, and program the window manager locally in that. Then you aren't fucked by synchronization issues. James Gosling did something like that with PostScript many years ago, an alternative to X11, which was then merged with X11, and it was called NeWS (and later X11/NeWS or OpenWindows): http://en.wikipedia.org/wiki/NeWS I've written several window manag…

I do like the idea of NeWS, but, Then you aren't fucked by synchronization issues. I don't know what you mean by this. The EWMH specifies policy for using the Sync extension to synchronize updates between the window manager and the clients.

It's much harder (and less efficient) to synchronize code running in two different address spaces, communicating via an asynchronous protocol.

NeWS had "synchronous event handlers" that when triggered would block the distribution of all other events (i.e. taking them off of the global event queue, figuring out their target, and putting them on a local event queue), until the synchronous event was handled (typically very quickly by code running in the window server, without any context switches -- but potentially it could send synchronos events to asynchronous network clients and continue to block the distribution of events until the client replied, which is what X11 window managers have to do all the time).

So if a mouse click would remove a window from the screen, the following keyboard events would not get distributed (to the wrong window, and lost) until after the window was removed.

Anything you do that changes the distribution of events (like moving the cursor in or out of a window changes the input focus, manipulating the window hierarchy changes the mapping from event position to window target, etc) needs to have its handler executed BEFORE any other events are distributed.

X11 has always suffered from flakey keyboard input focus tracking, just for this very reason. Of course now that computers are 1.0e+6 times faster than they were when it was developed, it's not as noticeable, and people have been trained (browbeaten) to let things "settle down" before expecting their keyboard events to go to the right window.

But believe me, on a 4 meg diskless Sun 3/50 running X11, Emacs and a C compiler, with expensive context switching and paging over the network, it took a very perceptible (in fact terribly dreadful) amount of time for events to be delivered when you clicked, typed, and moved windows around, and it was a big issue.

Strict guarantees on synchronous event distribution are necessary to implement reliable "mouse ahead", for gestural user interfaces like pie menus, and reliable window management and keyboard input focus tracking.

Having the window manager running as an outboard process, communicating via an asynchronous protocol, is a terrible idea, but is baked into X11 at a very low level -- with the ICCCM thrown in as a kludgy afterthought. The X11 protocol has hacks and band-aids like "mouse button grabs" and "server grabs" to mitigate the problems, but they cause a lot of other problems, complexity and inefficiencies on their own.

From http://en.wikipedia.org/wiki/NeWS:

Like the view system in most GUIs, NeWS included the concept of a tree of embedded views along which events were passed. For instance, a mouse click would generate an event that would be passed to the object directly under the mouse pointer, say a button. If this object did not respond to the event, the object "under" the button would then receive the message, and so on. NeWS included a complete model for these events, including timers and other automatic events, input queues for devices such as mice and keyboards, and other functionality required for full interaction. The input handling system was designed to provide strong event synchronization guarantees that were not possible with asynchronous protocols like X.

From the OLPC mailing list, http://lists.sugarlabs.org/archive/sugar-devel/2007-February...

[sugar] Re: Zoomable tracking protocol for non-windowed Cairo based objects.

The ScriptX tracking service was based on The NeWS Toolkit 2.0's tracking service (written in PostScript), which I adapted for ScriptX. Credit for the design goes to Don Woods, Owen Densmore, Brian Raymor, and other people on the NeWS team, whose goal was to redesign the old NeWS tracking service and toolkit to be smaller and faster.

TNT 2.0 tried to minimize the number of objects, inter-object sends, event manager threads, coordinate transformations, share event interests (patterns to receive events), and centralize event processing in the global event manager.

It also had "safe" input handling, because NeWS threads (like the global event manager) could use synchronous event handlers (when appropriate, but not always), which were guaranteed to block the input queue and run the event handler before any more events were delivered. Synchronous event handlers enabled the window manager to perfectly track and synchronize mouse clicks, input focus and key distribution changes, without losing any events that slip between the cracks from changes in the window hierarchy, event handler registrations, and delays due to paging and network response. Safe input handling is especially important for slow networked computers (like a diskless Sun 3/50 or an OLPC) that need to respond quickly and reliably to user input!

Here is James Gosling's original paper about what was eventually called NeWS: SunDew - A Distributed and Extensible Window System, from Methodology of Window Management (extremely interesting and required reading for anyone interested in window management and the history of user interface management system architecture): http://www.chilton-computing.org.uk/inf/literature/books/wm/...

This idea has very powerful implications within the context of window systems: it provides a graceful way to make the system much more flexible, and it provides some interesting solutions to performance and synchronization problems. SunDew contains a complete implementation of PostScript. The messages that client programs send to SunDew are really PostScript programs. [...]

5.3.3 User Interaction - Input

The key word in the design of the user interaction facilities is flexibility. Almost anything done by the window system preempts a decision about user interaction that a client might want to decide differently. The window system therefore defines almost nothing concrete. It is just a loose collection of facilities bound together by the extension mechanism.

Each possible input action is an event. Events are a general notion that includes buttons going up and down (where buttons can be on keyboards, mice, tablets, or whatever else) and locator motion.

Events are distinguished by where they occur, what happened, and to what. The objects spoken about here are physical, they are the things that a person can manipulate. An example of an event is the E key going down while window 3 is current. This might trigger the transmission of the ASCII code for E to the process that created the window. These bindings between events and actions are very loose, they are easy to change.

The actions to be executed when an event occurs can be specified in a general way, via PostScript. The triggering of an action by the striking of the E key in the previous example invokes a PostScript routine which is responsible for deciding what to do with it. It can do something as simple as sending it in a message to a Unix process, or as complicated as inserting it into a locally maintained document. PostScript procedures control much more than just the interpretation of keystrokes: they can be involved in cursor tracking, constructing the borders around windows, doing window layout, and implementing menus.

Synchronization of input events: we believe that it is necessary to synchronize input events within a user process, and to a certain extent across user processes. For example, the user ought to be able to invoke an operation that causes a window on top to disappear, then begin typing, and be confident about the identity of the recipient of the keystrokes. By having a centralized arbitration point, many of these problems disappear. [...]

Hopgood [Bob Hopgood, Rutherford Appleton Laboratory]: How do you handle input?

Gosling [James Gosling, CMU (Andrew, X10), Sun (SunDew/NeWS, Java)]: Input is also handled completely within PostScript. There are data objects which can provide you with connections to the input devices and what comes along are streams of events and these events can be sent to PostScript processes. A PostScript process can register its interest in an event and specify which canvas (a data object on which a client can draw) and what the region within the canvas is (and that region is specified by a path which is one of these arbitrarily curve-bounded regions) so you can grab events that just cover one circle, for example. In the registration of interest is the event that you are interested in and also a magic tag which is passed in and not interpreted by PostScript, but can be used by the application that handles the event. So you can have processes all over the place handling input events for different windows. There are strong synchronization guarantees for the delivery of events even among multiple processes. There is nothing at all specified about what the protocol is that the client program sees. The idea being that these PostScript processes are responsible for providing whatever the application wants to see. So one set of protocol conversion procedures that you can provide are ones that simply emulate the keyboard and all you will ever get is keyboard events and you will never see the mouse. Quite often mouse events can be handled within PostScript processes for things like moving a window. [...]

Teitelman [Warren Teitelman, Xerox PARC (Smalltalk, DLisp (Interlisp), Interlisp-D, Tajo (Mesa Development Environment), Docs (Cedar), Viewers), Sun (SunView, SunDew/NeWS)]: The innovation here is not that we are using PostScript. The reason we chose PostScript is due to a lot of historical connections and proximity to the people who are doing it. The interesting thing is that all these processes look as though they are executing in one of those old single address environments. It is a single user process that James has been able to implement lightweight processes in. You don't have lightweight processes in Unix systems, which you really need to implement realistic user interfaces.

Gosling: There is really nothing new here. It's just putting it together in a different way.

Rosenthal [David S. H. Rosenthal, CMU (Andrew, X10), Sun (one of the architects of NeWS, and developers of X10 and X11, who wrote the ICCCM)]:

It is worth bringing out a number of points about this style of window manager. There are some real limitations, though I think this is the way we should go.

Some help from the kernel is needed. This is easy in 4.2 which has a sensible IPC. It could be done in System V through shared resources etc.

A reliable signal mechanism is essential. The window manager has to stay up. It is the only routine for talking to the system and hence must stay alive. We have 100 systems running and only experience 1 - 2 crashes per week. This is good by Unix standards!

Applications cannot read pixels back - this is just too slow.

There must be a way to make the client think it has a real terminal, such as the 4.2BSD PTY device, otherwise all old programs misbehave.

There must be a mechanism for downloading application code into the window manager process, for example, rubber band line mouse tracking is done by a user level process. There must be off-screen space in the window manager.

Examples of systems built in this way are:

BLIT [50];

Andrew (CMU)(see Chapter 13);

VGTS (Stanford) [36];

X (MIT).

The BLIT system is successful - people wrote programs for it. I believe it is the only successful window manager for a Unix system.

Myers [Brad Myers, University of Toronto (Peridot), CMU (Garnet, Amulet)]: Maybe that is because BLIT doesn't run a Unix operating system.

Rosenthal: Overall, it is a Unix software environment.

Williams [Tony Williams, Rutherford Appleton Laboratory]: We should bear in mind that Rob Pike says that to do anything sensible using the BLIT, you need to write two processes which communicate: one running in the Unix host and one running in the BUT, and this must be harder to do than, say, writing two programs which don't communicate.

Re: Facts about Wayland vs X

#114
post #108

Earlier quoted context omitted.

""Mechanism, not policy" means the X11 core protocol leaves things like window managers and clipboard selection unspecified. (The ICCCM spec takes care of this.) This is sound design." XRotateProperties() XCirculateWindow() XRotateBuffers() XStoreBytes() XStoreBuffer() XFetchBytes() XFetchBuffer() and everything to do about window borders, including how they metastasized into the Shapes extension. http://www.art.net/…

Maybe moving away from X is really just a cover for moving away from ICCCM? :)

You might be right! The core issue of the ICCCM though is not that it's poorly designed in and of itself, but that it is forced to worked around certain specific deficiencies in the X11 protocol (and by "specific" I mean "easily fixed in the next protocol bump", as opposed to "warrant an entire redesign"). The ICCCM authors even suggest improvements to X11 to make for a more coherent system, but sadly it seems most of them have not yet (25 yrs on…) been implemented.

My overall thesis is that the overall design of X (client/server model, mechanism not policy, extensibility) is a sound one, and that the issues cited by Wayland proponents would be better addressed by an evolution of X than a whole-sale replacement.

Re: Facts about Wayland vs X

#115
post #104
post #101

Earlier quoted context omitted.

Coordinates in the X protocol are signed 16-bit so a screen can run from 0 to 32,767 along an edge. I agree though, the initial complaint is unclear and may be about something else.

Thanks for clarifying. So the following complaint about DPI does not make sense, given that a 50 inches wide screen with a resolution of 600 pixels per inch has 32000 pixels.

OK, I've gone and read the OP's text rather than just the quoted part. It seems he's talking about combining multiple X screens into one logical coordinate space, like I expect one or more of the existing extensions do, e.g. Xinerama.

Re: Facts about Wayland vs X

#116
post #110

Earlier quoted context omitted.

I pasted just the part about ICCCM, because it directly addressed the point I was trying to make, and it doesn't have link anchors. I didn't assume everyone would want to wade through the entire document to get to the part about ICCCM. If most people already read all of that Unix-Haters chapter which I wrote in 1993, then that's news to me. Obviously the guy who repeatedly parroted the 20-some-year-old discredited "M…

I loved the Unix Hater's Handbook. Still have the book, still have the barf bag. Still think it's one of the best books on operating systems design ever written. At least no-one tries to use csh anymore...

[deleted]

Re: Facts about Wayland vs X

#117
post #65
post #51

My issue with Wayland is that it risks being another KDE 4.0 (or another PulseAudio): the hype-machine was started too early in its development cycle and this is creating expectations that are then frustrated in practice. If you're trying to switch people en masse from such an entrenched technology, you must have a killer app ready from day 1. Is there an app that directly benefits from Wayland so much that it will e…

Check out this video of what Wayland can do with the Raspberry Pi GPU. People have tried and failed to get the same performance with X. https://www.youtube.com/watch?feature=player_embedded&v=0UkU...

Is there any reason why that approach wouldn't work on X? I read a few of the articles on it and seems like it could be implemented in X if somebody spent the time writing it.

Re: Facts about Wayland vs X

#118
post #44

Earlier quoted context omitted.

It's usually snappier, because the client has some insight in what it's displaying and so it can accelerate stuff here and there; it also allows for root-less mode, where individual remote windows appear as normal windows to the local OS, rather than being forced to live in a monolithic "remote desktop" window. VNC is basically like a movie player: the local OS doesn't really know what the movie is displaying (in con…

"oh, you're drawing a window, lemme put a nice border on it for you!" -- That is tragically one of the worst, most useless, and rarely used examples you could come up with for something the X server is capable of doing for you (at the expense of a lot of complexity -- read the X SHAPES extension documentation about how it supports shaped window borders) ... as long as you like black-and-white tiled 1 bit deep pixmap…

The point of the example was to show the duplication of efforts between X client and X server, which is actually in lots of places -- drawing borders, drawing backgrounds etc -- in a simple way. I'm not an X developer, I was just an unfortunate user of XFree86 and then Xorg, then I gave up and bought a Mac.

Re: Facts about Wayland vs X

#119
post #82

Earlier quoted context omitted.

You shouldn't believe everything you read. The tone of the article is very suspicious: the author will admit nothing bad about Wayland. In particular you might want to examine the claim that VNC style remoting is better than what X does, or that X remoting is a bad VNC. In actuality VNC is equivalent to the worst-case option X has in terms of rendering. If you wanted something else it's just a bad joke.

Any comment on the fact that now ALL modern X rendering is worst-case? Why bother having all that useless complexity (have you ever read how the SHAPES extension deals with window borders?)?

X's worst-case isn't ever the whole picture. Even if most applications do a lot of drawing in the worst-case mode that doesn't rob them of the richness of communicating more useful detail as well. Even when you're "just" getting a big picture you're still getting something much more than a picture; it's a real window and it's really connected to your X server in a meaningful way. VNC has a real window featuring real pictures of real windows that are really not connected to you.

X is by all means a Rube Goldberg machine and nobody's contesting that. That doesn't mean throwing the baby out with the bath water is the better way to solve the dirty baby problem, even if it is easier—who needs soap when you can just eliminate the baby?

Re: Facts about Wayland vs X

#120

Earlier quoted context omitted.

Any comment on the fact that now ALL modern X rendering is worst-case? Why bother having all that useless complexity (have you ever read how the SHAPES extension deals with window borders?)?

X's worst-case isn't ever the whole picture. Even if most applications do a lot of drawing in the worst-case mode that doesn't rob them of the richness of communicating more useful detail as well. Even when you're "just" getting a big picture you're still getting something much more than a picture; it's a real window and it's really connected to your X server in a meaningful way. VNC has a real window featuring real…

The baby should be able to clean itself, all grown up, educated, gainfully employed, and well on the way to paying off its student loans by now.
Post reply on HN