Repository navigation
perf(gc573): faster start-up and timestamped streamer log - #60
Merged
Merged
Conversation
streamer.log is written through stdio, which buffers file output in 4 KB blocks. The Control Hub saw status lines seconds late, and the log had no timing, so slow starts could not be diagnosed. Replace stdout/stderr with fopencookie() streams after argument parsing. They are line-buffered, write straight to fd 1/2, and prefix each line with the seconds since start ([ 5.706] ...). The banner records the wall-clock start time. EVERLIVE_LOG_TIMESTAMPS=0 keeps plain lines (but still line-buffered). The Control Hub matches log lines with unanchored regexes, so the prefix does not affect it.
gc573_user_bridge_wait_for_ddr() kicked the sampler, slept a fixed 2000 ms and checked once. Poll every 10 ms within the same 2 s budget, and accept the lock once it has held for 50 ms, so a transient bit right after the kick is not taken as a lock. The number of attempts and the timeout are unchanged. On the test card (GC573, RetroTINK 4K source) the sampler locks after ~1.63 s, so this saves ~0.35 s per start. The log now reports the time taken.
Every HDMI 2.0 lock ran the full hardware auto-EQ on the input receiver (~0.75 s), or the RS sweep when that left errors (~2.6 s), although the source and cable rarely change between starts. gc573_rx_eq_tune() now takes the settings that left the port error-free last time (RS and DFE taps per lane). After the baseline it applies them and keeps them if one 100 ms CED window reads zero. Otherwise it continues with the normal auto-EQ path, so a stale entry costs one extra window. The result returns the final settings when the link ends clean. The streamer keeps them per receiver in memory for re-locks and in $XDG_STATE_HOME/everlive/link-eq (default ~/.local/state) across restarts. The log shows 'auto-EQ skipped (saved EQ clean)' when they were used. Hardware (GC573, RetroTINK 4K, 4K60 RGB): input EQ took 227 ms with the saved settings, against 731 ms for a fresh auto-EQ.
The Link EQ line now has a 'saved EQ' field: 'none' when nothing was saved for the port, otherwise the error count from the saved settings' 100 ms check. This shows whether a full auto-EQ ran because the saved settings failed or because there were none. A skew retrain around the saved RS before falling back was also tested. On the card it only roughly halved the errors from bad saved settings, never rescued a start, and added ~0.3 s to the fallback, so it was dropped. Across 22 starts the saved settings passed the check every time.
Everlite
marked this pull request as ready for review
November 10, 2026 17:51
Owner
|
Thank you so much, Scyllinice! We tested this locally on physical GC573 hardware and timed the startup:
Merged into dev. Outstanding work! |
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.
Faster GC573 start-up and a timestamped streamer log
Why
Starting capture on a GC573 took ~9.5 s from launch to the first frame, and the log couldn't show where the time went.
streamer.logwas written in 4 KB blocks with no timestamps, so the Control Hub also saw status lines late.What
gc573_user_log.[ch]). After argument parsing, stdout and stderr are replaced withfopencookie()streams that write each line straight to the fd, prefixed with the seconds since start ([ 5.706] ...). The banner records the wall-clock start time. Output stays synchronous, so a crash loses at most the line being written.EVERLIVE_LOG_TIMESTAMPS=0turns the prefix off. The Control Hub matches log lines with unanchored regexes, so the prefix doesn't affect it.gc573_rx_eq_tune()takes the RS and DFE taps that last left the port error-free, applies them and keeps them if one 100 ms CED window reads zero. Otherwise it runs the normal auto-EQ, so stale settings cost one extra window. The streamer keeps the settings per receiver in memory and in$XDG_STATE_HOME/everlive/link-eq(default~/.local/state). TheLink EQlog line shows how the saved settings measured (saved EQ 0 errors, ornone).Results (GC573, RetroTINK 4K → 4K60 RGB)
In 22 starts the saved settings passed their check every time.
The remaining ~8 s is mostly fixed by the hardware or the source: card reset ~0.6 s, DDR sampler ~1.6 s, chip init and EDID programming ~2.1 s (including a deliberate 500 ms HPD-low pulse), and the source handshake ~1.0 s.
Tried and dropped
Testing
make selftestpasses.