Commit Graph

3977 Commits

Author SHA1 Message Date
Geoffrey McRae
4367fbc277 [client/idd] input: avoid replaying absolute position
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-08-09 02:07:38 +10:00
Geoffrey McRae
c89c01ae5a [idd] input: preserve relative mode on reset 2026-08-09 01:57:51 +10:00
Geoffrey McRae
008a4482d6 [client] tests: initialize debug for input manager 2026-08-09 01:57:36 +10:00
Geoffrey McRae
487920ada3 [client/idd] input: add transport diagnostics 2026-08-09 01:55:45 +10:00
Geoffrey McRae
5b90384123 [client/idd] input: report endpoint status 2026-08-09 01:36:54 +10:00
Geoffrey McRae
3e38c62050 [client] input: use absolute transport positioning 2026-08-09 01:23:30 +10:00
Geoffrey McRae
27a938e741 [client] input: send reports over LGMP
Use the LGMP input queue when the host advertises transport input,
while preserving SPICE fallback through the existing input abstraction.

Claim input lazily, publish ordered full-state keyboard and mouse
reports without blocking rendering, and keep the owner lease alive.
Reserve queue capacity for discrete transitions, coalesce only motion
under pressure, and release ownership safely during idle and disconnect.

Keep the Linux-to-HID map in the client and update LGMP to the
nonblocking data-send API required by the input worker.
2026-08-09 01:03:41 +10:00
Geoffrey McRae
726086a969 [idd] input: report volume keys as consumer controls
Expose a Consumer Control HID report for the system volume usages that
Windows does not handle through the Keyboard/Keypad usage page.

Translate the existing mute and volume keyboard usages at the LGInput
boundary, preserve normal keyboard state, and force a neutral consumer
report across resets and HID device reactivation.
2026-08-09 01:02:33 +10:00
Geoffrey McRae
ced2fb531e [idd] input: preserve reports under backpressure
Move named pipe writes off the LGMP input worker so a stalled LGInput
endpoint cannot block queue draining or lease maintenance.

Coalesce motion only under queue pressure while preserving mode, button,
wheel, and keyboard transitions. Reset HID state after discontinuities
and carry all 32 mouse button bits through the pipe and HID reports.
2026-08-08 23:42:27 +10:00
Geoffrey McRae
83c552fb9d [idd] input: receive LGMP input reports
Add an optional input transport and a dedicated LGMP receiver that
validates source ownership, generations, ordered sequences, and leases.

Poll input outside the 10 ms control timer. Forward mouse and keyboard
state through the LGInput pipe, and neutralize the endpoint before
ownership changes or transport failures can leave input held.
2026-08-08 22:56:02 +10:00
Geoffrey McRae
7f4a14a543 [common] input: define LGMP input protocol
Reserve a dedicated LGMP queue for low-latency input reports and
endpoint status. Bump KVMFR for the new feature and define ordered
ownership messages with full-state mouse and keyboard payloads.

Use a 32-bit physical button mask so future HID buttons do not require
another wire format change.
2026-08-08 22:17:30 +10:00
Geoffrey McRae
f495e5b7ba [client] input: abstract guest input backends
Introduce LG_InputOps and route keyboard and mouse input through the
active video transport when it provides an input backend.

Keep SPICE as the fallback and force it while the SPICE display is
active. Add atomic shared/exclusive locking for safe backend changes.
2026-08-08 21:23:32 +10:00
Geoffrey McRae
04fd31219c [idd] input: add mouse and keyboard IPC messages
Replace raw HID report forwarding with typed absolute mouse, relative
mouse, and keyboard messages.

Expose absolute and relative modes as separate Mouse collections because
Windows MouHID requires one X/Y motion mode per mouse device.
2026-08-08 20:18:05 +10:00
Geoffrey McRae
241ab3fad2 [idd] ipc: connect LGInput to LGIdd
Move the reusable named-pipe endpoint and shared support code into
the LGCommon static library.

Run a dedicated server in LGIdd and a reconnecting client in
LGInput, with device-lifecycle handling and report framing.

Refactor the helper pipe to use the same endpoint implementation.
2026-08-08 20:18:05 +10:00
Geoffrey McRae
214665bedd [idd] input: add virtual HID driver
Build LGInput as an independent UMDF driver with its own entry point,
service, tracing, and binary.

Expose absolute pointer, relative mouse, and keyboard collections with a
guarded report queue.

Keep LGIdd as the startup and deployment project. Give it a non-linking
build/package dependency on LGInput so F5 stages both driver stacks and
installs them together through LGIddInstall, while the two UMDF binaries
remain independent for future IPC.

Stage both DLLs for the NSIS installer, retain the WDK UMDF remote-debug
startup attachment, and move CSRWLock into LGCommon for the input
driver's report queue.
2026-08-08 20:17:32 +10:00
Geoffrey McRae
d3fff4eb57 [client] ci: run tests with each build
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
Run CTest directly in every client matrix job so each build is tested
without waiting for the full matrix to complete.

