feat(windows/capture): host-side cursor compositing for the capture model — the deterministic fix
Root cause, proven on-glass across five driver builds: a declared IddCx hardware cursor is IRREVOCABLE. There is no un-declare DDI, the empty-caps re-setup is rejected INVALID_PARAMETER, and after a successful same-mode re-commit with the driver's re-declare provably suppressed (sticky per-target flag, zero re-setups logged) DWM still never composites the software cursor back into the monitor's frames. Every DWM-based composite flip is therefore unfixable. The composite (capture) model is now implemented in OUR pipeline: - the driver keeps its hardware cursor declared for the session's whole life (the state that works) — frames stay pointer-free always; - in composite mode try_consume routes the conversion through a blend scratch: slot copy + one alpha-blended quad of the GDI poller's shape at its polled position (CursorBlendPass — fullscreen-triangle VS with viewport placement, straight-alpha PS, sRGB→linear for FP16/HDR rings), covering all four convert paths (NV12, 4:4:4 copy, P010, PyroWave) GPU-side under the slot's keyed mutex; - pointer-only motion produces no driver publish (declared hw cursor), so try_consume REGENERATES from the last slot whenever the polled cursor state changes — the cursor moves on a static desktop at tick rate, without faking freshness for the stall/death watchdogs; - set_cursor_forward becomes purely host-internal state; the SET_CURSOR_FORWARD IOCTL machinery is no longer used by the host (driver keeps it, dormant) and its sender plumbing is removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -79,12 +79,13 @@ pub trait Capturer: Send {
|
||||
}
|
||||
|
||||
/// LIVE cursor-render flip for a cursor-forward session (design/remote-desktop-sweep.md §8):
|
||||
/// `on = true` — the client draws the pointer, keep it OUT of the video (the Windows IDD
|
||||
/// capturer (re)declares the driver's hardware cursor so DWM excludes it); `on = false` —
|
||||
/// the client flipped to the capture mouse model, the pointer must be IN the video again
|
||||
/// (the IDD capturer un-declares, DWM composites — the pre-channel path). Default no-op:
|
||||
/// the Linux portal never bakes the pointer into frames — the encode loop blends its
|
||||
/// overlay instead, so there is nothing to switch at the capture layer.
|
||||
/// `on = true` — the client draws the pointer, keep it OUT of the video; `on = false` —
|
||||
/// the capture mouse model, the pointer must be IN the video again. The Windows IDD
|
||||
/// capturer implements the composite side ITSELF (slot-copy + alpha-blended quad from the
|
||||
/// GDI poller) — a declared IddCx hardware cursor is irrevocable, so DWM can never be
|
||||
/// handed the job back. Called every encode tick (implementations cache; steady state is
|
||||
/// one compare). Default no-op: the Linux portal never bakes the pointer into frames —
|
||||
/// the encode loop blends its overlay instead.
|
||||
fn set_cursor_forward(&mut self, _on: bool) {}
|
||||
|
||||
fn hdr_meta(&self) -> Option<punktfunk_core::quic::HdrMeta> {
|
||||
@@ -395,14 +396,6 @@ pub type CursorChannelSender = std::sync::Arc<
|
||||
dyn Fn(&pf_driver_proto::control::SetCursorChannelRequest) -> Result<()> + Send + Sync,
|
||||
>;
|
||||
|
||||
/// Mid-session cursor-render flip (`IOCTL_SET_CURSOR_FORWARD`, proto v6) — the live sibling of
|
||||
/// [`CursorChannelSender`], retained by the capturer for the session's lifetime so the client's
|
||||
/// mouse-model flips can (un)declare the driver's hardware cursor at any time.
|
||||
#[cfg(target_os = "windows")]
|
||||
pub type CursorForwardSender = std::sync::Arc<
|
||||
dyn Fn(&pf_driver_proto::control::SetCursorForwardRequest) -> Result<()> + Send + Sync,
|
||||
>;
|
||||
|
||||
// One-time PipeWire library init, shared by the video (portal) and audio capture threads.
|
||||
#[cfg(target_os = "linux")]
|
||||
pub mod pwinit;
|
||||
@@ -487,7 +480,6 @@ pub fn open_idd_push(
|
||||
keepalive: Box<dyn Send>,
|
||||
sender: FrameChannelSender,
|
||||
cursor_sender: Option<CursorChannelSender>,
|
||||
cursor_forward_sender: Option<CursorForwardSender>,
|
||||
) -> std::result::Result<Box<dyn Capturer>, (anyhow::Error, Box<dyn Send>)> {
|
||||
idd_push::IddPushCapturer::open(
|
||||
target,
|
||||
@@ -498,7 +490,6 @@ pub fn open_idd_push(
|
||||
keepalive,
|
||||
sender,
|
||||
cursor_sender,
|
||||
cursor_forward_sender,
|
||||
)
|
||||
.map(|c| Box::new(c) as Box<dyn Capturer>)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user