summaryrefslogtreecommitdiff
path: root/libhwc2.1/pixel-display.cpp
diff options
context:
space:
mode:
authorWeizhung Ding <weizhungding@google.com>2021-06-29 21:48:50 +0800
committerWeizhung Ding <weizhungding@google.com>2021-07-22 12:00:21 +0800
commitf0c96a9fc1c26ca5f7fbb1c8c125af975aaa5a5a (patch)
treefd33f9232d771aa356bed805ab6c2979ff44f3d7 /libhwc2.1/pixel-display.cpp
parent77bfc257fedc8d35c86e9f1bfbe3bdd0215cdb87 (diff)
libhwc2.1: pixel-display V3 interface implement
Add support for loading the shadow compensation images. Bug: 184697262 Test: app side can load the correct image Change-Id: Ie90fd74deb85a927a5fa4fa939dc5e53bea2741b
Diffstat (limited to 'libhwc2.1/pixel-display.cpp')
-rw-r--r--libhwc2.1/pixel-display.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/libhwc2.1/pixel-display.cpp b/libhwc2.1/pixel-display.cpp
index 2ee58ef..b6d0eb3 100644
--- a/libhwc2.1/pixel-display.cpp
+++ b/libhwc2.1/pixel-display.cpp
@@ -16,12 +16,15 @@
#include "pixel-display.h"
+#include <aidlcommonsupport/NativeHandle.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <sys/types.h>
#include <utils/Errors.h>
+extern int32_t load_png_image(const char *filepath, buffer_handle_t buffer);
+
using ::aidl::com::google::hardware::pixel::display::Display;
void PixelDisplayInit(ExynosDevice *device) {
@@ -37,6 +40,18 @@ void PixelDisplayInit(ExynosDevice *device) {
ABinderProcess_startThreadPool();
}
+int32_t readCompensationImage(const aidl::android::hardware::common::NativeHandle &handle,
+ const std::string &imageName) {
+ ALOGI("setCompensationImageHandle, imageName = %s", imageName.c_str());
+
+ std::string shadowCompensationImage("/mnt/vendor/persist/display/");
+ shadowCompensationImage.append(imageName);
+
+ native_handle_t *clone = makeFromAidl(handle);
+
+ return load_png_image(shadowCompensationImage.c_str(), static_cast<buffer_handle_t>(clone));
+}
+
namespace aidl {
namespace com {
namespace google {
@@ -118,6 +133,13 @@ ndk::ScopedAStatus Display::getLhbmState(bool *_aidl_return) {
}
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
+
+ndk::ScopedAStatus Display::setCompensationImageHandle(const NativeHandle &native_handle,
+ const std::string &imageName,
+ int *_aidl_return) {
+ *_aidl_return = readCompensationImage(native_handle, imageName);
+ return ndk::ScopedAStatus::ok();
+}
} // namespace display
} // namespace pixel
} // namespace hardware