This guide is mainly for Xorg, on Wayland there are easier way of achieving this, for example KDE's virtual monitor implementation in Krfb: krfb-virtualmonitor | tldr InBrowser.App.
A useful way to troubleshoot while working on this is to use OBS Studio to take a peek at the virtual output by adding a new source screen.
Method #1: Sacrificing one of your existing outputs
Use Xrandr to check for free outputs on your system.
Follow How to Create a Virtual Display for Sunshine on Arch Linux - Anton Ždanov and stop before the Sunshine section:
- Regarding EDID files, you can add modes later using xrandr, so you don't need to choose one that matches your desired specifications.
Step 1: Get an EDID File
An EDID (Extended Display Identification Data) file simulates a monitor. You can download pre-made EDID files from the v4l-utils repository. Choose one that matches your desired resolution and features (e.g., 4K, HDR).
Step 2: Place the EDID File
- Create a directory for EDID files:
sudo mkdir -p /usr/lib/firmware/edid
- Copy your chosen EDID file to this directory. For example:
sudo cp samsung-q800t-hdmi2.1 /usr/lib/firmware/edid/Step 3: Configure Kernel Parameters
- Identify your GPU's free HDMI or DP output:
for p in /sys/class/drm/*/status; do con=${p%/status}; echo -n "${con#*/card?-}: "; cat $p; doneReplace
HDMI-A-1in the next step with the appropriate output.
- Add the following kernel parameters (see arch wiki or endeavour os discovery):
drm.edid_firmware=HDMI-A-1:edid/samsung-q800t-hdmi2.1 video=HDMI-A-1:e
- Update your mkinitcpio.conf file to include the EDID file:
FILES=(/usr/lib/firmware/edid/samsung-q800t-hdmi2.1)
- Regenerate the initramfs:
sudo mkinitcpio -P
- Reboot your system.
You might afterwards need to enable the display in your Display Settings before it starts working.
Method #2: Abusing the EVDI Linux driver before adding the output in kernel parameters
From DisplayLink/evdi: Extensible Virtual Display Interface on Github:
The Extensible Virtual Display Interface (EVDI) is a Linux® kernel module that enables management of multiple screens, allowing user-space programs to take control over what happens with the image. It is essentially a virtual display you can add, remove and receive screen updates for, in an application that uses the
libevdilibrary.
- This driver is usually used for DisplayLink devices, which are basically external USB graphics cards used to obtain more display outputs from a system than it physically has, it even works for Macbooks. The cost being the software requirement and additional CPU overhead.
In Using the EVDI driver - Extreme Multihead - ArchWiki, it is suggested that this driver can be (ab)used to create virtual outputs without a DisplayLink dock. You will lose out on GPU acceleration that way, but the result is still usable for general tasks. The ArchWiki links to nvidia - Unable to add a VIRTUAL display to Xorg - Unix & Linux Stack Exchange, but the Etam Software - Virtual screen guide is clearer and lets you know that the current Xorg session will freeze during initial configuration. Although I've had luck deploying this solution for a long time on my machine, an update to EVDI suddenly now results in an unusable black screen, even tho this was supposedly patched in Monitor blank but detected as connected · Issue #523 · DisplayLink/evdi, I was never able to get it working again just using EVDI.
Either way, the pure EVDI solution is less elegant the solution presented here, as it does not play nicely with Desktop Environment screen management (eg. having to disable the Screen Management background service KScreen2 in KDE Plasma using the Background Services GUI Program, rendering the Display Configuration page in KDE System Settings unusable.)
From Etam Software - Virtual screen:
- For Arch Linux the EVDI module is available in the AUR
- You can get more than one extra output this way by changing the number for
initial_device_count
Install evdi kernel module
git clone https://github.com/DisplayLink/evdi.git cd evdi/module make && sudo make install # or sudo make install_dkmsAdd
evdito/etc/modules-load.d/local.conf.Add
options evdi initial_device_count=1to/etc/modprobe.d/local.conf.WARNING! This next step will freeze your Xorg, so you might want to reboot instead or be clever about killing your Xorg or something.
sudo modprobe evdi
After rebooting there should be new DVI outputs present in Xrandr
You will probably see that your new outputs don't have any modes listed in Xrandr, you should add those manually.
Now that you have extra outputs, you are able to use them to follow the steps in Method #1.
Using your newly obtained virtual outputs
It is straightforward now to use VNC or other screen sharing solutions to get your virtual outputs on your desired devices, remember that by default VNC traffic is unencrypted.
If you're planning on using and Android device, consider using adb reversing for better latency and easier connection without having to set up the target IP:
From Etam Software - Virtual screen:
4) (optional) Attach Android device through USB cable
adb reverse tcp:5900 tcp:5900Now you can point your VNC client application like MultiVNC to localhost:5900.
Top comments (0)