Repository navigation
icd_shim: the gate's period is the panel's, and a mailbox slot is freed at the compositor's release - #72
Open
joshuatam wants to merge 2 commits into
Open
icd_shim: the gate's period is the panel's, and a mailbox slot is freed at the compositor's release#72joshuatam wants to merge 2 commits into
joshuatam wants to merge 2 commits into
Conversation
The gate booked `1e9 / cap` and nothing else, so its clock and the panel's were two free-running clocks close to each other. `1e9 / 120` is 8 333 333 ns against a measured 8 257 000 ns on Nova and 8 260 500 on Odin 3: the gate slips 76 us a frame, sweeps the whole vblank interval every ~108 frames, and every frame that lands late of its vblank waits one it did not need. Measured 80-90 fps under a 120 cap on a 120 Hz panel, with `gate=clock` and the release intervals visibly alternating between one and two periods. `pacing()` now delegates to `paced_on(cap, latch_grid())`: a cap the panel can express is booked as the whole number of the panel's measured periods nearest to it, so the phase never moves and every interval is the same length. A cap the panel cannot express keeps its own `1e9 / cap` -- 90 on 120 Hz is 33 % from a multiple, and its achieved rate is already quantized by the display. The rounding goes to the *nearest* multiple, which lands the rate marginally above its nominal: the multiple is the panel's measured period, not its nominal one, so 60 on a 121 Hz panel is 60.55. Rounding up instead would cost a whole divisor. The same tolerance means a cap within 2 % of a multiple is served at that multiple even when it is not one -- 119 on that panel reads 121.06, +1.73 % -- which is the mapping's cost and is documented rather than avoided: the alternative is leaving the cap to beat against the panel. `Pacing` is still `Off | Clock` and `Schedule` is untouched: this changes the period a gated session books, not the kind of release. Generation keeps its own clock (`Declared::Generating` takes `on_clock`), and a session with no reported grid behaves exactly as before, so nothing about this reaches LSFG or an X11 present route. docs/10's gate section, the two rate claims above the table and the census sentence are corrected with it; the earlier "within 1 %" was wrong in direction and in size, and "the limit is a maximum by construction" is now qualified to the booked period. Five tests: the divisor cells, a cap the panel cannot divide, the cap-just-off-a-divisor boundary, a cap above the panel, and a delayed release that does not overrun. 135 tests pass; clippy clean with -D warnings.
… a note `on_buffer_release` parked a slot only when the *served* mode was in its `synced` set, and that set held MAILBOX. `f41381e` grew it because `choose_live_mode` serves both `IMMEDIATE` and `FIFO_RELAXED` as MAILBOX: once the key moved from the declared mode to the served one, those two could only stay parked by dragging a genuine mailbox guest in with them. The two verdicts it collapsed are about different buffers. A mailbox buffer that reaches the panel is scanned for a full period and must be held that long. One that is superseded in the pending slot never was, and nothing else holds it. Parking both holds the latched frames and also waits out the bound for the superseded ones, because only a latched frame is ever released and so only it gets a note. Measured on Odin 3, Hades II, uncapped mailbox, 4 slots, 120 Hz panel: `commits` 200.4/s against `notes` 119.8/s, which is the panel rate, so 40 % of commits had no note to wait for and fell to `release_note_limit_ns()`; every slot averaged 2.42 display periods against a hold the daemon measures at 1.0-1.5, `slot_waits` was 34 671 of 40 047 acquires, and the acquire itself averaged 3 670 us. The set is FIFO and FIFO-relaxed again, so a mailbox, immediate or FIFO-relaxed declaration all free at the compositor's `wl_buffer.release`. Same session after: 330 fps (5 samples, 328.7-331.0), `slot_waits` 2 of 59 356, `park_timeouts` 0, a 1.46-period hold, and the acquire down to 15.3 us. The governor followed the load — 607 MHz to 1050 MHz — which is why the GPU reads 84 % on both. What this gives up, recorded rather than hidden: a mailbox buffer that does reach the panel can be written again while it is being scanned, so the reuse tear is open on this path by construction. The authority that separates the two buffers is `wp_presentation_feedback.discarded`, and it is not subscribed yet (`present::expect_feedback` requests nothing when the present carries no id, so the census reads `presented=0 discarded=0`). Parking what was latched and freeing what was discarded is the shape that keeps this rate without the window. docs/10 and docs/15 both claimed the hold follows the served mode and that both served modes are synced; corrected with the measurement. 135 tests pass; clippy clean with -D warnings.
4 of 8 tasks
Collaborator
Author
|
Companion app change: utkarshdalal/GameNative#2484 — the app-side half (the cap reaching the shim, and the GL stack a GL guest needs). It bumps the payload to |
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.
What this is
Two places where a rate the shim books was decided by a constant instead of by the session's own measurements. Both were measured on one uncapped 120 Hz session, and together they are 200 → 330 fps on it.
The gate booked
1e9 / capagainst a panel whose measured period is not1e9 / refresh, so its clock and the display's were two free-running clocks close to each other. The slot park booked a display release for a buffer that was never displayed, so 40 % of the session's commits waited out a bound instead of a release.The gate's period is the panel's, not the nominal refresh
1e9 / 120is 8 333 333 ns. The panel measures 8 257 000 ns on Nova and 8 260 500 on Odin 3. The gate slips 76 µs a frame, sweeps the whole vblank interval every ~108 frames, and every frame that lands late of its vblank waits one it did not need — 80-90 fps under a 120 cap on a 120 Hz panel, with the release intervals visibly alternating between one and two periods.pacing()now delegates topaced_on(cap, latch_grid()): a cap the panel can express is booked as the whole number of the panel's measured periods nearest to it, so the phase never moves and every interval is the same length. A cap the panel cannot express keeps its own1e9 / cap— 90 on 120 Hz is 33 % from a multiple, and its achieved rate is already quantized by the display.Rounding goes to the nearest multiple, which lands the rate marginally above its nominal, because the multiple is the panel's measured period and not its nominal one. Rounding up instead would cost a whole divisor. The same tolerance means a cap within 2 % of a multiple is served at that multiple even when it is not one — 119 on that panel reads 121.06, +1.73 % — which is the mapping's cost and is documented rather than avoided; the alternative is leaving the cap to beat against the panel.
Pacingis stillOff | ClockandScheduleis untouched: this changes the period a gated session books, not the kind of release. Generation keeps its own clock (Declared::Generatingtakeson_clock), and a session with no reported grid behaves exactly as before, so nothing here reaches LSFG or an X11 present route.A mailbox slot is freed at the compositor's release
on_buffer_releaseparked a slot only when the served mode was in itssyncedset, and that set heldMAILBOX.f41381egrew it becausechoose_live_modeserves bothIMMEDIATEandFIFO_RELAXEDasMAILBOX: once the key moved from the declared mode to the served one, those two could only stay parked by dragging a genuine mailbox guest in with them.The two verdicts it collapsed are about different buffers. A mailbox buffer that reaches the panel is scanned for a full period and must be held that long. One that is superseded in the pending slot never was, and nothing else holds it. Parking both holds the latched frames and also waits out the bound for the superseded ones, because only a latched frame is ever released and so only it gets a note.
Odin 3, Hades II, uncapped mailbox, 4 slots, 120 Hz:
slot_waitspark_timeoutsnotescommitswas 200.4/s againstnotes119.8/s — the panel rate — so 40 % of commits had no note to wait for and fell torelease_note_limit_ns(). The daemon measures the display's own hold at 1.0-1.5 periods, which is what the 1.46 now is.The governor followed the load: 607 → 1050 MHz. That is why the GPU reads 84 % on both, and it is the reason the fps gain (65 %) is smaller than the clock gain (73 %) — the frame is not cheaper, there are just more of them.
The set is
FIFOandFIFO_RELAXEDagain, so a mailbox, immediate or FIFO-relaxed declaration all free at the compositor'swl_buffer.release.What this gives up, recorded rather than buried: a mailbox buffer that does reach the panel can be written again while it is being scanned, so the reuse tear is open on this path by construction. This is the pre-
f41381erule — payload20261110.1's 342.5 fps is the same rule on the same device — so it is a restored behaviour and not a new one, but it is a real cost and not a footnote. The authority that separates the two buffers iswp_presentation_feedback.discarded: park what was latched, free what was discarded. It is not subscribed yet (present::expect_feedbackrequests nothing when the present carries no id, so the census readspresented=0 discarded=0), and that is the follow-up this leaves open.Verified
cargo clippy --all-targets -D warningsclean.23732f5with only this diff on top ([shim 202611211203 23732f5-dirty]), 180 s, five census samples.cap=120on 120 Hz should showgate=clockwithacq_spacingcollapsing into the 8.26 ms bucket. The uncapped session the fps table comes from hascap=0 gate=off, so it says nothing about the gate.docs/10's gate section, the two rate claims above its table and the census sentence are corrected with it; the earlier "within 1 %" was wrong in direction and in size, and "the limit is a maximum by construction" is now qualified to the booked period.docs/10anddocs/15both claimed the hold follows the served mode and that both served modes are synced; corrected with the measurement.