Skip to content

fix: cpu stuck in performance mode on fresh install - #733

Merged
frysee merged 2 commits into
LoveRetro:mainfrom
pvaibhav:bugfix-cpu-speed
May 20, 2026
Merged

fix: cpu stuck in performance mode on fresh install#733
frysee merged 2 commits into
LoveRetro:mainfrom
pvaibhav:bugfix-cpu-speed

Conversation

@pvaibhav

Copy link
Copy Markdown

This fixes a bug where on fresh install i.e. when the CPU speed for minarch has not otherwise been changed, the CPU Speed stays stuck in Performance mode even though the UI shows Auto.

This is because minarch calls setOverclock(1) to upgrade to performance mode, but this overwrites the "overclock" variable. If a subsequent "Config_readoptions()" call does not reset it back to something else, the cpu will silently stay in performance mode while the UI shows the default option of Auto.

The fix is to set Auto cpu mode explicitly when minarch starts. At present this selects schedutil from min to one less than the max frequency. On TG5040 this is 10% slower clock, so startup time of every game will be 10% slower. But this is of the order of 100-200 ms, while the power and thermal savings are massive.

Closes #732

This fixes a bug where on fresh install i.e. when the CPU speed for minarch has not otherwise been changed, the CPU Speed stays stuck in Performance mode even though the UI shows Auto.

This is because minarch calls setOverclock(1) to upgrade to performance mode, but this overwrites the "overclock" variable. If a subsequent "Config_readoptions()" call does not reset it back to something else, the cpu will silently stay in performance mode while the UI shows the default option of Auto.

The fix is to set Auto cpu mode explicitly when minarch starts. At present this selects schedutil from min to one less than the max frequency. On TG5040 this is 10% slower clock, so startup time of every game will be 10% slower. But this is of the order of 100-200 ms, while the power and thermal savings are massive.

Closes LoveRetro#732
Comment thread workspace/all/minarch/minarch.c Outdated
Avoid clobbering the cpu speed by using PWR_setCPUSpeed() directly. Also move the reset of cpu speed to the last possible place before the gfx loop starts.

This fixes the bug without any performance regression, but infact a minor performance gain during load (about 5% faster loading).
@frysee
frysee merged commit e9e9113 into LoveRetro:main May 20, 2026
62 checks passed
@pvaibhav

Copy link
Copy Markdown
Author

Thanks!

@pvaibhav
pvaibhav deleted the bugfix-cpu-speed branch May 20, 2026 16:23
carroarmato0 pushed a commit to carroarmato0/NextUI that referenced this pull request May 23, 2026
* fix: cpu stuck in performance mode on fresh install

This fixes a bug where on fresh install i.e. when the CPU speed for minarch has not otherwise been changed, the CPU Speed stays stuck in Performance mode even though the UI shows Auto.

This is because minarch calls setOverclock(1) to upgrade to performance mode, but this overwrites the "overclock" variable. If a subsequent "Config_readoptions()" call does not reset it back to something else, the cpu will silently stay in performance mode while the UI shows the default option of Auto.

The fix is to set Auto cpu mode explicitly when minarch starts. At present this selects schedutil from min to one less than the max frequency. On TG5040 this is 10% slower clock, so startup time of every game will be 10% slower. But this is of the order of 100-200 ms, while the power and thermal savings are massive.

Closes LoveRetro#732

* fix: revert cpu speed to performance during load

Avoid clobbering the cpu speed by using PWR_setCPUSpeed() directly. Also move the reset of cpu speed to the last possible place before the gfx loop starts.

This fixes the bug without any performance regression, but infact a minor performance gain during load (about 5% faster loading).
ArjunKdaf pushed a commit to ArjunKdaf/kUI-Cold that referenced this pull request Jun 24, 2026
* fix: cpu stuck in performance mode on fresh install

This fixes a bug where on fresh install i.e. when the CPU speed for minarch has not otherwise been changed, the CPU Speed stays stuck in Performance mode even though the UI shows Auto.

This is because minarch calls setOverclock(1) to upgrade to performance mode, but this overwrites the "overclock" variable. If a subsequent "Config_readoptions()" call does not reset it back to something else, the cpu will silently stay in performance mode while the UI shows the default option of Auto.

