News for hackers. Stuff that matters.
Re:X Window System Basics by vermaden on Tuesday January 10, 2023 @02:59PM (#34330630)
Amazed?

I am amazed that people try to force limited and unfinished Wayland instead of X11. I recently had RHEL on ThinkPad T14 at work - which by default uses Wayland - yet even employer by default switches settings to X11 because EVERYTHING works there as desired - including screen sharing and/or recording.

... and for my personal stuff? I have ZERO issues with X11 on FreeBSD - why would I switch to Wayland if everything works as desired on X11? FreeBSD of course supports Wayland and you can use it there if you wish - but I just do not see the point of it. I do not have ANY screen flickering or other issues on X11.

Not to mention that A LOT of stuff is X11 only and not ported (and never will be) to Wayland.

Re:X Window System Basics by hulitu on Tuesday January 10, 2023 @03:33PM (#34331068)
> I am amazed that people try to force limited and unfinished Wayland instead of X11.

The xorg people phylosophy seems to be: if it works, fix it. Since xorg forked XFree86 the quality has gone down.

Re:X Window System Basics by asveikau on Tuesday January 10, 2023 @04:58PM (#34332166)
I remember using XFree86 in the late 90s and first ~3 years of the 2000s. When the X server started changing a lot circa 2003 it was really exciting, and I very eagerly anticipated those releases. I think Xorg is better than XFree86.

Some of the things they did off the top of my head:

* Render extension. This enabled all sorts of things, like easier drawing and scaling of pixmaps, or better font handling.

* Less monolithic build, phase out imake. This allowed iterating various components at different rates.

* Better auto configuration - less need to write a config file for the most common configurations.

XCB was also a good idea. I don't think it lived up to full potential because interest in writing code for X waned.

I think one thing that was lost to history are some of the proprietary X servers, such as those by Sun and SGI. The XFree86/Xorg lineage is missing their input.

Re:X Window System Basics by anthk on Tuesday January 10, 2023 @07:04PM (#34333258)
This. 30-70h, 50-160v. You know what I'm talking about. XFree86 was much worse.
Re:X Window System Basics by User23 on Tuesday January 10, 2023 @09:22PM (#34334289)
Driving CRTs was pretty different from LCD panels.
Re:X Window System Basics by hulitu on Wednesday January 11, 2023 @02:18AM (#34335962)
> * Better auto configuration - less need to write a config file for the most common configurations

Better until you compile a new kernel and realize that you don't have keyboard and mouse in X because it insists using an obscure (event ?) interface. And then press the power button to restart.

Re:X Window System Basics by BaculumMeumEst on Tuesday January 10, 2023 @03:21PM (#34330893)
The issues with xorg that i’m aware of are that it’s awful to maintain and that it has security issues like everything being able to access your clipboard.

And xwayland exists so porting isn’t much of an issue.

But yeah, despite all that i’m on x11 still as well. I need to use proprietary nvidia drivers and I don’t want to run full gnome or whatever to make that run smoothly. I’ll probably be dead before dwm stops working on an updated system.

Re:X Window System Basics by kaba0 on Tuesday January 10, 2023 @04:57PM (#34332140)
I don’t own nvidia, but from what I read they finally managed to have proper DRM support in their drivers which was the only limiting factor for Wayland (as opposed to nvidia patching your X server binary to run the proprietary driver, Wayland in itself only depends on proper linux kernel APIs which weren’t supported by nvidia for a long time)
Re:X Window System Basics by BaculumMeumEst on Tuesday January 10, 2023 @06:51PM (#34333152)
The technical capability does seem to be there, I was able to run Sway with the --unsupported-gpu flag for a little while, but it broke unfortunately, and my investment in Wayland isn't high enough to try to support it myself. I'm not sure if any other wlroots compositor based projects support nvidia.
Re:X Window System Basics by woodruffw on Tuesday January 10, 2023 @05:42PM (#34332566)
I don’t mean this in a flamey way, but I’ve always wondered what the importance of clipboard isolation is, given how bad of a user experience it results in.

I’m a security engineer, and I can’t think of many threat models in which an attacker can snoop clipboard contents but can’t do much worse things, which I assume is why neither macOS nor Windows has ever bothered with clipboard isolation.

(It’s entirely possible I’m under-thinking it!)

Re:X Window System Basics by kaba0 on Wednesday January 11, 2023 @11:09AM (#34339976)
So you think it is okay for a single npm install to fork a process and continuously query the clipboard and without any sort of notice just upload it to some random server? Or, even just log every single keystroke you press? Hell, it can even take screenshots of everything.

Afaik macOS doesn’t allow clipboard access in that naive way and you do get access in wayland, it is just not this “uncontrolled”.

Re:X Window System Basics by woodruffw on Wednesday January 11, 2023 @11:49AM (#34340641)
> So you think it is okay for a single npm install to fork a process and continuously query the clipboard and without any sort of notice just upload it to some random server? Or, even just log every single keystroke you press? Hell, it can even take screenshots of everything.

No, I don't think it's "okay." I just think it's indistinguishable from running arbitrary code, which is much worse anyways.

Again, ask yourself: what is the specific threat model in which an attacker can run a process that continually polls the clipboard, but can't do anything else?

> Afaik macOS doesn’t allow clipboard access in that naive way and you do get access in wayland, it is just not this “uncontrolled”.

You can try this for yourself: the `pbcopy` and `pbpaste` utilities on macOS allow uncontrolled access to the clipboard without any entitlements. These are well-known utilities that are baked into macOS, and are widely used by tools like password managers to programmatically control the clipboard.

More generally, you can look up the NSPasteboard and UIPasteboard APIs that Apple offers on macOS and iOS. There are no special entitlements required for either.

Re:X Window System Basics by tapoxi on Tuesday January 10, 2023 @03:18PM (#34330869)
In the examples of screen sharing and recording, they work on Wayland but the application needs to be aware and request permission. Zoom and Chrome both support this, AFAIK.
Re:X Window System Basics by sprash on Tuesday January 10, 2023 @05:31PM (#34332472)
Actually they don't work "on Wayland". The Wayland protocol provides no mechanisms for screen sharing and it is not intended that it ever will. Screen sharing has to be done by external protocols that are either compositor specific or using a somewhat standardized dbus protocol that is completely separate from Wayland.
Re:X Window System Basics by tapoxi on Wednesday January 11, 2023 @09:25AM (#34338783)
Semantics, if you're using GNOME or KDE like most users they support the org.freedesktop.portal.ScreenCast interface when running under Wayland.

I'm not sure if there are any compositor specific interfaces or why they would be used when xdg portals exist.

Re:X Window System Basics by sprash on Wednesday January 11, 2023 @01:40PM (#34342542)
Not Semantics. It shows how Wayland forces a Gnome/GTK and KDE/Qt duopoly and cuts out the long tail of hobbyists and power users. The latter was the interesting part about the FOSS/Linux-Desktop ecosystem. With Wayland the FOSS-Desktop will be 100% corporate controlled.
Re:X Window System Basics by QUrprUd1nCeicw on Wednesday January 11, 2023 @07:20PM (#34347168)
Can you please knock off the conspiracy theories?
Re:X Window System Basics by spijdar on Tuesday January 10, 2023 @03:57PM (#34331356)
Wayland is a complicated and sore topic for a lot of people, but I think I've gained some perspective over time.

From a historical perspective, the "why Wayland?" question is incredibly obvious IMO. The old Linux graphics stack consisted of the dumb Linux framebuffer and fbcon, and the separate Xorg stack with all its DDX/UMS drivers that required root-level permissions, and only provided a graphics API for ... Xorg. Your options were either Xorg, or the framebuffer, which IIRC didn't always support all of the available display modes.

Wayland was part of a wider push to rewrite the Linux graphics stack, with the new stack of KMS/DRM/DRI3/Mesa being a huge improvement over the 2000s Linux GUI stack. This came at the cost of old UMS and DRI drivers, making e.g. PowerPC Mac GPUs largely useless now (very unstable and incapable of suspend-to-RAM), while unifying mode-setting between the kernel and userland (no more praying the video card doesn't crash when ctrl-alt-f2'ing), also allowing for an arbitrary number of shared video buffers to be created (including by non GLX video applications) which makes compositors work in a not-hacked-together sense, but also allows for e.g. hardware video decoders to work in a not-hacky way.

Coupled with the addition of evdev to replace the Xorg DDX stuff like all the custom peripheral drivers, and you finally had a kernel-level API for accessing your video and input hardware. These were all prerequisites for the idea of "Wayland", decoupling the video and input layers from the display server and creating a low level API for window server things, so that you can have both small window servers (e.g. wlroots-based compositors) as well as "thick" environments (Mutter/KWin-based desktops).

Part of what makes this confusing is a lot of these benefits trickled down to Xorg itself. Nowadays evdev (and libinput) have replaced the old DDXs on Xorg, and I think most distros have switched to using xf86-video-modesetting, which could be thought of as "Wayland-style rendering on Xorg", in the sense it uses pure DRM and Mesa to render instead of GPU-specific DDX drivers.

So Xorg has gotten a lot of the benefits of Wayland's development "for free" anyway. This is intentional, as you mention, a lot of things will never be ported to Wayland. Wayland is not a replacement for X11, but an API for implementing the display server at a lower level than X11 allowed, while allowing us to implement full X11 compatibility "for free", by embedding Xorg in the form of Xwayland.

I think this makes a ton of sense for the majority of desktop-environment level compositors like Mutter (GNOME) and KWin (Plasma), which were already massive and implemented so much of their own functionality outside of Xorg, that it made sense to just let them do their own compositing. Same with GTK and Qt, which were already doing "their own rendering" outside of X.

Didn't mean for this to become an apologetic rant for Wayland, but as a "wayland skeptic" myself I feel like most anti-wayland arguments miss the forest for the trees (screen sharing not working). As an olive branch, though, I'll also add I don't think the wayland version of the big compositors like Mutter or KWin actually do much for end users, and it's pretty shameful how they've been launched with so many bugs, with no compelling user story beyond "better scaling" and "flicker".

Re:X Window System Basics by anthk on Tuesday January 10, 2023 @04:20PM (#34331677)
Xenocara under OpenBSD and Hyperbola don´t run as root.
Re:X Window System Basics by spijdar on Tuesday January 10, 2023 @04:50PM (#34332053)
True, though it does so using KMS/DRM adapted from Linux [0], which I would argue were created in the same spirit as Wayland, even if they're not strictly related.

[0] https://marc.info/?l=openbsd-cvs&;m=139245772023497&w=2

Re:X Window System Basics by anthk on Tuesday January 10, 2023 @07:02PM (#34333239)
X extensions overriding the core because of performance predate Wayland for long years.
Re:X Window System Basics by robinsonb5 on Tuesday January 10, 2023 @04:42PM (#34331946)
To be fair I don't really care all that much whether my box is running something X11-based or something Wayland-based. What I care about is whether it can still do today the things it could do 15 years ago. I'm finding it extremely frustrating that the answer is tending towards "no" - even with Xorg - but my impression is that Wayland increases the "no" count somewhat.
Re:X Window System Basics by hulitu on Wednesday January 11, 2023 @02:10AM (#34335906)
> So Xorg has gotten a lot of the benefits of Wayland's development "for free" anyway

Mesa was in X before Wayland was a thing.

Re:X Window System Basics by kaba0 on Tuesday January 10, 2023 @04:54PM (#34332109)
> I am amazed that people try to force limited and unfinished Wayland

Can we just not do this useless flamewar under every similar topic’s thread? Especially that no, noone wants to force Wayland, they want something that is under active maintenance, which X11 is not anymore, since every maintainer of it left/migrated to Wayland.

> Not to mention that A LOT of stuff is X11 only and not ported (and never will be) to Wayland.

Hmm, only if the goddamn maintainers of X11 who came up with Wayland thought of that. They could have named it something like W11.. no, XWayland!

Re:X Window System Basics by sprash on Tuesday January 10, 2023 @06:06PM (#34332768)
Legitimate concerns of people that have a severely degraded user experience are not flamewar. Xorg lost most of its corporate support which moved mostly to Wayland, that is true. Despite this Wayland has very poor adoption rate. The main reason for this is that Wayland has many unfixable flaws at the concept level that have been discussed here many times.
Re:X Window System Basics by wahern on Tuesday January 10, 2023 @06:25PM (#34332931)
Gripes are unconstructive, though. I'm just as disenchanted as the next person, but in the FOSS world the ethos is rightly, put up or shut up.

Personally, I suspect that if the Wayland developers simply dropped maintenance of Xorg completely--no more patches, no more XWayland or at least completely disassociate XWayland from Xorg--that a community would step up and carry Xorg forward. As it is, that erstwhile community remains largely hidden, maintaining out-of-tree patches. But if that community faced the prospect of 1) being able to take back the reigns of Xorg, and 2) if not, Xorg vanishes today, then it would likely become much more motivated, organized, and proactive. (Whether it would be capable of carrying Xorg forward is a different question.) Alternatively, it might create the environment for projects like Arcan to shine.

Re:X Window System Basics by AnonymousPlanet on Tuesday January 10, 2023 @08:19PM (#34333799)
Gripes are the reasons why most open source software exists in the first place. First comes the itch, then comes the scratch.
Re:X Window System Basics by QUrprUd1nCeicw on Wednesday January 11, 2023 @08:21PM (#34347789)
>I suspect that if the Wayland developers simply dropped maintenance of Xorg completely that a community would step up and carry Xorg forward

I don't. That community was sorely needed several years ago, but failed to show up.

Re:X Window System Basics by kaba0 on Tuesday January 10, 2023 @06:15PM (#34332846)
Actually caring a tiny bit about security and not letting everything be a keylogger is not an “unfixable flaw”, there is working screen sharing for basically every mainstream desktop app, what exactly is that flaw then?
Re:X Window System Basics by icedchai on Tuesday January 10, 2023 @06:27PM (#34332942)
How true this is. In the 90's, at least one commercial Unix vendor shipped their systems with X11 open to the world (equivalent of "xhost +", full remote access, no security.) In the days of no firewalls, that was a fun time.
Re:X Window System Basics by sprash on Tuesday January 10, 2023 @06:24PM (#34332922)
Wayland does not care about security. In fact it does not even offer standardized access control protocols. The flaw here (among many others) is that the protocol that is responsible for negotiating display output for multiple processes (which is what Wayland tries to be) should also contain standardized interfaces to exchange that output among processes, but Wayland doesn't.
Re:X Window System Basics by tadfisher on Tuesday January 10, 2023 @08:32PM (#34333916)
No. Wayland is a display protocol, not a general-purpose IPC, no matter how allergic to DBus you are.
Re:X Window System Basics by sprash on Tuesday January 10, 2023 @08:47PM (#34334058)
Yes. Wayland is a display protocol, not a general-purpose IPC. Hence it must contain access control interfaces for buffers.

Only the compositor has access to the composited image therefore is the only program able to make screenshots and full screen sharing. Furthermore, efficient sharing of single application windows is only possible with direct memory access to the buffer which also is something the compositor does/has. The Display protocol is the only sensible place to negotiate access to GPU resources.

Re:X Window System Basics by QUrprUd1nCeicw on Wednesday January 11, 2023 @07:13PM (#34347096)
>The Display protocol is the only sensible place to negotiate access to GPU resources.

No, GPU resources can come from any number of other places. That's literally the purpose of direct rendering. Any applications using GPU compute can produce them without requiring a connection to the display server. There's no reason to put that in Wayland or restrict it to the compositor. There's already a much better protocol for sharing GPU buffers: Pipewire. Dbus is only there to act as the glue between a Wayland compositor and Pipewire.

Re:X Window System Basics by sprash on Thursday January 12, 2023 @03:36AM (#34350754)
The display server needs to have full control over managing GPU resources. Otherwise you get stuttering mouse movements under high GPU load or programs that don't update their buffers for seconds/minutes because of some rogue process taking over the GPU.

Also Wayland was supposed to be simple. A former simple "XGetImage()" call now gets turned into a process of negotiating with at least three different protocols (most of them only semi stable and only "invented" a few years ago), each running their own daemon, requiring well above 1000 lines of code.

The whole ecosystem is garbage and is either conceived by complete moronic retards or with the purpose of sabotage. The latter is more likely, nobody can be that stupid.

Re:X Window System Basics by QUrprUd1nCeicw on Thursday January 12, 2023 @10:51AM (#34355319)
No, with direct rendering the display server uses the same API as any other process that uses the GPU. The way to fix stuttering is to fix scheduling in the kernel. XGetImage is comparing apples to oranges. That doesn't use the GPU at all, that does a copy into main memory. Pipewire is complicated because it has to handle format negotiation and conversion and audio support and a lot of other things that make sense for generically transferring video between processes but are outside the scope of the display server.

Can you please knock off the conspiracy theories and flames? What are you hoping to accomplish by hurting people like this on the internet?

Re:X Window System Basics by sprash on Thursday January 12, 2023 @11:49AM (#34356457)
> Can you please knock off the conspiracy theories

Don't tell other people what they are allowed to say Mr Thoughtpolice. This exactly the behaviour that I would expect from Wayland apologists, though. Your arguments are obviously wrong and pointless and the best thing you can come up with is shaming other people into self censorship.

Re:X Window System Basics by tadfisher on Thursday January 12, 2023 @02:20PM (#34358950)
> The whole ecosystem is garbage and is either conceived by complete moronic retards or with the purpose of sabotage. The latter is more likely, nobody can be that stupid.

> This exactly the behaviour that I would expect from Wayland apologists, though. Your arguments are obviously wrong and pointless and the best thing you can come up with is shaming other people into self censorship.

Yeah, I'm going to shame you for that. That kind of language isn't going to convince anyone, and it's actively harmful. Please stop.

Re:X Window System Basics by QUrprUd1nCeicw on Thursday January 12, 2023 @05:37PM (#34361244)
I didn't tell you what to say. I asked you nicely. Notice I used the word "please." You can make all the arguments against Wayland you want. Promoting baseless conspiracy theories and verbal abuse calling other people morons doesn't help get your argument across. It weakens your point. You're just hurting people as well as hurting your own argument by making these comments.
Re:X Window System Basics by wtay on Thursday January 12, 2023 @03:39PM (#34359957)
Hi, I'm maybe one of those moronic retards you talk about. Please, please help us out! The world is eagerly awaiting your super non-garbage solutions. Please show us the way... You could be a hero!
Re:X Window System Basics by sprash on Thursday January 12, 2023 @07:03PM (#34362122)
The Solution is very simple:

1. Scrap everything you have done so far and start over.

2. Use tried and tested engineering principles as basis for your development philosophy (such as "mechanism, not policy" or "Keep It Simple Stupid").

3. Choose the right target audience. The target audience of the FOSS-Desktop are neither car entertainment systems, nor Android consumer users that potentially download malware everyday. Your target audience are power users and developers that know what they are doing. If you don't agree, go work for a car manufacturer, work as an Android developer or do something else, just stay away from the FOSS-Desktop.

4. Do what developers and power users need! Just some examples: use simple and stable interfaces, use non-opaque low-level abstractions, standardize often used functionality, avoid redundant standards, don't litter my pstree with pointless daemons, use existing mechanism provided by the OS, use clear text for low bandwidth IPC, keep dependency trees as small as possible, keep build dependencies as small as possible, look at Plan9 as inspiration instead of Windows and MacOS.

Re:X Window System Basics by wtay on Friday January 13, 2023 @02:33AM (#34364927)
Awesome plan!
Re:X Window System Basics by QUrprUd1nCeicw on Friday January 13, 2023 @08:31PM (#34376304)
Wayland already meets all those points. And Plan9 doesn't use either X11 or Wayland. Why don't you take your own advice and switch to Plan9 if Linux is causing you problems?
Re:X Window System Basics by odiroot on Tuesday January 10, 2023 @05:44PM (#34332591)
I have T14 (AMD version) with Arch on it. I use Wayland because it's the only way to get HiDPI and fractional scaling to work well.

Pretty much the only problem I have with it, is lack of good screen-recording software. OBS is a bit of an overkill for short screen-casts.