Commit Graph

91 Commits

Author SHA1 Message Date
bengris32
2064bd02d4 hidl: sensors: 2.1: Add additional pick-up sensor name
Change-Id: I1f6216cfca6a3bd1c223eb2ba26afa33082fe261
Co-authored-by: LinkBoi00 <linkdevel@protonmail.com>
Signed-off-by: bengris32 <bengris32@protonmail.ch>
2024-09-28 12:50:17 +01:00
Cosmin Tanislav
e743eba68a aidl: sensors: Standardize xiaomi pickup sensor
* use standard sensor type
* ignore non-wakeup sensor variant
* ignore events that do not properly match a pickup

Change-Id: Ibe2f9fee1551da613713d40c1b8d0a26d38a93ae
Signed-off-by: ralph950412 <ralph950412@gmail.com>
2024-09-28 11:10:33 +00:00
Cosmin Tanislav
da9e56f0ae aidl: sensors: Avoid target name conflicts
Change-Id: Ib6426caf68fe1a7a7f637bdc5c4f0036866f8b78
Signed-off-by: ralph950412 <ralph950412@gmail.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
2024-09-28 11:10:33 +00:00
Arian
67564b7de5 aidl: sensors: Change default applicable license to Android-Apache-2.0
hardware_interfaces_license is not available here.

Change-Id: I8c8d00cdeda2739c3e4419f979f1fbf0ef66fc0a
2024-09-28 11:10:33 +00:00
ralph950412
895ee9099e aidl: sensors: Import 2.X sensors hal proxy
* From android-14.0.0_r15

Change-Id: Id6f37920db2869574ca1b8e04c10e6ec3268ad4b
Signed-off-by: ralph950412 <ralph950412@gmail.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
2024-09-28 11:10:33 +00:00
ralph950412
b8298ba75f aidl: sensors: Import aidl sensors MultiHal
* From android-14.0.0_r15

Change-Id: Id7d8dfae1290bdba84d5a9f4c6583d54a2769ba8
Signed-off-by: ralph950412 <ralph950412@gmail.com>
2024-09-28 11:10:33 +00:00
Sebastiano Barezzi
424428e9b5 ir: Stop setting duty cycle
Change-Id: Ibafc8877123abf26d8007ffdb2a7b3c9cfead2c8
2024-08-31 12:12:17 +00:00
Sebastiano Barezzi
a271b57c99 Rewrite IR HAL in AIDL
Change-Id: Ie27056c065766ab802ee337ced921876726de5cb
2024-08-31 12:10:28 +00:00
LuK1337
de082b2b25
aidl: light: Add RGB sync support
Change-Id: I3b26dce753487c2e0a2f191a57ca7ceb4bd752e4
2024-06-22 19:37:03 +02:00
LuK1337
842e692081
aidl: light: Lower battery light priority
Prioritize notification and attention lights over battery.

Change-Id: I88fe39a90ea8fb12a48a1a2d2d36e5bf4dca5b94
2024-06-22 19:07:07 +02:00
danielml
435cd2659d aidl: light: Support the left LED
Used by pop-up camera devices like davinci.

Change-Id: Ie6b37987d9a93d905464ddae366ce976ae7aaf8d
Signed-off-by: danielml <daniel@danielml.dev>
2024-06-22 12:36:49 +02:00
LuK1337
f75adee245
aidl: light: Add support for button-backlight2 device
Needed on natrium.

