diff options
author | dianlujitao <dianlujitao@lineageos.org> | 2019-02-04 10:34:27 +0800 |
---|---|---|
committer | Bruno Martins <bgcngm@gmail.com> | 2019-02-07 08:20:20 +0000 |
commit | 0d26b6b25acd7fc0ac26836eb23cfd36c2ce9e8e (patch) | |
tree | b426708c279cd867bf3654ad800ed7e23dc58227 | |
parent | d4210855b7aa3ca1612fc6fbfdaaf53a8571b570 (diff) | |
download | android_hardware_lineage_livedisplay-0d26b6b25acd7fc0ac26836eb23cfd36c2ce9e8e.tar.gz android_hardware_lineage_livedisplay-0d26b6b25acd7fc0ac26836eb23cfd36c2ce9e8e.tar.bz2 android_hardware_lineage_livedisplay-0d26b6b25acd7fc0ac26836eb23cfd36c2ce9e8e.zip |
livedisplay: Nuke color balance
* The isSupported() method always returns false here, and
there are currently no plans to fix it at this time
Change-Id: I45cec0542219b42009f7e4f2a1ab2a1fe0d06ede
-rw-r--r-- | legacymm/Android.bp | 1 | ||||
-rw-r--r-- | legacymm/ColorBalance.cpp | 113 | ||||
-rw-r--r-- | legacymm/ColorBalance.h | 58 | ||||
-rw-r--r-- | legacymm/service.cpp | 21 | ||||
-rw-r--r-- | sdm/Android.bp | 1 | ||||
-rw-r--r-- | sdm/ColorBalance.cpp | 126 | ||||
-rw-r--r-- | sdm/ColorBalance.h | 59 | ||||
-rw-r--r-- | sdm/service.cpp | 21 |
8 files changed, 2 insertions, 398 deletions
diff --git a/legacymm/Android.bp b/legacymm/Android.bp index 32ed897..5f3b44e 100644 --- a/legacymm/Android.bp +++ b/legacymm/Android.bp @@ -19,7 +19,6 @@ cc_binary { relative_install_path: "hw", proprietary: true, srcs: [ - "ColorBalance.cpp", "DisplayModes.cpp", "PictureAdjustment.cpp", "service.cpp", diff --git a/legacymm/ColorBalance.cpp b/legacymm/ColorBalance.cpp deleted file mode 100644 index 7100f01..0000000 --- a/legacymm/ColorBalance.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS 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. - */ - -#include <dlfcn.h> - -#include "ColorBalance.h" -#include "Constants.h" -#include "Types.h" - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_0 { -namespace legacymm { - -ColorBalance::ColorBalance(void* libHandle) { - mLibHandle = libHandle; - disp_api_supported = - reinterpret_cast<int (*)(int32_t, int32_t)>(dlsym(mLibHandle, "disp_api_supported")); - disp_api_get_color_balance_range = reinterpret_cast<int (*)(int32_t, void*)>( - dlsym(mLibHandle, "disp_api_get_color_balance_range")); - disp_api_get_color_balance = - reinterpret_cast<int (*)(int32_t, int*)>(dlsym(mLibHandle, "disp_api_get_color_balance")); - disp_api_set_color_balance = - reinterpret_cast<int (*)(int32_t, int)>(dlsym(mLibHandle, "disp_api_set_color_balance")); - disp_api_get_num_display_modes = reinterpret_cast<int (*)(int32_t, int32_t, int*)>( - dlsym(mLibHandle, "disp_api_get_num_display_modes")); -} - -bool ColorBalance::isSupported() { -#if 0 - mm_cb_range range{}; - // int count = 0; - - if (disp_api_supported == nullptr || disp_api_supported(0, COLOR_BALANCE_FEATURE) == 0) { - return false; - } - - if (disp_api_get_color_balance_range == nullptr || - disp_api_get_color_balance_range(0, &range) != 0) { - return false; - } - - if (range.max == 0 || range.min == 0) { - return false; - } - - // This is how this is supposed to work, but it doesn't work quite right - /* - if (disp_api_supported(0, DISPLAY_MODES_FEATURE) != 0 && - disp_api_get_num_display_modes != nullptr && - disp_api_get_num_display_modes(0, 0, &count) == 0) { - return count > 0; - } - */ -#endif - return false; -} - -// Methods from ::vendor::lineage::livedisplay::V2_0::IColorBalance follow. -Return<void> ColorBalance::getColorBalanceRange(getColorBalanceRange_cb _hidl_cb) { - Range range{}; - mm_cb_range r{}; - - if (disp_api_get_color_balance_range != nullptr) { - if (disp_api_get_color_balance_range(0, &range) == 0) { - range.min = r.min; - range.max = r.max; - } - } - - _hidl_cb(range); - return Void(); -} - -Return<int32_t> ColorBalance::getColorBalance() { - int value = 0; - - if (disp_api_get_color_balance != nullptr) { - if (disp_api_get_color_balance(0, &value) != 0) { - value = 0; - } - } - - return static_cast<int32_t>(value); -} - -Return<bool> ColorBalance::setColorBalance(int32_t value) { - if (disp_api_set_color_balance != nullptr) { - return disp_api_set_color_balance(0, static_cast<int>(value)) == 0; - } - - return false; -} - -} // namespace legacymm -} // namespace V2_0 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor diff --git a/legacymm/ColorBalance.h b/legacymm/ColorBalance.h deleted file mode 100644 index f6da7ea..0000000 --- a/legacymm/ColorBalance.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS 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 VENDOR_LINEAGE_LIVEDISPLAY_V2_0_COLORBALANCE_H -#define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_COLORBALANCE_H - -#include <vendor/lineage/livedisplay/2.0/IColorBalance.h> - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_0 { -namespace legacymm { - -using ::android::hardware::Return; -using ::android::hardware::Void; - -class ColorBalance : public IColorBalance { - public: - ColorBalance(void* libHandle); - - bool isSupported(); - - // Methods from ::vendor::lineage::livedisplay::V2_0::IColorBalance follow. - Return<void> getColorBalanceRange(getColorBalanceRange_cb _hidl_cb) override; - Return<int32_t> getColorBalance() override; - Return<bool> setColorBalance(int32_t value) override; - - private: - void* mLibHandle; - - int (*disp_api_supported)(int32_t, int32_t); - int (*disp_api_get_color_balance_range)(int32_t, void*); - int (*disp_api_get_color_balance)(int32_t, int*); - int (*disp_api_set_color_balance)(int32_t, int); - int (*disp_api_get_num_display_modes)(int32_t, int32_t, int*); -}; - -} // namespace legacymm -} // namespace V2_0 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor - -#endif // VENDOR_LINEAGE_LIVEDISPLAY_V2_0_COLORBALANCE_H diff --git a/legacymm/service.cpp b/legacymm/service.cpp index 66d452f..e668699 100644 --- a/legacymm/service.cpp +++ b/legacymm/service.cpp @@ -22,7 +22,6 @@ #include <binder/ProcessState.h> #include <hidl/HidlTransportSupport.h> -#include "ColorBalance.h" #include "DisplayModes.h" #include "PictureAdjustment.h" @@ -34,10 +33,8 @@ using android::status_t; using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; -using ::vendor::lineage::livedisplay::V2_0::IColorBalance; using ::vendor::lineage::livedisplay::V2_0::IDisplayModes; using ::vendor::lineage::livedisplay::V2_0::IPictureAdjustment; -using ::vendor::lineage::livedisplay::V2_0::legacymm::ColorBalance; using ::vendor::lineage::livedisplay::V2_0::legacymm::DisplayModes; using ::vendor::lineage::livedisplay::V2_0::legacymm::PictureAdjustment; @@ -47,7 +44,6 @@ int main() { int (*disp_api_init)(int32_t) = nullptr; // HIDL frontend - sp<ColorBalance> cb; sp<DisplayModes> dm; sp<PictureAdjustment> pa; @@ -73,12 +69,6 @@ int main() { goto shutdown; } - cb = new ColorBalance(libHandle); - if (cb == nullptr) { - LOG(ERROR) << "Can not create an instance of LiveDisplay HAL ColorBalance Iface, exiting."; - goto shutdown; - } - dm = new DisplayModes(libHandle); if (dm == nullptr) { LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayModes Iface, exiting."; @@ -92,22 +82,13 @@ int main() { goto shutdown; } - if (!cb->isSupported() && !dm->isSupported() && !pa->isSupported()) { + if (!dm->isSupported() && !pa->isSupported()) { // Backend isn't ready yet, so restart and try again goto shutdown; } configureRpcThreadpool(1, true /*callerWillJoin*/); - if (cb->isSupported()) { - status = cb->registerAsService(); - if (status != OK) { - LOG(ERROR) << "Could not register service for LiveDisplay HAL ColorBalance Iface (" - << status << ")"; - goto shutdown; - } - } - if (dm->isSupported()) { status = dm->registerAsService(); if (status != OK) { diff --git a/sdm/Android.bp b/sdm/Android.bp index 62c5aa8..8de6581 100644 --- a/sdm/Android.bp +++ b/sdm/Android.bp @@ -18,7 +18,6 @@ cc_defaults { relative_install_path: "hw", srcs: [ "AdaptiveBacklight.cpp", - "ColorBalance.cpp", "DisplayModes.cpp", "PictureAdjustment.cpp", "Utils.cpp", diff --git a/sdm/ColorBalance.cpp b/sdm/ColorBalance.cpp deleted file mode 100644 index ffda770..0000000 --- a/sdm/ColorBalance.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS 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. - */ - -#include <dlfcn.h> - -#include "ColorBalance.h" -#include "Constants.h" -#include "Types.h" - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_0 { -namespace sdm { - -ColorBalance::ColorBalance(void* libHandle, uint64_t cookie) { - mLibHandle = libHandle; - mCookie = cookie; - disp_api_get_feature_version = - reinterpret_cast<int32_t (*)(uint64_t, uint32_t, void*, uint32_t*)>( - dlsym(mLibHandle, "disp_api_get_feature_version")); - disp_api_get_global_color_balance_range = - reinterpret_cast<int32_t (*)(uint64_t, uint32_t, void*)>( - dlsym(mLibHandle, "disp_api_get_global_color_balance_range")); - disp_api_get_global_color_balance = - reinterpret_cast<int32_t (*)(uint64_t, uint32_t, int32_t*, uint32_t*)>( - dlsym(mLibHandle, "disp_api_get_global_color_balance")); - disp_api_set_global_color_balance = - reinterpret_cast<int32_t (*)(uint64_t, uint32_t, int32_t, uint32_t)>( - dlsym(mLibHandle, "disp_api_set_global_color_balance")); - disp_api_get_num_display_modes = - reinterpret_cast<int32_t (*)(uint64_t, uint32_t, int32_t, int32_t*, uint32_t*)>( - dlsym(mLibHandle, "disp_api_get_num_display_modes")); -} - -bool ColorBalance::isSupported() { -#if 0 - Range range{}; - sdm_feature_version version{}; - // int32_t count = 0; - uint32_t flags = 0; - - if (disp_api_get_feature_version == nullptr || - disp_api_get_feature_version(mCookie, COLOR_BALANCE_FEATURE, &version, &flags) != 0) { - return false; - } - - if (version.x <= 0 && version.y <= 0 && version.z <= 0) { - return false; - } - - if (disp_api_get_global_color_balance_range == nullptr || - disp_api_get_global_color_balance_range(mCookie, 0, &range) != 0) { - return false; - } - - if (range.max == 0 || range.min == 0) { - return false; - } - - // This is how this is supposed to work, but it doesn't work quite right - /* - if (disp_api_get_feature_version(mCookie, DISPLAY_MODES_FEATURE, &version, &flags) == 0 && - (version.x > 0 && version.y > 0 && version.z > 0) && - disp_api_get_num_display_modes != nullptr && - disp_api_get_num_display_modes(mCookie, 0, 0, &count, &flags) == 0) { - return count > 0; - } - */ -#endif - return false; -} - -// Methods from ::vendor::lineage::livedisplay::V2_0::IColorBalance follow. -Return<void> ColorBalance::getColorBalanceRange(getColorBalanceRange_cb _hidl_cb) { - Range range{}; - - if (disp_api_get_global_color_balance_range != nullptr) { - if (disp_api_get_global_color_balance_range(mCookie, 0, &range) != 0) { - range.max = range.min = 0; - } - } - - _hidl_cb(range); - return Void(); -} - -Return<int32_t> ColorBalance::getColorBalance() { - int32_t value = 0; - uint32_t flags = 0; - - if (disp_api_get_global_color_balance != nullptr) { - if (disp_api_get_global_color_balance(mCookie, 0, &value, &flags) != 0) { - value = 0; - } - } - - return value; -} - -Return<bool> ColorBalance::setColorBalance(int32_t value) { - if (disp_api_set_global_color_balance != nullptr) { - return disp_api_set_global_color_balance(mCookie, 0, value, 0) == 0; - } - - return false; -} - -} // namespace sdm -} // namespace V2_0 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor diff --git a/sdm/ColorBalance.h b/sdm/ColorBalance.h deleted file mode 100644 index 6539bbb..0000000 --- a/sdm/ColorBalance.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS 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 VENDOR_LINEAGE_LIVEDISPLAY_V2_0_COLORBALANCE_H -#define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_COLORBALANCE_H - -#include <vendor/lineage/livedisplay/2.0/IColorBalance.h> - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_0 { -namespace sdm { - -using ::android::hardware::Return; -using ::android::hardware::Void; - -class ColorBalance : public IColorBalance { - public: - ColorBalance(void* libHandle, uint64_t cookie); - - bool isSupported(); - - // Methods from ::vendor::lineage::livedisplay::V2_0::IColorBalance follow. - Return<void> getColorBalanceRange(getColorBalanceRange_cb _hidl_cb) override; - Return<int32_t> getColorBalance() override; - Return<bool> setColorBalance(int32_t value) override; - - private: - void* mLibHandle; - uint64_t mCookie; - - int32_t (*disp_api_get_feature_version)(uint64_t, uint32_t, void*, uint32_t*); - int32_t (*disp_api_get_global_color_balance_range)(uint64_t, uint32_t, void*); - int32_t (*disp_api_get_global_color_balance)(uint64_t, uint32_t, int32_t*, uint32_t*); - int32_t (*disp_api_set_global_color_balance)(uint64_t, uint32_t, int32_t, uint32_t); - int32_t (*disp_api_get_num_display_modes)(uint64_t, uint32_t, int32_t, int32_t*, uint32_t*); -}; - -} // namespace sdm -} // namespace V2_0 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor - -#endif // VENDOR_LINEAGE_LIVEDISPLAY_V2_0_COLORBALANCE_H diff --git a/sdm/service.cpp b/sdm/service.cpp index bee3ef6..527a761 100644 --- a/sdm/service.cpp +++ b/sdm/service.cpp @@ -27,7 +27,6 @@ #include <hidl/HidlTransportSupport.h> #include "AdaptiveBacklight.h" -#include "ColorBalance.h" #include "DisplayModes.h" #include "PictureAdjustment.h" @@ -44,11 +43,9 @@ using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; using ::vendor::lineage::livedisplay::V2_0::IAdaptiveBacklight; -using ::vendor::lineage::livedisplay::V2_0::IColorBalance; using ::vendor::lineage::livedisplay::V2_0::IDisplayModes; using ::vendor::lineage::livedisplay::V2_0::IPictureAdjustment; using ::vendor::lineage::livedisplay::V2_0::sdm::AdaptiveBacklight; -using ::vendor::lineage::livedisplay::V2_0::sdm::ColorBalance; using ::vendor::lineage::livedisplay::V2_0::sdm::DisplayModes; using ::vendor::lineage::livedisplay::V2_0::sdm::PictureAdjustment; @@ -61,7 +58,6 @@ int main() { // HIDL frontend sp<AdaptiveBacklight> ab; - sp<ColorBalance> cb; sp<DisplayModes> dm; sp<PictureAdjustment> pa; @@ -109,12 +105,6 @@ int main() { goto shutdown; } - cb = new ColorBalance(libHandle, cookie); - if (cb == nullptr) { - LOG(ERROR) << "Can not create an instance of LiveDisplay HAL ColorBalance Iface, exiting."; - goto shutdown; - } - dm = new DisplayModes(libHandle, cookie); if (dm == nullptr) { LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayModes Iface, exiting."; @@ -128,7 +118,7 @@ int main() { goto shutdown; } - if (!ab->isSupported() && !cb->isSupported() && !dm->isSupported() && !pa->isSupported()) { + if (!ab->isSupported() && !dm->isSupported() && !pa->isSupported()) { // Backend isn't ready yet, so restart and try again goto shutdown; } @@ -144,15 +134,6 @@ int main() { } } - if (cb->isSupported()) { - status = cb->registerAsService(); - if (status != OK) { - LOG(ERROR) << "Could not register service for LiveDisplay HAL ColorBalance Iface (" - << status << ")"; - goto shutdown; - } - } - if (dm->isSupported()) { status = dm->registerAsService(); if (status != OK) { |