The fix is to set Auto cpu mode explicitly when minarch starts. At present this selects schedutil from min to one less than the max frequency. On TG5040 this is 10% slower clock, so startup time of every game will be 10% slower. But this is of the order of 100-200 ms, while the power and thermal savings are massive.

Closes LoveRetro#732

* fix: revert cpu speed to performance during load

Avoid clobbering the cpu speed by using PWR_setCPUSpeed() directly. Also move the reset of cpu speed to the last possible place before the gfx loop starts.

This fixes the bug without any performance regression, but infact a minor performance gain during load (about 5% faster loading).
carroarmato0 added a commit to carroarmato0/NextUI that referenced this pull request Jul 2, 2026
Brings the migration branch current with upstream (LoveRetro/NextUI). New
upstream work pulled in: white-point colour correction + displaycal for
tg5040 (LoveRetro#760), configurable font style and custom system fonts (LoveRetro#748/LoveRetro#729),
usb-c card detection before boot (LoveRetro#750), the game-switcher label fix for
entries without a save state (LoveRetro#751), readyResume on Quick Menu directory
nav (LoveRetro#739). Two upstream commits (LoveRetro#733 cpu governor, LoveRetro#728 Rewind_init) are
the same PRs our fork already carried under different SHAs; git merged them
cleanly with no duplicated logic.

Conflict resolution:

- nextui.cpp: upstream still edits the old nextui.c, which we renamed to
  .cpp. Git followed the rename. The one real conflict was the recent-game
  preview button hints -- upstream's LoveRetro#751 changed the logic (group 0 always
  BACK; group 1 shows "A OPEN" when there's no save state instead of
  RESUME/REMOVE). Took upstream's logic, kept our C++-friendly cast style.
- nextui.cpp: LoveRetro#739 added a readyResume call site into nextui.c using the old
  Array API (->count / ->items[]); rewrote it against std::vector to match
  the migrated container (top->entries[top->selected]).

Also fixes a latent const-correctness bug the full clean build surfaced:
the tg5040 device descriptor stores sysfs paths as const char*, but
getInt/putInt/putFile took char* -- so libbatmondb (which compiles
platform.c with -Werror=discarded-qualifiers) failed once its cached header
forced a platform.c recompile. Those helpers only read the path string, so
const-ifying the parameter is the correct fix.

Verified: full clean build green for both desktop and tg5040 (nextui,
minarch, settings).
carroarmato0 added a commit to carroarmato0/NextUI that referenced this pull request Jul 5, 2026
Brings the migration branch current with upstream (LoveRetro/NextUI). New
upstream work pulled in: white-point colour correction + displaycal for
tg5040 (LoveRetro#760), configurable font style and custom system fonts (LoveRetro#748/LoveRetro#729),
usb-c card detection before boot (LoveRetro#750), the game-switcher label fix for
entries without a save state (LoveRetro#751), readyResume on Quick Menu directory
nav (LoveRetro#739). Two upstream commits (LoveRetro#733 cpu governor, LoveRetro#728 Rewind_init) are
the same PRs our fork already carried under different SHAs; git merged them
cleanly with no duplicated logic.

Conflict resolution:

- nextui.cpp: upstream still edits the old nextui.c, which we renamed to
  .cpp. Git followed the rename. The one real conflict was the recent-game
  preview button hints -- upstream's LoveRetro#751 changed the logic (group 0 always
  BACK; group 1 shows "A OPEN" when there's no save state instead of
  RESUME/REMOVE). Took upstream's logic, kept our C++-friendly cast style.
- nextui.cpp: LoveRetro#739 added a readyResume call site into nextui.c using the old
  Array API (->count / ->items[]); rewrote it against std::vector to match
  the migrated container (top->entries[top->selected]).

Also fixes a latent const-correctness bug the full clean build surfaced:
the tg5040 device descriptor stores sysfs paths as const char*, but
getInt/putInt/putFile took char* -- so libbatmondb (which compiles
platform.c with -Werror=discarded-qualifiers) failed once its cached header
forced a platform.c recompile. Those helpers only read the path string, so
const-ifying the parameter is the correct fix.

Verified: full clean build green for both desktop and tg5040 (nextui,
minarch, settings).
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.

[Brick] CPU stuck at 2000 MHz on a fresh install of 6.11.1

2 participants