I wanted to ask if anybody has an idea to add a virtual monitor with Nvidia proprietary driver. Previously I used an Intel card with this solution, which worked fine: Add VIRTUAL output to Xorg .

Now I want to switch to new hardware, without an Intel card. The solution mentioned in VNC-Server as a virtual X11 monitor to expand screen doesn't work in my case. When I want to add the mode to an output, xrandr throws an error.

xrandr --newmode test 173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
xrandr --addmode "DP-1" test
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  18 (RRAddOutputMode)
  Serial number of failed request:  41
  Current serial number in output stream:  42

Basic data: Hardware: HP ZBook 15 G3, configured for discrete graphics (Optimus doesn't work!) Software: Debian 10.0.2; Kernel: 4.19.0, Nvidia-Driver-Module: xserver-xorg-video-nvidia-legacy-390xx

If you ask, why I am doing this: I use a software to transfer the virtual screen to another machine via ethernet to achieve dual monitors with two notebooks. (https://github.com/B-LechCode/sooScreenShare)

Update: There is now a proposed solution which works on my machine, but it's unable to add new modes like 1920x1200. Maybe someone has an idea?

  • same problem... were you able to fix it?
    – Carlos
    Nov 15 '20 at 17:10

I have a solution that works for me, though it's missing the ability to choose completely arbitrary resolutions. To be clear, this is just for the proprietary nvidia driver; the open-source nouveau driver works differently, as do other video card drivers.

The short version is: Use the ConnectedMonitor nvidia xorg.conf Screen option to activate the extra output in addition to your main monitor.

Here's the long version:

Run xrandr --query to get the names of your primary output and the unconnected one you plan to use for the virtual screen. For example, I get the following output:

LVDS-0 connected primary 1440x900+0+0 (normal left inverted right x axis y axis) 331mm x 207mm
   [various monitor modes elided]
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)

So in my case, the laptop screen is LVDS-0 and I have DP-0 through DP-5 available. Like you, I'll choose DP-1 for the virtual screen.

You will need to add an xorg.conf Screen configuration, as well as a Device section for the screen to use. That can be anywhere xorg will find it. I put mine in /etc/X11/xorg.conf.d/30-virtscreen.conf . In that file, a minimal setup is:

Section "Device"
    Identifier  "nvidiagpu"
    Driver      "nvidia"

Section "Screen"
    Identifier  "nvidiascreen"
    Device      "nvidiagpu"
    Option      "ConnectedMonitor" "LVDS-0,DP-1"

This tells the driver to use the DP-1 output even if it doesn't detect a monitor connected to it. Note that you have to list your laptop monitor (or a real, physical monitor) too, if you want to use it! If you only list the virtual output, the driver will not activate any other outputs, even if it detects monitors connected to them.

Now restart X. You should see two active monitors with xrandr and other display-querying programs.

On my system the newly-activated virtual output has a variety of resolutions available. I can select any of them (e.g. via xrandr --output DP-1 --mode 1600x900) and the virtual output will resize itself. I cannot, however, add new modes (e.g. if I wanted a 1920x1080 resolution). That still gives me the "invalid parameter attributes" error. Fortunately, I can live with the modes available to me. With luck, you'll have something useful preset for you, too.

  • WOW! Thank you, I will test this, as soon I have time for it.
    – B-LechCode
    Apr 3 at 12:53
  • It works! The only thing is: There is no 1920x1200 mode available. Maybe there are other options for the config file to achieve this?
    – B-LechCode
    Jul 4 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.