Commit Graph

375 Commits

Author SHA1 Message Date
Geoffrey McRae
9d074519b2 [idd] config: retain four-decimal refresh rates 2026-08-17 02:09:58 +10:00
Geoffrey McRae
c0de47b1e1 [idd] wcwrite: gate SIMD stores on SSE2 2026-08-17 02:08:29 +10:00
Geoffrey McRae
26cafbe3df [idd] lgmp: stream staged copies to WC memory 2026-08-17 01:27:38 +10:00
Geoffrey McRae
86b83f3e23 [idd] lgmp: reject invalid frame layouts 2026-08-17 00:59:27 +10:00
Geoffrey McRae
e08e03bec0 [idd] postprocess: normalize downsample layout 2026-08-17 00:59:20 +10:00
Geoffrey McRae
946e0f4945 [idd] capture: copy partial linear damage by byte range
Retained native candidates and framebuffer targets are both linear
buffers with the same pitched layout. Publish partial damage using
CopyBufferRegion with byte offsets instead of encoding the ranges as
texture-footprint copies.

Collapse full-width rectangles into one command. Fall back to a full
copy when the partial path would exceed 256 commands, copy at least a
full frame of data, or receive invalid damage coordinates.

This removes the native-only command path introduced by 650636cc that
can fault the D3D12 copy queue after RGB24 benchmarking selects native.
2026-08-15 20:19:54 +10:00
Geoffrey McRae
edeff3cce1 [idd] install: keep captured output in one encoding
nsExec merges stdout and stderr into one pipe and detects its
encoding once. Emit UTF-16LE on both streams so error output cannot
reinterpret progress messages as CJK text.

Disable CRT buffering on both streams so progress is visible while
service and SetupAPI operations are running.
2026-08-15 19:12:14 +10:00
Geoffrey McRae
5d51567fd5 [idd] install: let SetupAPI manage device updates
Remove the separate ConfigMgr disable and enable transaction. It
bypassed device class/co-installers, failed before DiInstallDriverW,
and could add two 30-second waits to every update.

Keep LGIddHelper stopped across both DiInstallDriverW calls and let
SetupAPI own PnP stop/start and report any required restart.
2026-08-15 19:11:48 +10:00
Geoffrey McRae
d23a7a3cf2 [idd] helper: release authority during device removal
Register the retained LGIdd authority handle for service device
notifications. Close the exact handle before granting query-remove.

Use cancellable overlapped control requests so the SCM handler never
waits for driver I/O while Plug and Play is removing the device.

Keep authority publication, host liveness, and child activation under
one synchronized state machine to prevent activation after removal.

Retire device notifications on the service thread and keep polling for
the interface so a manual re-enable recovers without a service restart.
2026-08-15 18:53:33 +10:00
Geoffrey McRae
a1f11bcc3e [idd] install: quiesce devices during driver updates
Stop LGIddHelper before updating either UMDF stack. Disable LGInput
before LGIdd, update both packages while quiesced, then restore the
provider before its dependent and start the service last.

Use in-use replacement for UMDF binaries and prevent the INF from
restarting the Helper during package installation. Report each
SetupAPI restart result and propagate it through NSIS.

Roll back transaction-owned devices, packages, and service state on
fresh-install failure. Preserve dependency order during removal and
select the package actually installed on each devnode.
2026-08-15 18:50:44 +10:00
Geoffrey McRae
fd2357565a [idd] input: purge report reads asynchronously
WDF forbids WdfIoQueuePurgeSynchronously from an I/O callback.
Keep HID deactivation pending while the report queue is purged
asynchronously, then complete it from the queue-state callback.

Reject activation during the transition. Complete any remaining
deactivation request during queue cleanup.
2026-08-15 18:00:23 +10:00
Geoffrey McRae
066d64393d [idd] clipboard: pipeline remote file reads
Add two protocol-sized read-ahead buffers to each active clipboard
file stream. Fetch the next remote block on a worker while the caller
or CopyTo destination consumes the current block.

Serialize stream operations and invalidate queued work on seeks and
failures. Join the worker before releasing the remote dataset lease.
2026-08-15 16:32:59 +10:00
Geoffrey McRae
94d5f3729e [idd] clipboard: batch helper stream delivery
Extend the clipboard target boundary with ordered prefix delivery.
Pass up to four queued LGMP stream records to the Helper ring in one
operation, apply state only to the accepted prefix, and retain the
remaining suffix for exact retries.

