Repository navigation
Compositor: a window's buffers map at fixed ranges - #134
Merged
Merged
Conversation
The compositor mapped each buffer a window gave at the next address no mapping had used and unmapped the one it replaced, so a client giving buffers in a loop walked its address space upward until every give failed. It keeps one range of 128 MiB for each buffer number, and a buffer given under a number is mapped at that range's start once the buffer the range held is unmapped. The rules refuse the number of the buffer being read first, so no pixel a frame reads is unmapped. lib/mapping.c holds the ranges: mapping_range_reserve keeps one, mapping_range_image maps an image in it in place of the one it holds, and mapping_range_clear unmaps what it holds. mapping_image maps through the same code, gives back no size, which nothing read, and leaves the next address where it was when an image is refused. The kernel's table of 128 mappings for a process is as it was. display.md D6 counts what the compositor holds of it at each screen size, 11, 23 and 27 at the sizes the boots run and 135 at 7680 x 4320, says which screens have room for one, two and three buffers of their own size, and names how a buffer with no room is refused: its status line, 7 for ERR_NO_MEMORY, nothing of it left mapped, and its window closed for the reason buffer. tools/check-mapping.c checks the ranges on the host, over stubs that keep a process's mappings as the kernel does, its table of 128 among them. A million images given to one range, to the ranges in turn, and to ranges and at section counts drawn at random leave the addresses used as they were, with one image's sections mapped in a range at a time. An image the table has no room for, and one refused at each of its sections, leaves nothing mapped and its range fit for the next.
aoinoikaz
force-pushed
the
compositor-buffer-ranges
branch
from
November 12, 2026 17:36
0532dba to
7562f9d
Compare
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.
The compositor maps each buffer a window gives at an address no mapping has used, so a client that gives buffers in a loop uses up its address space, after which every give fails until the compositor restarts. Nothing says what happens to a buffer the kernel's table of 128 mappings has no room for.
Each of a window's three buffer numbers keeps one range of 128 MiB. A buffer given under a number is mapped at that range's start once the buffer the range held is unmapped. The rules refuse the number of the buffer being read first, so no pixel a frame reads is unmapped.
The table is as it was. display.md D6 counts what the compositor holds of it,
7 + 2sfor a screen ofssections, and says which screens have room for three, two and one buffers of their own size: up to 24, 30 and 40 sections. A buffer with no room is refused by name:buffer map failed status=7orbuffer size read failed status=7, nothing of it left mapped, its window closed withreason=buffer. A screen of more than 60 sections, as 7680 x 4320 is, takes the table with the compositor's own mappings, so the compositor ends and the console takes the display. #78 lifts the table.Checked:
tools/check-mapping.cunder the sanitizers, where a million gives leave the addresses as they were and 11 deliberate breaks of the library are each caught; 75 of 75 files againstSHA256SUMS; the window boot under TCG.Not checked: a boot at 7680 x 4320, which the firmware here does not set, so that case is derived, and simulated with a table filled by hand. No boot gives a second buffer under a number.
Closes #105