I currently have a Razer Blade 15 Advanced Model (Early 2020) and have been struggling to get my Nvidia graphics working properly with the i915 driver.
I have tried multiple configuration options as outlined in the Nvidia NixOS Wiki Page but have had no luck. The Nvidia card seems to have exclusive control over the USB-C ports so as I result I have tried multiple configurations using Prime’s sync mode.
When I enable the Nvidia card, my laptop screen goes black once I login via GDM. I’ve seen the note about blacklisting the i915 driver but that prevents my laptop screen from working properly. But when my integrated graphics card/laptop screen are functioning that prevents the external display ports from working properly.
So it seems I’m in a situation where I have to choose between either the integrated graphics or the Nvidia graphics. What do I need to change in order to have both functioning?
To use the laptop screen (and NVIDIA PRIME offload rendering):
To use the NVIDIA driver as an RandR 1.4 output source provider, also known as “PRIME”, the X server needs to be configured to use the NVIDIA driver for its primary screen and to use the “modesetting” driver for the other graphics device.
To use the laptop screen and any screen connected to the NVIDIA GPU:
To use the NVIDIA driver as an RandR 1.4 output sink provider, also known as “Reverse PRIME”, the X server needs to be configured to use the “modesetting” driver for its primary screen and to use the NVIDIA driver for the other graphics device.
Thanks for the response! So I’ve tried using the XServer snippets in your response and mixing certain NixOS configuration options but I still seem to have no luck getting both the laptop and GPU displays to work at the same time.
With Reverse PRIME, is there any way that I can implement it now? Or do I just have to wait until that PR is merged into a release?
This results in my laptop display working properly and external displays (connected to the Nvidia GPU) sort of working. The displays only work if I do not have them connected on boot and if I connect them when I’m on the GDM login screen. If I connect them during boot or after I have logged into GNOME, then my X server crashes.
After I login to GNOME, my external display is black and I have to run the following commands to mirror my laptop display:
This is some progress but it would be ideal for Xorg to not be so easy to crash – although from reading it seems to be an upstream issue with Nvidia/Xorg.
I would appreciate any additional suggestions on how to make my Reverse Prime setup more stable.
I have a similar setup to yours, on a Lenovo Thinkpad P1. I’ve found one workaround to the X crashes on monitor disconnect was to suspend first, then unplug.
sudo systemctl suspend
When using sync mode, you can run something similar to your above Xrandr to get both external and laptop monitors working:
Also, you probably saw this already, but the wiki has a helpful tip on creating “specialisations” for boot menu items, so you can switch easily between sync, offload, etc: Nvidia - NixOS Wiki
Finally, your laptop may have a BIOS controlled mux switch to drive the internal display off the dGPU – maybe that would let you run in sync mode and connect / disconnect monitors without suspend.
I did not even think to check the BIOS settings! I set GPU MODE to “Dedicated GPU only” in my BIOS and used sync mode and that got all my issues ironed out (aside from the fact that sync mode is more battery intensive, of course):