On Fri, 15 Jan 2021 at 23:16, Archange archange@archlinux.org wrote:
Le 14/01/2021 à 19:15, Emil Velikov a écrit :
On Wed, 13 Jan 2021 at 16:52, Archange archange@archlinux.org wrote:
Le 12/01/2021 à 21:45, Emil Velikov a écrit :
On Tue, 12 Jan 2021 at 18:24, Archange archange@archlinux.org wrote:
OK, will try to check tomorrow with a friend that has an Optimus laptop.
Perfect, thanks in advance.
To trigger the event one has to echo into a sysfs file... Don't recall exactly, some of the following should be it. a) If the nvidia module is driving an fbcon:
- echo "0" > /sys/class/vtconsole/vtconX/bind
b) and/or a combination of the following
- echo "remove" (or was it "unbind") > /sys/class/drm/cardX/device/uevent
- echo "remove" (or was it "unbind") >
/sys/class/drm/cardX/device/driver/uevent
- echo "1" > /sys/class/drm/cardX/device/driver/unbind
- If the driver is loaded before X, it works for PRIME. However, the
card refuse to unbind because it’s in use by X even if nothing is actually running on it.
It just works here so I suspect that a command or the order was off.
My setup:
- Intel/Nvidia system, monitor plugged/powered by Intel GPU
- Therefore fb0 is for Intel (alongside card0) and Nvidia does not
have fb device only card1.
Same on the laptop of my friend.
What I've done:
- Toggle render offload ON via xrandr, try glxgears
- Toggle render offload OFF via xrandr
Not sure how I’m supposed to do that, didn’t find any reference online.
Oops sorry about that - disabling it is a hard requirement, actually. The reason why it's barely mentioned, is that people (tend to) use FOSS drivers, where rmmod isn't needed ;-)
- Issue the removal - echo "remove" > /sys/class/drm/card1/uevent
This segfaults Xorg right away.
- Confirm that it works - Xorg.0.log should list "removing GPU device
...blabla/card1"
It does appear, with the segfault:
Did you disable the offload as mentioned above? You may also want to close any apps you've started while offload was enabled.
To put it otherwise: - xrandr enable offload - X and newly started programs start using the other GPU - echo "remove" > .../uevent sends an event to userspace that the GPU is being removed
Most programs do not handle, GPU removal so they crash.
Therefore, using "remove" w/o disabling offload, is akin to (physically) plugging out the GPU, while running optirun $app. A scenario which I suspect is not supported with bumblebee.
Maybe I missed a fb? Not sure…
Seems like I should add some information there. Our systems usually have 8 VT. On one of those we have X (intentionally ignoring Wayland/Weston here and multiple X instances) and on the rest we have vtcon (aka VT framebuffer console).
Even with X completely killed, a kernel module can be used for vtcon (usually, if a screen physically connected to the GPU you have one), thus rmmod will fail. You will see the reference counter in `lsmod | grep driver` show 1.
I might try again tomorrow but really not sure, I have a plane to catch and my friend might not be available early enough.
Sure, please don't miss your plane. Everything else can happen in due time.
Thanks Emil