Commit graph

685 commits

Author SHA1 Message Date
Vivekachooz
4b69a52f2c
sm6375-common: powerhint: Tune powerhint
Change-Id: I8fe54e156b15b6d3a58d7f83cf33d1cf83ce2418
2024-07-18 20:16:00 +05:30
Jimmy Shiu
5e76a2a191
sm6375-common: power-libperfmgr: ADPF: send ADPF_FIRST_FRAME hint
To send ADPF_FIRST_FRAME hint when reportWorkDurations was called first
time after stale state.

Bug: 243025173
Test: PtsUiBench & CUJ
Change-Id: I4377b1f549646bcf44bdf26b2657b7bc0646f9a4
Merged-In: I4377b1f549646bcf44bdf26b2657b7bc0646f9a4
2024-07-18 20:16:00 +05:30
Jimmy Shiu
f4fd4bcd5c
sm6375-common: power-libperfmgr: ADPF: support sending power hint
Send a hint only when the system can support the hint.

Bug: 243025173
Test: PtsUiBench & CUJ
Change-Id: If56d0c22f8dd61f5fe27ba79f08f2963269abe41
Merged-In: If56d0c22f8dd61f5fe27ba79f08f2963269abe41
2024-07-18 20:16:00 +05:30
Sugakesshaa
c4d4353fdd
sm6375-common: powerhint: Tune scheduler parameters
- kanged from powerhal boosting on CLO

Change-Id: Ic8b5a9d2b6b2a0b7a92c85445e30cd45936b60d2
2024-07-18 20:16:00 +05:30
Adithya R
cc6d0d7bca
sm6375-common: power-libperfmgr: Allow certain hints to be processed always
These don't affect performance, so we don't need to disable them
for battery saver or sustained performance mode.

Change-Id: I483d7fa6d0067f21d46b6811ba324793415218c7
2024-07-18 20:16:00 +05:30
Adithya R
431daebc40
sm6375-common: power-libperfmgr: Properly handle sustained performance mode
* when tested with [1], even after exiting the app, spm was
   still active in powerhal thereby keeping max freqs limited
   and blocking boosts

 * enable/disable it properly and end all other hints before
   enabling, to fix this issue

 * while we're at it, don't handle max freq for anything other
   than spm in powerhint

[1] https://android.googlesource.com/platform/cts/+/refs/heads/master/hostsidetests/sustainedperf

Change-Id: I6e37dfa7ffab0137d70cb5ba5d1b156133416062
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2024-07-18 20:16:00 +05:30
Adithya R
52a7d65121
sm6375-common: power-libperfmgr: Disable boosting when battery saver is on
* end all running boosts when battery saver is turned on,
   and block all boosts until its turned off

Change-Id: I6793d694747c27591e69594d9d46da3490673d63
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2024-07-18 20:16:00 +05:30
Chiawei Wang
ce80b10348
sm6375-common: configs: use min_pwrlevel to configure GPU freq
Bug: 146334579
Bug: 146336388
Test: run pts -m PtsPerformanceTestCases -t com.google.android.perf.pts.PowerHALAPITest
Test: run pts -m PtsPerformanceTestCases -t com.google.android.perf.pts.PowerHintJsonVerifyTest
Change-Id: I18c0210463f29831cc94c629a98718406ebdf21b
2024-07-18 20:16:00 +05:30
Wilson Chan
98d5b5b8d0
sm6375-common: configs: Add Flipendo powerhint
Bug: 153940282
Test: Manually check powerhint succeeds and check perf
Change-Id: Ia3482d3e3b69562aa7c0e5dd326037d1b3806930
2024-07-18 20:16:00 +05:30
Vivekachooz
1f4bd589cc
sm6375-common: configs: Enable FIXED_PERFORMANCE in powerhint
Change-Id: I30d519369162d577e419b1c0982a4ac1783fb3b7
2024-07-18 20:16:00 +05:30
Vivekachooz
4b9e90d4fb
sm6375-common: configs: Tune CPUBWMinFreq to a higher frequency
Change-Id: Iceb807b2175141576381fa9dd9a96c8845db3d3b
2024-07-18 20:16:00 +05:30
Vivekachooz
c89c6beec2
sm6375-common: rootdir: Cleanup power init script
* Let powerhint handle this

