Enable the psram-cache-issue fix for all components

Cherry-pick:  06433c152c067f6c94c8ae7fd16d91edb087b812

Previously it was only enabled in DOOM and the launcher because they write to PSRAM a lot, triggering the bug often.

Other emulators tend to use it only to store their ROM in PSRAM, so the write bug doesn't usually occur. Which is why the fix was disabled until now.

But it definitely causes instability regardless. In this commit it is now enabled for all emulators, but not for the esp-idf side or libretro-go.

This should be a reasonable compromise. More testing is needed to see if it makes any emulator unusably slow...

So far I'm seeing 10-15% higher CPU usage which is... not great. Thankfully most emulators were at 50-60% usage, so there's headroom...
This commit is contained in:
Alex Duchesne 2025-11-07 15:21:02 -05:00
parent 59c033d7d5
commit bd22070c93
3 changed files with 10 additions and 10 deletions

View File

@ -9,6 +9,16 @@ macro(rg_setup_compile_options)
${ARGV}
)
# The PSRAM cache bug is responsible for many subtile bugs and crashes. The workaround has a
# significant performance impact but the alternative is instability... Enabling the fix here
# instead of sdkconfig prevents the new libc and wifi from being linked in which increases
# size and reduces performance further. It's not entirely safe but retro-go has been built
# with the workaround fully disabled for years, so clearly this compromise should be "fine".
# memw seems to have the least impact both in terms of size and performance
if(IDF_TARGET STREQUAL "esp32")
component_compile_options(-mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw)
endif()
if(RG_ENABLE_NETPLAY)
component_compile_options(-DRG_ENABLE_NETWORKING -DRG_ENABLE_NETPLAY)
elseif(RG_ENABLE_NETWORKING)

View File

@ -1,9 +1,6 @@
set(COMPONENT_SRCDIRS ".")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
if(IDF_TARGET STREQUAL "esp32")
component_compile_options(-mfix-esp32-psram-cache-issue)
endif()
rg_setup_compile_options(-O2 -Wno-error=format -Wno-error=char-subscripts)
# add_custom_command(OUTPUT images.c

View File

@ -3,13 +3,6 @@ set(COMPONENT_ADD_INCLUDEDIRS ".")
set(COMPONENT_REQUIRES "retro-go")
register_component()
# The PSRAM cache bug seems responsible for very odd bugs that I spent way too much time
# trying to debug... In retro-go the fix is disabled because of the huge performance overhead
# but I guess we'll have to live with it in at least the prboom-go module...
if(IDF_TARGET STREQUAL "esp32")
component_compile_options(-mfix-esp32-psram-cache-issue)
endif()
rg_setup_compile_options(
-Wno-error=address
-Wno-misleading-indentation