5 ms·
Interesting write up, but it would be useful to explain how major graphics APIs fit into this (i.e. Vulkan / OpenGL) and how it all glues together (GPU drivers
by shmerl 9y ago
Interesting write up, but it would be useful to explain how major graphics APIs fit into this (i.e. Vulkan / OpenGL) and how it all glues together (GPU drivers with KMS/DRM and higher level APIs).
Also note, that Mir is now basically gone, Canonical decided now to stop that rift and stick to Wayland.
- simplicio 9y agoIs there a decent write-up of how the graphics stack goes, from userland to the monitor? I have a really hazy picture of how framebuffers, drivers, compositors, GPUs, display servers etc. all fit together. I've read good tutorials about the various pieces, but don't really grok how they inter-relate.
- shmerl 9y agoI saw one brief overview here: http://blog.mecheye.net/2012/06/the-linux-graphics-stack/ http://blog.mecheye.net/2012/06/the-linux-graphics-stack/
- thehardsphere 9y agoThat is a particularly superb overview. Thank you for sharing it.
- Jasper_ 9y ago(Author of that article here) It's a bit outdated and honestly needs replacing at this point. Xplain[0] replaces parts of it, and some of my newer blog posts[1][2] replace other parts. I can also answer any questions people have about the stack. [0] http://magcius.github.io/xplain/article/ http://magcius.github.io/xplain/article/ [1] http://blog.mecheye.net/2014/06/xdg-shell/ http://blog.mecheye.net/2014/06/xdg-shell/ [2] http://blog.mecheye.net/2016/01/dri/ http://blog.mecheye.net/2016/01/dri/
- d_theorist 9y agoAlso, I'm curious about portable (i.e. across different Unixes) low-level graphics, if such a thing exists. I assume that the interfaces discussed here are Linux specific, and the BSDs have something different. Does POSIX have anything to say about graphics interfaces? What is the lowest-level portable way to draw graphics? X11? It's funny, because I always thought of X as being more of a windowing abstraction, rather than graphics in general. Perhaps I am making a distinction that does not really exist. Obviously I am not a graphics guy :)
- shmerl 9y agoLooks like FreeBSD is following Linux design for DRM/KMS: https://wiki.freebsd.org/Graphics https://wiki.freebsd.org/Graphics
- panic 9y agoProbably because that's how the vendors distribute their proprietary drivers.
- shmerl 9y agoActually Nvidia blob didn't start using DRM/KMS until very recently. I think it's more because of Mesa. It makes sense for FreeBSD to leverage the major open project which does heavy lifting for graphics.
- kllrnohj 9y agoI don't think there is any common low level way, even among the Linux flavors. Android's graphics stack, for example, is completely different and doesn't use any of this. If you want portable you're going to want something like SDL probably.
- shmerl 9y agoAndriod is a weird deviation, and kind of annoying because the rift goes all the way to libc, which makes Android blobs incompatible without translation hacks like libhybris. If in case of GPU you can at least get something like Freedreno to avoid such hacks, but good luck getting open drivers for the modem and the like. So those blobs are a necessary evil for some devices to be usable, and there are none for glibc.
- wyldfire 9y agoWith which ubuntu release did/does Wayland start? Wayland obsoletes Xorg? Or complements it?
- badsectoracula 9y agoOk, some corrections first. Wayland is a protocol, not an implementation. Xorg is an implementation of a protocol, not the protocol itself. Weston is the reference implementation of Wayland, but it is not the only one - KDE's KWin is another. Xorg is the current most common implementation of the X11 protocol, however - again - it is not the only one (although almost all Linux desktop systems today use it) and there are other implementations. So how do X11 and Wayland relate to each other? Well, they are both protocols for providing a windowing system. They each do things differently, with pros and cons to each approach. They are different enough so that one can be implemented on top of the other, so compatibility should not be a problem, although obviously features are lost or crippled when doing so. There is this misconception that Wayland obsoletes X11, but they are very different systems designed by different people and worked by (mostly) different developers that only superficially provide the same features (showing windows on screen) that - at least personally - i do not see that happenning any time soon, if ever. Personally the way i see it is similar to asking if Atom (or VSCode, if that is your poison) obsoletes Emacs (or Vim).
- shmerl 9y agoWeston and KWin are Wayland compositors. Wayland should obsolete X11 (it's not a misconception, it's one of the primary goals), but it's a humongous task, especially from applications side. And Wayland is not yet feature complete to replace all common use cases. For example it's still lacking standard protocol for screen recording and screenshots, that fits its security model.
- hollerith 9y agoAlso, there are no guarantees that any mainstream browser will ever use the Wayland protocol directly without going through an X compatibility layer like XWayland. And XWayland consists of most or all of the X11 code base. Yes, Firefox and Chrome are open source, but they're atypical of open source projects in that (a) the amount of implementation effort required to make the kind of changes under discussion here are much larger than for typical open-source projects and (b) institutional users and knowledgeable (or simply well-advised) individual users of Firefox and Chrome won't use your fork unless you have a credible story about how you can protect them from 0days. I know of no fork of either Firefox or Chrome that has ever had a credible story, but I've spent only a couple of hours looking. Google has their own replacement for X11 which they use in some Chromebooks, which reduces the probability that they'll throw in behind Wayland. Not every OS install needs a mainstream browser (in-vehicle entertainment systems do not seem to: they're heavy users of Wayland) but if your OS install does, and you're waiting for Wayland (more precisely, software that uses the Wayland protocol) to replace xorg or X11, you might be waiting a long time. "mainstream": provides a decent experience on most popular web sites including e-commerce sites.
- kllrnohj 9y agoVulkan & OpenGL are just really fast and complicated ways of putting pixels into the buffer you get from Wayland, DRM, etc... It's somewhat orthogonal.
- shmerl 9y agoYeah, I get that eventually they just plug into lower levels, but there is still some gluing of it all together that parts of Mesa address.
- planteen 9y agoYeah the specifics I can hand wave about but would like more nice details. You get a "native" window surface from Mesa from DRM (the GBM API is one choice here I believe). You pass these returns to EGL for your display, native window, and surface. You then bind the OGLES2 API and you're of to the races.
- shmerl 9y ago> you pass these returns to EGL for your display, native window, and surface. EGL if you use OpenGL, and WSI if Vulkan, if I understand correctly.