On Thu, 14 Jan 2021 at 18:15, Emil Velikov email@example.com wrote:
On Wed, 13 Jan 2021 at 16:52, Archange firstname.lastname@example.org wrote:
Le 12/01/2021 à 21:45, Emil Velikov a écrit :
On Tue, 12 Jan 2021 at 18:24, Archange email@example.com 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") >
- 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.
- 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.
What I've done:
- Toggle render offload ON via xrandr, try glxgears
- Toggle render offload OFF via xrandr
- Issue the removal - echo "remove" > /sys/class/drm/card1/uevent
- Confirm that it works - Xorg.0.log should list "removing GPU device
- No Nvidia fb - skipping the vtcon magic
- Double-check nothing else is using the module - lsmod | grep
nvidia_drm -> returns 0
- Remove the nvidia module(s) - rmmod nvidia_drm (+ rest)
In practise the above approach should work with reverse PRIME but honestly I haven't tried.
Can you give it a try, step-by-step and let me know if any issues you encounter along the way.
Completely forgot: there is no need for an Optimus machine. The above is applicable for any multi GPU setup - dual AMD, dual Nvidia or any random 3+ combination.
The only hardcoded assumption of a) dual and b) optimus machine seems** to be in BB.
-Emil ** From a quick read through the code a while ago.