Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/ci-driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
-G "Visual Studio 18 2026"
-A "x64,version=$env:WindowsSDKVersion"
-DBUILD_TESTS=OFF
-DBUILD_SUNSHINE_VIRTUAL_DISPLAY_DRIVER=ON
-DBUILD_VIRTUALDISPLAY_WINDOWS_DRIVER=ON
-DBUILD_VIRTUALDISPLAY_TOOLS=ON
-DBUILD_VIRTUALDISPLAY_PROBE=ON
"-DLIBVIRTUALDISPLAY_PACKAGE_VERSION=$env:PACKAGE_VERSION"
Expand All @@ -105,7 +105,7 @@ jobs:
id: driver_catalog
shell: pwsh
run: |
$catalog = Resolve-Path -LiteralPath (Join-Path $env:DRIVER_PACKAGE 'sunshinevirtualdisplaydriver.cat')
$catalog = Resolve-Path -LiteralPath (Join-Path $env:DRIVER_PACKAGE 'lizardbytevirtualdisplay.cat')
"path=$($catalog.Path)" >> $env:GITHUB_OUTPUT

- name: Sign CI driver catalog with a local test certificate
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
throw "Windows driver catalog signature is invalid: $($signature.StatusMessage)"
}

$cer = Join-Path $env:DRIVER_PACKAGE 'SunshineVirtualDisplayDriver.cer'
$cer = Join-Path $env:DRIVER_PACKAGE 'LizardByteVirtualDisplay.cer'
Export-Certificate -Cert $signature.SignerCertificate -FilePath $cer | Out-Null

- name: Package driver and tools
Expand All @@ -175,17 +175,17 @@ jobs:
'LICENSE'
'README.md'
'driver/'
'driver/SunshineVirtualDisplayDriver.cat'
'driver/SunshineVirtualDisplayDriver.cer'
'driver/SunshineVirtualDisplayDriver.dll'
'driver/SunshineVirtualDisplayDriver.inf'
'driver/LizardByteVirtualDisplay.cat'
'driver/LizardByteVirtualDisplay.cer'
'driver/LizardByteVirtualDisplay.dll'
'driver/LizardByteVirtualDisplay.inf'
'tools/'
'tools/virtualdisplay.exe'
'tools/virtualdisplay_broker.exe'
'tools/virtualdisplay_probe.exe'
'vulkan-layer/'
'vulkan-layer/VkLayer_sunshine_hdr.dll'
'vulkan-layer/VkLayer_sunshine_hdr.json'
'vulkan-layer/VkLayer_lizardbyte_hdr.dll'
'vulkan-layer/VkLayer_lizardbyte_hdr.json'
) | ForEach-Object { "$env:WINDOWS_ARCHIVE_NAME/$_" }

$package = Get-Item -LiteralPath "artifacts/$env:WINDOWS_ARCHIVE_NAME.zip"
Expand Down
16 changes: 8 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ build-*/
cmake-build-*/

