Repository navigation
feat(graphics): gave gfxfb's outputs back to their base buffers on close - #453
Merged
Merged
Conversation
An output kept showing the last buffer a closed file presented instead of its base buffer. The controlling file's close presents each such output's base buffer and keeps control while waiting for those presents.
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
When the open file controlling gfxfb's buffers (the one file at a time that may create and present them) closes, it presents the base buffer (the pixels an output was lit with) on each output that shows a created buffer and whose base buffer gfxfb recorded, before another file can take control.
Changes
gfxfb_node::on_close()drops the file's unread events (the records of its presents' ends), presents the whole base buffer of each output showing another buffer and waits for those presents the device accepts. An output with no base buffer recorded, or one where the present does not latch, as on a dark output or a failed device, keeps showing the buffer it showed.on_close()has waited for the file's own presents and the base buffers', so another file's creation or present that passes gfxfb's own checks fails with EBUSY meanwhile. No file receives the events of the close's presents, and a file that does not control the buffers presents nothing when it closes.Note
Medium Risk
Changes kernel display teardown ordering, locking around controller release, and present/event lifetime on close—timing-sensitive graphics driver behavior with broad test coverage but real regression risk if handback races with other clients.
Overview
When the controlling
/dev/gfxfbclient closes, gfxfb now restores each output that was showing a non-base buffer by queueing a handle-0, full-frame present of that output’s recorded base buffer, after waiting for the client’s own in-flight presents to finish.on_close()is split intowait_for_unended_presentsandgive_outputs_back: the controller drops unread present events, issues those base-buffer presents only whereshown != base, waits again for accepted presents (events are not delivered to any fd), and releases buffer control only after both waits so rivals still get EBUSY. Non-controllers and edge cases (no recorded base, dark/refused/failed present, stuck failed hardware) behave as documented ingfxfb_abi.h/gfxfb_node.h.Tests add deadline-based close/create helpers, per-output present recording, and new cases for multi-output handback, queued presents, dark outputs, and outputs without a base buffer; many existing tests now use
closes_before_deadline/closes_giving_output_backinstead of barefs::close.Reviewed by Cursor Bugbot for commit 62de0a5. Bugbot is set up for automated code reviews on this repo. Configure here.