sdm710-common: power-libperfmgr: remove Google-specific camera and audio hints
Change-Id: I65285ca8c7248bd1e55d3800862e96c00f00effd Signed-off-by: SamarV-121 <samarv121@pixelexperience.org>
This commit is contained in:
parent
b3c33c6b0b
commit
6a159a6617
5 changed files with 15 additions and 139 deletions
|
@ -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_
|
|
@ -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_
|
|
@ -28,7 +28,6 @@
|
|||
#include <utils/Log.h>
|
||||
#include <utils/Trace.h>
|
||||
|
||||
#include "AudioStreaming.h"
|
||||
#include "Power.h"
|
||||
|
||||
#ifndef TAP_TO_WAKE_NODE
|
||||
|
@ -53,20 +52,12 @@ constexpr char kPowerHalInitProp[] = "vendor.powerhal.init";
|
|||
constexpr char kPowerHalRenderingProp[] = "vendor.powerhal.rendering";
|
||||
constexpr char kPowerHalConfigPath[] = "/system/etc/powerhint.json";
|
||||
|
||||
static const std::map<enum CameraStreamingMode, std::string> 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");
|
||||
|
@ -80,23 +71,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");
|
||||
|
@ -260,21 +235,10 @@ Return<void> 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<int32_t>(AUDIO_STREAMING_HINT::AUDIO_STREAMING_ON)) {
|
||||
if (data) {
|
||||
mHintManager->DoHint("AUDIO_STREAMING");
|
||||
} else if (data ==
|
||||
static_cast<int32_t>(AUDIO_STREAMING_HINT::AUDIO_STREAMING_OFF)) {
|
||||
mHintManager->EndHint("AUDIO_STREAMING");
|
||||
} else if (data == static_cast<int32_t>(AUDIO_STREAMING_HINT::TPU_BOOST_SHORT)) {
|
||||
mHintManager->DoHint("TPU_BOOST",
|
||||
std::chrono::milliseconds(TPU_HINT_DURATION_MS::SHORT));
|
||||
} else if (data == static_cast<int32_t>(AUDIO_STREAMING_HINT::TPU_BOOST_LONG)) {
|
||||
mHintManager->DoHint("TPU_BOOST",
|
||||
std::chrono::milliseconds(TPU_HINT_DURATION_MS::LONG));
|
||||
} else if (data == static_cast<int32_t>(AUDIO_STREAMING_HINT::TPU_BOOST_OFF)) {
|
||||
mHintManager->EndHint("TPU_BOOST");
|
||||
} else {
|
||||
ALOGE("AUDIO STREAMING INVALID DATA: %d", data);
|
||||
mHintManager->EndHint("AUDIO_STREAMING");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -288,34 +252,17 @@ Return<void> Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) {
|
|||
}
|
||||
break;
|
||||
case PowerHint_1_2::CAMERA_STREAMING: {
|
||||
const enum CameraStreamingMode mode = static_cast<enum CameraStreamingMode>(data);
|
||||
if (mode < CAMERA_STREAMING_OFF || mode >= CAMERA_STREAMING_MAX) {
|
||||
ALOGE("CAMERA STREAMING INVALID Mode: %d", mode);
|
||||
break;
|
||||
if (data > 0) {
|
||||
mHintManager->DoHint("CAMERA_STREAMING");
|
||||
mCameraStreamingMode = true;
|
||||
} else {
|
||||
mHintManager->EndHint("CAMERA_STREAMING");
|
||||
mCameraStreamingMode = false;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -373,7 +320,7 @@ Return<void> Power::debug(const hidl_handle &handle, const hidl_vec<hidl_string>
|
|||
"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);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <hidl/Status.h>
|
||||
#include <perfmgr/HintManager.h>
|
||||
|
||||
#include "CameraMode.h"
|
||||
#include "InteractionHandler.h"
|
||||
|
||||
namespace android {
|
||||
|
@ -74,7 +73,7 @@ class Power : public IPower {
|
|||
std::unique_ptr<InteractionHandler> mInteractionHandler;
|
||||
std::atomic<bool> mVRModeOn;
|
||||
std::atomic<bool> mSustainedPerfModeOn;
|
||||
std::atomic<enum CameraStreamingMode> mCameraStreamingMode;
|
||||
std::atomic<bool> mCameraStreamingMode;
|
||||
std::atomic<bool> mReady;
|
||||
std::thread mInitThread;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue