diff options
author | Leo Chen <yinchiuan@google.com> | 2023-08-25 08:15:04 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-08-25 08:15:04 +0000 |
commit | d437e2c90e46bfcdd0c49ccfa19194757e10c061 (patch) | |
tree | 91f4a55e26304584dcfda0323bad91bb4b6fc003 | |
parent | 5b6199a8a9e43b50c88d5c73a416748e9d73ec2a (diff) | |
parent | 573d3753c867db7d06cc6df42fcdd4678c2baa36 (diff) | |
download | zuma-d437e2c90e46bfcdd0c49ccfa19194757e10c061.tar.gz |
libhwc2.1: Add HistogramController class am: 573d3753c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/google/graphics/zuma/+/23655883
Change-Id: Ifd6df2c26d223278189136d6f83359e7e674a417
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | libhwc2.1/Android.mk | 3 | ||||
-rw-r--r-- | libhwc2.1/libdevice/HistogramController.cpp | 56 | ||||
-rw-r--r-- | libhwc2.1/libdevice/HistogramController.h | 30 |
3 files changed, 88 insertions, 1 deletions
diff --git a/libhwc2.1/Android.mk b/libhwc2.1/Android.mk index a6b6fba..c704838 100644 --- a/libhwc2.1/Android.mk +++ b/libhwc2.1/Android.mk @@ -28,7 +28,8 @@ LOCAL_SRC_FILES += \ ../../gs201/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp \ ../../zuma/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp \ ../../zuma/libhwc2.1/libcolormanager/DisplayColorModule.cpp \ - ../../zuma/libhwc2.1/libdevice/ExynosDeviceModule.cpp + ../../zuma/libhwc2.1/libdevice/ExynosDeviceModule.cpp \ + ../../zuma/libhwc2.1/libdevice/HistogramController.cpp LOCAL_CFLAGS += -DDISPLAY_COLOR_LIB=\"libdisplaycolor.so\" diff --git a/libhwc2.1/libdevice/HistogramController.cpp b/libhwc2.1/libdevice/HistogramController.cpp new file mode 100644 index 0000000..30b0d5d --- /dev/null +++ b/libhwc2.1/libdevice/HistogramController.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2023 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. + */ + +#include "HistogramController.h" + +// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. +#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) +int HistogramController::createHistogramDrmConfigLocked(const ChannelInfo &channel, + std::shared_ptr<void> &configPtr, + size_t &length) const { + configPtr = std::make_shared<struct histogram_channel_config>(); + struct histogram_channel_config *channelConfig = + (struct histogram_channel_config *)configPtr.get(); + + if (channelConfig == nullptr) { + ALOGE("%s: histogram failed to allocate histogram_channel_config", __func__); + return NO_MEMORY; + } + + channelConfig->roi.start_x = channel.workingConfig.roi.left; + channelConfig->roi.start_y = channel.workingConfig.roi.top; + channelConfig->roi.hsize = channel.workingConfig.roi.right - channel.workingConfig.roi.left; + channelConfig->roi.vsize = channel.workingConfig.roi.bottom - channel.workingConfig.roi.top; + channelConfig->weights.weight_r = channel.workingConfig.weights.weightR; + channelConfig->weights.weight_g = channel.workingConfig.weights.weightG; + channelConfig->weights.weight_b = channel.workingConfig.weights.weightB; + channelConfig->pos = (channel.workingConfig.samplePos == HistogramSamplePos::POST_POSTPROC) + ? POST_DQE + : PRE_DQE; + channelConfig->threshold = channel.threshold; + length = sizeof(struct histogram_channel_config); + + return NO_ERROR; +} + +int HistogramController::parseDrmEvent(void *event, uint8_t &channelId, char16_t *&buffer) const { + struct exynos_drm_histogram_channel_event *histogram_channel_event = + (struct exynos_drm_histogram_channel_event *)event; + channelId = histogram_channel_event->hist_id; + buffer = (char16_t *)&histogram_channel_event->bins; + return NO_ERROR; +} +#endif diff --git a/libhwc2.1/libdevice/HistogramController.h b/libhwc2.1/libdevice/HistogramController.h new file mode 100644 index 0000000..0cfee0e --- /dev/null +++ b/libhwc2.1/libdevice/HistogramController.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2023 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. + */ + +#include "HistogramDevice.h" + +class HistogramController : public HistogramDevice { +public: + HistogramController(ExynosDisplay *display) : HistogramDevice(display, 4, {3}) {} +// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged. +#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST) + virtual int createHistogramDrmConfigLocked(const ChannelInfo &channel, + std::shared_ptr<void> &configPtr, + size_t &length) const override + REQUIRES(channel.channelInfoMutex); + virtual int parseDrmEvent(void *event, uint8_t &channelId, char16_t *&buffer) const override; +#endif +}; |