Xorg Configuration – Add VIRTUAL Output to X11

openglvirtual-desktopx11xorgxrandr

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.

Best Answer

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.

Related Question