Add VIRTUAL output to Xorg

40,075

Solution 1

Create a 20-intel.conf file:

sudo vi /usr/share/X11/xorg.conf.d/20-intel.conf

Add the following configuration information into the file:

Section "Device"
    Identifier "intelgpu0"
    Driver "intel"
    Option "VirtualHeads" "2"
EndSection

This tells the Intel GPU to create 2 virtual displays. You can change the number of VirtualHeads to your needs.

Then logout and login. You should see VIRTUAL1 and VIRTUAL2 when you run xrandr.

Note if you were using the modesetting driver previously (which is the modern default) switching to the intel driver will cause the names of displays to change from, eg, HDMI-1 or DP-1 to HDMI1 or DP1.

Solution 2

In case of black screen on boot with 20-intel.conf, create a 30-virtscreen.conf with these contents:

# nvidia/nouveau/amdgpu device should be configured first before Intel GPU
Section "Device"
  Identifier "nvidiagpu0"
  Driver     "nvidia" # Because you are using Nvidia proprietary driver. Change to "nouveau" if you are using open source nouveau driver
EndSection

# Then configure intel internal GPU
Section "Device"
  Identifier "intelgpu0"
  Driver     "intel"
  Option     "VirtualHeads" "2"
EndSection

I found this solution on the Issues page of the kbumsik/VirtScreen Github project.

Share:
40,075

Related videos on Youtube

Paulus
Author by

Paulus

Updated on September 18, 2022

Comments

  • Paulus
    Paulus over 1 year

    I want to create a dummy, virtual output on my Xorg server on current Intel iGPU (on Ubuntu 16.04.2 HWE, with Xorg server version 1.18.4). It is the similiar to Linux Mint 18.2, which one of the xrandr output shows the following:

    Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
    ...
    eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
    ...
    VIRTUAL1 disconnected (normal left inverted right x axis y axis)
    ...
    

    In the Linux Mint 18.2, I can turn off the built-in display (eDP1) and turn on the VIRTUAL1 display with any arbitrary mode supported by the X server, attach x11vnc to my main display and I'll get a GPU accelerated remote desktop.

    But in Ubuntu 16.04.2, that's not the case. The VIRTUAL* display doesn't exist at all from xrandr. Also, FYI, xrandr's output names is a little bit different on Ubuntu 16.04.2, where every number is prefixed with a -. E.g. eDP1 in Linux Mint becomes eDP-1 in Ubuntu, HDMI1 becomes HDMI-1, and so on.

    So, how to add the virtual output in Xorg/xrandr?

    And how come Linux Mint 18.2 and Ubuntu 16.04.2 (which I believe uses the exact same Xorg server, since LM 18.2 is based on Ubuntu, right?) can have a very different xrandr configurations?

    Using xserver-xorg-video-dummy is not an option, because the virtual output won't be accelerated by GPU.

  • Paulus
    Paulus over 6 years
    And this also changes the xrandr display names to 'HDMI1' and 'eDP1' instead of 'HDMI-1' and 'eDP-1', as expected!
  • BayesianBroccoli
    BayesianBroccoli almost 5 years
    Doing this removed my HDMI1 screen from the list of displays as shown by xrandr. Could be that this interferes with my Nvidia X settings
  • Benjamin Barrois
    Benjamin Barrois over 4 years
    Is it any way to do the same thing with an Nvidia GPU instead of the Intel GPU?
  • Toby Speight
    Toby Speight over 2 years
    This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review