# Generated Linux DRM module build outputs.
/linux/vibeshine-drm/*.o
/linux/vibeshine-drm/.*.cmd
/linux/vibeshine-drm/*.ko
/linux/vibeshine-drm/*.mod
/linux/vibeshine-drm/*.mod.c
/linux/vibeshine-drm/Module.symvers
/linux/vibeshine-drm/modules.order
/linux/vibeshine-drm/vibeshine_drm_version.h
/linux/virtualdisplay-drm/*.o
/linux/virtualdisplay-drm/.*.cmd
/linux/virtualdisplay-drm/*.ko
/linux/virtualdisplay-drm/*.mod
/linux/virtualdisplay-drm/*.mod.c
/linux/virtualdisplay-drm/Module.symvers
/linux/virtualdisplay-drm/modules.order
/linux/virtualdisplay-drm/virtualdisplay_drm_version.h
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

## Style and workflows

- Keep public APIs and driver behavior independent of host applications. Document the requirements of optional integrations.
- Use `libvirtualdisplay` for the project and library, `virtualdisplay` for command and Linux component names, and
**LizardByte Virtual Display** for the Windows product. Use `LizardByte VD` as the short default EDID monitor name.
- Follow the repository's clang-format configuration. The VKMS-derived subtree follows the upstream kernel configuration.
- Document new and changed C/C++ APIs with Doxygen comments. Keep platform-specific tests under the applicable guards.
- Pin external GitHub Actions to full commit hashes. Declare empty workflow permissions and grant required permissions
Expand Down
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.24)

project(libvirtualdisplay
VERSION 0.0.0
DESCRIPTION "Clean-room virtual display driver support for Sunshine."
DESCRIPTION "Virtual display drivers, control APIs, and tools."
HOMEPAGE_URL "https://github.com/LizardByte/libvirtualdisplay"
LANGUAGES CXX)

Expand Down Expand Up @@ -36,11 +36,10 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
option(BUILD_TESTS "Build tests" ON)
endif()

option(BUILD_VIBESHINE_KWIN_GPU_BRIDGE
"Build and install the KWin GPU-association bridge for Vibeshine DRM" OFF)
option(BUILD_VIRTUALDISPLAY_KWIN_GPU_BRIDGE
"Build and install the KWin GPU-association bridge for the DRM backend" OFF)
set(_libvirtualdisplay_build_kwin_bridge OFF)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND BUILD_VIBESHINE_KWIN_GPU_BRIDGE AND
NOT SUNSHINE_BUILD_APPIMAGE AND NOT SUNSHINE_BUILD_FLATPAK)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND BUILD_VIRTUALDISPLAY_KWIN_GPU_BRIDGE)
set(_libvirtualdisplay_build_kwin_bridge ON)
endif()

Expand Down
64 changes: 30 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,12 @@
<a href="https://sonarcloud.io/project/overview?id=LizardByte_libvirtualdisplay"><img src="https://img.shields.io/sonar/quality_gate/LizardByte_libvirtualdisplay.svg?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarqubecloud&label=sonarcloud" alt="SonarCloud"></a>
</div>

Cross-platform virtual display driver support for Sunshine.

This repository owns Sunshine's dedicated virtual display control protocols,
identity model, EDID generation, Windows UMDF/IddCx driver implementation, and
Linux DRM virtual-display backend.
It is intentionally separate from Sunshine's existing `libdisplaydevice`
dependency, which remains only a display enumeration/settings library.
libvirtualdisplay provides drivers, C++ control APIs, and tools for creating
and managing virtual displays. It includes a Windows UMDF/IddCx driver and a
Linux DRM backend that applications can use independently.

## Scope

The driver is dedicated to Sunshine virtual-display use cases:

- create and remove temporary displays through the control API
- set and query a small permanent-display pool
- preserve stable display identity through `DisplayId`
Expand Down Expand Up @@ -57,19 +51,19 @@ and pass `-C Release` to CTest. Standalone GNU test builds enable coverage autom

On Linux, the same build also tests the connector broker, module installer,
kernel-source contract, deterministic HDR EDID, and the public
`LinuxControlClient`. The `linux/vibeshine-drm` tree contains the GPL-licensed
`LinuxControlClient`. The `linux/virtualdisplay-drm` tree contains the GPL-licensed
out-of-tree DRM module derived from upstream VKMS; its source files retain the
upstream SPDX identifiers. Service and installer assets live under
`linux/packaging`.

The optional KWin bridge (`-DBUILD_VIBESHINE_KWIN_GPU_BRIDGE=ON`) requires
The optional KWin bridge (`-DBUILD_VIRTUALDISPLAY_KWIN_GPU_BRIDGE=ON`) requires
libdrm 2.4.127 or newer and the GBM development package.

To build only the Windows driver, CLI, and runtime probe:
To build the Windows driver and tools:

```powershell
cmake -S . -B build-driver -G Ninja -DBUILD_TESTS=OFF -DBUILD_SUNSHINE_VIRTUAL_DISPLAY_DRIVER=ON -DBUILD_VIRTUALDISPLAY_TOOLS=ON -DBUILD_VIRTUALDISPLAY_PROBE=ON
cmake --build build-driver --target SunshineVirtualDisplayDriver virtualdisplay_tools -j 10
cmake -S . -B cmake-build-driver -G Ninja -DBUILD_TESTS=OFF -DBUILD_VIRTUALDISPLAY_WINDOWS_DRIVER=ON -DBUILD_VIRTUALDISPLAY_TOOLS=ON -DBUILD_VIRTUALDISPLAY_PROBE=ON
cmake --build cmake-build-driver --parallel
```

The Windows driver build requires MSVC and the Windows Driver Kit. Packaging
Expand All @@ -81,19 +75,19 @@ developer environment.
To build the release ZIP locally:

```powershell
cmake -S . -B build-driver -G Ninja -DBUILD_TESTS=OFF -DBUILD_SUNSHINE_VIRTUAL_DISPLAY_DRIVER=ON -DBUILD_VIRTUALDISPLAY_TOOLS=ON -DBUILD_VIRTUALDISPLAY_PROBE=ON -DLIBVIRTUALDISPLAY_PACKAGE_VERSION=0.1.0
cmake --build build-driver --target package -j 10
cmake -S . -B cmake-build-driver -G Ninja -DBUILD_TESTS=OFF -DBUILD_VIRTUALDISPLAY_WINDOWS_DRIVER=ON -DBUILD_VIRTUALDISPLAY_TOOLS=ON -DBUILD_VIRTUALDISPLAY_PROBE=ON -DLIBVIRTUALDISPLAY_PACKAGE_VERSION=0.1.0
cmake --build cmake-build-driver --target package --parallel
```

The ZIP contains:

- `driver/SunshineVirtualDisplayDriver.inf`
- `driver/SunshineVirtualDisplayDriver.cat`
- `driver/SunshineVirtualDisplayDriver.dll`
- `driver/LizardByteVirtualDisplay.inf`
- `driver/LizardByteVirtualDisplay.cat`
- `driver/LizardByteVirtualDisplay.dll`
- `tools/virtualdisplay.exe`
- `tools/virtualdisplay_broker.exe`
- `tools/virtualdisplay_probe.exe`
- `vulkan-layer/VkLayer_sunshine_hdr.dll` and `vulkan-layer/VkLayer_sunshine_hdr.json`
- `vulkan-layer/VkLayer_lizardbyte_hdr.dll` and `vulkan-layer/VkLayer_lizardbyte_hdr.json`
- `README.md` and `LICENSE`

Support traces and Event Log capture should follow
Expand All @@ -104,8 +98,7 @@ is intended for the driver, CLI, and probe tools.

## CLI usage

`virtualdisplay.exe` is the user-facing command line tool. It talks to the
installed driver through the same control interface Sunshine uses.
`virtualdisplay.exe` manages the **LizardByte Virtual Display** driver through its control interface.

After extracting the release ZIP, run commands from the extracted top-level
directory. Install the driver with:
Expand All @@ -117,12 +110,12 @@ directory. Install the driver with:
For a local developer build, the same command can be run from the build output:

```powershell
.\build-driver\src\driver\virtualdisplay.exe driver install
.\cmake-build-driver\src\driver\virtualdisplay.exe driver install
```

`driver install` self-elevates through the Windows UAC prompt when it is not
already running as administrator. By default it installs
`driver\SunshineVirtualDisplayDriver.inf` from the same extracted release
`driver\LizardByteVirtualDisplay.inf` from the same extracted release
directory. To install a different INF:

```powershell
Expand Down Expand Up @@ -190,7 +183,8 @@ Supported settings:
- `--physical-width-mm`: physical panel width advertised in EDID, in millimeters.
- `--physical-height-mm`: physical panel height advertised in EDID, in millimeters.
- `--refresh`: preferred refresh rate. Values up to `1000` are treated as Hz, so `120` means `120 Hz`; larger values are treated as millihertz.
- `--name`: monitor name advertised in EDID, truncated to the protocol limit.
- `--name` sets the monitor name advertised in EDID. The default is `LizardByte VD`.
The EDID name field holds up to 13 ASCII characters.

The driver validates modes against the protocol range:

Expand All @@ -199,7 +193,7 @@ The driver validates modes against the protocol range:
- physical width and height: `10 mm` through `2550 mm`
- refresh: any positive millihertz value accepted by the protocol; the driver no longer applies a policy refresh-rate ceiling

### Vulkan HDR layer
### Optional Vulkan HDR layer

Vendor Vulkan ICDs (NVIDIA, Intel) only advertise HDR surface formats for
displays driven by their own display pipeline. Indirect (IddCx) displays are
Expand All @@ -211,7 +205,7 @@ correctly when asked (verified by reading back DWM's FP16 scRGB composition
through Desktop Duplication). DirectX HDR is unaffected; this gap is specific
to Vulkan surface-format enumeration.

`VK_LAYER_SUNSHINE_virtual_hdr` is an implicit Vulkan layer that closes the
`VK_LAYER_LIZARDBYTE_virtual_hdr` is an implicit Vulkan layer that closes the
gap: it appends the two missing HDR format pairs to
`vkGetPhysicalDeviceSurfaceFormats(2)KHR` results when the surface's monitor
reports HDR support in Windows and the ICD did not already advertise them.
Expand All @@ -224,13 +218,15 @@ Register it system-wide with:
```

`vulkan-layer install` self-elevates and registers the manifest from the
`vulkan-layer` directory of the extracted release (or next to the CLI in a
build tree); pass `--json PATH` to register a different manifest. Set
The layer only injects HDR formats while Sunshine publishes an active HDR stream
signal; outside an HDR stream it remains loaded but passes results through
unchanged. Set `DISABLE_SUNSHINE_VIRTUAL_HDR=1` to disable it per-process, or
`SUNSHINE_VHDR_FORCE=1` to inject the formats regardless of the monitor's
reported HDR support while the Sunshine HDR stream signal is active.
`vulkan-layer` directory of the extracted release or next to the CLI in a build
tree. Pass `--json PATH` to register a different manifest.

The layer injects HDR formats while a host signals an active HDR session using
the Windows event `Global\LizardByteVirtualHdrActive` or its local equivalent
`Local\LizardByteVirtualHdrActive`. Other queries pass through unchanged.
Set `DISABLE_LIBVIRTUALDISPLAY_HDR_LAYER=1` to disable the layer for a process.
Set `LIBVIRTUALDISPLAY_HDR_FORCE=1` to bypass the monitor HDR capability check while
the event is signaled.

Use `virtualdisplay_probe.exe` for diagnostics and runtime validation rather
than normal display management. Common commands are:
Expand Down
16 changes: 7 additions & 9 deletions docs/frame-transport.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Experimental frame transport

This is the opt-in source path for Nonary/Vibepollo#626. It implements the
owner-authenticated ring, WDF request identity adapter, IddCx producer, and
matching host capture integration. Both host and native driver build options
default off. No signed driver, install, or release is part of this source change.
The experimental frame transport provides an owner-authenticated frame ring,
WDF request identity handling, an IddCx producer, and a D3D11 consumer adapter.
Enable the driver producer with `LIBVIRTUALDISPLAY_ENABLE_FRAME_TRANSPORT`.
The host application's capture integration is opt-in.

Protocol 3.8 adds `QueryFrameTransportCapabilities` (read access, no input, a
40-byte `FrameTransportCapabilities` reply) and an owner-authenticated target
Expand Down Expand Up @@ -101,11 +101,9 @@ primitive, including wrong owner, expiry, failed registration, late clear/error,
display recreation and in-flight resource lifetime. They do not execute WDF,
DXGI handle duplication, GPU synchronization or IddCx callbacks.

The current host packages self-signed release v1.6.4 from revision
`2a29ea71a52d15522c95b3de532b6612c54d75cc`, independently of the submodule's
source revision. Neither build option enables frame push by default. A native
Windows/WDK build, direct requestor identity/process access checks, four old/new
host-driver combinations, handle-negative tests, and lifecycle stress must
Frame push is disabled by default. A native Windows/WDK build, direct requestor
identity and process access checks, four old/new host-driver combinations,
handle-negative tests, and lifecycle stress must
precede enabling or shipping it. Keep WGC/DDA available throughout.

Validate frame correctness and acquire-to-receiver timing at 60/120/240 Hz on
Expand Down
10 changes: 5 additions & 5 deletions docs/support-diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ HDR, color profile, swapchain, or driver restart issues.

## Driver ETW Trace

The UMDF driver registers the `Sunshine.VirtualDisplayDriver` TraceLogging
The UMDF driver registers the `LizardByte.VirtualDisplay` TraceLogging
provider:

- Provider GUID: `{3d5d3bd9-8500-4523-9334-583f4b5e6f80}`
Expand All @@ -18,9 +18,9 @@ provider:
Collect a live trace with:

```powershell
logman start SunshineVDD -p "{3d5d3bd9-8500-4523-9334-583f4b5e6f80}" 0xffffffff 0xff -ets
logman start VirtualDisplayDriver -p "{3d5d3bd9-8500-4523-9334-583f4b5e6f80}" 0xffffffff 0xff -ets
# Reproduce the issue.
logman stop SunshineVDD -ets
logman stop VirtualDisplayDriver -ets
```

Export or archive the generated ETL with the matching driver package, PDB, and
Expand All @@ -37,10 +37,10 @@ recent in-memory trace ring with:
## Broker And Helper Events

The broker and active-session helper write Windows Event Log entries through
the `SunshineVirtualDisplayBroker` source. Capture recent entries with:
the `LizardByteVirtualDisplayBroker` source. Capture recent entries with:

```powershell
wevtutil qe Application /q:"*[System[Provider[@Name='SunshineVirtualDisplayBroker']]]" /f:text /c:100
wevtutil qe Application /q:"*[System[Provider[@Name='LizardByteVirtualDisplayBroker']]]" /f:text /c:100
```

Include these helper command outputs when they are relevant:
Expand Down
19 changes: 9 additions & 10 deletions linux/kwin-gpu-bridge.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# KWin virtual rendering bridge

The native Linux package preloads `libvibeshine-kwin-gpu.so` into the KDE
desktop and login compositors. Only `/usr/bin/kwin_wayland` enables its hooks;
other processes pass through unchanged and compositor children do not inherit
the preload.
The optional bridge loads `libvirtualdisplay-kwin-gpu.so` into the KDE desktop and
login compositors. Its hooks activate in `/usr/bin/kwin_wayland`, and the
compositor's children run without the preload.

For KWin's recognized legacy GBM allocator ABI (including KWin 6.7), the
bridge gives a Vibeshine faux KMS device a GBM allocator opened on a real
bridge gives a libvirtualdisplay faux KMS device a GBM allocator opened on a real
NVIDIA render node. The original KMS fd remains the output's scanout endpoint.
Physical DRM devices, libdrm identities and enumeration order are unchanged.
KWin and EGL use their normal per-output GPU import path. This also avoids advertising the virtual card as a second copy of an
Expand All @@ -22,7 +21,7 @@ allocation keep the NVIDIA render fd. This scope is thread-local and restored
after nested or failed allocations. Physical seat allocators retain their fds.

KWin 6.8 also resolves each display's compatible render device independently
of its GBM allocator. For the Vibeshine faux device alone, the bridge asks
of its GBM allocator. For the libvirtualdisplay faux device alone, the bridge asks
KWin's compatibility policy for the same verified NVIDIA render device. The
physical seat and libdrm device identities are unchanged. If that renderer is
unavailable, KWin's original compatibility policy remains the fallback. Merely
Expand Down Expand Up @@ -63,17 +62,17 @@ PCI identity explicitly for each intended KWin service:
```ini
# /etc/systemd/user/plasma-kwin_wayland.service.d/90-virtual-renderer.conf
[Service]
Environment=VIBESHINE_KWIN_RENDER_PCI=0000:01:00.0
Environment=VIRTUALDISPLAY_KWIN_RENDER_PCI=0000:01:00.0
```

The login compositor uses `plasma-login-kwin_wayland.service.d` with the same
setting. These settings take effect when the corresponding compositor next
starts. No monitor or dummy plug is required by the bridge. An unrelated seat
GPU, including a VM's Virtio console, retains its own GBM device.

`VIBESHINE_KWIN_RENDER_PCI` selects **virtual-output rendering**. Vibeshine's
`adapter_name` selects **capture/encoding** and must not implicitly change the
compositor's seat primary. To use the same GPU for both, resolve the chosen
`VIRTUALDISPLAY_KWIN_RENDER_PCI` selects the GPU for virtual-output rendering.
Applications choose their capture and encoding GPU independently of the
compositor's primary GPU. To use the same GPU for both, resolve the chosen
render node's `/sys/class/drm/renderD*/device` to its PCI identity and configure
the virtual renderer deliberately. The automatic default does not infer the
encoder or KWin's eventual primary renderer: KWin constructs these allocators
Expand Down
Loading