GPU Acceleration on Remote Desktop
Sometimes the solution to a problem is strange. Imagine a headless, remote, Linux based desktop setup where users can remote into a graphical environment. The remote desktop works great with the integrated graphics card but once it switches to discrete graphics it comes to a screeching halt. No graphical acceleration.
Many discrete graphic cards now enter a low power state if you do not connect a monitor. This is good for users who care about power efficiency but a pain for those who implement headless configurations. The common solution to this problem is to buy a “dummy plug” for your
HDMI or Display Port to fake a head onto your headless configuration. It does work.
There is a way of doing this without a dummy plug. It turns out that we can pretend that we have a display connected by using
xrandr. First tell the system to add new resolution
We can get a modeline by using the command
cvt 1024 768.
xrandr --newmode "1366x768p" 72.00 1366 1414 1446 1494 768 771 777 803; xrandr --newmode "1280x800p" 24.15 1280 1312 1400 1432 800 819 822 841; xrandr --newmode "1024x768p" 18.71 1024 1056 1120 1152 768 786 789 807;
Then add and assign those resolution modes to a port We are using a display port.
xrandr --addmode DisplayPort-0 "1366x768p"; xrandr --addmode DisplayPort-0 "1280x800p"; xrandr --addmode DisplayPort-0 "1024x768p";
Finally pick a mode and then force output on the interface.
xrandr --output DisplayPort-0 --mode "1366x768p";
The discrete graphics card comes alive and we get
GPU acceleration on the remote. This may not work for all cards, but it has good coverage. For everything else there is always the “dummy plug”.
22 January 2020