Install the Mesa runtime in the build job, preserve failure artifacts,
and remove the archive transfer and duplicate test job.
2026-08-08 01:31:40 +10:00
Geoffrey McRae
e9d4b2f563 [client] tests: keep splash out of captures
Hide the startup splash immediately after overlay initialization when a
render-pipeline capture is requested. This occurs before the frame
thread is released, so no EGL surface buffer can contain splash pixels.
2026-08-08 01:26:42 +10:00
Geoffrey McRae
4e82af162d [client] tests: cover padded frame strides
Add a configurable stride to the synthetic transport and poison row
padding so incorrect row addressing is visible in captured output.

Cover full-frame and moving-damage BGRA uploads with 512-byte and
5120-byte pitches, and verify the advertised layout in the log.
2026-08-08 00:29:32 +10:00
Geoffrey McRae
e470f9d8ae [idd] capture: preserve software copy row pitch
Use an explicit placed buffer for software frame copies so the D3D copy
uses the same row pitch published through KVMFR.

GetCopyableFootprints describes buffer copies and cannot be used to infer
the physical layout of a placed row-major texture. This caused padded
resolutions to use the wrong row starts in every consumer.

Keep the copy direct to IVSHMEM without a staging or CPU copy.
2026-08-07 21:10:37 +10:00
Geoffrey McRae
1de52f6e8a [idd] project: organize source layout
Move cadence and pipeline declarations under capture, and move local
named-pipe handling under ipc.

Flatten display contexts and rename files after their contained classes.
Keep transport headers limited to transport contracts and capabilities.

Consolidate CSwapChainProcessor definitions so each source file matches
the class it implements.
2026-08-07 18:16:18 +10:00
Geoffrey McRae
6725133375 [idd] transport: abstract LGMP implementation
Introduce transport, frame, and control interfaces with an LGMP factory
backend.

Move LGMP and IVSHMEM implementation details under transport/lgmp and
expose direct frame-buffer memory through a neutral capability.
2026-08-07 17:53:00 +10:00
Geoffrey McRae
30a1383d5e [idd] project: organize driver sources by responsibility
Group the IDD sources and Visual Studio filters by subsystem.

Split the device and swap-chain implementations into focused units,
rename the context classes, and reduce header coupling.
2026-08-07 15:49:18 +10:00
Geoffrey McRae
3ddc199bec [idd] capture: split software and hardware frame processors
Move cadence-aware hardware capture and immediate software capture
behind a common frame processor interface.

Keep shared damage tracking and frame-buffer ownership in the base
processor, and move stateless format, resource, and rectangle helpers
into CFrameProcessorUtil.

Decouple frame-buffer resources from CSwapChainProcessor by passing the
device dependencies they use directly.
2026-08-07 13:34:40 +10:00
Geoffrey McRae
d7c90e4693 [idd] capture: copy software frames directly to IVSHMEM
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
Bypass cadence retention when the software render adapter is active.
Publish each available source frame immediately with one damage-aware
D3D copy into its final IVSHMEM resource.

Keep only one software copy in flight so newer frames are dropped
instead of queued behind stale work. Retain accumulated damage for the
next frame and skip static re-encodes when no image update is pending.

Use a row-major IVSHMEM texture when the shared heap supports it and
fall back to a direct IVSHMEM buffer copy otherwise. In indirect mode,
copy only damaged rows from readback memory into IVSHMEM.
2026-08-07 12:43:48 +10:00
Geoffrey McRae
ce47758ebd [idd] config: support fractional refresh rates
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 refresh rates in millihertz and preserve three decimal places.

Advertise exact rational rates while accepting legacy integer values.

Accept rates from 23.900 through 1000.000 Hz.
2026-08-06 23:40:08 +10:00
Geoffrey McRae
a279a87bdb [idd] config: reload persisted display modes
Rebuild the driver's cached mode list before replugging the monitor so
Windows enumerates the settings saved by the helper.

Keep saved mode refresh rates intact and update only ExtraMode to the
configured default refresh.
2026-08-06 23:06:40 +10:00
Geoffrey McRae
05599ffd02 [client] cursor: restore Wayland pointer convergence
Keep the tracked Wayland hardware position sourced only from absolute
wl_pointer events. Relative motion remains unclipped at output edges,
so accumulating it made the client believe the hardware cursor had
reached the guest position and caused the corrective warp to be
skipped.

Keep cursor coordinates in shape-origin form after absolute
realignment. Preserve the logical hotspot when a shape-only update
changes its hotspot, preventing either path from leaving a permanent
offset.
2026-08-06 22:26:14 +10:00
Geoffrey McRae
5ab10614f2 [client] cursor: improve Wayland hotspot alignment
Center the Wayland diagnostic cursor on its actual pointer hotspot and
preserve it while cursor themes are reloaded for output-scale changes.

Round fractional guest positions to the nearest logical pixel instead of
biasing synchronization toward the top-left corner.

