voelin-media: offer the encoder's tiled layout to the compositor
The portal asked for LINEAR DMA-BUFs only, because the CPU could not read anything else. With the frames going to the GPU, a compositor that hands over its own tiled layout saves itself a de-tiling copy per frame, and the converter reads tiled memory faster. FrameSink::dmabuf_modifiers lists the tiled modifiers a sink takes now; the streamer's sink lists the GPU converter's (the layout the driver gives its own RGB surfaces, which it imports: 0x200000028a01f04 on the RX 7900 GRE) while the GPU path runs, and nothing on the CPU path. The portal offers them ahead of LINEAR, picks the first one the compositor can produce when it leaves the choice to us (LINEAR otherwise, as before), and renegotiates whenever the sink's list changes: a switch to an encoder that needs frames in memory, or a failed GPU conversion, brings LINEAR buffers back before the CPU has to read one. The first DMA-BUF of a capture is LINEAR (the converter is made for it), and the offer is renewed from the second frame. Not tested against a compositor: that needs a portal capture, which asks the person at the desktop. The offer and the choice are unit-tested. Also: exact_size tolerates an alignment of 0 (a stopped layer reports one), which divided by zero. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f317153203
commit
a45e85de02
4 files changed
+103
-25
No files matched your search
@@ -656,7 +656,10 @@ pub struct FfmpegEncoder {
|
||||
/// `size` cropped to a multiple of `alignment` (even at least, for 4:2:0
|
||||
/// chroma; at least 2x2): what an encoder of that alignment encodes exactly.
|
||||
pub(crate) fn exact_size(size: (u32, u32), alignment: (u32, u32)) -> (u32, u32) {
|
||||
let crop = |v: u32, a: u32| if v >= a { v / a * a } else { (v & !1).max(2) };
|
||||
let crop = |v: u32, a: u32| {
|
||||
let a = a.max(2);
|
||||
if v >= a { v / a * a } else { (v & !1).max(2) }
|
||||
};
|
||||
(crop(size.0, alignment.0), crop(size.1, alignment.1))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user