1 /* 2 * Copyright (C) 2012 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 ANDROID_EXYNOS_HWC_SERVICE_H_ 18 #define ANDROID_EXYNOS_HWC_SERVICE_H_ 19 20 #include <utils/Errors.h> 21 #include <sys/types.h> 22 #include <log/log.h> 23 #include <binder/IServiceManager.h> 24 #include <utils/Singleton.h> 25 #include <utils/StrongPointer.h> 26 #include "IExynosHWC.h" 27 #include "ExynosHWC.h" 28 29 typedef struct exynos_hwc2_device_t ExynosHWCCtx; 30 31 namespace android { 32 33 class ExynosHWCService 34 : public BnExynosHWCService, Singleton<ExynosHWCService> { 35 36 public: 37 static ExynosHWCService* getExynosHWCService(); 38 ~ExynosHWCService(); 39 virtual void setExynosHWCCtx(ExynosHWCCtx *); 40 41 virtual int addVirtualDisplayDevice(); 42 virtual int destroyVirtualDisplayDevice(); 43 virtual int setWFDMode(unsigned int mode); 44 virtual int getWFDMode(); 45 virtual int sendWFDCommand(int32_t cmd, int32_t ext1, int32_t ext2); 46 virtual int setSecureVDSMode(unsigned int mode); 47 virtual int setWFDOutputResolution(unsigned int width, unsigned int height); 48 virtual int getWFDOutputResolution(unsigned int* width, unsigned int* height); 49 virtual void setPresentationMode(bool use); 50 virtual int getPresentationMode(void); 51 virtual int setVDSGlesFormat(int format); 52 53 virtual int getExternalDisplayConfigs(); 54 virtual int setExternalDisplayConfig(unsigned int index); 55 virtual int setExternalVsyncEnabled(unsigned int index); 56 virtual int getExternalHdrCapabilities(); 57 void setBootFinishedCallback(void (*callback)(ExynosHWCCtx *)); 58 virtual void setBootFinished(void); 59 virtual void enableMPP(uint32_t physicalType, uint32_t physicalIndex, uint32_t logicalIndex, uint32_t enable); 60 virtual void setScaleDownRatio(uint32_t physicalType, uint32_t physicalIndex, 61 uint32_t logicalIndex, uint32_t scaleDownRatio); 62 virtual void setHWCDebug(int debug); 63 virtual uint32_t getHWCDebug(); 64 virtual void setHWCFenceDebug(uint32_t ipNum, uint32_t fenceNum, uint32_t mode); 65 virtual void getHWCFenceDebug(); 66 virtual int setHWCCtl(uint32_t display, uint32_t ctrl, int32_t val); 67 68 virtual int setDDIScaler(uint32_t display_id, uint32_t width, uint32_t height); 69 virtual void setLbeCtrl(uint32_t display_id, uint32_t state, uint32_t lux) override; 70 virtual int32_t setDisplayDeviceMode(int32_t display_id, int32_t mode); 71 virtual int32_t setPanelGammaTableSource(int32_t display_id, int32_t type, int32_t source); 72 virtual int32_t setDisplayBrightness(int32_t display_id, float brightness); 73 virtual int32_t ignoreDisplayBrightnessUpdateRequests(int32_t displayId, bool ignore); 74 virtual int32_t setDisplayBrightnessNits(const int32_t display_id, const float nits); 75 virtual int32_t setDisplayBrightnessDbv(const int32_t display_id, const uint32_t dbv); 76 virtual int32_t setDisplayLhbm(int32_t display_id, uint32_t on); 77 78 virtual int32_t setMinIdleRefreshRate(uint32_t display_id, int32_t fps); 79 virtual int32_t setRefreshRateThrottle(uint32_t display_id, int32_t delayMs); 80 virtual int32_t setDisplayDbm(int32_t display_id, uint32_t on); 81 82 int32_t setDisplayRCDLayerEnabled(uint32_t displayIndex, bool enable) override; 83 int32_t triggerDisplayIdleEnter(uint32_t displayIndex, uint32_t idleTeRefreshRate) override; 84 85 virtual int32_t setDisplayMultiThreadedPresent(const int32_t& display_id, 86 const bool& enable) override; 87 virtual int32_t triggerRefreshRateIndicatorUpdate(uint32_t displayId, 88 uint32_t refreshRate) override; 89 virtual int32_t dumpBuffers(uint32_t displayId, int32_t count) override; 90 91 int32_t setPresentTimeoutController(uint32_t displayId, uint32_t controllerType) override; 92 93 int32_t setPresentTimeoutParameters(uint32_t displayId, int __unused timeoutNs, 94 const std::vector<std::pair<uint32_t, uint32_t>>& __unused 95 settings) override; 96 virtual int32_t setFixedTe2Rate(uint32_t displayId, int32_t rateHz); 97 98 private: 99 friend class Singleton<ExynosHWCService>; 100 ExynosHWCService(); 101 int createServiceLocked(); 102 ExynosHWCService *mHWCService; 103 Mutex mLock; 104 ExynosHWCCtx *mHWCCtx; 105 void (*bootFinishedCallback)(ExynosHWCCtx *); 106 }; 107 108 } 109 #endif 110