Resynchronize the hardware pointer when a cursor shape changes its
hotspot. Only perform the extra synchronization when the hotspot
actually changes, and update the basic-mode projection at the same time.
2026-08-06 22:26:14 +10:00
Geoffrey McRae
e4874ee32d [client] cursor: restore Wayland edge synchronization
Keep guest-to-host pointer synchronization active while an attempted
surface exit is blocked by the edge of a Wayland output. Continue
forwarding relative motion and wait for wl_pointer.leave before marking
the cursor outside the window.

Distinguish whole-surface releases from exits into letterbox space so
the expected asynchronous release callback cannot disable the feedback
loop before the pointer is confined again.

Treat Wayland pointer capability loss as a real leave so an unrelated
inactive callback cannot be mistaken for the intentional release.
2026-08-06 22:26:14 +10:00
Geoffrey McRae
5cc7f06185 [client] cursor: pace composited redraws
Coalesce pointer updates to the nominal output cadence instead of
waking the renderer for every transport packet. Keep request and
presented generations separate so updates racing a render receive a
trailing swap.

Let JIT consume cursor changes on display callbacks to preserve VRR
cadence, and use a deadline worker for non-JIT rendering. Give normal
source frames a short grace period so an on-rate feed absorbs the
cursor update instead of producing an extra swap.

Repaint visibility and cursor-content changes even when movement
redraws are disabled, including the transition that hides the cursor.
2026-08-06 22:26:10 +10:00
Geoffrey McRae
604b3082f3 [client] overlay: coalesce pointer redraws during splash fade
Pointer updates bypassed the paced overlay render and woke the renderer
for every cursor packet. On the default single-buffer EGL surface,
each full fade redraw could expose the desktop before the splash was
blended again.

Coalesce pointer redraws into the existing fade cadence while keeping
the latest cursor state. Immediate cursor redraw resumes when the fade
ends.
2026-08-06 18:17:34 +10:00
Geoffrey McRae
d8604ec144 [client] metrics: hide presentation timing 2026-08-06 18:04:10 +10:00
Geoffrey McRae
ee9d958626 [idd] scheduler: avoid secondary subscription replays 2026-08-06 18:04:10 +10:00
Geoffrey McRae
b50dd41909 [idd] scheduler: account queue maintenance work 2026-08-06 18:04:10 +10:00
Geoffrey McRae
807ea52b02 [idd] scheduler: reject isolated work timing stalls 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
ea6e155bbf [client] metrics: correlate Wayland presentation timing 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
bdfb1c3ce0 [client] metrics: expose cadence pipeline stages 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
1b78384da3 [client] wayland: publish stable presentation cadence 2026-08-06 18:04:10 +10:00
Geoffrey McRae
988675e53a [client] x11: recover stalled present cadence
Reseed the synthetic Present target window when compositor MSC advances
outside the queued range. This prevents a long compositor stall from
permanently exhausting JIT cadence callbacks.

Mark the recovery sample as discontinuous so calibration does not treat the
MSC jump or completion burst as renderer skipping.
2026-08-06 18:02:08 +10:00
Geoffrey McRae
a0b7b12ffc [client] tree: restore unrelated working changes
Restore client and test files that were already staged when the OBS
cadence commit was created. Keep that work out of the scheduler series
while leaving its working-tree contents untouched.
2026-08-06 18:02:08 +10:00
Geoffrey McRae
8a04037c9b [obs] scheduler: serialize cadence controls
Track the LGMP serial for each accepted frame-schedule message and wait
for its acknowledgement before sending another. Preserve pending RESET,
IMMEDIATE, and feedback state after definite enqueue failures.

Use bounded retry polling and request one fresh immediate frame after an
ambiguous pointer-queue fault recovers.
2026-08-06 18:02:08 +10:00
Geoffrey McRae
1040683a3a [client] scheduler: serialize cadence controls
Keep one accepted frame-schedule control in flight until LGMP reports
that its serial has been consumed. Retain ambiguous tokens across pointer
queue recovery instead of retransmitting RESET or IMMEDIATE messages.

Back off acknowledgement polling and definite enqueue failures. Use modular
serial comparison so acknowledgement remains correct across rollover.
2026-08-06 18:02:08 +10:00
Geoffrey McRae
fb1fb8447e [idd] scheduler: unblock ownership transitions
Permit retained-buffer reuse when both private queues are occupied by a
previous timing owner, even if the new owner has no pending deliveries.

Use the shared fallback when possible. Otherwise retain the fresh frame
locally and republish it instead of waiting for stale private deliveries.
2026-08-06 18:02:08 +10:00
Geoffrey McRae
3e9dadf340 [idd] scheduler: reserve slots for frame subscribers
Replace the oldest provisional schedule entry when the bounded client
table has no empty slot. Never evict a client whose frame subscription has
already been observed.

This prevents rapid failed reconnects from filling every scheduler slot
before a real frame subscriber can be registered.
2026-08-06 18:02:08 +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
05fe4f1dd8 [idd] scheduler: account partial shared delivery
Record every requested recipient after LGMP posts to at least one live
subscriber. Targets that disappeared during the post are harmless, while
surviving targets must advance instead of remaining perpetually due.
2026-08-06 18:02:08 +10:00