Commit Graph
100 Commits
Author SHA1 Message Date
Geoffrey McRae 4ef6672e64 [client] egl: uninitialized value release build failure 2026-07-28 13:45:57 +10:00
Geoffrey McRae dc20ac05ab [client] main: fix release build uninitalized value warning 2026-07-28 13:42:38 +10:00
Geoffrey McRae b9b2521bb7 [client] audio: synchronize callback and microphone lifetimes 2026-07-28 13:33:19 +10:00
Geoffrey McRae 532305d263 [client] pipewire: make it possible to stop from the process callback 2026-07-28 13:32:41 +10:00
Geoffrey McRae a421be5e54 [client] audio: restore microphone volume and mute state 2026-07-28 13:17:58 +10:00
Geoffrey McRae d384591e05 [client] audio: fix microphone restart bookkeeping 2026-07-28 13:17:02 +10:00
Geoffrey McRae a5571f0e9e [client] spice: separate clipboard state by direction 2026-07-28 13:10:38 +10:00
Geoffrey McRae e4658b4263 [client] spice: validate clipboard responses 2026-07-28 13:08:16 +10:00
Geoffrey McRae e73a3dec60 [client] spice: handle clipboard request failures 2026-07-28 13:05:40 +10:00
Geoffrey McRae 67e2675afa [client] spice: fix clipboard transfer accounting 2026-07-28 13:00:38 +10:00
Geoffrey McRae 49b7f50c6b [client] spice: start for display-only configurations 2026-07-28 12:50:27 +10:00
Geoffrey McRae 44a28d52c9 [client] spice: complete startup when server info retrieval fails 2026-07-28 12:43:18 +10:00
Geoffrey McRae f4ee349880 [client] app: make shared application state access thread-safe 2026-07-28 12:41:35 +10:00
Geoffrey McRae f980248221 [client] spice: fix missing scancode translation for key up 2026-07-28 12:28:02 +10:00
Geoffrey McRae e4888c362a [client] spice: make display switching atomic and failure-aware 2026-07-28 12:24:51 +10:00
Geoffrey McRae 5c7431dfd6 [client] spice: validate bitmap fills and prevent potental VLA crash 2026-07-28 12:12:38 +10:00
Geoffrey McRae b7a1637cb0 [client] spice: validate bitmap format and check for failures 2026-07-28 12:04:32 +10:00
Geoffrey McRae 2f88063d77 [client] spice: check and track the primary surface format & validity 2026-07-28 12:01:08 +10:00
Geoffrey McRae e09a3f7715 [repos] purespice: update submodule 2026-07-28 07:17:02 +10:00
Geoffrey McRae fe4088797c [github] workflow: fix random clang build errors due to runner issue
Ref: https://github.com/actions/runner-images/issues/14296
2026-07-23 09:44:00 +10:00
Geoffrey McRae 0e113d9d83 [client] wayland: use the locally configured white level for SDR 2026-07-23 09:44:00 +10:00
Geoffrey McRae 34af6e6f8f [idd] hdr: correct virtual monitor capabilities 2026-07-23 09:44:00 +10:00
Geoffrey McRae 9376ac10b6 [client] wayland: separate mastering metadata validation
Validate mastering primaries and luminance independently so one
unsupported component does not discard the other.

Trust content chromaticities when extended target volumes are supported,
and report the exact values and reason when metadata must be omitted.
2026-07-23 09:44:00 +10:00
Geoffrey McRae e716435617 [idd] edid: advertise the full PQ luminance range
The virtual display transports HDR pixels rather than emitting light.
Advertise approximately 10,000 nits for both peak and frame-average
luminance, and leave the physical black level unspecified.

This prevents Windows from mapping HDR into an arbitrary virtual
display limit before the frame reaches the real host display.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 21a0fc08fb [idd] hdr: publish only per-content metadata
Monitor-default HDR metadata describes the virtual display rather than
the captured content. Do not expose it through KVMFR or use it to select
downstream processing limits.

Only publish explicit NEW frame metadata and otherwise use the complete
PQ range internally.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 1b0e1cf74b [client] egl: correct CAS processing for HDR
Convert HDR scRGB input to normalized linear Rec.2020 before CAS, then
convert the filtered result back to scRGB. Use the content metadata to
select an appropriate normalization peak while leaving SDR unchanged.

This follows AMD's documented recommendation for applying CAS to HDR
content and prevents HDR highlights from being clamped and dimmed.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 697bbc6601 [client] egl: restore effects for PQ frames
PQ sources excluded every external filter from the post-process chain.
Decode PQ/BT.2020 into FP16 linear scRGB before active effects and pass
the resulting transfer state to the desktop shader.

