From 9ad453ffae7e03b1b3711d9a41ff6c5f8b3d6bc9 Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Wed, 13 Nov 2024 00:55:32 +0000 Subject: [PATCH] Set input thread priority to RT - try 4 This reverts commit 52da71d47b8af5d3796cb0b4bb626de66a0a8435. Reason for revert: camera was using its own stale copy of libprocessgroup, and now has revved up its version that includes the new parsing code. So this time the json file update should work OK. Original description: To improve input latency, set the critical input threads to RT priority. This will use RT priority on AOSP devices by default. OEMs can still choose to customize what "input policy" means for their device, which may not necessarily mean RT. For example, on device with multiple small / big cores, input task affinity could be changed to prioritize big cores + higher CPU frequency / voltage, but still keep the standard / default input thread priority. Note: there is an open issue where the thread priority is not remaining constant. See b/378761104. Bug: 330719044 Bug: 378761104 Flag: com.android.input.flags.enable_input_policy_profile Test: took perfetto trace and checked the priority on InputDispatcher and InputReader threads. Change-Id: I449be0eeeac989222f5deefa62615478bd65b968 --- libprocessgroup/profiles/task_profiles.json | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libprocessgroup/profiles/task_profiles.json b/libprocessgroup/profiles/task_profiles.json index feda3b49c..28902efe8 100644 --- a/libprocessgroup/profiles/task_profiles.json +++ b/libprocessgroup/profiles/task_profiles.json @@ -202,6 +202,19 @@ } ] }, + { + "Name": "RealTimeInputScheduling", + "Actions": [ + { + "Name": "SetSchedulerPolicy", + "Params": + { + "Policy": "SCHED_FIFO", + "Priority": "2" + } + } + ] + }, { "Name": "CameraServicePerformance", "Actions": [ @@ -704,7 +717,7 @@ }, { "Name": "InputPolicy", - "Profiles": [ "MaxPerformance", "ProcessCapacityMax", "TimerSlackNormal" ] + "Profiles": [ "RealTimeInputScheduling", "MaxPerformance", "ProcessCapacityMax", "TimerSlackNormal" ] } ] }