Live data from Hacker News

Understanding the working of X11 from the ground up (2017)

magcius.github.io

81–90 of 134 posts

Re: Understanding the working of X11 from the ground up (2017)

#81
post #19

Money Quote: > So, a lot of the design of X11 is giving clients and apps a large set of tools to design and implement their app, without any real opinionated design about how an app should be made. An X client can use this tool or that tool to battle this tradeoff or that tradeoffs, and neither is fundamentally a wrong choice. That is something that can not be said about Wayland. Besides the "every frame is perfect"…

I run a Arch with the newest GPU drivers and the Compton compositor. I still have significant screen tearing in every app except video games with v-sync enabled and mpv with the vulkan backend.

This is your video driver's fault not X's.

Re: Understanding the working of X11 from the ground up (2017)

#82
Looking over this stuff, I get an uneasy feeling. X was a brilliant solution to problems 35 years ago, where you barely had enough memory for a full frame buffer and the graphics model was primitive (no antialiasing or transparency). From what I've seen, Wayland is a good solution for the model maybe 15 years ago, where you're willing to accept the frame-and-a-half latency hit from having a compositor in the path.

Basically, my question is whether anybody is working on a solution for the hardware we have today, where there are hardware overlays, the GPU throughput is orders of magnitude higher than what's needed to composite a desktop, but we still care about memory bandwidth, largely because all of resolution, bit depth, and frame rate is still going up. And you really want to be able to schedule every pixel that gets presented with a high degree of timing accuracy.

I've become familiar with Windows, but feel like it's a bunch of hacks. They will promote a window to an overlay, but it's all a heuristic, and I'm pretty sure latency will stutter while it does the transition in and out. And the new flip-model stuff actually regresses the ability to do smooth window resizing.

I'm not even sure macOS is working on lowering latency. I haven't seen any mention from them of hardware overlays.

Most of the attention these days seems to be in the VR/AR space, where latency is obviously important, and there's more of a green field with respect to legacy compatibility, but I'd love to see this problem space actually solved on the desktop. Doing this right is not easy - it probably requires some form of soft real time discipline across the graphics stack (including GPU scheduling) so you can race the beam.

Re: Understanding the working of X11 from the ground up (2017)

#83
post #73

Author here. I stopped working on this a few years ago, so now's as good a time as any for an overly-long, rambly, unedited retrospective. When I started this, I was working on GNOME's window manager full-time, and wanted to learn intricately how X11's drawing model worked, so over the course of a few weeks in a hotel room, I recreated large parts of X11's drawing model in a web browser, fixing artifacts as I went al…

Thank you for taking the time to explain it to us!

Re: Understanding the working of X11 from the ground up (2017)

#84

Looking over this stuff, I get an uneasy feeling. X was a brilliant solution to problems 35 years ago, where you barely had enough memory for a full frame buffer and the graphics model was primitive (no antialiasing or transparency). From what I've seen, Wayland is a good solution for the model maybe 15 years ago, where you're willing to accept the frame-and-a-half latency hit from having a compositor in the path. Ba…

I have a lot of replies to this, but the back-and-forth format that HN has isn't the best for collaborative discussion. Imagine us sitting in a room with a whiteboard, rather than bickering at each other at loud volume. If you're ever in south bay area and want to meet up at a coffee shop, let's :)

> Basically, my question is whether anybody is working on a solution for the hardware we have today, where there are hardware overlays, the GPU throughput is orders of magnitude higher than what's needed to composite a desktop

Hardware overlays are... not that popular on desktop devices? You just stomp on the gas pedal with bandwidth and power consumption on consumer desktop gaming GPUs. Besides a couple YUV planes and a cursor overlay, you don't see that much in the way of CRTC capabilities on desktop. All of that's happening in the mobile space, because of power consumption reasons, where you basically have an SNES PPU in your CRTC with multi-plane compositing.

I remain unconvinced that compositors need to add a frame and a half of latency. 16ms is a lot of time to render a frame, and composition isn't too difficult of a task. It just comes down to buffer handoff, which can be smoothed out over time. Similarly, the new flip-model isn't the thing that makes smooth resizing difficult, buffer allocation and resizing has always been a pain and racy on Windows/X11. This is one of the things that Wayland fixes -- it was actually the thing that caused Kristian to start Wayland forever ago.

Presentation and timing is something I think should be possible, but I don't think it makes sense for every app to have to handle it. Multi-monitor scenarios are what make global timing difficult, and having per-monitor surfaces is just a pain to deal with from an API standpoint; if we did the work to have per-monitor timing information and split surface rendering, nobody wants to go through the work to set up two devices and present different ones at the right time.

You might protest that all monitor timing is roughly the same these days, but someone hooking up their laptop to a projector, you get radically different timing.