Change-Id: If98c748567995b2bbb33bf0d9c1e2192b0c43b7c
2024-07-18 20:16:00 +05:30
Vivekachooz
5ac3c047b3
sm6375-common: configs: Rearrange powerhint
Change-Id: I77e792f4d453ce6c0b929cad7236be38e6ba475e
2024-07-18 20:16:00 +05:30
Subhajeet Muhuri
4562fbcd20
sm6375-common: powerhint: Remove audio hints
Signed-off-by: Subhajeet Muhuri <subhajeet.muhuri@aosip.dev>
Change-Id: Ife1cb1e356e62283f3c4d353931458adaf84e975
2024-07-18 20:16:00 +05:30
Vivekachooz
d2cffdfdb0
sm6375-common: rootdir: Tune background cgroup uclamp values
* Values taken from gs201

Change-Id: Ice4cb9b6ee4845e5a965ead26f2775a1522b065c
2024-07-18 20:16:00 +05:30
Jake Weinstein
0c0f036d7a
sm6375-common: Use foreground cpuset/uclamp for gralloc
Makes sure rendering has enough capacity.

Change-Id: I7ad051248353485a8090bec578b2c4325ea06024
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2024-07-18 20:16:00 +05:30
Jake Weinstein
9be114c30d
sm6375-common: Use foreground uclamp for hwcomposer
Matches SF, makes sure rendering always
has enough capacity.

Also switches to task_profiles.

Change-Id: I2a2de504be7d3f4f66f31445f44fbbf9376bd927
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2024-07-18 20:16:00 +05:30
Vishalcj17
75531a87f2
sm6375-common: Switch hwcomposer to foreground CPU set
* Greatly affects the performance/latency of the display
   considering you have foreground set to 0-6 cores on <SM7350
   whilst being power efficient.

 * This shows an improvement on HWUI graph and even jankbench.

Change-Id: I6438375d844e1b1f38872fb53bdfadfb644fc722
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2024-07-18 20:16:00 +05:30
Suren Baghdasaryan
b721be0fd8
sm6375-common: Replace direct pid writes with setting task profiles for audio interfaces
For easy transition from SchedTune to UtilClamp, direct access to these
cgroups should be abstracted by using task profiles. Replace writepid
commands with new task_profiles command.

Bug: 155419956
Test: change .rc file and confirm task profile is applied
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ide373c283359cf4b73af4cb0813d8c0306942595
2024-07-18 20:16:00 +05:30
Sugakesshaa
1c76650adc
sm6375-common: powerhint: Setup uclamp boosting
- Make use of uclamp boost for top-app and foreground
  hints based on newer pixels

Co-authored-by: Vivekachooz <vivekachooz@gmail.com>
Change-Id: I70c4262230841b3c7bf84b4165916a22312f829f
2024-07-18 20:16:00 +05:30
Subhajeet Muhuri
220856c963
sm6375-common: powerhint: Drop PM QoS boosting
Change-Id: Idcedcc3f4ff1998b6fb59437a2517ee9e0bc75bb
Signed-off-by: Subhajeet Muhuri <subhajeet.muhuri@aosip.dev>
2024-07-18 20:16:00 +05:30
Subhajeet Muhuri
dc8d9f8a10
sm6375-common: Set top-app schedtune.boost to 1
Fix for:
W libperfmgr: Failed to write to node: /dev/stune/top-app/schedtune.boost with value: 10, fd: -1

Change-Id: I1e394919b75e192def99c444993546634c951781
2024-07-18 20:16:00 +05:30
Vivekachooz
df75d5ee49
sm6375-common: Import and adapt powerhint from redfin
* From redfin-user-13-TQ3A.230901.001-10750268-release-keys

