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 void 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 width, uint32_t height); 69 virtual void setLbeCtrl(uint32_t display_id, uint32_t state, uint32_t lux) override; 70 #if 0 71 void setPSRExitCallback(void (*callback)(exynos_hwc_composer_device_1_t *)); 72 virtual void notifyPSRExit(); 73 #endif 74 virtual int32_t setDisplayDeviceMode(int32_t display_id, int32_t mode); 75 virtual int32_t setPanelGammaTableSource(int32_t display_id, int32_t type, int32_t source); 76 virtual int32_t setDisplayBrightness(int32_t display_id, float brightness); 77 virtual int32_t setDisplayLhbm(int32_t display_id, uint32_t on); 78 79 virtual int32_t setMinIdleRefreshRate(uint32_t display_id, int32_t fps); 80 virtual int32_t setRefreshRateThrottle(uint32_t display_id, int32_t delayMs); 81 82 private: 83 friend class Singleton<ExynosHWCService>; 84 ExynosHWCService(); 85 int createServiceLocked(); 86 ExynosHWCService *mHWCService; 87 Mutex mLock; 88 ExynosHWCCtx *mHWCCtx; 89 void (*bootFinishedCallback)(ExynosHWCCtx *); 90 void (*doPSRExit)(ExynosHWCCtx *ctx); 91 }; 92 93 } 94 #endif 95