Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

Multiple logical seat support

Open crthpl opened this issue 1 year ago • 15 comments

  • Support logical seats
  • Each seat has its own focus
  • Seats are configured with per-device input config option seat = seat2oranyname (default is seat0)
  • Dispatchers are run for the seat that executed them (in the case of binds)
  • IPC has --seat=seatname flag (default is seat0)
  • Perhaps a seat configuration that allows you to restrict seats to specific monitors

crthpl avatar Mar 07 '23 18:03 crthpl

why?

vaxerski avatar Mar 08 '23 01:03 vaxerski

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

crthpl avatar Mar 08 '23 04:03 crthpl

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

vaxerski avatar Mar 08 '23 09:03 vaxerski

If I implemented this myself, would it be merged?

crthpl avatar Mar 08 '23 22:03 crthpl

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.

MahouShoujoMivutilde avatar Mar 08 '23 22:03 MahouShoujoMivutilde

@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)

crthpl avatar Mar 08 '23 23:03 crthpl

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.

MahouShoujoMivutilde avatar Mar 09 '23 00:03 MahouShoujoMivutilde

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.

crthpl avatar Mar 09 '23 16:03 crthpl

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.

MahouShoujoMivutilde avatar Mar 09 '23 18:03 MahouShoujoMivutilde

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.

crthpl avatar Mar 09 '23 20:03 crthpl

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?

MahouShoujoMivutilde avatar Mar 09 '23 21:03 MahouShoujoMivutilde

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

HuntFeng avatar Aug 25 '23 21:08 HuntFeng

no. There is only one seat.

vaxerski avatar Aug 25 '23 22:08 vaxerski

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.

crthpl avatar Aug 26 '23 00:08 crthpl

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.

clsty avatar Apr 21 '24 05:04 clsty

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?

garlett avatar Aug 08 '24 03:08 garlett