[HN Gopher] Write a Wayland Compositor [video]
___________________________________________________________________
Write a Wayland Compositor [video]
Author : pantalaimon
Score : 95 points
Date : 2022-12-30 14:43 UTC (8 hours ago)
(HTM) web link (streaming.media.ccc.de)
(TXT) w3m dump (streaming.media.ccc.de)
| yxhuvud wrote:
| I'd rather not. More people should write wayland clients though,
| and complain to the makers of existing compositors where they
| fall short. Which is in a lot of places, and they are definitely
| not sufficiently robust.
| sprash wrote:
| The presenter says that you should not write native Wayland
| clients at all but use either Gtk or Qt.
| [deleted]
| pwdisswordfish9 wrote:
| [flagged]
| [deleted]
| selfhifive wrote:
| Does screen sharing work on wayland now?
| vladharbuz wrote:
| It seems to work for a lot of people, but I still get constant
| crashes using xdg-desktop-portal-wlr, despite trying multiple
| GPUs, extensive testing etc. I will probably dive into the code
| when I get some time.
| vetinari wrote:
| It does for a long time.
|
| However, applications that just grabbed X11 framebuffer won't
| work. They have to use respective APIs with user control
| ("portals") for that. Some do (Chrome, Firefox), some don't (MS
| Teams).
| Arnavion wrote:
| If you're forced to use an application that only supports the
| X API, you can kludge it to work by VNCing to yourself with
| x11vnc and then screencasting the x11vnc window.
| amalgamated_inc wrote:
| I use it every day. I can share screen in Google Meet, Zoom,
| Slack Huddle, and many others. It doesn't work in Signal,
| though, because Signal is using an outdated version of
| Electron.
|
| Since each company sort of sticks with 1 tool for every
| employee, could be kind of a deal breaker if they pick a tool
| that can't screen share on Wayland.
| sheerun wrote:
| The best app for this task doesn't support it:
| https://github.com/rustdesk/rustdesk/issues/56
| horsawlarway wrote:
| Yes, and has basically since early covid...
|
| So does RDP and VNC, if you're interested... Across most every
| variant (wlroots based - ex: sway, gnome - mutter, kde - plasma
| wayland)
| selfhifive wrote:
| A friend of mine couldn't share his screen on meet or teams
| and I had to change it from Wayland to X11 to make it work.
| His was a Ubuntu 22.04 distro (GNOME) 4 month old install.
| Wonder why that happened.
| fhackenberger wrote:
| Bit off-topic: My major pain point a while ago was that Gnome-
| shell crashes take down all running applications. Is that still
| the case?
| sprash wrote:
| Yes. Similarly a crash of Xorg will bring down all running
| applications. However thanks to standardized interfaces in X11
| both the window manager and the compositor can independently
| crash or even replaced at runtime by a different program
| without affecting running programs. This just shows how much
| further ahead X11 is on a conceptual level and how bad the
| Wayland design philosophy really is.
| [deleted]
| LAC-Tech wrote:
| Is it worth switching to Wayland? Can't tell if we're at the
| point where the momentum has shifted or not.
| yjftsjthsd-h wrote:
| If X works, why bother? If you're missing something it's not
| hard to test, but if there's nothing driving you to it then why
| bother at this point? It'll keep getting better over time
| amalgamated_inc wrote:
| I honestly only notice the difference once in a while, when an
| obscure app isn't compatible. And screen sharing is still kinda
| hit or miss.
| [deleted]
| [deleted]
| wing-_-nuts wrote:
| I really wanted to like wayland as the 'next big thing', but for
| the life of me I can't.
|
| * I've yet to see any actual, honest to god benefits for the _end
| user_. Literally everything I 've seen is the fact that it makes
| development easier for the wayland devs and harder for literally
| everyone else.
|
| * Trying to use a wayland window manager outside of gnome or kde
| leaves you reliant on a bunch of hackish utilities (redshift,
| taskbar, screen recording / sharing, etc) which are available on
| AUR and basically no where else
|
| * Scaling and perf for xwayland apps (i.e. most apps) is pretty
| bad.
|
| Is wayland the future? Maybe, but I'll happily use xorg for the
| next decade if needed until the user experience is rock solid
| over on wayland.
| encryptluks2 wrote:
| > Trying to use a wayland window manager outside of gnome or
| kde leaves you reliant on a bunch of hackish utilities
| (redshift, taskbar, screen recording / sharing, etc) which are
| available on AUR and basically no where else.
|
| Because redshift is designed for X11. If you want redshift for
| Wayland then you use gammastep. Taskbar options if you don't
| want to use whatever is part of a common window manager would
| be Waybar, swaybar, and i3statusrs. Screen recording works well
| with OBS. All this works without relying on the AUR BTW.
| guerrilla wrote:
| > gammastep
|
| Nope, wrong, this doesn't work for KDE or GNOME or most of
| the big compositors for that matter. There really is no
| standard way as I mentioned in another comment. Anyway, from
| the gammastep README:
|
| > Why doesn't this work with Wayland compositors like Mutter,
| KWin, Mir, and Enlightenment?
|
| > This program supports the wlroots protocol for gamma
| adjustments, but several Wayland compositors do not support
| this protocol. GNOME and KDE have their own built-in
| mechanisms for adjusting color temperature on Wayland.
|
| For GNOME, I might as well say here for reference, using
| gsettings to adjust the keys in
| org.gnome.desktop.a11y.magnifier seems to work for now, but
| I'm sure they'll find a reason to remove that soon enough.
| saghm wrote:
| The original comment was that redshift was needed outside
| of Gnome or KDE, so I think the comment you're responding
| to is addressing that. It still seems like a legitimate
| gripe that it doesn't work for many other compositors, but
| I think the inclusion of KDE/Gnome here is a bit of an
| accidental goal post shift for the parent comment.
| [deleted]
| guerrilla wrote:
| Mmmm okay I see what you mean.
| jcelerier wrote:
| > The original comment was that redshift was needed
| outside of Gnome or KDE,
|
| but even if you use gnome or kde you can still use
| redshift in X11 because these things are independent.
| e.g. maybe you have a redshift config file associated
| with a screen / location, it shouldn't matter which DE
| you are using for it.
| mnd999 wrote:
| The killer feature for me is setting different scaling for
| different screens. This just works for me in wayland.
| horsawlarway wrote:
| I find the general defaults in most Wayland compositors to be
| much more pleasant than X-org defaults.
|
| Libinput and Pipewire in particular solve a huge selection of
| issues I would routinely run into on linux machines in the
| 2010's.
|
| Not limited to wayland, but definitely pushed by wayland and
| developed in tandom with a similar set of goals (renovate
| mostly legacy spaces that are critical in the end-user
| space).
|
| I have also - not ever - had to touch a terminal/file editor
| to make an external display work with wayland. Which... is
| just hands down pleasant. And frankly an experience that does
| not exist with X. For the most part - I just plug it an and
| things work as expected. Including much better scaling/hidpi
| support.
|
| Honestly - not having to mess with conf files for basic
| input/output has been a hallmark of my experience with
| Wayland.
|
| I enjoy quite a bit more deep diving in linux than most any
| typical user (I run arch as a daily driver and host about 15
| apps in a k8s cluster in my basement - I'm not afraid of some
| configuration), but I'm tired of wasting time making devices
| work like they should. Personally - I don't find that
| experience enjoyable or satisfying. I'd like my
| mouse/touchpad/monitor/headset to just work when I connect
| them, and wayland based compositors seem to get those mostly
| right.
|
| I switched 5 years ago - back when screen sharing was
| still... rough, and a lot of the benefits weren't present
| because major applications (namely - browsers) were still
| running in Xwayland. The experience today is just downright
| pleasant. I enjoy my wayland boxes far more than my work
| macbook, and the last hold-out has been a Windows 10 box for
| games, which thanks to valve and wine will not be getting
| upgraded to windows 11.
| unshavedyak wrote:
| It's a pretty big deal for me too, but:
|
| 1. I was told to ~piss off~ because i use Nvidia for Blender
| and don't want to switch to AMD. The hostility was very
| discouraging.
|
| 2. I adjusted my workstation accordingly to not deal with the
| screen issue long ago. Yea, it would be nice to use differing
| monitors, but before Wayland was really viable i had to solve
| the problem properly to keep working. The net result is this
| killer feature had to be solved by me with hardware before
| Wayland could even have a chance to solve it with software.
| kelnos wrote:
| > _The hostility was very discouraging._
|
| I can understand that. This doesn't excuse the hostility,
| but also understand that, to the developers, it's been a
| huge slap in the face that nvidia didn't feel like adopting
| the standard that the rest of the Linux graphics community
| had adopted. Having to support another rendering backend,
| just because nvidia chooses to -- yet again -- abuse the
| Linux community, is hard to feel good about.
|
| Now, it's inexcusable to pass that hostility on to regular
| users, assuming they are asking politely, and aren't acting
| entitled to a solution. But I understand where the
| hostility comes from.
|
| (It's also telling that nvidia has, more recently, decided
| to stop doing their own thing, and adopt the established
| standard. Even they realized -- though it took them way
| more time than it should have -- that what they were asking
| was too much.)
| deagle50 wrote:
| Well, what seemed like an attempt to split the ecosystem
| didn't work and the ship was sailing in the opposite
| direction. The community holding firm helped the greater
| good in this case.
| lnxg33k1 wrote:
| I'm using wayland right now not because I give a f*ck about
| graphic servers, but having a 2K laptop monitor and 2 4K
| external monitors, I find the "monitor independent scaling"
| supported by wayland better than "only one scaling per all the
| monitors" of X11, had just to solve an issue related to
| screensharing on browsers but following archlinux wiki was
| straightforward enough for me
|
| But yeah I use KDE so probably for other DE is not worth it?
| amalgamated_inc wrote:
| FWIW, I much prefer learning and using 4-5 "hackish utilities"
| to the giant blob of design-by-committee that is Gnome or KDE.
| Redshift took like 1 minute to set up once, and has worked
| flawlessly w/o intervention since. Taskbar is actually better
| than on any distribution including Mac or Windows, IMO. I can
| put anything on the system in my task bar with a few minutes of
| work. Try that anywhere else. Screen recording is still a bit
| buggy, but usually because projects (like Electron) haven't
| updated their dependencies.
|
| Love Sway.
|
| I'd kind of say it the other way around. I don't notice any
| real downside over X, configuration is much nicer, and
| apparently it's more secure or something? Why not.
| LAC-Tech wrote:
| _Trying to use a wayland window manager outside of gnome or kde
| leaves you reliant on a bunch of hackish utilities (redshift,
| taskbar, screen recording / sharing, etc) which are available
| on AUR and basically no where else_
|
| LOL as a long time "just a WM" user, I don't find any of these
| to be that hackish.
| guerrilla wrote:
| > * I've yet to see any actual, honest to god benefits for the
| end user. Literally everything I've seen is the fact that it
| makes development easier for the wayland devs and harder for
| literally everyone else.
|
| You can see some small benefits in GNOME like movies still
| playing while window switching, nice shadows, no more tearing,
| etc. but honestly who cares but aesthetes. None of this was in
| popular demand. The security is nice but when was that ever
| exploited in the wild? Mostly I see downsides, like now there's
| multiple ways (or no way in some compositors) to dim screens...
|
| I'm sure eventually we'll get all our features back but for now
| it's mostly a bunch of small irritations that add up.
| adrian_b wrote:
| Under X11, I do not remember to have ever seen any
| disturbance in movie playing during window switching, but I
| have also never used GNOME.
|
| If Wayland improves movie playing under GNOME, then it solves
| a GNOME bug, not an X11 bug.
| guerrilla wrote:
| I mean in thumbnails and while switching workspaces and all
| that... There's never any frozen frames, skips or anything.
| Yes, eventually X got compositing, but not for most of its
| life and not in mainstream WMs.
| pantalaimon wrote:
| Compiz has been around for 16 years now
| guerrilla wrote:
| Yeah, I did mention that in my comment and also that it's
| not Metacity/Mutter, KWin or popular. On the other hand,
| I've never seen Compiz perform this well.
| amelius wrote:
| > but honestly who cares but aesthetes
|
| Someone building the next Apple might care.
| guerrilla wrote:
| So, aesthetes making up virtually zero percent of Linux
| desktop users while handicapping the rest for years.
| solarkraft wrote:
| I used to be a Wayland maximalist and have somewhat given up.
| X11 works just fine. The theoretical security benefits haven't
| really been realized and the incompatibility inside of the
| ecosystem due to the aggressive "out of scope" response by the
| Wayland team massively killed my enthusiasm. All it has done is
| cement the Gnome monopoly because instead of general-purpose
| desktop tools, you now mostly have Gnome shell (or KDE)
| extensions for everything and all other desktops are left out.
| deagle50 wrote:
| X11 only works fine if you don't use multiple monitors and
| need vsync, or variable refresh, or different scaling
| settings.
| adrian_b wrote:
| I have no experience with variable refresh, but I have been
| using up to three monitors with different resolutions, up
| to 4k, under X11, for almost a decade, without any problems
| whatsoever (mostly with NVIDIA GPUs, where their Settings
| utility simplifies the configuration of a multi-monitor
| layout).
|
| X11 is very far from an ideal graphics system and I would
| like to see it replaced by a better system, which would
| still have to also implement the X protocol for the legacy
| applications.
|
| Nevertheless, I have not seen any argument yet that would
| indicate that Wayland is the appropriate replacement for
| X11. On the contrary, some of the ideas on which Wayland
| was originally based were definitely wrong and they have
| shown that the Wayland developers lacked experience about
| how many computers are used.
|
| Even if a part of the initial mistakes have been patched
| meanwhile, that lack of vision at the Wayland origin makes
| me skeptical even about the quality level of the Wayland
| parts about which I do not know anything.
| tpush wrote:
| > On the contrary, some of the ideas on which Wayland was
| originally based were definitely wrong and they have
| shown that the Wayland developers lacked experience about
| how many computers are used.
|
| Like what?
| deagle50 wrote:
| Not defending wayland, but X11 has serious downsides for
| me with multiple monitors.
|
| Are you using fractional scaling (or different scaling
| values per monitor)? Does vsync work? How about the
| scrolling stutter at high refresh rates? And if you want
| to use variable refresh, you have to disable/unplug all
| the other monitors and reboot.
| adrian_b wrote:
| All my monitors are fixed 60 Hz, so I have never used
| variable refresh and there is no scrolling stutter.
|
| Vsync works, but I must choose with which of the
| monitors.
|
| For about a decade, I have used only 4k monitors, even
| starting with the early models that were seen by the
| computer as multiple monitors, because HDMI and
| DisplayLink could not carry 4k @ 60 Hz on a single link
| at that time.
|
| Nevertheless, I still cannot understand why would anyone
| want to use any kind of "scaling" in relationship with a
| monitor.
|
| Any kind of "scaling" is guaranteed to generate sub-
| optimal images.
|
| The correct way to deal with monitor resolutions is to
| set for each monitor the appropriate dots-per-inch value,
| depending on the monitor size and resolution.
|
| With the right DPI value, all typefaces and vector
| drawings will be rendered beautifully. Scaling is never
| needed per monitor, but only per window, either for the
| windows containing bitmap images, i.e. pictures or
| movies, or for the windows that contain GUIs implemented
| by incompetent programmers in Java with typefaces sized
| in pixels, instead of using scalable typefaces sized in
| points, like any decent (non-Java) GUI.
|
| I did not need to set different DPI values for each
| monitor belonging to a multi-monitor layout, so I do not
| know if that is possible in X11.
| deagle50 wrote:
| There is one DPI setting per X server I think, and I use
| 192 because I have two 4k screens. Which forces me to
| xrandr the 1440p display at 2160p then output a blurry
| 1080p to match the 4k screens at 2x scale.
|
| As for why use scaling, I can't read anything at 4k
| native and the UI elements don't scale correctly with the
| font dpi. Windows has fully functional 150% and 175%
| options (one of the few things Windows does well now) and
| in MacOS has really nice global super-sampling options
| between 1080p-1440p hidpi.
| johnny22 wrote:
| the wayland folks were the folks who worked on xorg for
| the most part, so that doesn't make sense.
| blueflow wrote:
| Which terminal emulator did you settle on?
| amalgamated_inc wrote:
| I use Alacritty. Works awesome.
| [deleted]
| bsder wrote:
| Wayland needs a restart. I get (and applaud) the aggressive
| "not in scope" as the developers don't want to be maintaining
| the universe and dealing with nVidia, AMD, and Intel is
| difficult enough. I really wonder if implementing this stuff in
| something other than C/C++ (Go, Nim, D, Ada, Zig, Rust, etc.)
| would be an improvement as it would force developers to come to
| grips with "No, you _DON 'T_ own that memory and you can't bash
| on it and people who want to use your system won't either.
| Figure out how to abstract that."
|
| It's become pretty clear that their abstractions aren't
| correct. If I have to link against a gigantic C library just to
| get window decorations, we have a deeper problem.
|
| (see: http://way-cooler.org/blog/2019/04/29/rewriting-way-
| cooler-i... for how big it is)
|
| > Currently there is 11 THOUSAND lines of Rust in wlroots-rs.
| All of this code is just wrapper code, it doesn't do anything
| but memory management. This isn't just repeated code either, I
| defined a very complicated and ugly macro to try to make it
| easier.
|
| > This wrapper code doesn't cover even half of the API surface
| of wlroots. It's exhausting writing wlroots-rs code, memory
| management is constantly on my mind because that's the whole
| purpose of the library. It's a very boring problem and it's
| always at odds with usability - see the motivation for the
| escape from callback hell described above.
| pengaru wrote:
| > (see: http://way-cooler.org/blog/2019/04/29/rewriting-way-
| cooler-i... for how big it is)
|
| Disclaimer: I don't know Rust beyond println!("Hello World");
| C is my preferred language for decades now.
|
| The example Rust code in that linked post is just an absolute
| unreadable horror show. If that's representative of what it's
| _really_ like to interop C with Rust or just write real Rust
| code in general, I 'm strongly discouraged from bothering to
| put more effort into the language.
|
| Can anyone skilled and experienced enough with Rust to judge
| what's going on there comment? Is the author just a noob
| making a mess of things as anyone can do in any language, or
| is this limited to C interop? Or is Rust normally such an
| inscrutably verbose disaster?
| guerrilla wrote:
| from scratch or with wlroots?
| sprash wrote:
| He recommends wlroots. (Which means it won't work with Nvidia
| GPUs btw.)
| ajarofpinecones wrote:
| *she, also newer Nvidia drivers support GBM supposedly, so
| this (hopefully) won't be true for much longer
| arghwhat wrote:
| nvidia drivers generally work but will remain unsupported
| for as long as they are not fully open source. Providing
| support requires the ability to debug the driver when
| issues arise.
|
| (Improvements to Nvidia support is accepted, if it is a
| general improvement and not just a hack around a driver
| bug.)
| pixelfarmer wrote:
| IIRC, the blob stuff should be able to handle buffers it
| created itself no problem. The issue here are foreign
| buffers that are not supported, yet. Supposedly version
| 525.x will do that, so lets see how that goes.
| synergy20 wrote:
| was trying to run swaywm this morning to no avail as it
| refused to start when it detects nvidia driver is in use. why
| did not wlroots work with nvidia drivers? is it because
| nvidia drivers are closed that wlroots(i.e. swaywm) can not
| work with it? a bit disappointed.
| vetinari wrote:
| > why did not wlroots work with nvidia drivers?
|
| Because nvidia drivers traditionally didn't provide APIs
| that sway and other wayland compositors expected (drm,
| dmabuf, atomic) and tried to do it's own things
| (EGLStreams). For compositors it meant to have to code
| paths, one nvidia-specific and another one generic. Some
| compositors implemented both, others implemented generic
| only.
|
| For comparison, it would be like complaining that
| Windows/DirectX games do not run with a GPU that doesn't
| come with DirectX driver. Well, duh.
|
| However, Nvidia signaled a u-turn, that they are going to
| be more cooperative. How and when, well, it remains to be
| seen.
| loeg wrote:
| Some discussion here:
| https://news.ycombinator.com/item?id=21628494
| arghwhat wrote:
| That discussion is outdated.
|
| Current Nvidia drivers support GBM, and thus should work
| with wlroots. Their status of unsupported mean that the
| wlroots maintainers cannot help if it does not work as
| they cannot debug a closed source driver, making it
| impossible to see what might be wrong.
|
| General improvements that help nvidia compatibility are
| accepted though if other's identify an issue.
| singron wrote:
| Every other driver uses GBM, which is well supported by all
| the various software related to gpu buffer management.
| Nvidia decided to not use GBM and instead use this
| EGLStreams thing, which meant it wasn't compatible.
| Politically, this was contentious since nvidia was
| offloading a huge development burden onto the ecosystem to
| create parallel implementations of buffer management
| specifically for nvidia. Wlroots ended up deciding this was
| such an inane thing for nvidia to do, that they refused to
| implement EGLStreams at all. Eventually, nvidia backpedaled
| and decided to implement GBM. Now they are just behind, but
| everything will probably eventually support nvidia.
| mnd999 wrote:
| It does work, you have to add --unsupported-gpu and there's
| a bunch of other tweaks to make it good. There's a long
| thread on the Nvidia UNIX driver forums on how to configure
| it.
|
| It is still unsupported though as wlroots only actively
| support open source video drivers.
| deagle50 wrote:
| 0.16 works with Nvidia proprietary driver. I'm using it right
| now.
| synergy20 wrote:
| https://gitlab.freedesktop.org/wlroots/wlroots/-/releases
| has the newest wlroots,google still leads to github wlroots
| which has an old 0.14 release
| Jorengarenar wrote:
| Wait, weren't Nvidia drivers finally open-sourced not so
| long ago?
| delusional wrote:
| They open-sourced a kernel intermediary driver that talks
| to a proprietary binary blob running in userspace. The
| driver itself is still proprietary.
| monocasa wrote:
| And a massive multiple MB proprietary blob running on the
| GPU. It seems they ported most of their privileged driver
| to running on the GPU itself.
| bdhcuidbebe wrote:
| [flagged]
___________________________________________________________________
(page generated 2022-12-30 23:01 UTC)