In many respects, I think graphics is in a local minima right now: it works well enough and we understand it well enough that nobody's really interested in pushing us to the next thing. VR/AR research might, but that's been relatively unimportant as a target platform, commercially.

Re: Understanding the working of X11 from the ground up (2017)

#85
post #31

Earlier quoted context omitted.

Easy to fix - don't use it. Linux users today stay away from it for good reasons.

I specifically bought only NVIDIA GPUs because they were faster under Linux when I got them.

In the past that was a common reason. Today it's not relevant anymore. And downsides of the blob make buying Nvidia a non starter. You can clearly observe this trend today among Linux users.

Re: Understanding the working of X11 from the ground up (2017)

#86
post #62
post #2

> I've made a personal decision to leave the Linux, X11, and Wayland worlds mostly behind. I understand X11 has a lot of unfixable problems, but what's wrong with Wayland world?

Author here. I had been working on Linux professionally for about 6 years at that point, and got burned out on it. I have a lot of thoughts on the success of Linux as a general-use platform but mostly keep them to myself these days. I still have a deep love for graphics, and have since moved onto working in the games industry, where I am much happier. I also still have a passion for explaining graphics topics. Curren…

What's your view on the recent progress of Linux gaming?

Re: Understanding the working of X11 from the ground up (2017)

#87
post #75
post #33

Earlier quoted context omitted.

Personally I’m not the biggest fan of wayland (I haven’t found a compositor I like and using OpenGL for everything including VTEs feels like a mistake.) but I will say it’s common knowledge (as far as I’m aware) that nvidia drivers on Linux are pretty bad and you’re not going to have a good experience with them no matter what kind of display manager you use.

In what world are nVidia drivers crap? I'm regularly doing some pretty funky stuff with OpenGL on top of X11 and nVidia and this setup fails me less often and less hard than any equivalent AMD setup has done so far. Unless I'm trying to allocating tons textures or ridiculously sized vertex buffers, I don't see any hickups at all.

In the Linux world. All of their problems (roughly you can call them poor integration with the Linux stack) are consequences of them refusing to upstream their kernel driver.

The fact that Nvidia blob fails you less is not a good indicator for you, unless you test with Mesa as well in each case. Mesa is a lot stricter about OpenGL spec compliance. So if you only test on Nvidia, you likely have bugs that you didn't notice.

Re: Understanding the working of X11 from the ground up (2017)

#88
post #29
post #24

Earlier quoted context omitted.

My window manager won't work, my hotkey daemon won't work, my screenshot tool won't work, any X11 program that draws to the root window won't work. Xwayland is obviously not a working solution to fix the ecosystem problem. Who is inaccurate now? > debate the merits Wayland has no merits. That is kind of the problem. It is just a reimplementation of stuff that worked.

The wayland project exposes what marvelous piece of software X11 really is since Wayland is still not able to compete, otherwise the whole Linux community would use it already. I respect the intention and efforts of the Wayland community to make things better. However, I wished the community would have focused on making X11 better (easier to maintain with modularity etc.) instead of following the mainstream which is…

> Win7/8

Windows 8 was a major improvement saddled with an untested UI that someone was using to make their political mark. The internals of Windows 8 and Windows 10 are a major, major step forward from 7.

Re: Understanding the working of X11 from the ground up (2017)

#89
post #38
post #31

Earlier quoted context omitted.

Easy to fix - don't use it. Linux users today stay away from it for good reasons.

That’s fine if you’re already a Linux user and purchased hardware with Linux in mind.

For Windows users coming to Linux with Nvidia, this usually simply involves one extra cycle of GPU upgrades. By the next one, it's AMD for them. So in the long run - still not an issue.

Re: Understanding the working of X11 from the ground up (2017)

#90
post #29

Earlier quoted context omitted.

The wayland project exposes what marvelous piece of software X11 really is since Wayland is still not able to compete, otherwise the whole Linux community would use it already. I respect the intention and efforts of the Wayland community to make things better. However, I wished the community would have focused on making X11 better (easier to maintain with modularity etc.) instead of following the mainstream which is…

> I respect the intention and efforts of the Wayland community to make things better. My understanding is that Wayland was started by a few core developers of Xorg who just couldn't stand maintaining Xorg anymore.

It is, including the author of this post. Unlike other controversial things like systemd or pulseaudio, Wayland was started by major Xorg contributors. I've watched some of their talks and can see why they went down this route.

I've tired Wayland a few times and whenever I do, I give it an honest shot for a few weeks, but tend to run into issues (Sway being pretty buggy or oddities with old X apps or Steam, etc.) I've heard Sway has gotten a lot better and I should really try it out again; probably the next time I setup a laptop.

I do wonder what plans FreeBSD and OpenBSD have for the future. Currently they main their own Xorg trees, but I wonder if we'll ever see Wayland implemented on other platforms.

Post reply on HN