How to Create a Virtual Display for Sunshine on Arch Linux

If you're using Sunshine for remote game streaming and want to keep your monitor off while playing, creating a virtual display is a cost-effective alternative to using dummy HDMI or DP dongles. This guide will walk you through setting up a virtual display using an EDID file and enhancing your Sunshine setup with custom scripts.

See the original posts that inspired me to combine the found information:


Why Use a Virtual Display?

  • Cost-effective: No need to buy dummy plugs.
  • Customizable resolutions: Stream in resolutions your physical monitor may not support.
  • Convenience: Keep your monitor off while streaming.

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

  1. Create a directory for EDID files:
    sudo mkdir -p /usr/lib/firmware/edid
    
  2. 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

  1. 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; done
    

    Replace HDMI-A-1 in the next step with the appropriate output.

  2. 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
    
  3. Update your mkinitcpio.conf file to include the EDID file:

    FILES=(/usr/lib/firmware/edid/samsung-q800t-hdmi2.1)
    
  4. Regenerate the initramfs:

    sudo mkinitcpio -P
    
  5. Reboot your system.


Step 4: Use Sunshine for Streaming

After rebooting, Sunshine can use the virtual display for streaming. Ensure you configure Sunshine to capture the virtual display using KMS or wlroots capture.


Step 5: Automate with Custom Scripts

You can enhance your setup by adding scripts to Sunshine. These scripts can improve your experience with sunshine by automating the resolution set up and toggling off and on of the main monitor display. Examples are available in this GitHub Gist.

Example Script Workflow:

  • On Connect: Disable physical monitors and enable the virtual display.
  • On Disconnect: Re-enable physical monitors and disable the virtual display.

Conclusion

By following these steps, you can create a virtual display for Sunshine on Arch Linux without spending extra money on dummy plugs. This setup is flexible, allowing you to stream in higher resolutions or HDR, and can be further automated with custom scripts for a seamless experience. For bonus points you can install and use wxedid to modify the edid file and adjust the display parameters such as hz or resolutions, but that is outside the scope of this article.