Change-Id: I923c1adf70d035c9def0032ccf29530ce92ebe66
2024-07-18 20:16:00 +05:30
Vivekachooz
b96db6ee48
sm6375-common: Update permissions for powerhal
Change-Id: Id43043a24dd19eab0234def5121e811d18174096
2024-07-18 20:16:00 +05:30
Bruno Martins
276a5c6fcd
sm6375-common: Create power init script
* Gather all performance related items in one place
   and drop all deprecated services.

Change-Id: I4dbdc164c60136b0957a8c1ff67feafbaf471747
2024-07-18 20:16:00 +05:30
Sebastiano Barezzi
5606a905c5
sm6375-common: libqti-perfd-client: Move to C
* Why bothering with C++ mangling when we can just build it as a standard C library?

Change-Id: I45ea977edf7ea7fab6fece76f3049654a8d24c5d
2024-07-18 20:16:00 +05:30
Chenyang Zhong
6b6029c515
sm6375-common: libqti-perfd-client: return a dummy value
Return a positive integer for perf lock acquire and release so
that Goodix/FPC fingerprint sensor blobs will not complain.

Goodix:
E [goodixHAL][gf_hal_milan_f_series]: goodix_perf_lock_acquire: Failed to acquire perf lock, err: 0
E [goodixHAL][gf_hal_milan_f_series]: goodix_perf_lock_release: Perf lock release error 0

FPC:
E fpc_tac : fpc_perf_lock_acquire: Incorrect params, Failed to acquire perf lock, err
E fpc_tac : fpc_perf_lock_release: Perf lock release error 0

Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com>
Change-Id: I861672e9a738c2204755d802670f4b28b662f286
2024-07-18 20:16:00 +05:30
Bruno Martins
ddaba172c6
sm6375-common: libqti-perfd-client: Remove namespace declaration
It's pointless when using extern "C".

Change-Id: Ibdf9f06a70aa3a75687b33781c78cf2172bb334d
2024-07-18 20:16:00 +05:30
Lucchetto
1e25d6fd85
sm6375-common: Create dummy libqti-perfd-client
* proprietary perfd blobs can finally be nuked without breaking goodix
* we could even map the functions to use libperfmgr powerhints in the future

Change-Id: I124652f3041761966a3e3bd97c757fecc39cc5fb
2024-07-18 20:16:00 +05:30
Sugakesshaa
ca771e2087
sm6375-common: sepolicy: Allow libperfmgr to write to proc_sched nodes
Change-Id: Ic8d9f03befb2ea5722d340d9f2b797b1cf8f0f50
2024-07-18 20:16:00 +05:30
Arian
4bbb9ac9bc
sm6375-common: sepolicy: Address pixel power HAL denials
Change-Id: I7327bd54c0d12fde03472695a5598d2a3d22f716
2024-07-18 20:16:00 +05:30
Subhajeet Muhuri
642f408f24
sm6375-common: Include hardware/google/interfaces and hardware/google/pixel
* Required by power-libperfmgr

Change-Id: I4053938614be26c7066ea83d97955739f39b4144
2024-07-18 20:16:00 +05:30
Bruno Martins
e3669945b5
sm6375-common: power-libperfmgr: enable powerhint parsing after boot completion
Change-Id: Ie065f234bfd949264b962bae80e400a446f65b80
2024-07-18 20:16:00 +05:30
Jimmy Shiu
3478253879
sm6375-common: power-libperfmgr: ADPF: fix use-after-free crash
The main problem is the timer thread could be woken after the session
was destroyed. We did have a closed flag which was set in destructor and the flag would be checked before handleMessage accessing the session
instance. To fix the problem, the operations of flag checking and session instance accessing should be guarded by the lock.

