Skip to content

Commit e650ba3

Browse files
perf: Window.setPreferMinimalPostProcessing(true) for lower display latency
Agent-Logs-Url: https://github.com/winnerspiros/osu/sessions/2523e170-1d43-41d8-af53-47db9142dcaa Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
1 parent 9294538 commit e650ba3

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

osu.Android/OsuGameActivity.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,23 @@ protected override void OnCreate(Bundle? savedInstanceState)
446446
if (Window.Attributes != null)
447447
Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
448448

449+
// Request the display compositor skip post-processing on our window.
450+
// setPreferMinimalPostProcessing(true) tells SurfaceFlinger to bypass
451+
// color-calibration lookup tables and gamma correction, saving ~0.5–1ms
452+
// of latency on OLED/AMOLED panels. The tradeoff is that the rendered
453+
// output bypasses the device's factory color profile — acceptable for a
454+
// rhythm game where photon-to-registered-touch timing accuracy matters
455+
// more than display color fidelity. Available since API 28 (Android 9);
456+
// our minSdkVersion=33 guarantees the call always reaches the API.
457+
try
458+
{
459+
Window.SetPreferMinimalPostProcessing(true);
460+
}
461+
catch (Exception e)
462+
{
463+
Logger.Log($"[osu!] Failed to set minimal post-processing: {e.Message}", LoggingTarget.Performance);
464+
}
465+
449466
// Request unbuffered touch dispatch early for minimum input latency.
450467
try
451468
{

0 commit comments

Comments
 (0)