Skip to content

feat: clock raise, Save Battery, Lowest latency take steering, one-frame Automatic - #15

Draft
broslife wants to merge 9 commits into
mainfrom
clock-control
Draft

broslife wants to merge 9 commits into
mainfrom
clock-control

Conversation

@broslife

@broslife broslife commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

What

Fixes for issue #30, items 1 to 3, as one test build.

1. The title raises its clocks (issue #30, item 1)

Stage CPU GPU Memory
Menu, handheld 1428 422.4 1600
Menu, docked 1428 system's 1600
Stream 1785 system's 1600
  • Raise only. Each clock is held only where the rate the system or the player's overclock profile runs is below the table's. A memory clock at 2400 or a docked CPU profile at 2397 is left alone. The rates are read before the title asks for anything. Under a module, the first stage lets go of any hold a crash left and reads them once the module has put its own back. A dock change does the same for the new mode.
  • A running sys-clk or Horizon OC takes the request through its override command. Without one, the title sets clkrst itself.
  • No polling. The title asks again at a wake, a return to focus and a new performance mode (module or not), and once more 0.5 s later. Between events it reads nothing. Each ask logs what it holds and what it leaves: clocks: Stream holds cpu 1785.0; leaves gpu at 384.0, emc at 2400.0 MHz.
  • A module's hold outlives the title, so Lifecycle::exit and the panic hook hand the clocks back.
  • A governor that lowers the CPU after the stream starts is out of scope: the title does not watch the clocks between events. Players using one should turn it off in the title's profile.
  • Save Battery ("nx.save_battery": true in the "settings" object of sdmc:/switch/punktfunk/settings.json) leaves every clock to the system. The settings row needs the shared console UI: Settings: Save Battery row needs the shared console UI #31.
  • Probe check 7 is in this branch, with its console results in docs/NOTES.md.

2. Lowest latency: the take follows the arrivals (issue #30, item 2)

Newest wins took the picture at a fixed 10 ms after the vblank. The arrivals drift through the refresh (about 0.8 ms a minute in the issue's logs). Once their band straddled the take, up to 150 pictures a window went unseen for minutes. The take now sits 2 ms past the latest usual arrival, within the GPU budget, and moves with the band (pf-nx-vk steer.rs). present[10s] reports the band, the take and the moves. Smoothness is unchanged.

3. Automatic smoothness takes one frame (issue #30, item 3)

The shared rule resolves Automatic to two frames. On the console, one frame presents as many pictures as two, one refresh sooner. A buffer the player picks still stands.

Status

Draft: a test build for the console.

  • Proven on the console with Horizon OC 2.5.1: the CPU hold through the module, through sleep and past exit.
  • To test:
    • the hold with Horizon OC's governor on (the overlay should read 1785, not 612);
    • a profile above the table (memory 2400): the log line should say it leaves that clock;
    • a wake and a return from HOME without a module (back to 1785 in the stream);
    • Save Battery through settings.json;
    • Lowest latency for 10+ minutes handheld (unseen (replaced) near zero);
    • Smoothness Automatic against 1;
    • dock changes;
    • plain sys-clk.

broslife and others added 5 commits November 20, 2026 16:21
Y at the start runs it alone. X, Y and B ask for 1785, 1224 and 1020 MHz;
every change of the clocks, focus or mode becomes a line in probe-clock.log.
Leaving does not restore the rate, so the next run shows what the system left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Horizon OC puts the CPU back to stock when no profile sets it, so a direct
clkrst rate falls within 300 ms while the module runs. Its service and
sys-clk's share the override command. The check finds which one runs, logs
its versions, and A and R hold and release the CPU through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The menu holds CPU 1428, GPU 422.4 in handheld and memory 1600; the
stream holds CPU 1785 and memory 1600 and leaves the GPU to the system.
A running sys-clk or Horizon OC takes the ask, since it undoes clkrst;
without one the title sets clkrst and asks again when the clocks move.

A module's hold outlives the title, so Lifecycle::exit and the panic
hook hand the clocks back, and the first stage replaces what a hard
crash left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The clock hold stays on by default. With `nx.save_battery` on in the
settings document, the menu and the stream hold nothing: the title lets
go of the module's hold, or puts the stock rates back without one, and
stops asking again. The menu reads the setting every frame, so a flip
takes effect at once.

The settings screen has no row for it yet: its rows are the shared
console's, and a Switch-only row needs one there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
broslife and others added 2 commits November 20, 2026 16:57
The shared rule resolves an Automatic buffer to two frames. On the
console one frame presents as many pictures a second as two, a refresh
sooner: 15-23 ms decode to present against 31-40 on 2026-10-31, and
21-25 ms end to end against a 23-36 ms swing in issue 30's run on
another network. A buffer the player picks still stands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The host's frame clock and the panel's drift apart, so the pictures'
arrivals walk through the refresh, about 0.8 ms a minute in issue 30's
logs. Newest wins took at a fixed 10 ms after the vblank, and once the
band of arrivals straddled it, up to 150 pictures a window went unseen
for minutes.

Under the latency intent the take now sits 2 ms past the latest usual
arrival, within the GPU budget. It moves at once when the band comes
within 1 ms, moves earlier when that saves over 3 ms, and goes to the
start of the next refresh when the band runs past the budget. The
present line reports the band, the take and the moves. Smoothness keeps
its fixed late take.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@broslife broslife changed the title feat: the title holds its clocks for the menu and the stream feat: clock hold, Save Battery, Lowest latency take steering, one-frame Automatic Nov 20, 2026
@Zayr64

Zayr64 commented Nov 20, 2026

Copy link
Copy Markdown

Thanks for turning the report into a build this fast.

One thing before I test this PR, about the clock hold. This console runs its RAM at 2400 MHz through Horizon OC 2.6.0 (my logs read emc 2400.0), with timings validated only at that rate, and I keep it fixed there. On Nov 15 it hard-froze twice the moment a profile moved the RAM from 2400 to 2133. A GPU voltage change went in the same step, so I can't fully separate the two, but the RAM switch is my main suspect and I have not changed it at runtime since.

From the clock table, the title asks the module for memory 1600 in the menu and in the stream as soon as it opens. On this console that would be a runtime drop from 2400 to 1600, and I'd rather not find out what happens.

Would one of these be possible?

  • Never lower a clock: skip the memory hold when the system's rate is already at or above 1600. The same rule would help docked, where my profile runs the CPU at 2397 and the 1785 hold would pull it down.
  • Or a way to leave memory alone while keeping the CPU hold. Save Battery turns everything off, and the CPU hold is the part I need (the 612 MHz governor case).

If I should use Save Battery for a first run: where does settings.json live on the SD, and is the key a top-level "nx.save_battery": true?

Once memory is left alone, I'm happy to run the Lowest latency test (10+ minutes, handheld) and send the logs.


Generated by Claude Code

With no overclock module the title read the clocks every second to see
whether the system had put its own back. The system does that at a wake,
a return from HOME and a dock change (NOTES, 2026-11-07), and the title
hears each of them. It now asks again at those events, and once more
half a second later in case the system moved the clocks after the event.
Between events it reads nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@broslife

Copy link
Copy Markdown
Collaborator Author

Hi @Zayr64 . Thanks again for your contribution.

Understood about your concern. I fact, the Switch OLED, as known as Mariko, it runs at 1600mhz the memory clock, a little above from the Eristas, which is mine, 1333mhz on stock.

So the hold on 1600mhz wasn't supposed to be a problem. However, in your case, you had undervolt/timing changes that can cause system crashes if you lower the clock to stock values.

I'll follow your suggestion and make the app check if the clocks used by the device at moment when a streaming starts or open the app are above the target ones, if yes, the app won't change the clocks. That way wouldn't reduce your memory clock.

I'll generate a new build and let you know when it's ready to test.

But keep in mind CPU governor can still be a problem. Not sure how could solve this. My theory would be if the app request a specific clock, the governor may not lower the clock, but with these new changes, if the clock set by the user is above the clocks requested by the app, so nothing would be done in the app side, so that way the governor could still lower the clock.

Doesn't have an option in Horizon OC to exclude governor to work when an specific app is running?

The hold asked for its rates whatever the console ran. On issue 30's
console that would drop a memory clock the player runs at 2400 to 1600
at runtime, and docked it would pull a 2397 CPU profile down to 1785.

Each clock is now held only where the rate the system or the player's
profile runs is below the stage's. Those rates are read before the title
asks for anything: under a module the first stage lets go of a crash's
hold and reads them once the module has put its own back, and a dock
change does the same for the new mode. A wake, a return to focus and a
new performance mode ask again with a module too. Each ask logs what it
holds and what it leaves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@broslife broslife changed the title feat: clock hold, Save Battery, Lowest latency take steering, one-frame Automatic feat: clock raise, Save Battery, Lowest latency take steering, one-frame Automatic Nov 21, 2026
@broslife

broslife commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

@Zayr64

The new build only raises a clock, never lowers one:

Each clock is held only where the rate your system or profile runs is below the app's table (menu: CPU 1428, GPU 422.4 handheld, memory 1600; stream: CPU 1785, memory 1600). Your memory at 2400 and a docked CPU at 2397 are left alone.
The app reads the rates before it asks for anything. With Horizon OC it first lets go of any hold a crash left and waits for the module to restore your profile.

It asks again only at a wake, a return from HOME or a dock change. It does not poll. If the governor lowers the CPU after the stream starts, the app won't see it, so the governor might need to be handled apart.
The log shows every decision, for example clocks: Stream holds cpu 1785.0; leaves gpu at 384.0, emc at 2400.0 MHz.

Correction on Save Battery (I had the path wrong): the file is sdmc:/switch/punktfunk/settings.json, and the key goes directly inside the "settings" object, next to the other options, not inside "extra": "nx.save_battery": true. You don't need to test this right now if you don't want to. We can't wait the owner, Enrico, implement this in the main repo, so the option will appear in the front-end settings.

Build: https://github.com/punktfunk/client-switch/actions/runs/44901362648/artifacts/14706775261 (the zip holds the .nro; the link expires on Nov 24)

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.

2 participants