Bug: 236674672
Test: manual test
Change-Id: I49a18efbc135b1bc070b101038a8a0bcc6e19fec
(cherry picked from commit 5c75978f530b27bd976d8695ed79acd336c24776)
Merged-In: I49a18efbc135b1bc070b101038a8a0bcc6e19fec
2024-07-18 20:16:00 +05:30
jimmyshiu
523949c628
sm6375-common: power-libperfmgr: ADPF: optimize the wakeup performance and fix unstable boost.
Optimize boost:
A more efficient way is to trigger the wakeup boost through mTidSessionListMap, so the time
   complexity reduce from O(n^3) to O(n^2).

The original code path:
  PSM:wakeSessions() contains a loop that is O(n),
  inside the loop, it calls to PHS::wakeup() which call to
  PSM::setUclampMinLocked(), and
  PSM::setUclampMinLocked() contains two loops O(n^2)

The new code path:
  PSM::wakeSessions() directly checks all the ADPF tasks O(n) and
  get the wakeup boost value O(n), then directly set the uclamp.min
  The time complexity lower to O(n^2).

Fix unstable boost:
The original flow is to find max boost and wake it up from stale state
one by one. But the previous woken ones would not be counted when the later ones finding their max boost value.
The new flow boost all the tasks first, then wake up all those sessions.

Bug: 235510337
Test: Manually playing UIBench -> Transitions -> ActivityTransition
Change-Id: I995673b74401e198eb72188134ba1ebc134f971c
2024-07-18 20:16:00 +05:30
Wei Wang
de130faac2
sm6375-common: power-libperfmgr: ADPF: extend non-stale session timer in wakeup
For DISPLAY_UPDATE_IMMINENT wakeup signal, non-stale
session's timer should be also extended. This resolves
the performance issue caused those sessions to go stale    
prematurely.

Bug: 241621485
Test: Build
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I06330e064060248bb556ae35e0cb8fd302cef231
2024-07-18 20:16:00 +05:30
jimmyshiu
fbcc05b19b
sm6375-common: power-libperfmgr: ADPF: Fix updateHintBoost blocks the binder thread
post the task into a looper thread.

Bug: 232992641
Test: Manually playing UIBench -> Transitions -> ActivityTransition
Change-Id: Ibd241834f904b4c87a51363e766e110d2818d496
2024-07-18 20:16:00 +05:30
jimmyshiu
620a6da869
sm6375-common: power-libperfmgr: Fix uclamp_min stuck at high freq
Separate Stale and EarlyBoost handlers and refine the code.

Test: adb shell dumpsys android.hardware.power.IPower/default
Test: Manual
Bug: 232992641

Change-Id: I81a4fd96fb7311ae5bbb7cbabe72378c9cad4aa3
2024-07-18 20:16:00 +05:30
Will McVicker
00036d86cc
sm6375-common: power-libperfmgr: Fix race between closing a session and receiving a boost
We need to be holding the session lock when we dereference mDescriptor
since mDescriptor is destroyed when the session is closed. This patch
takes the session lock and verifies if it's still open during wakeup.

Test: vts run -m VtsHalGraphicsComposerV2_4TargetTest
Bug: 232992641
Change-Id: I4000a85bf2932cfdcddd3006d671a3c91ed32c48
2024-07-18 20:16:00 +05:30
jimmyshiu
0118a38571
sm6375-common: power-libperfmgr: ADPF: dump ADPF session info
Dump current ADPF profile and ADPF session list into bugreport.

Bug: 204444691
Test: adb root && adb shell dumpsys android.hardware.power.IPower/default
Test: gpaste/6469309887938560
Change-Id: I17c0d615051f5e51c2e1fe99d17c402f9a65679a
2024-07-18 20:16:00 +05:30
jimmyshiu
f032fe2747
sm6375-common: power-libperfmgr: ADPF: uclamp.min integration
Integrate the uclamp.min across sessions.
Add UClampMininit as the display update boost

Bug: 232313238
Test: Manual test
Change-Id: I601f407b0b5383a1e39eac448d45cbaaeb7788fb
2024-07-18 20:16:00 +05:30
Wei Wang
7fc85e9871
sm6375-common: power-libperfmgr: PowerHAL: remove UclampMinGranularity
This is causing session update skipped and stuck.

