Skip to content

Use AUDIO_VIDEO_ENABLE flags to skip rendering when not needed by the frontend - #570

Open
msheehan79 wants to merge 5 commits into
libretro:masterfrom
msheehan79:av-enable
Open

Use AUDIO_VIDEO_ENABLE flags to skip rendering when not needed by the frontend#570
msheehan79 wants to merge 5 commits into
libretro:masterfrom
msheehan79:av-enable

Conversation

@msheehan79

Copy link
Copy Markdown

This PR adds some checks based on the RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE macro to skip the rendering portion of video or audio when not required, in order to reduce the overhead when running features such as Runahead.

I did some benchmark testing on this PR using the method detailed below. In addition, I also just used the core as I normally would to play and did not notice any regressions during my playback.

Benchmarking:

I used Hyperfine to run the core in headless mode, using the following .cfg changes from default:

audio_driver = "null"
config_save_minimal = "true"
log_to_file = "true"
log_verbosity = "true"
rgui_show_start_screen = "false"
run_ahead_enabled = "true"
run_ahead_frames = "4"
run_ahead_secondary_instance = "false"
video_driver = "null"

Test Method: Used an average of 10 runs of the original vs pr core, calculated for 5000 frames, with 1 warmup run. I used 4 frames of runahead for the bulk of my testing.
Example command used: hyperfine -w 1 --runs 10 -n "Current Core" "retroarch.exe -L mame_libretro_current.dll C:\emulation\roms\arcade\mame\4dwarrio.7z -v --config benchmark.cfg --max-frames 5000" ^ -n "Updated Core" "retroarch.exe -L mame_libretro_updated.dll C:\emulation\roms\arcade\mame\4dwarrio.7z -v --config benchmark.cfg --max-frames 5000"

Results
The actual FPS gain varied quite a bit by game, but at no point did I see a regression or drop in FPS with this enabled.

Game Time (Sec) (Original Build) Time (Sec) (PR Build) FPS (Original Build) FPS (PR Build) % Diff
pacman 7.156 4.902 698.7144 1019.992 45.98%
strider2 60.613 59.382 82.49055 84.2006 2.07%
005 9.404 7.126 531.6886 701.6559 31.97%
gdarius2 145.945 138.373 34.25948 36.13422 5.47%
sf2ce 22.428 19.448 222.9356 257.0958 15.32%
aquajet 121.092 103.938 41.29092 48.1056 16.50%
batsugun 38.214 35.622 130.8421 140.3627 7.28%
berzerk 20.942 14.965 238.7547 334.1129 39.94%
vf2 109.918 102.166 45.48846 48.93996 7.59%
4dwarrio 30.828 25.599 162.1902 195.3201 20.43%

AI Disclosure I used Gemini Pro 3.1 to help me get a better understanding of the libretro/MAME runloop and to suggest some possible locations where we could skip rendering, it was used a guideline only. All code was committed by me and all tests run myself, not using AI agents,

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.

1 participant