Repository navigation
feat(graphics): presented gfxfb's buffers on an output's vertical blank - #450
Merged
Merged
Conversation
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.
Summary
A program presents one of its buffers, or an output's base buffer (the pixels the output was lit with, which it shows until another buffer presented on it takes their place at a vertical blank), on an output with
GFXFB_PRESENT, and gfxfb keeps each buffer allocated while an output shows it or holds it for a present.Changes
GFXFB_PRESENThands the buffer to the display'spresent()and returns without waiting for the vertical blank, and the display reports togfxfb_node::present_done()how each present it accepted ended. An output holds one present at a time, so another present on it fails with EBUSY until the first latches (the output shows it from that vertical blank) or the output goes dark, and for good if the device fails first.Note
Medium Risk
New kernel/user ABI and refcount/lifecycle rules around scanout buffers; incorrect
present_donetiming could free memory still read by the GPU, though behavior is heavily tested.Overview
Adds buffer presentation to
/dev/gfxfb: userland can callGFXFB_PRESENTto swap what an output shows at the next vertical blank, using a client buffer handle or handle 0 for that output’s recorded base buffer.The kernel extends the
displaycontract withpresent()andgfxfb_node::present_done()(latched / dark / failed), tracks per-outputbase/shown/queuedbuffer records (up toGFXFB_OUTPUTS_MAX), and records every lit output’s base buffer at show time—not only the primary. Presents share the same single-file control model as buffer creation, allow one in-flight present per output (serialized with per-output mutexes), and keep buffers alive while hardware or a pending present may still read them.Boot and virtio-gpu displays stub
present()as unsupported; the user ABI and docs ingfxfb_abi.hdescribe errors and semantics. A large gfxfb test suite covers latching, refcounts, control/EBUSY paths, and concurrent presents.Reviewed by Cursor Bugbot for commit cd45ce1. Bugbot is set up for automated code reviews on this repo. Configure here.