hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.62k stars 827 forks source link

Multiple logical seat support #1731

Open crthpl opened 1 year ago

crthpl commented 1 year ago
vaxerski commented 1 year ago

why?

crthpl commented 1 year ago

So you can have multiple people using the same computer. Physical seats require 1 graphics card per seat.

vaxerski commented 1 year ago

I don't think I am too concerned about that on a tiling wayland compositor.

crthpl commented 1 year ago

If I implemented this myself, would it be merged?

MahouShoujoMivutilde commented 1 year ago

Can't you just connect 2 monitors, 2 mouse/keyboards and run 2 hyprlands with different configs (different users too) mapping said devices?

IDK, maybe you can't, just throwing idea out there.

Because I can run Two separate hyprland instances on TTY1 and TTY2.

I don't have second monitor to test the rest though.

EDIT:

Loginctl seems to be able to attach devices per seat.

crthpl commented 1 year ago

@MahouShoujoMivutilde This will not work as switching the tty switches it for all monitors (i.e. you can only have one tty focused at a time)

MahouShoujoMivutilde commented 1 year ago

Maybe have a service to setup multiple seats at boot with their devices ?

❯ loginctl seat-status seat0
seat0
seat0
        Sessions: *1
         Devices:
                  ├─/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input1
                  │ input:input1 "Power Button"
                  ├─/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input0
                  │ input:input0 "Power Button"
                  ├─/sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1
                  │ usb:usb1
                  │ └─/sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-9
                  │   usb:1-9
                  ├─/sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb5
                  │ usb:usb5
                  ├─/sys/devices/pci0000:00/0000:00:01.3/0000:02:00.2/0000:03:04.0/0000:05:00.0/usb4
                  │ usb:usb4
                  ├─/sys/devices/pci0000:00/0000:00:01.3/0000:02:00.2/0000:03:04.0/0000:05:00.0/usb6
                  │ usb:usb6
                  ├─/sys/devices/pci0000:00/0000:00:03.1/0000:09:00.0/drm/card0
                  │ [MASTER] drm:card0
                  │ ├─/sys/devices/pci0000:00/0000:00:03.1/0000:09:00.0/drm/card0/card0-DP-1
                  │ │ [MASTER] drm:card0-DP-1
                  │ ├─/sys/devices/pci0000:00/0000:00:03.1/0000:09:00.0/drm/card0/card0-DVI-D-1
                  │ │ [MASTER] drm:card0-DVI-D-1
                  │ ├─/sys/devices/pci0000:00/0000:00:03.1/0000:09:00.0/drm/card0/card0-DVI-I-1
                  │ │ [MASTER] drm:card0-DVI-I-1
                  │ └─/sys/devices/pci0000:00/0000:00:03.1/0000:09:00.0/drm/card0/card0-HDMI-A-1
                  │   [MASTER] drm:card0-HDMI-A-1
....

Like in my case it seems like it is possible to distinguish different video outputs.

So I would (idk if it works like that, just reading 1 and 2) just

loginctl attach seat1 /sys/devices/pci0000:00/0000:00:03.1/0000:09:00.0/drm/card0/card0-HDMI-A-1

(assuming /sys/devices/pci0000:00/0000:00:03.1/0000:09:00.0/drm/card0/card0-DP-1 already on seat0)

+ keyboard/mouse/etc, something like this.

So theoretically you will boot at different TTYs.

crthpl commented 1 year ago

I tried this and it didn't work, because agetty only uses seat0 and LightDM uses whichever seat has the master drm/card0. All links you referenced also had one graphics card per user. I think this is because Login Managers, WMs, and Xorg all open the graphics card, and not any specific display which is attached to it.

MahouShoujoMivutilde commented 1 year ago

All links you referenced also had one graphics card per user. I think this is because Login Managers, WMs, and Xorg all open the graphics card, and not any specific display which is attached to it.

Yeah, seems likely.

But, I mean, we do have containers with full GPU acceleration, so it should be possible without full software awareness on every level to achieve a working multiseat configuration.


...Also, what kind of graphics card do you have?

Because I remember reading that at least for nvidia it is possible to split single GPU to multiple virtual ones with patched(*) driver. Not as seat-per-output-port like I wrote above, but full virtual GPU, for PCI-E passthrough to VMs.

* see https://krutavshah.github.io/GPU_Virtualization-Wiki/ and https://aur.archlinux.org/packages/nvidia-merged-dkms

Intel also has https://wiki.archlinux.org/title/Intel_GVT-g without any need for modded driver.

Maybe if you split GPU on such a low level you'll be able too just.. IDK, make some containers instead of two loginctl seats, so they both seat0 and completely unaware of each other.

Or, hell, maybe it'll even convince LightDM to just work...


Also, dude here (on 14 minutes) says that even if you attach just 1 port (like I posited to be possible above) to another seat, it'll attach the whole card anyway, which sucks.

So yeah, 2 vGPUs seems like a way to do it.

crthpl commented 1 year ago

This looks like it is not easy to setup. It also says that kernels 5.10 and up are not supported (so I'll need downgrade), and that Ampere Series GA102 (which I have) GPUs are not supported.

MahouShoujoMivutilde commented 1 year ago

This looks like it is not easy to setup.

Oh yeah

Also found:

Multiseat with only a single DRM driver is not possible so far. This is NOT a limitation of logind, but rather of DRM. There have been ideas how to fix this, but so far no-one pushed it to the upstream kernel. For now you need at least one separate DRM card per seat.

Thanks David

https://systemd-devel.freedesktop.narkive.com/oquQNHa5/loginctl-multi-seats#post37

That was 9 years ago.

https://serverfault.com/q/814420

https://forums.debian.net/viewtopic.php?t=153072

And it didn't seem like it changed.

So yeah, sucks.


I've used to have RDP setup to windows machine (on lan), just to have an actually decent office and modern photoshop.

This setup allowed (after some patching to lift artificial restrictions) both local and remote (me) users to work simultaneously (on different user accounts) without any noticeable lag, including watching videos. I haven't played any heavy games that way, but it probably possible too.

Point is - take laptop / old pc / buy raspberry pi equivalent / etc, set it up as thin client for RDP, and have desktop running as server.

If fucking windows can do it, linux can.

Question is - can wayland?

HuntFeng commented 1 year ago

Any luck? I'm trying to setup multiseat as well, but hyprland only works on seat0 and not seat1. (There are 2 seats total)

vaxerski commented 1 year ago

no. There is only one seat.

crthpl commented 1 year ago

I have a branch with multiple logical seat that is maybe 40% done, and it doesn't compile yet. The codebase (and even some parts of Wayland) are very dependent on their being 1 seat.

clsty commented 4 months ago

Any luck on this? I've just found an article that Sway added support for multiseat.

Sway 1.9 also brings improved xdg-activation-v1 support, which now includes workspace tracking and multi-seat capabilities, making it more versatile in multi-user environments.

Though I still prefer Hyprland. :) Would be even better if Hyprland supports multi-seat. It's a cool feature.

garlett commented 1 month ago

I am using this on weston, but I am going to patch wlroots, or maybe hyprland. It works by using 'drm lease manager' from automotive linux. A better solution is seatd managing the leases and forward the drm fd, but seatd does not have multiseat support yet. @vaxerski can you look at this patch stub?