Remove headroom selection type and move interval to support info
Bug: 346604998
Flag: EXEMPT hal
Test: atest VtsHalPowerTargetTest
Change-Id: I8ee116b8e297349241917deb102a1a8cca3bfebe
diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/CpuHeadroomParams.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/CpuHeadroomParams.aidl
index de92105..a38156a 100644
--- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/CpuHeadroomParams.aidl
+++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/CpuHeadroomParams.aidl
@@ -36,14 +36,9 @@
parcelable CpuHeadroomParams {
android.hardware.power.CpuHeadroomParams.CalculationType calculationType = android.hardware.power.CpuHeadroomParams.CalculationType.MIN;
int calculationWindowMillis = 1000;
- android.hardware.power.CpuHeadroomParams.SelectionType selectionType = android.hardware.power.CpuHeadroomParams.SelectionType.ALL;
int[] tids;
enum CalculationType {
MIN,
AVERAGE,
}
- enum SelectionType {
- ALL,
- PER_CORE,
- }
}
diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/CpuHeadroomResult.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/CpuHeadroomResult.aidl
index 9303906..21b1e69 100644
--- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/CpuHeadroomResult.aidl
+++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/CpuHeadroomResult.aidl
@@ -35,5 +35,4 @@
@JavaDerive(equals=true, toString=true) @VintfStability
union CpuHeadroomResult {
float globalHeadroom;
- float[] perCoreHeadroom;
}
diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPower.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPower.aidl
index 9d20ca1..080c0bd 100644
--- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPower.aidl
+++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPower.aidl
@@ -46,8 +46,6 @@
android.hardware.power.SupportInfo getSupportInfo();
android.hardware.power.CpuHeadroomResult getCpuHeadroom(in android.hardware.power.CpuHeadroomParams params);
android.hardware.power.GpuHeadroomResult getGpuHeadroom(in android.hardware.power.GpuHeadroomParams params);
- long getCpuHeadroomMinIntervalMillis();
- long getGpuHeadroomMinIntervalMillis();
oneway void sendCompositionData(in android.hardware.power.CompositionData[] data);
oneway void sendCompositionUpdate(in android.hardware.power.CompositionUpdate update);
}
diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SupportInfo.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SupportInfo.aidl
index 9609169..c90125c 100644
--- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SupportInfo.aidl
+++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SupportInfo.aidl
@@ -41,6 +41,7 @@
long sessionModes;
long sessionTags;
android.hardware.power.SupportInfo.CompositionDataSupportInfo compositionData;
+ android.hardware.power.SupportInfo.HeadroomSupportInfo headroom;
@VintfStability
parcelable CompositionDataSupportInfo {
boolean isSupported;
@@ -48,4 +49,11 @@
int maxBatchSize;
boolean alwaysBatch;
}
+ @VintfStability
+ parcelable HeadroomSupportInfo {
+ boolean isCpuSupported;
+ boolean isGpuSupported;
+ int cpuMinIntervalMillis;
+ int gpuMinIntervalMillis;
+ }
}
diff --git a/power/aidl/android/hardware/power/CpuHeadroomParams.aidl b/power/aidl/android/hardware/power/CpuHeadroomParams.aidl
index 64c7b44..fab8f43 100644
--- a/power/aidl/android/hardware/power/CpuHeadroomParams.aidl
+++ b/power/aidl/android/hardware/power/CpuHeadroomParams.aidl
@@ -42,21 +42,6 @@
int calculationWindowMillis = 1000;
/**
- * Defines how to select the CPU.
- */
- enum SelectionType {
- // Default to return a single value for all cores.
- ALL,
- // Returns per-core headroom in a list.
- PER_CORE,
- }
-
- /**
- * The CPU selection type.
- */
- SelectionType selectionType = SelectionType.ALL;
-
- /**
* The thread TIDs to track.
*
* If tids are not-empty, return the headrooms only for cores that are available
diff --git a/power/aidl/android/hardware/power/CpuHeadroomResult.aidl b/power/aidl/android/hardware/power/CpuHeadroomResult.aidl
index 316d5f6..e7ed8b6 100644
--- a/power/aidl/android/hardware/power/CpuHeadroomResult.aidl
+++ b/power/aidl/android/hardware/power/CpuHeadroomResult.aidl
@@ -29,8 +29,4 @@
* If ALL selection type is requested.
*/
float globalHeadroom;
- /**
- * If PER_CORE selection type is requested.
- */
- float[] perCoreHeadroom;
}
diff --git a/power/aidl/android/hardware/power/IPower.aidl b/power/aidl/android/hardware/power/IPower.aidl
index 41a9379..ce61af4 100644
--- a/power/aidl/android/hardware/power/IPower.aidl
+++ b/power/aidl/android/hardware/power/IPower.aidl
@@ -181,26 +181,6 @@
GpuHeadroomResult getGpuHeadroom(in GpuHeadroomParams params);
/**
- * Minimum polling interval for calling getCpuHeadroom in milliseconds.
- *
- * The getCpuHeadroom API may return cached result if called more frequent
- * than the interval.
- *
- * @throws EX_UNSUPPORTED_OPERATION if the API is unsupported.
- */
- long getCpuHeadroomMinIntervalMillis();
-
- /**
- * Minimum polling interval for calling getGpuHeadroom in milliseconds.
- *
- * The getGpuHeadroom API may return cached result if called more frequent
- * than the interval.
- *
- * @throws EX_UNSUPPORTED_OPERATION if the API is unsupported.
- */
- long getGpuHeadroomMinIntervalMillis();
-
- /**
* Sent to PowerHAL when there are surface-attached sessions being composed,
* providing FPS and frame timing data that can be used to supplement
* and validate timing sent via reportActual. This call can be batched,
diff --git a/power/aidl/android/hardware/power/SupportInfo.aidl b/power/aidl/android/hardware/power/SupportInfo.aidl
index 4178b3a..55287cb 100644
--- a/power/aidl/android/hardware/power/SupportInfo.aidl
+++ b/power/aidl/android/hardware/power/SupportInfo.aidl
@@ -77,6 +77,11 @@
*/
CompositionDataSupportInfo compositionData;
+ /**
+ * Parcel detailing support info for headroom information.
+ */
+ HeadroomSupportInfo headroom;
+
@VintfStability
parcelable CompositionDataSupportInfo {
/**
@@ -106,4 +111,33 @@
*/
boolean alwaysBatch;
}
+
+ @VintfStability
+ parcelable HeadroomSupportInfo {
+ /**
+ * Whether the CPU headroom feature is supported.
+ */
+ boolean isCpuSupported;
+
+ /**
+ * Whether the GPU headroom feature is supported.
+ */
+ boolean isGpuSupported;
+
+ /**
+ * Minimum polling interval for calling getCpuHeadroom in milliseconds
+ *
+ * The getCpuHeadroom API may return cached result if called more frequent
+ * than the interval.
+ */
+ int cpuMinIntervalMillis;
+
+ /**
+ * Minimum polling interval for calling getGpuHeadroom in milliseconds.
+ *
+ * The getGpuHeadroom API may return cached result if called more frequent
+ * than the interval.
+ */
+ int gpuMinIntervalMillis;
+ }
}
diff --git a/power/aidl/default/Power.cpp b/power/aidl/default/Power.cpp
index 8490b62..0a9c90f 100644
--- a/power/aidl/default/Power.cpp
+++ b/power/aidl/default/Power.cpp
@@ -71,33 +71,12 @@
return ScopedAStatus::ok();
}
-ndk::ScopedAStatus Power::getCpuHeadroom(const CpuHeadroomParams& params,
- CpuHeadroomResult* _aidl_return) {
- if (params.selectionType == CpuHeadroomParams::SelectionType::ALL) {
- _aidl_return->set<CpuHeadroomResult::globalHeadroom>(100.0f);
- return ndk::ScopedAStatus::ok();
- } else if (params.selectionType == CpuHeadroomParams::SelectionType::PER_CORE) {
- std::vector<float> headroom = {50.0f, 100.0f};
- _aidl_return->set<CpuHeadroomResult::perCoreHeadroom>(headroom);
- return ndk::ScopedAStatus::ok();
- }
+ndk::ScopedAStatus Power::getCpuHeadroom(const CpuHeadroomParams&, CpuHeadroomResult*) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
-ndk::ScopedAStatus Power::getGpuHeadroom(const GpuHeadroomParams& _,
- GpuHeadroomResult* _aidl_return) {
- _aidl_return->set<GpuHeadroomResult::globalHeadroom>(100.0f);
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus Power::getCpuHeadroomMinIntervalMillis(int64_t* _aidl_return) {
- *_aidl_return = 1000;
- return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus Power::getGpuHeadroomMinIntervalMillis(int64_t* _aidl_return) {
- *_aidl_return = 1000;
- return ndk::ScopedAStatus::ok();
+ndk::ScopedAStatus Power::getGpuHeadroom(const GpuHeadroomParams&, GpuHeadroomResult*) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ScopedAStatus Power::createHintSession(int32_t, int32_t, const std::vector<int32_t>& tids, int64_t,
@@ -163,6 +142,12 @@
.disableGpuFences = false,
.maxBatchSize = 1,
.alwaysBatch = false,
+ },
+ .headroom = {
+ .isCpuSupported = false,
+ .isGpuSupported = false,
+ .cpuMinIntervalMillis = 0,
+ .gpuMinIntervalMillis = 0,
}};
// Copy the support object into the binder
*_aidl_return = supportInfo;
diff --git a/power/aidl/default/Power.h b/power/aidl/default/Power.h
index c4aa7ab..118097f 100644
--- a/power/aidl/default/Power.h
+++ b/power/aidl/default/Power.h
@@ -50,8 +50,6 @@
ndk::ScopedAStatus getGpuHeadroom(const GpuHeadroomParams& params,
GpuHeadroomResult* _aidl_return) override;
- ndk::ScopedAStatus getCpuHeadroomMinIntervalMillis(int64_t* _aidl_return) override;
- ndk::ScopedAStatus getGpuHeadroomMinIntervalMillis(int64_t* _aidl_return) override;
ndk::ScopedAStatus sendCompositionData(const std::vector<CompositionData>& in_data) override;
ndk::ScopedAStatus sendCompositionUpdate(const CompositionUpdate& in_update) override;
diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp
index ffe20c6..b8ed634 100644
--- a/power/aidl/vts/VtsHalPowerTargetTest.cpp
+++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp
@@ -311,13 +311,12 @@
CpuHeadroomParams params;
CpuHeadroomResult headroom;
auto ret = power->getCpuHeadroom(params, &headroom);
- if (ret.getExceptionCode() == EX_UNSUPPORTED_OPERATION) {
+ if (!mSupportInfo->headroom.isCpuSupported) {
+ ASSERT_EQ(ret.getExceptionCode(), EX_UNSUPPORTED_OPERATION);
GTEST_SKIP() << "power->getCpuHeadroom is not supported";
}
ASSERT_TRUE(ret.isOk());
- int64_t minIntervalMillis;
- ASSERT_TRUE(power->getCpuHeadroomMinIntervalMillis(&minIntervalMillis).isOk());
- ASSERT_GE(minIntervalMillis, 0);
+ ASSERT_GE(mSupportInfo->headroom.cpuMinIntervalMillis, 0);
ASSERT_EQ(headroom.getTag(), CpuHeadroomResult::globalHeadroom);
ASSERT_GE(headroom.get<CpuHeadroomResult::globalHeadroom>(), 0.0f);
ASSERT_LE(headroom.get<CpuHeadroomResult::globalHeadroom>(), 100.00f);
@@ -330,13 +329,12 @@
GpuHeadroomParams params;
GpuHeadroomResult headroom;
auto ret = power->getGpuHeadroom(params, &headroom);
- if (ret.getExceptionCode() == EX_UNSUPPORTED_OPERATION) {
+ if (!mSupportInfo->headroom.isGpuSupported) {
+ ASSERT_EQ(ret.getExceptionCode(), EX_UNSUPPORTED_OPERATION);
GTEST_SKIP() << "power->getGpuHeadroom is not supported";
}
ASSERT_TRUE(ret.isOk());
- int64_t minIntervalMillis;
- ASSERT_TRUE(power->getGpuHeadroomMinIntervalMillis(&minIntervalMillis).isOk());
- ASSERT_GE(minIntervalMillis, 0);
+ ASSERT_GE(mSupportInfo->headroom.gpuMinIntervalMillis, 0);
ASSERT_EQ(headroom.getTag(), GpuHeadroomResult::globalHeadroom);
ASSERT_GE(headroom.get<GpuHeadroomResult::globalHeadroom>(), 0.0f);
ASSERT_LE(headroom.get<GpuHeadroomResult::globalHeadroom>(), 100.00f);