The channel holds its write lock across the prefix and emits one pipe
doorbell per stream window instead of one per record.
2026-08-15 16:32:43 +10:00
Geoffrey McRae
5bdfc0fe80 [idd] clipboard: remove stream payload restaging
Keep inbound stream payloads in the bounded stream-target window while
the Helper channel is busy and publish directly from those buffers.
Retain the pending target only for LGMP queue controls. Their credits
remain outstanding across retries.

This removes one full payload copy per client-to-Helper record without
changing delivery order, backpressure, or reset behavior.
2026-08-15 16:17:39 +10:00
Geoffrey McRae
4477ac0de1 [idd] clipboard: optimize write-combined reads
Add a reusable copy path for moving data from write-combined mappings
into normal cacheable memory. Dispatch to MOVNTDQA-based SSE4.1 or AVX2
loads when the processor and OS support them, with a fenced fallback.

Use the optimized path when staging inbound clipboard stream records from
the IVSHMEM mapping.
2026-08-15 16:09:28 +10:00
Geoffrey McRae
9e9bf6b88c [idd] lgmp: use precise clipboard polling
Drive adaptive clipboard stream polling with a high-resolution waitable
timer instead of rounding microsecond delays into coarse wait-function
timeouts.

Preserve the explicit stop and local wake events while avoiding a clock-tick
stall at each file-transfer window.
2026-08-15 16:03:43 +10:00
Geoffrey McRae
6a590e343a [idd] win32: use wait result constants
Use the documented Win32 wait constants throughout the pipe, clipboard,
and input workers instead of local numeric aliases.

Select the WDK NT-status definitions before including Windows headers.
Include wudfwdm.h privately in the affected translation units so UMDF 2
provides NTSTATUS without exposing WDF headers through LGCommon's public
interface to the desktop Helper.
2026-08-15 15:07:38 +10:00
Geoffrey McRae
be4bb19fa4 [clipboard] lgmp: make payload streams mandatory
Carry DATA and FILE_DATA only through the duplex SPSC streams. Keep LGMP
queues for control and status. Remove grants, commits, ACKs, and
queue-payload transport negotiation.

Poll adaptively while ownership or release is active. Preserve FIFO
release and graceful draining. Quarantine payloads crossed by a newer
OFFER or CLEAR, and retire data-plane state on detach.
2026-08-15 14:51:24 +10:00
Geoffrey McRae
12801df353 [input] lgmp: make report streams mandatory
Carry every input activation and report through its client-bound SPSC
stream. Keep the LGMP queue only for status publication and subscriber
discovery, removing transport selection and the queue-report fallback.

Retain graceful endpoint draining when a subscriber disappears and use
bounded adaptive polling while streams are active. The IDD polling setup
remains compatible with the project’s current C++ language mode.
2026-08-15 14:51:24 +10:00
Geoffrey McRae
89b1ced8fc [idd] clipboard: pipeline helper channel
Publish ordered four-record prefixes through the Helper mapping and ring
once per accepted burst. Wake blocked producers when the peer returns
credits while retaining the bounded polling fallback.

Move received payload ownership into manager work items and place remote
file-read data directly into the waiting caller’s bounded output buffer.
This removes avoidable 256 KiB copies without changing record ordering,
timeouts, cancellation, or reset semantics.
2026-08-15 14:51:16 +10:00
Geoffrey McRae
aea73cd2b3 [idd] input: consume per-client LGMP streams
Create and advertise one reliable input stream for each possible LGMP
client, then bind endpoints to active input subscribers.

Drain endpoints fairly while prioritizing the current owner's lane so
its RELEASE remains the ordering barrier. Reject transport changes
within an activation generation.

Gracefully retire missing or stalled subscribers without reusing an
active reservation. Keep excess clients on the queue and release HID
ownership from the input worker when its stream retires.
2026-08-15 14:38:16 +10:00
Geoffrey McRae
72522dadb8 [idd] clipboard: carry payloads over streams
Create one reliable four-slot lane in each direction and advertise the
stream data plane for clipboard protocol v4.

