Skip to content

perf(stream): build the latency round for a console test - #38

Draft
enricobuehler wants to merge 10 commits into
mainfrom
perf/latency-and-load
Draft

enricobuehler wants to merge 10 commits into
mainfrom
perf/latency-and-load

Conversation

@enricobuehler

Copy link
Copy Markdown
Member

A build for one console round. Draft until that round has run: nothing here has been on a console.

Why

Two measured facts from #30 and docs/NOTES.md shape it.

  • Latency is mostly the wait for the panel. Of 22.6 ms end to end, 13.5 ms pass between a decoded picture and its present. A picture that lands after the take waits a whole refresh, so the take should sit as late as the console allows and never among the arrivals.
  • Load is the system's socket service on core 3, at about 330 µs a datagram. What counts is how many datagrams cross it.

What changes

Change Default moves?
The late take finds its limit in the stream: starts at 10 ms, moves 0.25 ms later after 600 clean presents, steps back for good when a frame is found queued yes, where the GPU has room past 10 ms
Under Lowest latency the take keeps clear of the arrivals' band yes
Automatic smoothness is one frame; a picked buffer stands yes
Audio conceals a quiet wire on core's thresholds, ported from client-ps5 yes
Motion goes out on a new sensor sample yes, small
stats: counts uplink datagrams by kind log only
A warning when the CPU runs below stock, at start and mid-stream log only
teto-mbps (5 to 20) sets Automatic's ceiling for a run no: stays 20
nivel-gpu (384 or 460) asks the system for that handheld GPU level no: nothing is asked
espera-fixa keeps the late take at the old fixed 10 ms A/B baseline

Credit

The arrival-band estimate (pf-nx-vk/src/steer.rs) and the one-frame Automatic are @broslife's work from #15, carried over here. The band now chooses a side of the limit instead of placing the take on its own.

What the round should know

The runs, the lines to read and what passes are in docs/improvements.md, "Latency and load round".

Checked

  • Dev box: cargo test --workspace (152 passed), fmt, clippy.
  • Linux lane in punktfunk-nx-host:2: fmt, clippy --workspace --all-targets -D warnings, cargo test --workspace (184 passed), on the nine commits before the GPU marker.
  • Console target: check -p pf-nx-sys only.

Not checked locally: the console build of pf-nx-platform and pf-nx. The changes in console/mod.rs, console/lifecycle.rs and console/pads.rs have never compiled; this PR's console lane is that check.

The late take stopped at a fixed 10 ms, a guess at the compositor's
deadline, while composition left room past 12 ms. A frame still queued
at the next present is the one sign it missed its vblank, so the limit
walks later only after long clean runs and steps back for good at a
miss, inside the GPU's room.

The arrivals drift through the refresh. While their band sits on the
take, newest wins shows some pictures a refresh late and never shows
others. Under the latency intent the take moves before such a band, so
every picture goes the same way, and returns once the band clears it.

A queued frame after a stalled present, a drained wait or stopped
drains says nothing about the deadline and is not read as a miss. The
espera-fixa marker keeps the fixed 10 ms for the A/B.
The shared rule resolves an Automatic buffer to two frames. On this
console one frame presents as many pictures a second, one refresh
sooner, and holds end to end steady where two swing by a refresh.

A buffer the player picks still stands, and the latency intent is
untouched.
The system core that serves every socket call is the stream's bottleneck,
and its load follows datagrams in both directions. The input thread sends
pads, motion and touch as their own datagrams at 250 Hz, and nobody has
counted them.

The stats line now reports what the input thread hands core a second:
pad, motion, touch and other. A pad's button and axis events in one tick
count once, as core folds them into one snapshot.
hid stamps each six-axis sample with a sampling number. A tick that reads
the same sample again has nothing new for the host, which holds the last
rate it got. A sample the every-other-tick rule held back used to go out
a tick late; it now stays home and the next new sample goes out instead.

A reading that moves under an unchanged number still counts as new, so a
sensor whose counter never moves cannot freeze the gyro. Rest is still
counted in ticks, so a pad's zero rate goes out on time between samples.

The stats line now shows motion datagrams against the new samples read,
which measures the sensors' real rate on the console.
Video is most of the datagrams the system's socket service carries, in
proportion to bitrate, and Automatic climbs to the flat 20 Mb/s ceiling
handheld. A lower ceiling trades picture for load, so it is measured
before anyone picks a default.

A file teto-mbps in the data directory, holding whole megabits a second
from 5 to 20, sets the ceiling for that run. Absent, it stays 20; the log
names the ceiling each run uses, and says when the file was ignored.
Every performance configuration a retail console runs a game at keeps
the CPU at 1020 MHz, and the socket service that carries the stream runs
near its limit there. A governor that drops it lower slows the receive
path, and the clocks in the stats line alone do not flag it.

Each stream now logs one warning with the clock it read when the CPU is
below stock. The clock is only read; this client sets none.
A governor can lower the CPU clock while a stream runs, after the check
at stream start has passed. The stats window reads the clocks every 10 s
anyway, so a drop below stock there warns once, and a return to stock
arms the next warning. A drop the stream start already named is not
named again.
The pump waited 100 ms on an empty plane and fed nothing, so a Wi-Fi
stall drained the ring into underruns. Underruns grew the ring's target,
and the gap concealed at the stall's end landed on top, so the ring
stayed deeper and the audio later behind the picture.

The pump now wakes once a frame and ticks core's DroughtConceal, which
conceals on core's own thresholds and budget. The packet that ends the
quiet conceals only the frames still owed.

Concealment enters the sink apart from fed packets, so the audio window
still shows the stall's gap and counts the concealed frames.
The late take's limit, the steering, Automatic smoothness, the uplink
count, the bitrate ceiling marker, the CPU warning and the audio
concealment are built and have not run on a console. The notes say
what each does, where the limit cannot help, and what the round reads.

The clock raise is marked as decided against, and the slow way back
after a hitch as read from the code with the log that would settle it.
Unasked, a title runs the handheld GPU at 307 MHz, the lowest row of
the system's table, and composition on it is what bounds the late take
at stock clocks. A retail game asks for its row.

A file nivel-gpu holding 384 or 460 makes the title ask for that row,
with the CPU and the memory where the default has them, so a console
round can measure what the level buys against the battery. Without the
file nothing is asked, and the former row goes back at exit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant