+++ date = "2018-02-11T21:37:32+00:00" publishdate = "2023-12-29T07:08:55+00:00" title = "GPU Acceleration on Remote Desktop" slug = "headless-gpu-remote-acceleration" author = "Thedro" tags = ["headless","server","linux"] type = "posts" summary = "Sometimes the solution to some problems are strange. Imagine a headless, remote, linux based desktop setup where users can remote into a graphical environment." draft = "" syntax = "1" toc = "" updated = "2020-01-22" +++ {{< image source="/images/headless-gpu-remote-acceleration.png" >}} A screenshot of my remote server's desktop {{< /image >}} 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 {{< sidenote mark="modes." set="left" >}}We can get a modeline by using the command `cvt 1024 768`.{{< /sidenote>}} ```shell 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 {{< sidenote mark="type." set="right" >}}We are using a display port.{{< /sidenote>}} ```shell 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. ```shell 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".