Repository navigation
feat(gfxfb): added IMPORT_BUFFER to scan out GPU buffers - #607
Merged
Merged
Conversation
A picture rendered into a /dev/gpuN buffer reached the screen only through a CPU copy into a gfxfb buffer. Importing the GPU buffer lets the display scan out that memory directly, a reference keeping it allocated while the display reaches it. Each display decides which memory it can scan out, and one that takes none refuses imports.
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 picture the GPU renders into a buffer of /dev/gpuN (the GPU core's device file) reaches the screen only through a CPU
copy into a buffer of /dev/gfxfb (the display device), and
GFXFB_IMPORT_BUFFERlets a display whose hardware can readthe GPU buffer show it directly instead.
Changes
gpu::lookup_bufferlooks up a buffer handle in the calling process, refusesone lacking the rights asked for, takes a reference on the buffer and describes its memory (
gpu::memory_view).gpu::release_bufferdrops that reference from any context without waiting.GFXFB_IMPORT_BUFFER(gfxfb_import_args) checks that the picture's rows lieinside a GPU buffer the caller may read and hands its memory to the display's
import_buffer. A successful importtakes a handle and, as a creation does, control of the buffers for its open file, and its buffer works as a created
one except that mmap refuses it.
release_bufferdrops it, and gfxfb drops it on any failure before the display takes it.import, which userland sees as ENOTTY.
address, which the heap can hand to the next memory, so
drain_reapersees memory freed early.handle naming no buffer or lacking read rights. Seven gfxfb.test.cpp tests, on a fake display that imports one fake
GPU backend's scanout memory, check the reply, mmap's refusal, the release after a destroy, a present or an
unwritable reply, gfxfb's own refusals in order, the display's refusals as file errors, control and the handle
limit, and the boot display's refusal.