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:
selikhovandClaude Opus 5.5 committed 2026-10-04 04:18:53 +03:00
1 parent 5dd9aa1cd0
commit a0ff7dae61
7 files changed
+392 -121

No files matched your search

+9 -1
View File
@@ -85,6 +85,13 @@ struct BenchArgs {
/// encoders the frames are then converted and scaled on the GPU.
#[arg(long)]
dmabuf: bool,
/// The pattern drawn in advance into DMA-BUFs in video memory (VA-API
/// surfaces in the driver's layout), as a compositor hands over the
/// screen; implies --dmabuf. Without it the DMA-BUFs are ordinary
/// memory, which the GPU reads over the bus several times slower, and
/// which `/dev/udmabuf` limits to 64 MiB (7680x4320 needs 132).
#[arg(long)]
vram: bool,
/// Video codec: vp8, vp9, h264, av1 or h265 [default: the codec of
/// --encoder if named, else the first the encoder choice gives].
#[arg(long)]
@@ -388,7 +395,8 @@ fn bench(args: BenchArgs) -> Result<()> {
source: source.clone(),
synthetic_size: (width, height),
synthetic_pattern: pattern,
synthetic_dmabuf: args.dmabuf,
synthetic_dmabuf: args.dmabuf || args.vram,
synthetic_video_memory: args.vram,
fps: args.fps,
bitrate_kbps: args.bitrate,
codec,