Skip to content

Commit 06433c1

Browse files
committed
Enable the psram-cache-issue fix for all components
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...
1 parent 7118ae8 commit 06433c1

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

base.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ macro(rg_setup_compile_options)
99
${ARGV}
1010
)
1111

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

launcher/main/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
set(COMPONENT_SRCDIRS ".")
22
set(COMPONENT_ADD_INCLUDEDIRS ".")
33
register_component()
4-
if(IDF_TARGET STREQUAL "esp32")
5-
component_compile_options(-mfix-esp32-psram-cache-issue)
6-
endif()
74
rg_setup_compile_options(-O2 -Wno-error=format -Wno-error=char-subscripts)
85

96
# add_custom_command(OUTPUT images.c

prboom-go/components/prboom/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ set(COMPONENT_ADD_INCLUDEDIRS ".")
33
set(COMPONENT_REQUIRES "retro-go")
44
register_component()
55

6-
# The PSRAM cache bug seems responsible for very odd bugs that I spent way too much time
7-
# trying to debug... In retro-go the fix is disabled because of the huge performance overhead
8-
# but I guess we'll have to live with it in at least the prboom-go module...
9-
if(IDF_TARGET STREQUAL "esp32")
10-
component_compile_options(-mfix-esp32-psram-cache-issue)
11-
endif()
12-
136
rg_setup_compile_options(
147
-Wno-error=address
158
-Wno-misleading-indentation

rg_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
'retro-core': [0, 0, 983040],
2121
'prboom-go': [0, 0, 851968],
2222
'gwenesis': [0, 0, 983040],
23-
'fmsx': [0, 0, 589824],
23+
'fmsx': [0, 0, 655360],
2424
'gbsp': [0, 0, 851968],
2525
}
2626
# PROJECT_APPS = {}

0 commit comments

Comments
 (0)