Keep the raw PQ path when no effect is active. This avoids adding a
conversion pass or per-frame latency to the common case.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 719ffeaa60 [client] wayland: separate PQ and mastering volumes
Describe PQ pixels with the protocol-defined primary luminance range and
keep mastering luminance in the target volume. Track extended target-volume
support and omit unsupported metadata instead of creating an invalid image
description.
2026-07-23 09:44:00 +10:00
Geoffrey McRae dbc5ca104e [client] wayland: retain coherent HDR state on failure
Keep the reference white associated with the active PQ description until
a replacement is ready. If asynchronous description creation fails, the
renderer now retains the complete previous HDR state instead of combining
new white-level values with stale compositor metadata.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 068362b816 [host] hdr: encode legacy captures as HDR10
Convert FP16 scRGB captures to BT.2020 PQ before storing them in the
10-bit wire format. Preserve linear-light downsampling, publish the real
SDR white level and display metadata, and advance the format version when
those properties change.
2026-07-23 09:44:00 +10:00
Geoffrey McRae b7e56244c1 [obs] hdr: correct logical and color cursor composition
Keep masked-color XOR operands on the untransformed logical path rather
than applying the color cursor shader. Preserve the white level delivered
with cursor updates instead of replacing it with frame SDR white during
format changes.

This keeps inverse-destination blending intact and ensures HDR cursor
brightness follows QueryHardwareCursor3.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 0b9603d398 [client] egl: compose native PQ output in linear light
Decode PQ/BT.2020 desktop pixels into an FP16 linear scRGB target before
compositing the color cursor, ImGui, damage overlay, and letterboxing.
Encode the damaged result to PQ once at the surface boundary. Keep logical
AND/XOR cursor masks in the encoded domain.

This preserves premultiplied cursor edges, prevents encoded-domain
blending, uses the Wayland output reference white for local overlays, and
keeps guest cursor white and display calibration independent from frame
SDR white. It also corrects HDR-to-SDR absolute luminance scaling, gamut
matrices, black handling, and buffer-age repair for the extra pass.

Suppress overlays when their conversion framebuffer is unavailable rather
than allowing unconverted sRGB draws into an HDR target.

Use named transfer constants for cursor shader state. Convert clipped
surface rectangles explicitly before using the frame-damage merge helper,
which avoids mixing its unsigned type with the EGL surface rectangle type.

Only advertise native PQ when the FP16 composition target is available.
SDR and native scRGB retain their direct single-pass paths.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 672b6c0d8a [client] hdr: serialize surface format transitions
Queue the display-server surface format while the renderer lock still
serializes the matching onFrameFormat update. This prevents the render
thread from presenting a frame in a new HDR encoding before the Wayland
image description transition has been queued.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 3dd41f242e [client] egl: fix SPICE video rendering to a HDR surface
If the last state had HDR enabled, the spice video surface was being
rendered as HDR even though the SPICE video content is SDR. This
corrects this.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 786f52e8ea [idd] fix failure to detect GPU acceleration is available 2026-07-23 09:44:00 +10:00
Geoffrey McRae d3e05a7958 [idd] disable HDR and post-processing when in software mode 2026-07-23 09:44:00 +10:00
Geoffrey McRae cd09c080b8 [obs] hdr: apply the complete HDR cursor transform
Keep transform-only cursor messages independent from visibility and use
the cursor-specific SDR white level reported by IddCx.

Apply the Windows XYZ matrix, scalar, and transfer-domain LUT before
compositing colour and masked-colour cursors into OBS scRGB. Preserve
premultiplied alpha and leave monochrome logical masks unchanged.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 4c7b5b2531 [client] wayland: harden native HDR colour state
Serialize asynchronous image-description state and publish compositor
capabilities safely across the Wayland and render threads.

Use the predefined Windows-scRGB description, query each output image
description for its configured reference white, and reapply HDR when the
surface moves to an output with different colour settings.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 0e14e9c357 [client] egl: make native HDR encoding-safe
Request true floating-point EGL configs for scRGB and expose the native
encodings supported by the selected surface. Fall back to software HDR
mapping when the surface cannot represent the incoming wire format.

Resample PQ in linear light, keep SDR-only effects out of native PQ
chains, and consume the cursor-specific white level without changing
binary monochrome cursor mask operations.
2026-07-23 09:44:00 +10:00
Geoffrey McRae cdc8ed96bf [idd] hdr: complete HDR display and cursor metadata
Publish BT.2020 chromaticities in the virtual monitor EDID so
Windows receives a valid HDR colour volume.

