Commit Graph

85 Commits

Author SHA1 Message Date
Geoffrey McRae
b50dd41909 [idd] scheduler: account queue maintenance work 2026-08-06 18:04:10 +10:00
Geoffrey McRae
5e7d944607 [idd] pipeline: overlap independent frame copies 2026-08-06 18:04:10 +10:00
Geoffrey McRae
d3ee46f376 [idd] scheduler: prioritize deadline publication 2026-08-06 18:04:10 +10:00
Geoffrey McRae
fac417c6b3 [idd] scheduler: avoid stale deadline waits 2026-08-06 18:04:10 +10:00
Geoffrey McRae
0b744d2286 [common] kvmfr: report cadence hold and lead timing 2026-08-06 18:04:10 +10:00
Geoffrey McRae
ece6afd74e [idd] scheduler: retain frames behind stalled owners
Keep preparing the newest frame when both private owner lanes remain
referenced by a non-consuming timing client. Reuse only an unreferenced
completed buffer and continue serving eligible shared subscribers.

Track owner delivery separately from local retention so cadence advances
without acknowledging owner delivery or accepting phase feedback. Republish
the newest completed frame as soon as an owner lane becomes available.
2026-08-06 18:02:08 +10:00
Geoffrey McRae
515f4ba06f [client/host/idd/obs] scheduler: validate phase feedback
Bump KVMFR to version 28 and attach generation, epoch, and deadline
identities to cadence deliveries and their timing records.

Accept phase corrections only for the exact completed publication. Keep
VM and client clocks independent by exchanging relative phase errors.

Make submission, completion, and work-estimate accounting best effort
so scheduler state cannot delay GPU submission or frame publication.
2026-08-06 18:02:08 +10:00
Geoffrey McRae
f65ecdaf5d [idd] capture: recover final desktop updates
Request one static-desktop re-encode and inspect repeated presentation
numbers for its empty dirty-rectangle marker.

Prepare every marker in a free candidate without superseding retained
damage, so the last desktop update survives a late copy failure.
2026-08-06 18:02:08 +10:00
Geoffrey McRae
f6c72b0bc5 [idd] capture: replay only completed frames
Track the newest submitted and completed frame independently. Only
retain or replay a frame after its copy callback succeeds.

Keep the prior completed frame when a newer copy fails, and compare
publication sequences so out-of-order callbacks cannot move backward.
2026-08-06 18:02:08 +10:00
Geoffrey McRae
6bb5c039cd [idd] capture: keep preparing during publication
Do not freeze the spare retained candidate while a frame is copied to
IVSHMEM. Allow newer source frames to replace that candidate and retain
any frame prepared after the published sequence for the next deadline.

Take the pipeline lock before selecting the publication candidate so its
transport copy is submitted before any newly admitted preparation.
2026-08-06 18:02:08 +10:00
Geoffrey McRae
f04775823d [idd] capture: retire damage before copy submission
Retire candidate damage before submitting its publication copy. A fast
completion callback can otherwise release and reuse the candidate while
the publisher is still reading its fields and damage tail.
2026-08-06 18:02:08 +10:00
Geoffrey McRae
da7d6b4011 [idd] capture: defer interop synchronization
Signal the shared D3D11 source only after a retained candidate and its
command slots have been acquired. Superseded source frames no longer queue
a fence that no Direct3D 12 work will consume.
2026-08-06 18:02:07 +10:00
Geoffrey McRae
3e6c9197f1 [idd] capture: never wait on superseded frames
Drop an acquired frame immediately when both retained candidate slots are
unavailable. Waiting for up to 2 ms held the IddCx surface and
backpressured sources whose frame period was shorter than the wait.
2026-08-06 18:02:07 +10:00
Geoffrey McRae
3add7d066f [idd] logging: remove misleading swapchain noise 2026-08-06 05:58:28 +10:00
Geoffrey McRae
057fb4d40a [idd] swapchain: bind device before pipeline setup 2026-08-06 05:43:29 +10:00
Geoffrey McRae
650636ccee [idd] capture: retain frames in linear buffers
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
Store retained frame candidates in the final linear transport layout.
Prepare texture output in local DEFAULT buffers before cadence holding.
Then publish full frames with a single buffer copy.

Keep partial damage on matching pitched layouts and leave effect-owned
buffer copies unchanged. This moves detiling out of the
deadline-critical IVSHMEM or readback transfer.
2026-08-05 22:08:38 +10:00
Geoffrey McRae
ab25601a61 [idd] rgb24: compare stable candidate timings
Ignore allocation alignment when matching retained candidate resources.
D3D12 may resolve automatic alignment requests in GetDesc.
Comparing that value recreated the candidate for every benchmark sample.

Measure native and packed over matching wall-clock intervals.
Use preparation and publication intervals, excluding the cadence hold.
This avoids mixing GPU timestamps with fallback timing. The CPU IVSHMEM
copy is included only on indirect systems.
2026-08-05 21:45:45 +10:00
Geoffrey McRae
f073099950 [idd] capture: retire published pending damage
Track damage received after each retained candidate snapshot. When a
candidate is submitted successfully, replace the global pending set
with its trailing damage instead of requiring the source generation
to remain unchanged.

This lets published full-frame damage retire while preserving newer
partial or full updates.
2026-08-05 20:58:02 +10:00
Geoffrey McRae
ff5b43173a [idd] rgb24: isolate benchmark samples from cadence
Run effect timing samples only when the retained candidate pipeline is idle
and force each completed sample to publish immediately. This prevents work
from superseded candidates from being charged to a surviving sample.

Include the indirect CPU copy to IVSHMEM in the measured copy stage while
preserving the wall-clock fallback when GPU timestamps are unavailable.
2026-08-05 20:48:50 +10:00
Geoffrey McRae
f95c8f0660 [idd] scheduler: pace secondary frame delivery 2026-08-05 17:10:35 +10:00
Geoffrey McRae
c7ed04412e [client/idd/obs] scheduler: isolate timing owner delivery 2026-08-05 15:45:30 +10:00
Geoffrey McRae
0b9b805530 [idd] scheduler: retain frames for publication deadlines
Prepare each acquired content frame into one of two private GPU
candidates so the IddCx frame can be released without copying it to
IVSHMEM immediately.

Wake a high-resolution publisher at the client deadline and send the
newest completed candidate. Preserve accumulated damage across
superseded candidates, include the scheduling hold in end-to-end timing,
and keep transport work on the existing physical copy queue.
2026-08-05 12:38:07 +10:00
Geoffrey McRae
32ced2f24a [idd] publish the latest frame before its deadline 2026-08-04 13:49:07 +10:00
Geoffrey McRae
6109501eed [idd] select linear RGB24 packing automatically
Replace the texture-shaped RGB24 output with a linear raw buffer and
keep its packing, damage translation, and buffer copies inside the
RGB24 effect.

Benchmark full-frame native and packed processing and retain the faster
path for each source format. Preserve logical damage rectangles for
client updates and alternating framebuffer repair.

Return compute outputs to COMMON for COPY queue handoff and refresh
cached framebuffer sizes when switching packed and native layouts.
2026-08-03 23:53:33 +10:00
Geoffrey McRae
fa2769b332 [idd] isolate post-processing by framebuffer slot
Give each in-flight framebuffer a complete post-processing chain and
its own COMPUTE recording slot while retaining one physical queue.

Claim framebuffer ownership before submitting compute work, and use
the frame index for both COMPUTE and COPY recording state. Drain
in-flight work before reconfiguring either chain so COPY never
references replaced effect resources.

Require both chains to contain the same effects, preserve pending
damage, and release ownership on every pre-copy failure path.
2026-08-03 23:53:33 +10:00
Geoffrey McRae
ff4ca7d786 [idd] serialize framebuffer copies on one queue
Replace the rotating D3D12 copy queues with two framebuffer-bound
recording slots on one physical COPY queue. Keep allocator, command
list, query range, callback state, and fence target independent per
slot.

Submit source waits, execution, and signaling on the shared timeline.
Track framebuffer ownership through completion and serialize LGMP
publication around the last successfully published frame.
2026-08-03 23:53:33 +10:00
Geoffrey McRae
843207c628 [idd] coalesce framebuffer copy damage
Combine the previous and current frame damage before recording copy
commands. Remove contained regions, merge beneficial overlaps, and use
one full-frame copy when partial work reaches the full surface size.

This prevents a previous full-frame update from being copied again
alongside the current damage.
2026-08-03 23:53:33 +10:00
Geoffrey McRae
24be0a8869 [host] measure ready time at framebuffer publication
Exclude command queue reset and cleanup from the ready stage, and keep
the wall-clock residual only as the legacy timing fallback.
2026-08-03 23:53:33 +10:00
Geoffrey McRae
aa289fa022 [client/host/idd] correct frame timing attribution
Use calibrated copy-queue timestamps to separate source and effect
waits from the actual framebuffer copy.

Exclude producer readiness waits from client import timing so the
same interval is not counted in both Copy and Import.
2026-08-03 23:53:33 +10:00
Geoffrey McRae
c8e4b97c3c [idd] skip copies for static frames
Treat IddCx's single empty dirty rectangle as no image update instead
of promoting it to full damage.

Preserve pending damage and format changes, and fall back to full damage
when legacy move regions are present.
2026-08-03 23:53:33 +10:00
Geoffrey McRae
7533c855c2 [client/host/idd/lgmp] add additional timing metrics 2026-08-03 23:53:33 +10:00
Geoffrey McRae
34af6e6f8f [idd] hdr: correct virtual monitor capabilities 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
d3e05a7958 [idd] disable HDR and post-processing when in software mode 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
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
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
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
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
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
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
845c612d0f [idd/client/obs] hdr: wire up the SdrWhiteLevel from the capture 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
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
0140a3f6fb [client/idd] hdr: fix incorrect tone mapping knee bug
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
2026-07-16 10:48:10 +10:00
Geoffrey McRae
ff1631da67 [idd] hdr: dont advertise non hdr formats as hdr
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
2026-07-16 05:34:09 +10:00
Geoffrey McRae
8301ec5ae5 [idd] cleanup IDD version guards for HDR support 2026-07-16 05:34:09 +10:00
Geoffrey McRae
9721fc8c7e [idd] whitespace fixes 2026-07-16 05:34:09 +10:00
Geoffrey McRae
0c653c1fb2 [idd] add support to return HDR metadata to clients 2026-07-16 05:34:09 +10:00