diff options
author | Leo Chen <yinchiuan@google.com> | 2023-05-31 08:52:15 +0000 |
---|---|---|
committer | Leo Chen <yinchiuan@google.com> | 2023-08-23 06:55:57 +0000 |
commit | 573d3753c867db7d06cc6df42fcdd4678c2baa36 (patch) | |
tree | 91f4a55e26304584dcfda0323bad91bb4b6fc003 | |
parent | b21fac0c042ab14b33dde8b44a7d8102efb65db6 (diff) | |
download | zuma-573d3753c867db7d06cc6df42fcdd4678c2baa36.tar.gz |
libhwc2.1: Add HistogramController class
Bug: 255986866
Bug: 227384721
Test: use aidl_hist_client to test multi channel histogram
Change-Id: If9372091533d882edcb9dbb7fd94801f64dc4c74
Signed-off-by: Leo Chen <yinchiuan@google.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 +}; |