1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef EXYNOS_DISPLAY_DRM_INTERFACE_MODULE_GS201_H 18 #define EXYNOS_DISPLAY_DRM_INTERFACE_MODULE_GS201_H 19 20 #include <drm/samsung_drm.h> 21 22 #include "../../gs101/libhwc2.1/libdisplayinterface/ExynosDisplayDrmInterfaceModule.h" 23 24 namespace gs201 { 25 26 using namespace displaycolor; 27 28 class ExynosDisplayDrmInterfaceModule : public gs101::ExynosDisplayDrmInterfaceModule { 29 static constexpr size_t sizeCgcDmaLut = 2 * 3 * DRM_SAMSUNG_CGC_DMA_LUT_ENTRY_CNT; // 16bit BGR 30 static constexpr int32_t disabledCgc = -1; 31 static constexpr size_t sizeCgCDataInfo = 2; 32 using GsInterfaceType = gs::ColorDrmBlobFactory::GsInterfaceType; 33 public: 34 ExynosDisplayDrmInterfaceModule(ExynosDisplay *exynosDisplay); 35 virtual ~ExynosDisplayDrmInterfaceModule(); 36 virtual int32_t initDrmDevice(DrmDevice *drmDevice); 37 38 virtual int32_t setDisplayColorSetting( 39 ExynosDisplayDrmInterface::DrmModeAtomicReq &drmReq); 40 41 /* For Histogram */ 42 virtual int32_t setDisplayHistogramSetting( 43 ExynosDisplayDrmInterface::DrmModeAtomicReq &drmReq) override; 44 virtual void registerHistogramInfo(const std::shared_ptr<IDLHistogram> &info) override; 45 46 private: 47 int32_t createCgcDMAFromIDqe(const GsInterfaceType::IDqe::CgcData &cgcData); 48 int32_t setCgcLutDmaProperty(const DrmProperty &prop, 49 ExynosDisplayDrmInterface::DrmModeAtomicReq &drmReq); 50 /* For Histogram */ 51 int32_t setHistoPosProperty( 52 const DrmProperty &prop, 53 ExynosDisplayDrmInterface::DrmModeAtomicReq &drmReq); 54 55 bool mCgcEnabled = false; 56 57 using CGCDataInfo = std::pair<int32_t, struct cgc_dma_lut *>; 58 std::vector<CGCDataInfo> mCGCDataInfos; 59 size_t iCGCDataInfo = 0; 60 }; 61 62 class ExynosPrimaryDisplayDrmInterfaceModule : public ExynosDisplayDrmInterfaceModule { 63 public: 64 ExynosPrimaryDisplayDrmInterfaceModule(ExynosDisplay *exynosDisplay); 65 virtual ~ExynosPrimaryDisplayDrmInterfaceModule(); 66 }; 67 68 using ExynosExternalDisplayDrmInterfaceModule = gs101::ExynosExternalDisplayDrmInterfaceModule; 69 70 } // namespace gs201 71 72 #endif // EXYNOS_DISPLAY_DRM_INTERFACE_MODULE_GS201_H 73