Repository navigation
feat(graphics): passed a gfxfb present's changed regions to the display - #452
Merged
Merged
Conversation
A present can name its buffer's changed regions, so a display showing a copy of each buffer copies only those. gfxfb checks them before it checks which file controls buffers, and copying can fail with ENOMEM.
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 gfxfb present (
GFXFB_PRESENT, which asks for a buffer to replace what an output shows from its next vertical blank) can name the regions of its buffer that changed since the buffer was created or last presented, so a display that shows a copy of each buffer can copy only those.Changes
gfxfb_present_argsgainsregions,region_count(at mostGFXFB_MAX_FLUSH_RECTS, 0 for the whole buffer) andreserved, anddisplay::present()receives the regions, or null and 0 for a present naming none.GFXFB_MAX_FLUSH_RECTSregions, regions it cannot read, and a region with a zero width or height or not wholly inside the presented buffer. It checks a copy of the regions on the unprivileged heap, failing with ENOMEM when no memory is left for it.Note
Medium Risk
User/kernel ABI change on
GFXFB_PRESENTplus new uaccess validation on a hot graphics path; incorrect bounds checks could allow bad copies, though region checks run before queuing to hardware.Overview
GFXFB_PRESENTcan name dirty regions so displays that copy buffers can update only what changed instead of the full framebuffer.gfxfb_present_argsgrows withregions,region_count(≤GFXFB_MAX_FLUSH_RECTS, 0 = whole buffer), andreserved.display::present()now takes the validated region list (or null/0 for full-buffer presents). The kernel copies regions from userland onto the unprivileged heap, returns ENOMEM if that fails, and rejects invalid rects before the single-client control check—including empty rects, out-of-bounds geometry (without coordinate+size wrap), unreadable user memory, non-zero reserved, and counts over the cap.Accepted presents forward regions through
queue_present; the heap copy is freed whenpresent()returns, so drivers that need them later must copy. virtio-gpu and boot_display still refuse presents; ABI/docs andgfxfb.test.cppcover delivery, limits, validation ordering vs control, and creation hooks.Reviewed by Cursor Bugbot for commit 08f0c02. Bugbot is set up for automated code reviews on this repo. Configure here.