feat(display): black frame insertion on 100 Hz and faster screens (#2653)

* feat(display): black frame insertion on 100 Hz and faster screens

* feat(display): black frame insertion lives in Screen effects

* test(compositor): cover black frame insertion in the render-on-commit harness

* fix(display): keep HDR and pacing intact around black frame insertion

* fix(display): gate black frame insertion on the panel's refresh, not the tick rate

BFI checked the 100 Hz minimum against g_refresh_ns, an average of the time
between handled vsync ticks. BFI presents on every tick, so under load the
ticks run late, the average fell to 95-100 Hz on a 120 Hz panel, and BFI
switched off and on again many times a second (3793 times in one session on
a Retroid Pocket Duo). That showed as uneven flicker.

Use the display mode's refresh (g_output_refresh_mhz) instead, which only
changes when the mode does.

* fix(display): offer black frame insertion for the bottom screen and while it is on

* fix(display): capture a picture, not a black refresh, while black frame insertion strobes

* fix(display): hold black frame insertion off until the last capture ends

* fix(display): keep the game composed while a capture holds black frame insertion

* test(display): a picture hold presents only pictures while black frame insertion runs
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-16 07:33:39 -05:00
1 parent f65e7a3d43
commit 758e7983fa
46 files changed
+343 -29

No files matched your search

@@ -11,6 +11,7 @@ import android.view.Display
object PerfMode {
private const val TAG = "PerfMode"
const val BFI_MIN_REFRESH_HZ = 100f
fun apply(a: Activity, fpsLimit: Int = 0, refreshLimit: Int = 0): String {
val parts = ArrayList<String>(2)
@@ -85,6 +85,12 @@ object SessionPrefs {
prefs(context).edit().putBoolean("launcherFullscreen", on).apply()
}
fun blackFrameInsertion(context: Context): Boolean = prefs(context).getBoolean("blackFrameInsertion", false)
fun setBlackFrameInsertion(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("blackFrameInsertion", on).apply()
}
fun animationsEnabled(context: Context): Boolean = prefs(context).getBoolean("animations", true)
fun setAnimationsEnabled(context: Context, on: Boolean) {
@@ -24,7 +24,7 @@ object SettingsReset {
"directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus",
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "nativeUserland", "cursorComposite",
"guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "enhancedDiagnosticsNext", "storageDiagnostics", "buildWatermark",
"upscaler", "upscaleSharpness", "screenEffects", "textureAnisotropy", "textureLodBias",
"upscaler", "upscaleSharpness", "screenEffects", "blackFrameInsertion", "textureAnisotropy", "textureLodBias",
"steamDownloadsInBackground", "steam_offline", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds", "skipBootMovie",
"bootMovieApplyNext", "bootMovieSteamSeen", "bootMovieShuffle",
"questDefaultsV1", "telemetryAuto", "telemetryOff", "statsStrip", "statsHud", "bottomHud", "bottomStripMetrics", "bottomStripTabs", "statsDash", "statsSpeedUnit",