Mirroring displays (nvidia PRIME)

Desktop Environments and Multimedia
Post Reply
Message
Author
henrylaw
Posts: 1
Joined: 2021-05-16 18:51

Mirroring displays (nvidia PRIME)

#1 Post by henrylaw »

I have a shiny new Lenovo laptop with a GeForce GTX 1650, which has the PRIME technology. It's a hidpi machine, native resolution 3840x2160. At home I like to use laptops with an external screen - an HP LP2475 with native resolution 1920x1200.

I had all sorts of problems even getting the external screen recognised, but some help from the Nvidia forum helped me to the point where I can set it up the way I want: with both screens set to 1920x1200, the lid closed, and the external display doing the job. Part of it was moving to Debian Unstable to get the right level of the nvidia driver.

But currently I have to set this up manually every time I reboot or even log off and on again. Here are the steps I go through to get it like I want it:
  • Login at the laptop screen: lightdm isn't set up for hidpi so the password window is really tiny, but once logged on Debian operates with 2x UI scaling so everything looks OK. At this point the external screen is black and the laptop is at full resolution (again, despite my changing it the previous time).
  • Issue xrandr --setprovideroutputsource NVIDIA-G0 modesetting (Without this xrandr only sees one provider, and the display applet only sees the laptop screen).
  • Using the "Display" applet, set 1x scaling and mirrored screens at 1920x1200 resolution. The external screen bursts into life.
  • Close the laptop lid and get on with something more interesting.
Can someone suggest how I can automate this? (checking for the presence of the external screen of course; that's fairly easy).

I've tried putting my --setprovideroutputsource command in .xsessionrc, without effect. I also have it in a script pointed to by the "display-setup-script" setting of /etc/lightdm/lightdm.conf: that has no effect either. I tried a customised xorg.conf screen definition from https://wiki.debian.org/NVIDIA%20Optimus but lightdm barfed altogether. But even if I could get that bit working I can't see how to automate the action of the Display applet.

The much-reviléd Redmond product does this kind of thing seamlessly; surely we can do it too?

Post Reply