Change-Id: I345ff6039702c26a5c580a73290c4d19c4ae272b
2024-06-22 12:26:24 +02:00
Bruno Martins
7329fd774f
aidl: light: Add support for timed mode
Co-authored-by: Sebastiano Barezzi <seba@sebaubuntu.dev>
Change-Id: I23623c7527cf98230f890935a4742f86adc3b3ea
2024-06-18 03:19:00 +02:00
Sebastiano Barezzi
ee864f39ea
aidl: light: Refactor
Change-Id: Ib4ae8e9821dd0fb36e922e2c5f993aa6c0e28be1
2024-06-18 02:32:19 +02:00
Bruno Martins
ab7514301c aidl: Remove useless makefile
Change-Id: Iddb49786d632f0622b51cd9062baef9b1297e538
2024-05-19 17:33:05 +01:00
Michael Bestas
44cf4e0f85 Move to common power-libperfmgr
Change-Id: Icaa3b265fbc0fb71ae57a5cbde1654f62d07aef8
2024-05-18 13:18:30 +01:00
Matt Buckley
4453055456 power: Remove wakeup behavior from PowerHintSession and PowerSessionManager
Currently, all sessions get boosted any time DISPLAY_UPDATE_IMMINENT is
sent from SurfaceFlinger which can lead to large, unnecessary boosts.
This patch aims to change that by removing the wakeup behavior, relying
instead on sessions to boost themselves with new load change hints.

 * Remove wakeup() from PowerHintSession
 * Remove wakeSessions from PowerSessionManager
 * Remove related timers and message handlers
 * Remove DISPLAY_UPDATE_IMMINENT behavior entirely

Test: manual
Bug: b/260136431
Change-Id: I4610edfefe8fcbef7d4cdbf5768830a9392a54f7
2024-03-21 13:05:52 +00:00
Matt Buckley
035ad6c78d power: Add better tracing for sendHint and refactor existing tracing
Reset traced hint value to -1 on reportActualWorkDuration or stale
timeout, and rewrite existing tracing for readability.

Bug: b/243973548
Test: manual
Change-Id: I135ec5f8971a9902d880e4089b0df746f5b917e2
2024-03-21 13:05:52 +00:00
Jimmy Shiu
f2c8c33939 ADPF: refine StaleTimeHandler
Bug: 256515601
Test: build
Change-Id: Ia7f80c838961b837733c457b189f16c6433cf3c3
2024-03-21 13:05:52 +00:00
Jimmy Shiu
773630adc8 ADPF: remove unused EarlyBoostHandler
Bug: 256515601
Test: build
Change-Id: I9b63c6ee3decaa4c70f38bcc66a0e9e1de464ad6
2024-03-21 13:05:52 +00:00
Jimmy Shiu
d2c0e46e16 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
2023-11-24 16:37:12 +00:00
Jimmy Shiu
cec3b97eda 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
2023-11-24 16:36:58 +00:00
Jimmy Shiu
e69da0c258 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
2023-11-24 16:31:32 +00:00
jimmyshiu
6ab718385b 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
2023-11-24 16:31:32 +00:00
Wei Wang
dada1040af 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
2023-11-24 16:31:32 +00:00
Sebastiano Barezzi
9cbf7b03e3
aidl: light: Implement attention light type
Change-Id: Ia7fff2a4374ad4d05718909000dc2fd99b9264f0
2023-11-13 15:36:27 +01:00
Luca Stefani
69f546cc9b
aidl: light: Make rgb a normal struct
No need to typedef in C++

Change-Id: I949c4319eb8f116d6cd2903a294757bacc7751a7
2023-11-13 01:39:53 +01:00
Sebastiano Barezzi
2154cee0ec
aidl: light: Reformat with clang-format
Change-Id: Iee8f2dc3777a95df827f33ad1f4e37f7d0f48eed
2023-11-13 01:39:53 +01:00
Luca Stefani
5981d19419
aidl: light: Construct HwLight in place
They aren't used outside the ctor, let's
inline their construction.

Change-Id: Ic4f2afb24caabc42a95f94c8c150fa028975c8a5
2023-11-13 01:39:53 +01:00
Sebastiano Barezzi
ad315044e4
aidl: light: Use const on getLights' foreach loop
Change-Id: I00570c7315ef31e20c8265650025b4969e2d98af
2023-11-13 01:39:53 +01:00
Sebastiano Barezzi
481f209d2a
aidl: light: Fix a bug where breath wouldn't be disabled when not needed
Change-Id: I65c84c845fe8fb514d6b8345013077e3d0946972
2023-11-13 01:39:53 +01:00
Sebastiano Barezzi
d71257fb4a
aidl: light: Uprev to V2
Change-Id: I69ce3c31c63ed5316fec295bc2d79e060f43093b
2023-11-13 01:39:53 +01:00
jimmyshiu
47d31efd43 power: 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
2022-11-01 11:01:16 +00:00
jimmyshiu
43c9b76b8a power: 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
2022-11-01 11:01:16 +00:00
Will McVicker
4ad8e47249 power: 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
2022-11-01 11:01:16 +00:00
jimmyshiu
4cace0eb8a power: 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
2022-11-01 11:01:16 +00:00
jimmyshiu
cf51b4aa5f power: 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
2022-11-01 11:01:16 +00:00
Wei Wang
5b35105303 power: 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
2022-11-01 11:01:16 +00:00
Matt Buckley
895962ed16 power: 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
2022-11-01 11:01:16 +00:00
jimmyshiu
295d5f53ed power: ADPF: log clean up
Remove ALOGD logs.