Extend cursor messages with their IddCx SDR white level and an
explicit visibility-valid flag. Consumers can then calibrate cursors
without treating colour-transform-only messages as cursor hides.
2026-07-23 09:44:00 +10:00
Geoffrey McRae a047b7d68a egl: follow active native HDR state
Keep software HDR mapping enabled until the display server activates the
requested image description. Re-evaluate the state while rendering so
asynchronous readiness or failure updates the desktop, cursor, and overlay
together with a full redraw.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 2d4f0dbf00 wayland: make HDR descriptions asynchronous
Publish HDR metadata through a locked request snapshot and wait for
image-description readiness before using it. Commit encoding changes with
matching content, preserve the active description during same-format
metadata replacements, and handle creation failures without protocol
errors.
2026-07-23 09:44:00 +10:00
Geoffrey McRae c0b0aa0566 [all] fix copyright headers 2026-07-23 09:44:00 +10:00
Geoffrey McRae 74f3b426e1 [idd/client] apply the Windows display color transform
Honor the IddCx 3x4 XYZ matrix and post-transfer LUT in the IDD
conversion pipeline. Carry transform changes to the client so EGL applies
the same calibration to hardware cursors, and invalidate the full frame
whenever calibration changes.
2026-07-23 09:44:00 +10:00
Geoffrey McRae c234866055 [client] wayland: forward HDR mastering metadata
Propagate valid ST 2086 mastering primaries and luminance data, MaxCLL,
and MaxFALL to the Wayland compositor using the protocol's expected
units.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 5dbaf42b7c [idd] hdr: propagate per-frame HDR metadata
Handle DEFAULT, NEW, and UNCHANGED IDDCX HDR10 metadata states and
publish valid mastering metadata through KVMFR. Preserve the metadata
across post-processing without reallocating resources for
metadata-only changes.
2026-07-23 09:44:00 +10:00
Geoffrey McRae e7e156dc69 [client] egl: correct surface damage reporting
Apply the same sampling margin to swap damage as buffer-age repair and
clip reported rectangles to the EGL surface. This ensures compositors
update every pixel affected by scaling or filtering.
2026-07-23 09:44:00 +10:00
Geoffrey McRae 09acb0153b [client] main: validate damage metadata 2026-07-23 09:44:00 +10:00
Geoffrey McRae 9b02742934 [idd] rgb24: fix packed-texel damage endpoints 2026-07-23 09:44:00 +10:00
Geoffrey McRae f8b50e741c [idd] accumulate damage from dropped frames 2026-07-23 09:44:00 +10:00
Geoffrey McRae 3e67052cb4 [idd] cancel stale swap chain assignments
Invalidate in-progress swap chain setup when IddCx unassigns the
monitor, and serialize replacement assignments so workers are
never started on abandoned handles.

