diff --git a/hidl/power-libperfmgr/AudioStreaming.h b/hidl/power-libperfmgr/AudioStreaming.h deleted file mode 100644 index d8772d53..00000000 --- a/hidl/power-libperfmgr/AudioStreaming.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef POWER_LIBPERFMGR_AUDIOSTREAMING_H_ -#define POWER_LIBPERFMGR_AUDIOSTREAMING_H_ - -enum AUDIO_STREAMING_HINT { - AUDIO_STREAMING_OFF = 0, - AUDIO_STREAMING_ON = 1, - TPU_BOOST_OFF = 1000, - TPU_BOOST_SHORT = 1001, - TPU_BOOST_LONG = 1002 -}; - -enum TPU_HINT_DURATION_MS { SHORT = 200, LONG = 2000 }; - -#endif // POWER_LIBPERFMGR_AUDIOSTREAMING_H_ diff --git a/hidl/power-libperfmgr/CameraMode.h b/hidl/power-libperfmgr/CameraMode.h deleted file mode 100644 index 1e056231..00000000 --- a/hidl/power-libperfmgr/CameraMode.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef POWER_LIBPERFMGR_CAMERAMODE_H_ -#define POWER_LIBPERFMGR_CAMERAMODE_H_ - -enum CameraStreamingMode { - CAMERA_STREAMING_OFF = 0, - CAMERA_STREAMING, - CAMERA_STREAMING_1080P, - CAMERA_STREAMING_60FPS, - CAMERA_STREAMING_4K, - CAMERA_STREAMING_SECURE, - CAMERA_STREAMING_MAX -}; - -#endif // POWER_LIBPERFMGR_CAMERAMODE_H_ diff --git a/hidl/power-libperfmgr/Power.cpp b/hidl/power-libperfmgr/Power.cpp index 150b1aaa..4c29c264 100644 --- a/hidl/power-libperfmgr/Power.cpp +++ b/hidl/power-libperfmgr/Power.cpp @@ -28,7 +28,6 @@ #include #include -#include "AudioStreaming.h" #include "Power.h" namespace android { @@ -49,20 +48,12 @@ constexpr char kPowerHalInitProp[] = "vendor.powerhal.init"; constexpr char kPowerHalRenderingProp[] = "vendor.powerhal.rendering"; constexpr char kPowerHalConfigPath[] = "/vendor/etc/powerhint.json"; -static const std::map kCamStreamingHint = { - {CAMERA_STREAMING_OFF, "CAMERA_STREAMING_OFF"}, - {CAMERA_STREAMING, "CAMERA_STREAMING"}, - {CAMERA_STREAMING_1080P, "CAMERA_STREAMING_1080P"}, - {CAMERA_STREAMING_60FPS, "CAMERA_STREAMING_60FPS"}, - {CAMERA_STREAMING_4K, "CAMERA_STREAMING_4K"}, - {CAMERA_STREAMING_SECURE, "CAMERA_STREAMING_SECURE"}}; - Power::Power() : mHintManager(nullptr), mInteractionHandler(nullptr), mVRModeOn(false), mSustainedPerfModeOn(false), - mCameraStreamingMode(CAMERA_STREAMING_OFF), + mCameraStreamingMode(false), mReady(false) { mInitThread = std::thread([this]() { android::base::WaitForProperty(kPowerHalInitProp, "1"); @@ -76,23 +67,7 @@ Power::Power() if (state == "CAMERA_STREAMING") { ALOGI("Initialize with CAMERA_STREAMING on"); mHintManager->DoHint("CAMERA_STREAMING"); - mCameraStreamingMode = CAMERA_STREAMING; - } else if (state == "CAMERA_STREAMING_1080P") { - ALOGI("Initialize CAMERA_STREAMING_1080P on"); - mHintManager->DoHint("CAMERA_STREAMING_1080P"); - mCameraStreamingMode = CAMERA_STREAMING_1080P; - } else if (state == "CAMERA_STREAMING_60FPS") { - ALOGI("Initialize CAMERA_STREAMING_60FPS on"); - mHintManager->DoHint("CAMERA_STREAMING_60FPS"); - mCameraStreamingMode = CAMERA_STREAMING_60FPS; - } else if (state == "CAMERA_STREAMING_4K") { - ALOGI("Initialize with CAMERA_STREAMING_4K on"); - mHintManager->DoHint("CAMERA_STREAMING_4K"); - mCameraStreamingMode = CAMERA_STREAMING_4K; - } else if (state == "CAMERA_STREAMING_SECURE") { - ALOGI("Initialize with CAMERA_STREAMING_SECURE on"); - mHintManager->DoHint("CAMERA_STREAMING_SECURE"); - mCameraStreamingMode = CAMERA_STREAMING_SECURE; + mCameraStreamingMode = true; } else if (state == "SUSTAINED_PERFORMANCE") { ALOGI("Initialize with SUSTAINED_PERFORMANCE on"); mHintManager->DoHint("SUSTAINED_PERFORMANCE"); @@ -250,21 +225,10 @@ Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { if (mVRModeOn || mSustainedPerfModeOn) { ALOGV("%s: ignoring due to other active perf hints", __func__); } else { - if (data == static_cast(AUDIO_STREAMING_HINT::AUDIO_STREAMING_ON)) { + if (data) { mHintManager->DoHint("AUDIO_STREAMING"); - } else if (data == - static_cast(AUDIO_STREAMING_HINT::AUDIO_STREAMING_OFF)) { - mHintManager->EndHint("AUDIO_STREAMING"); - } else if (data == static_cast(AUDIO_STREAMING_HINT::TPU_BOOST_SHORT)) { - mHintManager->DoHint("TPU_BOOST", - std::chrono::milliseconds(TPU_HINT_DURATION_MS::SHORT)); - } else if (data == static_cast(AUDIO_STREAMING_HINT::TPU_BOOST_LONG)) { - mHintManager->DoHint("TPU_BOOST", - std::chrono::milliseconds(TPU_HINT_DURATION_MS::LONG)); - } else if (data == static_cast(AUDIO_STREAMING_HINT::TPU_BOOST_OFF)) { - mHintManager->EndHint("TPU_BOOST"); } else { - ALOGE("AUDIO STREAMING INVALID DATA: %d", data); + mHintManager->EndHint("AUDIO_STREAMING"); } } break; @@ -278,34 +242,17 @@ Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { } break; case PowerHint_1_2::CAMERA_STREAMING: { - const enum CameraStreamingMode mode = static_cast(data); - if (mode < CAMERA_STREAMING_OFF || mode >= CAMERA_STREAMING_MAX) { - ALOGE("CAMERA STREAMING INVALID Mode: %d", mode); - break; - } - - if (mCameraStreamingMode == mode) - break; - - // turn it off first if any previous hint. - if ((mCameraStreamingMode != CAMERA_STREAMING_OFF)) { - const auto modeValue = kCamStreamingHint.at(mCameraStreamingMode); - mHintManager->EndHint(modeValue); - if ((mCameraStreamingMode != CAMERA_STREAMING_SECURE)) { - // Boost 1s for tear down if not secure streaming use case - mHintManager->DoHint("CAMERA_LAUNCH", std::chrono::seconds(1)); - } - } - - if (mode != CAMERA_STREAMING_OFF) { - const auto hintValue = kCamStreamingHint.at(mode); - mHintManager->DoHint(hintValue); + if (data > 0) { + mHintManager->DoHint("CAMERA_STREAMING"); + mCameraStreamingMode = true; + } else { + mHintManager->EndHint("CAMERA_STREAMING"); + mCameraStreamingMode = false; } - mCameraStreamingMode = mode; - const auto prop = (mCameraStreamingMode == CAMERA_STREAMING_OFF) - ? "" - : kCamStreamingHint.at(mode).c_str(); + const auto prop = mCameraStreamingMode + ? "CAMERA_STREAMING" + : ""; if (!android::base::SetProperty(kPowerHalStateProp, prop)) { ALOGE("%s: could set powerHAL state %s property", __func__, prop); } @@ -363,7 +310,7 @@ Return Power::debug(const hidl_handle &handle, const hidl_vec "CameraStreamingMode: %s\n" "SustainedPerformanceMode: %s\n", boolToString(mHintManager->IsRunning()), boolToString(mVRModeOn), - kCamStreamingHint.at(mCameraStreamingMode).c_str(), + boolToString(mCameraStreamingMode), boolToString(mSustainedPerfModeOn))); // Dump nodes through libperfmgr mHintManager->DumpToFd(fd); diff --git a/hidl/power-libperfmgr/Power.h b/hidl/power-libperfmgr/Power.h index b43fecd7..1acabdb7 100644 --- a/hidl/power-libperfmgr/Power.h +++ b/hidl/power-libperfmgr/Power.h @@ -26,7 +26,6 @@ #include #include -#include "CameraMode.h" #include "InteractionHandler.h" namespace android { @@ -74,7 +73,7 @@ class Power : public IPower { std::unique_ptr mInteractionHandler; std::atomic mVRModeOn; std::atomic mSustainedPerfModeOn; - std::atomic mCameraStreamingMode; + std::atomic mCameraStreamingMode; std::atomic mReady; std::thread mInitThread; }; diff --git a/hidl/power-libperfmgr/android.hardware.power@1.3-service.samsung-libperfmgr.rc b/hidl/power-libperfmgr/android.hardware.power@1.3-service.samsung-libperfmgr.rc index f24fb2be..91301ab3 100644 --- a/hidl/power-libperfmgr/android.hardware.power@1.3-service.samsung-libperfmgr.rc +++ b/hidl/power-libperfmgr/android.hardware.power@1.3-service.samsung-libperfmgr.rc @@ -14,13 +14,3 @@ on property:init.svc.zygote=restarting && property:vendor.powerhal.state=* setprop vendor.powerhal.audio "" setprop vendor.powerhal.rendering "" restart vendor.power-hal-1-3 - -# restart powerHAL when cameraHAL died -on property:init.svc.vendor.camera-provider-2-4=restarting && property:vendor.powerhal.state=CAMERA_STREAMING - setprop vendor.powerhal.state "" - restart vendor.power-hal-1-3 - -# restart powerHAL when audioHAL died -on property:init.svc.vendor.audio-hal-2-0=restarting && property:vendor.powerhal.audio=AUDIO_LOW_LATENCY - setprop vendor.powerhal.audio "" - restart vendor.power-hal-1-3