libhwc2.1: move multi channel support from zuma to common folder

Test: trigger test build, check the log
Bug: 322454133
Change-Id: Iea685a239486b80f0bdaa232b3410ff5677d9de5
Signed-off-by: Leo Chen <[email protected]>
diff --git a/libhwc2.1/libdevice/HistogramController.cpp b/libhwc2.1/libdevice/HistogramController.cpp
index 6cf6f78..b9f635a 100644
--- a/libhwc2.1/libdevice/HistogramController.cpp
+++ b/libhwc2.1/libdevice/HistogramController.cpp
@@ -20,54 +20,3 @@
     mHistogramCapability.supportSamplePosList.push_back(HistogramSamplePos::PRE_POSTPROC);
     mHistogramCapability.supportBlockingRoi = true;
 }
-
-// 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;
-    if (channel.workingConfig.blockingRoi.has_value() &&
-        channel.workingConfig.blockingRoi.value() != DISABLED_ROI) {
-        const HistogramRoiRect& blockedRoi = channel.workingConfig.blockingRoi.value();
-        channelConfig->flags |= HISTOGRAM_FLAGS_BLOCKED_ROI;
-        channelConfig->blocked_roi.start_x = blockedRoi.left;
-        channelConfig->blocked_roi.start_y = blockedRoi.top;
-        channelConfig->blocked_roi.hsize = blockedRoi.right - blockedRoi.left;
-        channelConfig->blocked_roi.vsize = blockedRoi.bottom - blockedRoi.top;
-    } else {
-        channelConfig->flags &= ~HISTOGRAM_FLAGS_BLOCKED_ROI;
-    }
-    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
index a895bdd..58b3f5c 100644
--- a/libhwc2.1/libdevice/HistogramController.h
+++ b/libhwc2.1/libdevice/HistogramController.h
@@ -22,12 +22,4 @@
 public:
     HistogramController(ExynosDisplay* display) : HistogramDevice(display, 4, {3}) {}
     virtual void initPlatformHistogramCapability() override;
-// 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
 };
diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp
index 62ab010..4400cfe 100644
--- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp
+++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.cpp
@@ -51,26 +51,3 @@
 
             std::memcpy(mMonitorDescription.data(), panelModel.c_str(), mMonitorDescription.size());
 }
-
-// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged.
-#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST)
-int32_t ExynosPrimaryDisplayDrmInterfaceModule::sendHistogramChannelIoctl(HistogramChannelIoctl_t control, uint8_t channelId) const {
-    struct exynos_drm_histogram_channel_request histogramRequest;
-
-    histogramRequest.crtc_id = mDrmCrtc->id();
-    histogramRequest.hist_id = channelId;
-
-    if (control == HistogramChannelIoctl_t::REQUEST) {
-        ATRACE_NAME(String8::format("requestIoctl #%u", channelId).c_str());
-        return mDrmDevice->CallVendorIoctl(DRM_IOCTL_EXYNOS_HISTOGRAM_CHANNEL_REQUEST,
-                                           (void *)&histogramRequest);
-    } else if (control == HistogramChannelIoctl_t::CANCEL) {
-        ATRACE_NAME(String8::format("cancelIoctl #%u", channelId).c_str());
-        return mDrmDevice->CallVendorIoctl(DRM_IOCTL_EXYNOS_HISTOGRAM_CHANNEL_CANCEL,
-                                           (void *)&histogramRequest);
-    } else {
-        ALOGE("%s: unknown control %d", __func__, (int)control);
-        return BAD_VALUE;
-    }
-}
-#endif
diff --git a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h
index f654d4b..27a5b26 100644
--- a/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h
+++ b/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h
@@ -27,11 +27,6 @@
       : public gs201::ExynosPrimaryDisplayDrmInterfaceModule {
 public:
     ExynosPrimaryDisplayDrmInterfaceModule(ExynosDisplay *exynosDisplay);
-// TODO: b/295990513 - Remove the if defined after kernel prebuilts are merged.
-#if defined(EXYNOS_HISTOGRAM_CHANNEL_REQUEST)
-    virtual int32_t sendHistogramChannelIoctl(HistogramChannelIoctl_t control,
-                                              uint8_t channelId) const override;
-#endif
 };
 
 using ExynosExternalDisplayDrmInterfaceModule = gs201::ExynosExternalDisplayDrmInterfaceModule;