Repository navigation
iris-hostgl: flush presents don't wait, and come at most once a frame - #248
Merged
techomancer merged 3 commits intoOct 17, 2026
Merged
Conversation
atomchild411
force-pushed
the
hostgl-flush-presents
branch
3 times, most recently
from
October 17, 2026 23:00
803025f to
5d1e8b1
Compare
… flushes OP_SWAP applied GLX_SGI_swap_control's wait to every call, and every call moved the next one's due time: showing the front buffer after a flush (bit 1) and a colour-index window shown after a flush slept up to interval frames each. SGI's IRIS GL flushes after each primitive it draws into the front buffer, and flight asks for swapinterval(2): it drew a few primitives a second (the IRIS GL shim's flight ran at 4 frames a second the same way). Only swaps wait now; the seventh slot's new bit 4 says a present is a flush, for colour-index windows, whose frames carry no front bit. Unpaced, IGLOO's flight runs at 230 frames a second on IMPACT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… too SGI's IRIS GL flushes after every primitive it draws into the front buffer: flight drew its cockpit with 2,736 presents in five seconds, each a full-window composite, and each waited for the presenter (2.8 s of the five), so the instruments appeared one by one where SGI's library shows them at once. - A present made because the program flushed (OP_SWAP's front bit, or bit 4 for a colour-index window) never waits for the presenter: it replaces that window's frame still waiting. The screen gets the newest drawing as fast as the presenter can put it there, and the last one always. - Colour-index frames take the queue like RGBA ones (the first of each drawable synchronously, to learn whether the display takes it). - The queue keeps one waiting frame a window, not one in all, so one window's flushes never drop another's frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…off the CPU thread SGI's IRIS GL flushes after every primitive it draws into the front buffer -- two thousand a second in flight's cockpit -- and each flush was an OP_SWAP: a trip to the GL thread behind the client's queued buffers, and a whole frame copied for the screen. The cockpit drew itself over a second; on the board it takes a few hundred milliseconds. OP_PRESENT_LATER takes OP_SWAP's slots. On the GL thread it is read and answered 1 at once and queued in order with the buffers; the GL thread shows a client's window at most once a FLUSH_GAP (a 60 Hz frame), the latest waiting when the gap is up -- waking for it when nothing else comes -- or before the client's next call that is not a buffer, the only thing that changes what it draws to. Without the GL thread it is OP_SWAP. The library sends it only for a window whose last present the display took, so nothing ever has to come back. OP_SWAP's body moves into GlService::swap, unchanged, for both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
atomchild411
force-pushed
the
hostgl-flush-presents
branch
from
October 17, 2026 23:06
5d1e8b1 to
e9e9d5d
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.
iris-hostgl: flush presents don't wait, and come at most once a frame
SGI's IRIS GL flushes after every primitive it draws into the front buffer. Under host GL each flush was a full present the program waited for, so flight's cockpit drew itself instrument by instrument, over a second or more. On the board, and under SGI's own libraries on the emulated Max IMPACT, it appears at once.
The change
GLX_SGI_swap_controlapplied its wait to every OP_SWAP: showing the front buffer, or a colour-index window, after a flush slept up tointervalframes each. flight asks forswapinterval(2), so it drew a few primitives a second. A new bit 4 in the seventh slot marks a present as a flush, for colour-index windows, which have no front bit. Only swaps wait now.OP_PRESENT_LATER(0x1_0012). It takes OP_SWAP's slots.FLUSH_GAP(a 60 Hz frame).GlService::swap, unchanged, for both.Tests
flush_presents_wait_out_the_gap,present_later_is_answered_at_once_and_runs_in_order. The first sets its own gap (GlService::flush_gap), so it doesn't depend on how fast the host draws. WithFLUSH_GAPitself it failed about one run in six on a loaded VM, where a present took longer than a frame. It passed 10 of 10 there afterwards.cargo test --manifest-path iris-hostgl/Cargo.toml: 35 passed on macOS.cargo test --lib mgras: 177 passed.cargo test: 35 passed.🤖 Generated with Claude Code