Also initialize all worker dependencies before starting the processing
thread and treat teardown during SetDevice as normal cancellation.
2026-07-23 09:44:00 +10:00
Geoffrey McRae d316bcdd22 [idd] helper: fix dependency cycle issue on windows 10 2026-07-23 09:44:00 +10:00
Geoffrey McRae 7707decc57 [idd] debug: add additional logging 2026-07-23 09:44:00 +10:00
Geoffrey McRae 6f2a81edf8 [idd] ensure the only active monitor is the IDD 2026-07-23 09:44:00 +10:00
Geoffrey McRae 9e4de870fc [client] egl: fix messy white level default definition 2026-07-23 09:44:00 +10:00
Geoffrey McRae 9d2b8da098 [client] glsl: fix failure to build on clang
Clang with -ffast-math doesnt have `isfinite`, instead implement it
locally.
2026-07-23 09:43:59 +10:00
Geoffrey McRae 78802319e3 [client] add a MPV glsl style effect loader 2026-07-23 09:43:59 +10:00
Geoffrey McRae 5982a60d6c [idd] remove debounce logic now the lifecycle is properly protected 2026-07-23 09:43:59 +10:00
Geoffrey McRae 2f237a841c [idd] apply resolution after the final replug
Preserve the requested display mode across intermediate swap chains when
rapid resolution changes cause replugs to be coalesced. Apply and clear
the mode only once the final replacement swap chain is ready.
2026-07-23 09:43:59 +10:00
Geoffrey McRae 5adc22ebca [idd] serialize monitor replugs with swap chain teardown
Keep the replug lifecycle gated until the old swap chain has drained and
released its pending frame, and the replacement swap chain is fully
initialized. Coalesce additional requests into a follow-up replug to
prevent overlapping topology changes and IddCx release-frame timeout
bugchecks.
2026-07-23 09:43:59 +10:00
Geoffrey McRae de68e5ae97 [idd] stop flooding the log with parsed modes 2026-07-23 09:43:59 +10:00
Geoffrey McRae 1ec92a943d [idd] implement config reload 2026-07-23 09:43:59 +10:00
Geoffrey McRae 1da457affe [idd] never add the extraMode to the EDID
Doing so causes windows to treat a new EDID as a new monitor
2026-07-23 09:43:59 +10:00
Geoffrey McRae 4d3636dba5 [idd] avoid release frame timeouts during replug
Drop frames when the LGMP queue is full instead of blocking
while holding an IddCx surface. Always finish every
acquired frame, including duplicate frame numbers, so
replug teardown cannot trigger the release-frame watchdog.
2026-07-23 09:43:59 +10:00
Geoffrey McRae 2e616ddf79 [idd] fix failure to initialize variables 2026-07-23 09:43:59 +10:00
Geoffrey McRae b397b7c66a [client] wayland: fix fullscreen option launch bug 2026-07-23 09:43:59 +10:00
Geoffrey McRae 275253181a egl: correct ImGui overlay luminance in HDR
Render ImGui to an intermediate SDR framebuffer and map it into the
native PQ or scRGB output using the Wayland surface reference white.
Preserve premultiplied alpha during conversion and limit composition to
damaged overlay regions.
2026-07-23 09:43:59 +10:00
Geoffrey McRae e6ac8a2b75 [idd] keep the generated EDID immutable
Generate the EDID once during adapter initialization and update only the
live mode list when resolutions change.

Changing the EDID during a monitor replug causes Windows to identify it
as a different monitor, losing the existing display configuration.
Reusing the original EDID preserves the monitor identity while still
allowing dynamic modes to be advertised through IddCx.
2026-07-23 09:43:59 +10:00
Geoffrey McRae 96b16debad client: move LGMP session probing off the event thread
LGMP session validation may wait 500 ms for the shared-memory heartbeat
to advance. Run it on a worker so Wayland input remains responsive while
preserving stale-data detection.
2026-07-23 09:43:59 +10:00
Geoffrey McRae 116cafc806 [obs] fix DMABUF import attributes
Match the EGL client’s DRM formats, use implicit linear modifiers, and
reset cached imports safely across format changes and restarts. Fall
back to CPU upload if either DMA buffer cannot be imported.
2026-07-23 09:43:59 +10:00
Geoffrey McRae 041ae0e9f4 [idd] publish frames after copy submission
Submit the D3D12 copy before exposing the frame through LGMP, preventing
clients from waiting on work that has not yet been queued. Track the
last published buffer separately for safe subscriber resends and handle
submission failures.
2026-07-23 09:43:59 +10:00
Geoffrey McRae bcd17ed220 [client] egl: avoid per-frame DMABUF flushes
Only fence and flush when initially attaching an EGLImage. Subsequent
imports rely on framebuffer write completion, avoiding periodic driver
stalls.
2026-07-23 09:43:59 +10:00
Geoffrey McRae 8dadfab5c5 [client] egl: cache post-process configuration
Build the active filter chain only when its configuration changes,
including filter settings or order, input format, dimensions, output
size, and DMA mode.

Unchanged frames now execute only the cached active filters, avoiding
repeated setup, preparation, and output-resolution queries.
Reconfiguration forces a full-frame pass to prevent stale intermediate
framebuffer contents.

Also refresh CAS and FSR uniforms when loading presets and move
downscale pass selection out of the per-frame path.
2026-07-23 09:43:59 +10:00
Geoffrey McRae cd0d668076 [client] egl: cache renderer GL state
Track context-local GL bindings to avoid redundant program, framebuffer,
buffer, texture, sampler, viewport, blend, and scissor state changes.

Invalidate the cache across context switches, ImGui rendering, and
shared object changes. Preserve CPU-backed texture upload correctness by
explicitly clearing pixel unpack buffer bindings where required.

This reduces hot-path driver overhead without adding waits or GPU
synchronization.
2026-07-23 09:43:59 +10:00
Geoffrey McRae b60fa8756f [client] egl: remove blocking waits from frame submission
Track PBO fences per upload slot and wait only when a slot is reused,
allowing rendering to proceed without a CPU stall. Use GPU-side waits
for cross-context DMABUF synchronization.