Bug: 232336917
Test: /data/nativetest64/libperfmgr_test/libperfmgr_test
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I8928b6f6a60dcf8d21e60228a74d3aa0ab792eff
2024-07-18 20:16:00 +05:30
Matt Buckley
be068a8061
sm6375-common: power-libperfmgr: Ignore system hint sessions for universal boost
Currently PowerHAL does not distinguish between system processes and
apps when deciding whether to apply universal boost. This patch
distinguishes system sessions and app sessions and ignores system ones,
making the disabling of universal boost dependent on the presence of app
hint sessions.

Bug: b/230511824
Test: manual
Change-Id: I08dea29b3a45f2ba69ed99a9f188fa83ba143423
2024-07-18 20:16:00 +05:30
jimmyshiu
c3f82f2ecd
sm6375-common: power-libperfmgr: ADPF: log clean up
Remove ALOGD logs.

Bug: 230205812
Test: adb shell logcat -b all | grep libperf
Change-Id: I4125afec526b76e3905e75c22fc2bfb555810fa8
2024-07-18 20:16:00 +05:30
Wei Wang
454a949b18
sm6375-common: power-libperfmgr: Add minimal binder thread prio as -20 to match process prio
Bug: 227811781
Test: Build
Change-Id: I94670429ede032703661ee8eb8b1ea6456f5cbd5
Signed-off-by: Wei Wang <wvw@google.com>
2024-07-18 20:16:00 +05:30
Jimmy Shiu
938e2b96f7
sm6375-common: power-libperfmgr: ADPF: add Early Hint feature
Add Early Hint feature and integrate with Stale Timer

Bug: 198379880
Test: build and manual test

Change-Id: I17009ee5b9ff922a79ccf5cb68be5b959038267d
2024-07-18 20:16:00 +05:30
Jimmy Shiu
362ddc9bd3
sm6375-common: power-libperfmgr: ADPF: Use Adpf Profile for PID tunnables
1. Use Adpf Profile to replace system-property-based PID tunnables.
2. Add a tunable for switch PID on/off
3. Switch Adpf Profile by hint name (ex: REFRESH_120FPS)

Bug: 202158746
Bug: 204444691
Bug: 206061061
Test: Build
Change-Id: Ia673a6bf64d40128ca1797d1e26fe564b3b35ff1
2024-07-18 20:16:00 +05:30
Jimmy Shiu
e395871686
sm6375-common: power-libperfmgr: ADPF: make uclamp.min stable
Considering the previous uclamp.min value is the base of PID output.
Instead of:
  `next_min = std::min(sUclampMinHighLimit, output);`
We should use:
  `next_min = std::min(sUclampMinHighLimit, current_min + output);`

When session status entered stale state, set the uclamp to 0, but keep
the current_min. That would be helpful for boosting the heavy workload
of the first few frames.

Bug: 204444691
Test: build && manual test

Change-Id: Idb19e2bfd8e9522fae5fd452b1fcc58786e96e65
2024-07-18 20:16:00 +05:30
Jimmy Shiu
53f1fc4eee
sm6375-common: power-libperfmgr: Make HintManager a singleton class
HintManager is unique and widely used in many different components.
This is for making it easiler to be reloaded for debugging.

Bug: 172285365
Test: adb push \
      out/target/product/raven/data/nativetest64/libperfmgr_test/libperfmgr_test \
      /data/nativetest64/libperfmgr_test/libperfmgr_test && \
      adb shell /data/nativetest64/libperfmgr_test/libperfmgr_test
Change-Id: I3affdfe780073ebbc50fac7bfbdd1530ee9dc8c2
2024-07-18 20:16:00 +05:30
Wei Wang
40a340e68d
sm6375-common: power-libperfmgr: PowerHintSession: do not update PID controller when target changes
There is no history kept in powerhint session, so let us just keep what
we have in the PID controller and let new samples settle.

Bug: 227003278
Test: Build
Change-Id: Ia8b9a0be288389ec36ac35c668aca013d470c257
2024-07-18 20:16:00 +05:30