Repository navigation
feat(vpp)!: resize into recycled surfaces, one pool per output size - #9
Merged
Merged
Conversation
`Processor::resize` scales a surface into NV12 and returns it exported, writing into a surface pool kept per output size. Once the caller drops a frame, its surface is the next one written at that size; a frame still held is never written over, and the next resize allocates beside it. At most one free surface is kept per size. The pool moves out of the decoder into its own module so both share it. `Processor::process` becomes private: `resize` covers what it was public for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
marked this pull request as ready for review
November 6, 2026 09:25
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the moq-video VAAPI quest, moq-dev/moq#8013, which switches moq-video's GPU resize over to this.
Problem
moq-video resizes a decoded VAAPI frame with
Processor::processand exports the result withExportedFrame::from_surface. Each call allocates a new VA surface and the driver destroys it when the frame drops, so a stream of resizes allocates once per frame.Approach
Processor::resize(input, size, input_color, output_color)scales into NV12 and returns anExportedFrame. Its output comes from a surface pool kept per output size, the same pool the decoder already uses for its targets, now insrc/pool.rs.ExportedFrame::exporttakes a pooled surface, so a resized frame returns to its pool the same way a decoded one does.Impact
Processor::resize.Processor::processis private.resizeis what it was public for, and moq-video is its only user.Validation
On Intel Arrow Lake (iHD 26.1.2) and AMD Radeon RX 9070 (radeonsi, Mesa 26.0.8),
cargo test --lib,cargo clippy --all-targets -- -D warnings, andcargo fmt --all --check. The AMD run pointed the VPP tests at its render node for the run only.a_released_output_is_written_into_againresizes twice into the same size, releases the first frame, and checks by DMA-BUF inode that the next resize reuses its surface. It also holds one frame while resizing a different picture and checks that the held frame keeps its pixels and that the pool allocated twice and keeps one free.a_scaled_surface_reads_back_at_its_new_sizenow goes throughresize.Alternatives
processpublic besideresize: two ways to do one thing, one of which allocates every call.Review
Codex (
quest review), one round: no findings.(Written by Claude Opus 5.5)
🤖 Generated with Claude Code