Bind both lanes to the accepted owner generation, stage incoming data
within a fixed window, and apply backpressure when Helper delivery is
full.

Drain reliable records before releasing an owner. Force stale or
unresponsive bindings after a bounded deadline while preserving the
existing cancellation and clipboard-clear cleanup.
2026-08-15 14:38:16 +10:00
Geoffrey McRae
10b32cb883 [common] clipboard: define stream transport
Replace the single 1 MiB clipboard slot with a four-record 256 KiB
window while retaining a 1 MiB logical file-read limit.

Advertise transport capabilities and duplex stream descriptors in the
clipboard status. Make each claim select one data plane for its entire
owner generation so control and payload ordering cannot be mixed.

Bump the clipboard, KVMFR, and Helper mapping versions for the new
wire layouts and shared-memory geometry.
2026-08-15 14:38:16 +10:00
Geoffrey McRae
6c412e0307 [idd] lgmp: expose stream allocation
Expose LGMP stream creation through the existing IDD host wrapper so
subsystem transports do not reach through its ownership boundary.

Keep stream lifetime and binding under each transport while the host
continues to own the underlying shared-memory allocator.
2026-08-15 14:38:16 +10:00
Geoffrey McRae
13d1bb1855 [idd] lgmp: remove old debug logging 2026-08-15 02:39:59 +10:00
Geoffrey McRae
a373df7705 [idd] capture: restore direct software publication 2026-08-15 02:28:26 +10:00
Geoffrey McRae
9ea988b2a4 [idd] helper: open the IDD log directory
The interactive Helper now writes its own log under LocalAppData so it
can run with the desktop user token. The tray menu should still take
users to the system-wide IDD and service logs under ProgramData.

Expose the log-directory resolver and have Open log directory request
the ProgramData location explicitly. Keep Helper log storage unchanged.
2026-08-15 01:14:24 +10:00
Geoffrey McRae
bf8e68c888 [idd] helper: read ahead remote clipboard files
Explorer can consume FILECONTENTS streams with reads much smaller than
the 1 MiB protocol limit. Previously each IStream::Read became a
synchronous cross-VM request, including client-side path validation and
a fresh file open.

Give each clipboard file stream a lazy 1 MiB absolute-offset read-ahead
window. Serve sequential reads and seeks within that window locally.
Bypass the cache for 1 MiB-or-larger reads and for CopyTo so bulk
callers avoid an extra copy. Preserve EOF, partial-read, failure, seek,
and clone semantics.
2026-08-15 01:14:02 +10:00
Geoffrey McRae
f9ffce528a [idd] helper: run interactive process as desktop user
Explorer file copies were invisible to the Helper because the service
launched its child with a duplicate of the LocalSystem token and changed
only TokenSessionId. The child therefore remained a System-integrity
process. Windows filtered Explorer's file clipboard formats across that
integrity boundary. Basic text and bitmap formats continued to work.

Keep only the SCM service privileged. Obtain the active session user's
primary token with WTSQueryUserToken. For elevated accounts, prefer the
linked limited token. Validate its session and security properties.
Build the user environment and launch the interactive Helper on
WinSta0\Default. Gate Helper activation until the service has rechecked
the active session and registered the clipboard authority.

Use random lifetime, stop, and activation objects owned by the service.
Give the target logon SID synchronization access only. Recheck the
active console session and service state before activation. Make the
lifetime mutex terminate the Helper if the service exits unexpectedly.
Restart it when the active session, IDD host, or authority changes.

Replace the old process-handle mapping transfer with a device-bound
authority protocol on the LGIdd device interface. The service verifies
the exact driver host instance, duplicates only section map rights into
that process, and registers the session, mapping identifier, and handle.
Bind authority lifetime to its WDF file object, revoke it synchronously
on cleanup, and poll the driver host identity while the child is active.

Restrict the device stack to SYSTEM and isolate LGIdd in a unique UMDF
device group. Restrict the shared section to SYSTEM and the target logon
SID. Apply a medium mandatory label that prevents low-integrity readers
and writers. Map it with read/write rights instead of all access.

Give each clipboard mapping a second random authority identifier. Store
it only inside the logon-SID-protected mapping and send it in the
mandatory HELLO. LGIdd matches it against the service-injected mapping.
This authenticates the user Helper without the unsupported UMDF call to
GetNamedPipeClientSessionId. Have the Helper verify that its pipe server
is in session zero.

Extend the pipe endpoint with bounded authentication reads, cancellable
overlapped I/O, periodic authorization checks, and explicit disconnects.
Serialize authority changes with clipboard attach and detach. Prevent
stale cleanup from tearing down a replacement mapping. Disconnect the
user pipe immediately when its owning authority is revoked.

Run clipboard, OLE, display, configuration, and file access in the
user's interactive process. Retain its process token for worker-thread
file operations instead of querying and impersonating the desktop user
from a System process. Store Helper logs in LocalAppData and grant only
the registry rights needed by interactive configuration and UMDF.

Keep immediate, stage-specific Win32 and HRESULT diagnostics throughout
clipboard capture. Probe CF_HDROP while holding the Win32 clipboard and
enumerate the OLE object's advertised file formats. Validate returned
storage and fall back to Shell item paths when direct retrieval fails.
Validate clipboard sequence changes and defer retries during contention
without publishing incomplete clipboard state.

Complete the 1 MiB transfer work with full-sized Windows copy buffers.
Use full-sized FUSE reads and retain the named 64 KiB X11 chunk limit.
Validate the user-writable mapping with CClipboardRing before attaching.

The pipe, mapping, and authority protocols change together. LGIdd.dll,
the INF, and LGIddHelper.exe must be rebuilt and installed as one
matching set.
2026-08-15 00:42:24 +10:00
Geoffrey McRae
e40dc19c7e [idd] helper: capture file clipboard under lock 2026-08-14 21:26:47 +10:00
Geoffrey McRae
352c3c42b6 [common] clipboard: enlarge transfer buffers 2026-08-14 19:09:11 +10:00
Geoffrey McRae
9679c94b91 [idd] helper: synchronize clipboard files 2026-08-14 19:09:11 +10:00
Geoffrey McRae
9ce121f97e [idd] helper: add clipboard file primitives 2026-08-14 18:13:22 +10:00
Geoffrey McRae
3525796a00 [idd] lgmp: route clipboard file operations 2026-08-14 16:09:08 +10:00
Geoffrey McRae
88fd0da19e [idd] clipboard: route file dataset records 2026-08-14 16:09:08 +10:00
Geoffrey McRae
71acbe71ad [idd] clipboard: accept restarted client generations
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-14 12:46:11 +10:00
Geoffrey McRae
c868082a7f [client/idd] fix copyright headers 2026-08-14 12:36:43 +10:00
Geoffrey McRae
b786167f72 [idd] clipboard: add direct synchronization 2026-08-14 10:22:37 +10:00
Geoffrey McRae
4602f20e62 [common] clipboard: define streamed clipboard ABIs 2026-08-14 10:06:34 +10:00
Geoffrey McRae
1e4f274553 [idd] helper: follow the active console session 2026-08-14 09:40:48 +10:00
Geoffrey McRae
caf8515e9d [idd] logging: make periodic statistics opt-in 2026-08-14 03:14:36 +10:00
Geoffrey McRae
879b8429e7 [idd] capture: log committed frame graph 2026-08-14 02:30:31 +10:00
Geoffrey McRae
1dcab65ab9 [idd] capture: version frame graph changes 2026-08-14 02:30:31 +10:00
Geoffrey McRae
70bc66b3f1 [idd] capture: execute texture frame graphs 2026-08-14 02:30:31 +10:00
Geoffrey McRae
deb963774e [idd] transport: route immutable texture frames 2026-08-14 02:30:31 +10:00
Geoffrey McRae
ba7a037f23 [idd] d3d: add leased D3D11 texture interop 2026-08-14 02:30:31 +10:00
Geoffrey McRae
3dd5abb05e [idd] capture: define immutable texture products 2026-08-14 02:30:31 +10:00
Geoffrey McRae
a8eb49fb17 [idd] postprocess: separate calibrated frame branches 2026-08-14 02:30:31 +10:00
Geoffrey McRae
43d918b5f3 [idd] capture: build frame processing graph 2026-08-14 02:30:31 +10:00
Geoffrey McRae
081dcf8879 [idd] transport: isolate frame configuration 2026-08-14 02:30:30 +10:00