Bug: 230205812
Test: adb shell logcat -b all | grep libperf
Change-Id: I4125afec526b76e3905e75c22fc2bfb555810fa8
2022-11-01 11:01:16 +00:00
Wei Wang
b4fb26bc8a power: 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>
2022-11-01 11:01:16 +00:00
Jimmy Shiu
3a178070ce power: ADPF: add Early Hint feature
Add Early Hint feature and integrate with Stale Timer

Bug: 198379880
Test: build and manual test

Change-Id: I17009ee5b9ff922a79ccf5cb68be5b959038267d
2022-11-01 11:01:16 +00:00
Jimmy Shiu
52e5ce99b3 power: 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
2022-11-01 11:01:16 +00:00
Jimmy Shiu
5936e4a52e power: 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
2022-11-01 11:01:16 +00:00
Jimmy Shiu
c998138db6 power: 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
2022-11-01 11:01:16 +00:00
Wei Wang
34cf7df6f0 power: 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
2022-11-01 11:01:16 +00:00
Jimmy Shiu
ff3b168ea1 power: Fix race condition between Looper and destructor
1. Clean all messages before add new.
2. Insteading of using `this`, use the unique mStaleHandler sp so Looper
   can hold the sp to keep the instance alive until the last message
   done.

Test: Manual Test
Bug: 219965773
Change-Id: Ic039146f0b966c1f27d86b121d4b72b75ff360e5
2022-11-01 11:01:16 +00:00
Wei Wang
1fbcb7d62e power: Add global debug property for override config path properly
An init trigger would restart powerhal as early as the property was
loaded and it is hopefully early than any clients would try to connect.

Also remove the obsolete restart hook with audio.

Bug: 218872105
Test: boot
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: Ib55897f65709a963016b729f213718aae5af8e8c
2022-11-01 11:01:16 +00:00
Jimmy Shiu
3978399d16 power: Add a debug property for switching powerhint.json path
Add a bool property `vendor.powerhal.config.debug`.
Power HAL would use `/data/vendor/etc/powerhint.json` when vendor.powerhal.config.debug = true.

Bug: 218872105
Bug: 206061061
Test: adb wait-for-device root; adb shell mkdir -p /data/vendor/etc/;
      adb push powerhint_mod.json /data/vendor/etc/powerhint.json
Test: adb shell setprop vendor.powerhal.config.debug true && \
      adb shell getprop vendor.powerhal.config.debug && \
      adb shell stop vendor.power-hal-aidl && \
      adb shell start vendor.power-hal-aidl && adb shell stop && adb shell start
Test: adb pull /data/local.prop ; vim local.prop
      + vendor.powerhal.config.debug=true
Test: adb wait-for-device root && adb shell perfetto -o \
      /data/misc/perfetto-traces/trace_file.perfetto-trace -t 20s sched freq \
      idle am wm gfx view power hal && \
      adb pull /data/misc/perfetto-traces/trace_file.perfetto-trace trace_profile_debug.pftrace
Change-Id: Ibaf5df280b989a8268efce1e3ab9a3f1e5510800
2022-11-01 11:01:16 +00:00
Jimmy Shiu
445137072b power: ADPF: fix stale trace status
Bug: 196192645
Test: Manual
Change-Id: Ibdbb8f47a16032ce3249aa667fa0c11e7869748f
2022-11-01 11:01:16 +00:00