fix(capture): map the DMA-BUF frames niri actually sends (#26)
* fix(capture): map the DMA-BUF frames niri actually sends
`uur run` reported "No Wayland frames arrived within 120 seconds" on a
session where the portal handshake succeeded. The session log showed the
stream never leaving negotiation:
portal session ready (video node 73)
stream state: connecting
stream state: paused
stream state: error - no more input formats
stream state: unconnected
Three separate defects in `uur-pw-capture`:
1. The format filter omitted `modifier`. niri marks that property
MANDATORY (SPA flags 0x18), and SPA filtering fails unless both sides
carry a mandatory property -- which surfaces as "no more input
formats". The filter now advertises LINEAR, the layout the frame
protocol already assumes.
2. `on_process` only handled `data != NULL` and `SPA_DATA_MemFd`. niri
delivers SPA_DATA_DmaBuf planes, which carry an fd and no pointer, so
every frame was dropped in silence. Since the session negotiates
LINEAR, that fd is directly mappable without GBM/EGL; the helper now
mmaps it. A non-linear modifier is refused instead of publishing
garbage.
3. DMA-BUF producers leave `chunk->size` and `maxsize` at 1. Both the
mapping length and the row count were derived from those, so the mmap
covered one byte and `rows` came out zero -- publishing an all-black
frame. Both now use the negotiated stride and height.
Verified on niri 26.04 with Wine 11.19: the stream reaches `streaming`,
~60 fps (1195 frames in 20 s), and the published frame decodes to the
real desktop rather than black.
* fix(capture): validate DMA-BUFs and recover interrupted screen streams
Use immutable transport files across geometry changes and remap Wine readers safely. Bound stream recovery and preserve portal stop-sharing intent. Refs #29.
* fix(capture): watch Mutter layout changes and support older build headers
* fix(capture): keep display changes outside the failure retry budget
* fix(capture): honor portal stop signals during GNOME recovery
Subscribe before starting on the portal-owned D-Bus connection and accept the real Session.Closed dictionary body. Correlate Mutter's close-before-MonitorsChanged ordering without restarting an explicit Stop Sharing session.
Verified in a private GNOME 51.1 namespace with real GBM DMA-BUF, 100/125 percent scaling, portrait and landscape, and native Stop Sharing. Existing 48 tests and strict clippy pass. Real Wine GDI reader captured 120 final-run frames across four layout changes with no hook fallbacks. No test scripts added.
---------
Co-authored-by: Xuc Pan <[email protected]>
This commit is contained in:
1 parent
306489d8ad
commit
a5e2aa44cd
5 files changed
+552
-133
No files matched your search
+10
-33
@@ -45,13 +45,7 @@ fn complete_hook_directory(dir: &Path) -> bool {
|
||||
}
|
||||
|
||||
fn hook_dir() -> Result<PathBuf> {
|
||||
let mut candidates = vec![
|
||||
PathBuf::from("/usr/lib/uur/hook"),
|
||||
PathBuf::from("/usr/local/lib/uur/hook"),
|
||||
];
|
||||
if let Ok(home) = std::env::var("HOME") {
|
||||
candidates.push(PathBuf::from(home).join(".local/lib/uur/hook"));
|
||||
}
|
||||
let mut candidates = Vec::new();
|
||||
if let Ok(exe) = std::env::current_exe() {
|
||||
if let Some(dir) = exe.parent() {
|
||||
candidates.push(dir.join("../lib/uur/hook"));
|
||||
@@ -59,6 +53,14 @@ fn hook_dir() -> Result<PathBuf> {
|
||||
candidates.push(dir.to_path_buf());
|
||||
}
|
||||
}
|
||||
candidates.push(PathBuf::from("/usr/lib/uur/hook"));
|
||||
candidates.push(PathBuf::from("/usr/local/lib/uur/hook"));
|
||||
if let Ok(home) = std::env::var("HOME") {
|
||||
candidates.push(PathBuf::from(home).join(".local/lib/uur/hook"));
|
||||
}
|
||||
if let Ok(directory) = std::env::current_dir() {
|
||||
candidates.push(directory.join("build/hook"));
|
||||
}
|
||||
candidates
|
||||
.into_iter()
|
||||
.find(|dir| complete_hook_directory(dir))
|
||||
@@ -66,32 +68,7 @@ fn hook_dir() -> Result<PathBuf> {
|
||||
}
|
||||
|
||||
fn hook_source_dir() -> Result<PathBuf> {
|
||||
let mut candidates = vec![PathBuf::from("/usr/lib/uur/hook")];
|
||||
if let Ok(home) = std::env::var("HOME") {
|
||||
candidates.push(PathBuf::from(home).join(".local/lib/uur/hook"));
|
||||
}
|
||||
candidates.push(
|
||||
std::env::current_exe()
|
||||
.ok()
|
||||
.and_then(|exe| exe.parent().map(|d| d.join("../lib/uur/hook")))
|
||||
.unwrap_or_default(),
|
||||
);
|
||||
candidates.push(
|
||||
std::env::current_exe()
|
||||
.ok()
|
||||
.and_then(|exe| exe.parent().map(|d| d.join("../../build/hook")))
|
||||
.unwrap_or_default(),
|
||||
);
|
||||
candidates.push(
|
||||
std::env::current_dir()
|
||||
.ok()
|
||||
.map(|dir| dir.join("build/hook"))
|
||||
.unwrap_or_default(),
|
||||
);
|
||||
candidates
|
||||
.into_iter()
|
||||
.find(|dir| complete_hook_directory(dir))
|
||||
.context("hook DLLs not found (run the build first)")
|
||||
hook_dir()
|
||||
}
|
||||
|
||||
static DEPLOY_TEMP_SEQUENCE: AtomicU64 = AtomicU64::new(0);
|
||||
|
||||
Reference in new issue
Block a user