Also propagate KVMFR write-completion failures so incomplete
shared-memory frames are never submitted, while retaining incremental
damage-copy waits to avoid added latency.
2026-07-23 09:43:59 +10:00
Geoffrey McRae 615adac090 [client] egl: add cached uniforms and multipass effects
Replace the per-frame uniform list with stable, name-cached handles that
retain their values across shader recompilation. Track dirty uniforms so
only changed values are uploaded, reducing redundant GL calls and buffer
management.

Add a reusable effect-pass pipeline with per-pass shaders, samplers,
formats, resolutions, and intermediate render targets. This makes
external effects easier to integrate and supports arbitrary multipass
chains.

Migrate the desktop, cursor, damage, 24-bit, downscale, CAS, and FSR
rendering paths to the new APIs. Also ensure framebuffer objects are
released correctly.
2026-07-23 09:43:59 +10:00
Geoffrey McRae 5d6ef7d690 [obs] hdr: use BT.2020 gamut for PQ decoding
Mastering display primaries do not define the pixel encoding gamut.
2026-07-23 09:43:59 +10:00
Geoffrey McRae 845c612d0f [idd/client/obs] hdr: wire up the SdrWhiteLevel from the capture 2026-07-23 09:43:59 +10:00
Geoffrey McRae 0d2dc2694e [client] egl: fix masked color cursor HDR mapping 2026-07-23 09:43:59 +10:00
Geoffrey McRae 9bcf1d4994 [obs] hdr: improve hdr cursor rendering 2026-07-23 09:43:59 +10:00
Geoffrey McRae 93ce131d4f [client] egl: improve HDR cursor rendering, fixes alpha blending 2026-07-23 09:43:59 +10:00
Geoffrey McRae 27faae1116 [obs] fix masked color and monochrome cursors 2026-07-23 09:43:59 +10:00
Geoffrey McRae 7884c46cd6 [client] egl: implement SDR to HDR mapping for cursors 2026-07-23 09:43:59 +10:00
Geoffrey McRae 993c724e67 [client] wayland: set the application icon 2026-07-23 09:43:59 +10:00
Geoffrey McRae f2b45646d7 [idd] hdr: correct the BT.709 to BT.2020 conversion 2026-07-23 09:43:59 +10:00
Geoffrey McRae f9a77048ab [obs] fix HDR support to properly convert from PQ 2026-07-23 09:43:59 +10:00
Geoffrey McRae f8f5576359 [client] fix the HDR colorspace mapping to SDR 2026-07-23 09:43:59 +10:00
Geoffrey McRae 4dd9d11cca [idd] use the actual surface colorspace instead of guessing 2026-07-23 09:43:59 +10:00
Geoffrey McRae e245256860 [idd] collapse duplicate messages to the latest event only 2026-07-23 09:43:59 +10:00
Geoffrey McRae e5e378f255 [client] fix reversed event timestamp logic 2026-07-23 09:43:59 +10:00
Geoffrey McRae 67d29242ba [idd] debounce resolution changes 2026-07-23 09:43:59 +10:00
Geoffrey McRae f702576820 [idd] stop using IddCxMonitorUpdateModes(2)
While it would make much more sense to use these then a full replug to
change modes, Microsoft have not properly implemented the API to clear
the cached monitor mode states internally, making these calls useless.

Revert to just replugging the device on mode change
2026-07-23 09:40:49 +10:00
Geoffrey McRae b97a0b79f1 [idd] don't rebuild the monitor from inside the old monitor's context 2026-07-16 16:13:24 +10:00
Geoffrey McRae fbf564f2e1 [idd] prevent races from corrupting the mode list and edid 2026-07-16 15:26:21 +10:00
Geoffrey McRae 0140a3f6fb [client/idd] hdr: fix incorrect tone mapping knee bug 2026-07-16 10:48:10 +10:00
Geoffrey McRae e502af7d9d Revert "[idd/client] correct HDR luminance when PQ conversion is in use"
This reverts commit 05d8bc5311.
2026-07-16 09:58:44 +10:00
Geoffrey McRae 05d8bc5311 [idd/client] correct HDR luminance when PQ conversion is in use 2026-07-16 09:34:02 +10:00
Geoffrey McRae 1b3305e1dc [client] wayland: fix hdr luminance scaling 2026-07-16 06:40:27 +10:00
Geoffrey McRae ff1631da67 [idd] hdr: dont advertise non hdr formats as hdr 2026-07-16 05:34:09 +10:00
Geoffrey McRae 2f59de572b [client] wayland: fix broken initialization 2026-07-16 05:34:09 +10:00