unplugged-system/frameworks/native/services/surfaceflinger/mediatek/aidl/MtkSF_ext.cpp

80 lines
2.5 KiB
C++
Raw Normal View History

/*
* 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.
*/
#ifdef MTK_SF_AIDL
#include "MtkSF_ext.h"
#include <android-base/logging.h>
#include <log/log.h>
#ifdef MTK_DISPLAY_DEJITTER
#include <mediatek/DispDejitterConfig.h>
#endif
#ifdef MTK_DYNAMIC_DURATION
#include <mediatek/MtkOverrideDurationConfigs.h>
#endif
namespace aidl {
namespace vendor {
namespace mediatek {
namespace framework {
namespace mtksf_ext {
using ::ndk::ScopedAStatus;
ndk::ScopedAStatus MtkSF_ext::setDisplayDejitterConfig(int64_t fps, int64_t pbc, bool* result) {
ALOGV("MtkSF_ext::setDisplayDejitterConfig %" PRId64 ", %" PRId64, fps, pbc);
#ifdef MTK_DISPLAY_DEJITTER
*result = ::android::DispDejitterConfig::getInstance().setDisplayDejitterConfig(fps, pbc);
#endif
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus MtkSF_ext::setDuration(int64_t app, int64_t sf, int64_t hz, bool* result) {
ALOGD("MtkSF_ext::setDuration app:%" PRId64 ", sf:%" PRId64 ", hz:%" PRId64, app, sf, hz);
#ifdef MTK_DYNAMIC_DURATION
*result = ::android::MtkOverrideDurationConfigs::getInstance().setOverrideDurationConfigs(app, sf, hz);
#endif
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus MtkSF_ext::setPELT32(int64_t enabled, bool* result) {
ALOGD("MtkSF_ext::setPELT32 enabled:%" PRId64, enabled);
#ifdef MTK_SF_HINT_LOW_POWER
*result = mFlinger->setPELT32(enabled == 1 ? true : false);
#endif
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus MtkSF_ext::getDisplayFrameCount(int64_t* result) {
#ifdef MTK_SF_MBRAIN_FPS_SUPPORT
*result = mFlinger->getDisplayFrameCount();
#endif
return ndk::ScopedAStatus::ok();
}
void MtkSF_ext::setFlinger(::android::SurfaceFlinger* flinger) {
LOG(INFO) << "Get flinger";
mFlinger = ::android::sp<::android::SurfaceFlinger>::fromExisting(flinger);
}
} // namespace mtksf_ext
} // namespace framework
} // namespace mediatek
} // namespace vendor
} // namespace aidl
#endif