Skip to content

Sunshine: integrate Virtual Display Driver #54

Todo

Description

@ReenigneArcher

Is there an existing issue for this item?

  • I have searched the existing issues

Repositories

SunshineStream/Sunshine, LizardByte/libvirtualdisplay, LizardByte/libdisplaydevice

Languages/Skills/Technologies

C++, Windows, Linux, macOS

Description

This has been a highly requested feature for Sunshine.

Scope and ownership

Ship opt-in, client-sized virtual displays in Sunshine on Windows, macOS, and supported Linux desktops. The first release on each platform should provide one temporary SDR display per Sunshine app session, work with the physical monitors disconnected where the host session supports it, and clean up reliably. Release each platform when it passes its own validation.

libvirtualdisplay owns display creation, backend capabilities, stable identity, leases, and driver or service artifacts. libdisplaydevice continues to enumerate and configure displays and restore supported desktop settings. Sunshine owns user policy, session lifetime, capture, input mapping, and client-facing errors. The Windows driver is free to use. Display creation and management must work offline without a purchase, account, activation, or licensing service.

1. Stabilize the imported repository

  • Import Nonary’s source, commit history, and license notices into libvirtualdisplay. The starting point is 0923f66.
  • Fix the imported MSVC link failure for kernelbase.lib in the Windows unit-test and package jobs. The initial hosted Linux tests and CodeQL passed, and the local UCRT64 build passed all 245 tests. Make Windows MSVC/UCRT64 and Linux builds and tests green, and add macOS compile and unit-test jobs with the backend. Keep production artifacts separate from instrumented test builds. Initial CI run · CodeQL run
  • Align the repo with Sunshine, libdisplaydevice, and libvirtualhid. Add AGENTS.md, use the shared pinned tooling and test dependencies from lizardbyte-common, use cmake-build-*, CTest and GoogleTest, and enforce the repository’s clang-format and Doxygen conventions. Use the established CMake target and packaging conventions and verify a tests-disabled build from a downstream consumer. Keep reviewable formatting and build cleanup in focused changes. Audit attribution and third-party provenance, including the GPL VKMS-derived subtree and its notices. libdisplaydevice guidance · libvirtualhid guidance
  • Activate Codecov. Generate coverage and test reports with platform flags and normalized paths, establish a master baseline, and verify PR patch reporting on a real change before requiring the status. Aim for full changed-code coverage with meaningful regression tests. Keep hardware-only coverage gaps visible. Update SonarQube Cloud analysis to cover the current C/C++ and Objective-C++ sources as they land. Use compiler-aware CI analysis where needed, verify covered files and PR decoration, and triage the imported findings before requiring the new-code gate. The current Sonar result is from the old template commit and only measures YAML and JSON. Retain shared lint and CodeQL. libdisplaydevice CI · Sonar analysis

2. Define the library contract

  • Agree on a small platform-neutral C++ API for capability probing, acquiring and releasing a lease, and reporting readiness, effective mode, and a platform capture target. Keep stable display identity distinct from the current OS display ID, connector, or PipeWire stream. Keep broker transport and protocol versions behind the API. Cover ownership, idempotent cleanup, expiration after a crash, unsupported modes, and version mismatch with a fake backend and contract tests.
  • Agree on the lifecycle with Sunshine before stabilizing the API. Serialize initial display creation and mode changes. Share one target for concurrent viewers of the same app session. Retain it for pause and resume according to Sunshine’s disconnect policy, and make failed launch or resume roll back changes. Defer permanent pools and independent per-client displays until the temporary lifecycle is proven.

3. Build and validate the platform backends

  • Windows. Bring the imported UMDF/IddCx driver and broker up to LizardByte’s release standards. Use libvirtualhid’s separate WDK/MSVC build, installer and service lifecycle, signing and artifact verification as the reference. Validate device and service identities, local access controls, protocol compatibility, lease expiry, and diagnostics for standard-user and Sunshine service sessions. Start with a separately versioned x64 installer for supported Windows versions. Verify the catalog and installer signing route on stock Windows with Secure Boot and normal trust settings. Test fresh install, repair, upgrade, uninstall, rollback, and reboot with existing third-party VDDs present. Keep test certificates and coverage instrumentation confined to test artifacts. Treat ARM64 and additional Windows versions as supported once their packages pass the same checks. libvirtualhid driver packaging · Microsoft signing guidance
  • macOS. Port Dave’s in-process Objective-C++ CGVirtualDisplay backend to libvirtualdisplay. Probe the private API at runtime and release it as opt-in in Sunshine’s signed, notarized distribution. Update Sunshine’s libdisplaydevice pin to include the stable ID fix. Exercise the AppKit event loop with the tray off, lock and sleep errors, deferred cleanup after unlock, capture discovery, and actual modes on supported Macs. Expose the display ID and index to launch scripts. Track automatic window placement separately and consider a per-user helper if a concrete entitlement or lifetime requirement warrants it. Dave’s prototype notes · Stable ID fix
  • Linux. Start with logged-in KDE Plasma Wayland and test a compositor-created virtual output through Sunshine’s KWin/PipeWire path. Verify the returned stream, effective mode, GPU encoding, cursor and input geometry, and cleanup without an extra driver. Check support in each distributed package, including Flatpak, and document any portal authorization needed. Evaluate GNOME and wlroots separately. Keep the imported VKMS-derived module as an optional candidate for a demonstrated DRM or deployment gap. Require a kernel, compositor, and GPU support matrix, signed-module handling where required, and documented install and rollback before distributing it. KWin virtual-output protocol · Imported DRM backend

4. Integrate with Sunshine

  • Add a disabled-by-default setting and availability diagnostics. During launch or resume, acquire the display before encoder probing and app startup, wait for it to become capturable, and hand its exact target to capture. Use the effective mode and geometry for input mapping. Report an actionable Moonlight error if the requested display cannot be used.
  • Cover ready-to-stream, failed encoder or app startup, abandoned RTSP setup, cancel, disconnect and resume, app exit, display disappearance, and Sunshine shutdown. Stop capture and restore any changed topology in the correct order before releasing the display. Add regression tests with Sunshine’s shared test header and include conventions. Wire the dependency into the CMake lock and affected packaging manifests. Use PR #5114 as reference for use cases and UI feedback.

5. Release and expand support

  • For each platform, validate a real Moonlight launch, stream, reconnect at the same or a different client mode, and teardown. Exercise a host with no physical monitor attached, a host with a physical monitor, and failure or crash recovery. Confirm existing physical display streaming still works. Publish the tested OS, desktop, and GPU support matrix, installation and rollback steps, and troubleshooting guidance.
  • After the SDR lifecycle is stable, prioritize HDR end-to-end, persistent displays, platform-specific app placement, additional Linux compositors, and multi-display or per-client support. Keep each behind its own capability and validation evidence.

Start with the MSVC fix and CI/quality baseline, then the shared API and test double. Windows release packaging and the KDE feasibility work can proceed alongside the macOS port. Use linked implementation issues and PRs for individual changes and keep this roadmap issue as the cross-repo checklist.

Estimated Effort

effort:Extra-Large

Priority

priority:High

Target Milestone

6+ months

Dependencies

  • A libvirtualdisplay release and compatible Sunshine dependency pin for each enabled backend.
  • LizardByte’s Windows signing and installer pipeline, plus clean Windows test systems for installed-driver validation.
  • A libdisplaydevice release containing the macOS stable ID fix, signed Sunshine macOS builds, and hardware to test the supported versions.
  • Supported Linux compositor and capture combinations, with a host-side module package only if the optional DRM backend is adopted.

Activity

  1. added
    help wanted
    planned
    on Apr 20, 2025
  2. Xarishark commented on Mar 1, 2026

    @Xarishark
  3. ReenigneArcher commented on Mar 3, 2026

    @ReenigneArcher
    Author
  4. Xarishark commented on Mar 3, 2026

    @Xarishark
  5. quantumphaze commented on May 9, 2026

    @quantumphaze

    This feature worked briefly, if unintentionally, under Linux when XDG-Portal was being developed with v2026.204.180221. On the first run the compositor would run that screen and window selection screen most desktop sharing applications trigger with the option of using a virtual monitor. Every subsequent run would no longer prompt for which monitor (virtual or not) to use, remembering the first setting forever and the whole feature stopped working after a later update.

  6. SorceressLyra commented on Sep 11, 2026

    @SorceressLyra

    I would be willing to look into this in my spare time, as this is the feature I miss the most from Sunshine :)

  7. ReenigneArcher commented on Sep 11, 2026

    @ReenigneArcher
    MemberAuthor

    This feature is probably next on my list actually.

  8. SorceressLyra commented on Sep 11, 2026

    @SorceressLyra

    This feature is probably next on my list actually.

    Alright that's awesome to hear! I won't get in your way then :)

  9. moved this from Todo to In Progress in roadmapon Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

  • Status
    In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions