Bench the GPU path from buffers in video memory, as a compositor's are
The test pattern's DMA-BUFs came from /dev/udmabuf: ordinary memory, which the GPU reads over the bus. Measured on the Radeon RX 7900 GRE (`gpu_conversion_cost`, new, ignored): converting a 3840x2160 RGB buffer to NV12 took 9.7 ms from such a buffer against 0.16 ms from one in video memory in the driver's tiled layout, and 4.0 against 0.09 ms at 1080p; the import itself costs 0.01-0.02 ms either way. So the bench showed the GPU path at 4K240 stuck at 70 fps waiting for the bus, which no real capture does. udmabuf also refuses buffers over 64 MiB, so 7680x4320 (132 MiB) could not be benched on the GPU path at all. `SyntheticScreen::with_video_memory` (`StreamerConfig:: synthetic_video_memory`, `voelinctl stream bench --vram`) draws eight frames of the pattern in advance into VA-API surfaces of the driver's layout, exported as DMA-BUFs and handed over in turn, as a compositor hands over the screen; a sink that declines them gets memory frames as before. The exported surface was a test helper and is now crate code (`ffmpeg::Exported`). With it, from a dev build: 4K240 AV1 at 60 Mbit/s 236.8 fps with 0.31 ms on the GPU per frame and 0.03 cores; 8K60 60.0 fps, 1.01 ms, 0.01 cores, the encoder's 16.5 ms per frame the limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a2333c8223
commit
a6e163e9aa
7 files changed
+392
-121
No files matched your search
@@ -575,6 +575,9 @@ pub struct StreamerConfig {
|
||||
/// ([`SyntheticScreen::with_dmabuf`]): drives the GPU path without a
|
||||
/// portal (Linux, `/dev/udmabuf`).
|
||||
pub synthetic_dmabuf: bool,
|
||||
/// With `synthetic_dmabuf`: buffers in video memory drawn in advance, as
|
||||
/// a compositor's are ([`SyntheticScreen::with_video_memory`]; VA-API).
|
||||
pub synthetic_video_memory: bool,
|
||||
/// Portal restore token from an earlier share: the desktop may skip its
|
||||
/// dialog. The new one is [`Streamer::restore_token`].
|
||||
pub restore_token: Option<String>,
|
||||
@@ -598,6 +601,7 @@ impl Default for StreamerConfig {
|
||||
synthetic_size: (1280, 720),
|
||||
synthetic_pattern: Pattern::Simple,
|
||||
synthetic_dmabuf: false,
|
||||
synthetic_video_memory: false,
|
||||
restore_token: None,
|
||||
layers: Vec::new(),
|
||||
}
|
||||
@@ -1058,7 +1062,8 @@ impl Streamer {
|
||||
SourceId::Synthetic => {
|
||||
let (w, h) = config.synthetic_size;
|
||||
let mut screen = SyntheticScreen::with_pattern(w, h, config.synthetic_pattern)
|
||||
.with_dmabuf(config.synthetic_dmabuf);
|
||||
.with_dmabuf(config.synthetic_dmabuf)
|
||||
.with_video_memory(config.synthetic_video_memory);
|
||||
screen.start_sink(&SourceId::Synthetic, &options, ingest).await?;
|
||||
(Box::new(screen), None)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user