1 /* 2 * Copyright (C) 2019 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 _EXYNOSDISPLAYINTERFACE_H 18 #define _EXYNOSDISPLAYINTERFACE_H 19 20 #include <hardware/hwcomposer2.h> 21 #include <sys/types.h> 22 #include <utils/Errors.h> 23 24 #include "../libvrr/VariableRefreshRateVersion.h" 25 #include "ExynosHWCHelper.h" 26 27 class ExynosDisplay; 28 29 struct XrrSettings; 30 typedef struct XrrSettings XrrSettings_t; 31 32 using namespace android; 33 class ExynosDisplayInterface { 34 protected: 35 ExynosDisplay *mExynosDisplay = NULL; 36 public: 37 virtual ~ExynosDisplayInterface(); init(ExynosDisplay * __unused exynosDisplay)38 virtual void init(ExynosDisplay* __unused exynosDisplay) {}; setPowerMode(int32_t __unused mode)39 virtual int32_t setPowerMode(int32_t __unused mode) {return NO_ERROR;}; setLowPowerMode()40 virtual int32_t setLowPowerMode() { return HWC2_ERROR_UNSUPPORTED; }; isDozeModeAvailable()41 virtual bool isDozeModeAvailable() const { return false; }; setVsyncEnabled(uint32_t __unused enabled)42 virtual int32_t setVsyncEnabled(uint32_t __unused enabled) {return NO_ERROR;}; 43 virtual int32_t getDisplayConfigs( 44 uint32_t* outNumConfigs, 45 hwc2_config_t* outConfigs); dumpDisplayConfigs()46 virtual void dumpDisplayConfigs() {}; supportDataspace(int32_t __unused dataspace)47 virtual bool supportDataspace(int32_t __unused dataspace) { return true; }; 48 virtual int32_t getColorModes(uint32_t* outNumModes, int32_t* outModes); setColorMode(int32_t __unused mode)49 virtual int32_t setColorMode(int32_t __unused mode) {return NO_ERROR;}; setActiveConfig(hwc2_config_t __unused config)50 virtual int32_t setActiveConfig(hwc2_config_t __unused config) {return NO_ERROR;}; 51 virtual int32_t setActiveConfigWithConstraints( 52 hwc2_config_t __unused config, bool __unused test = false) 53 {return NO_ERROR;}; 54 virtual int32_t getDisplayVsyncPeriod(hwc2_vsync_period_t* outVsyncPeriod); getConfigChangeDuration()55 virtual int32_t getConfigChangeDuration() {return 0;}; needRefreshOnLP()56 virtual bool needRefreshOnLP() { return false; }; setCursorPositionAsync(uint32_t __unused x_pos,uint32_t __unused y_pos)57 virtual int32_t setCursorPositionAsync(uint32_t __unused x_pos, 58 uint32_t __unused y_pos) {return NO_ERROR;}; 59 virtual int32_t updateHdrCapabilities(); deliverWinConfigData()60 virtual int32_t deliverWinConfigData() {return NO_ERROR;}; 61 virtual int32_t clearDisplay(bool __unused needModeClear = false) {return NO_ERROR;}; triggerClearDisplayPlanes()62 virtual int32_t triggerClearDisplayPlanes() { return NO_ERROR; } disableSelfRefresh(uint32_t __unused disable)63 virtual int32_t disableSelfRefresh(uint32_t __unused disable) {return NO_ERROR;}; setForcePanic()64 virtual int32_t setForcePanic() {return NO_ERROR;}; getDisplayFd()65 virtual int getDisplayFd() {return -1;}; getMaxWindowNum()66 virtual uint32_t getMaxWindowNum() {return 0;}; setColorTransform(const float * __unused matrix,int32_t __unused hint)67 virtual int32_t setColorTransform(const float* __unused matrix, 68 int32_t __unused hint) {return HWC2_ERROR_UNSUPPORTED;} getRenderIntents(int32_t __unused mode,uint32_t * __unused outNumIntents,int32_t * __unused outIntents)69 virtual int32_t getRenderIntents(int32_t __unused mode, uint32_t* __unused outNumIntents, 70 int32_t* __unused outIntents) {return 0;} setColorModeWithRenderIntent(int32_t __unused mode,int32_t __unused intent)71 virtual int32_t setColorModeWithRenderIntent(int32_t __unused mode, int32_t __unused intent) {return 0;} 72 virtual int32_t getReadbackBufferAttributes(int32_t* /*android_pixel_format_t*/ outFormat, 73 int32_t* /*android_dataspace_t*/ outDataspace); 74 /* HWC 2.3 APIs */ getDisplayIdentificationData(uint8_t * __unused outPort,uint32_t * __unused outDataSize,uint8_t * __unused outData)75 virtual int32_t getDisplayIdentificationData(uint8_t* __unused outPort, 76 uint32_t* __unused outDataSize, uint8_t* __unused outData) {return 0;} 77 bool isPrimary(); 78 /* For HWC 2.4 APIs */ getVsyncAppliedTime(hwc2_config_t __unused config,int64_t * __unused actualChangeTime)79 virtual int32_t getVsyncAppliedTime(hwc2_config_t __unused config, int64_t* __unused actualChangeTime) {return NO_ERROR;} destroyLayer(ExynosLayer * __unused layer)80 virtual void destroyLayer(ExynosLayer* __unused layer){}; 81 /* For HWC 3.0 APIs */ getDisplayIdleTimerSupport(bool & outSupport)82 virtual int32_t getDisplayIdleTimerSupport(bool& outSupport) { 83 outSupport = false; 84 return NO_ERROR; 85 } getDefaultModeId(int32_t * __unused modeId)86 virtual int32_t getDefaultModeId(int32_t* __unused modeId) { 87 return HWC2_ERROR_UNSUPPORTED; 88 } getActiveModeId()89 virtual uint32_t getActiveModeId() { return UINT_MAX; } 90 waitVBlank()91 virtual int32_t waitVBlank() { return 0; }; 92 readHotplugStatus()93 virtual bool readHotplugStatus() { return true; }; readHotplugErrorCode()94 virtual int readHotplugErrorCode() { return 0; }; resetHotplugErrorCode()95 virtual void resetHotplugErrorCode(){}; 96 97 virtual void setXrrSettings(const XrrSettings_t& __unused settings); 98 setManufacturerInfo(uint8_t __unused edid8,uint8_t __unused edid9)99 virtual void setManufacturerInfo(uint8_t __unused edid8, uint8_t __unused edid9){}; getManufacturerInfo()100 virtual uint32_t getManufacturerInfo() { return 0; } setProductId(uint8_t __unused edid10,uint8_t __unused edid11)101 virtual void setProductId(uint8_t __unused edid10, uint8_t __unused edid11){}; getProductId()102 virtual uint32_t getProductId() { return 0; } 103 swapCrtcs(ExynosDisplay * anotherDisplay)104 virtual int32_t swapCrtcs(ExynosDisplay* anotherDisplay) { return HWC2_ERROR_UNSUPPORTED; } borrowedCrtcFrom()105 virtual ExynosDisplay* borrowedCrtcFrom() { return nullptr; } clearOldCrtcBlobs()106 virtual void clearOldCrtcBlobs() {} 107 uncacheLayerBuffers(const ExynosLayer * layer,const std::vector<buffer_handle_t> & buffers)108 virtual int32_t uncacheLayerBuffers(const ExynosLayer* layer, 109 const std::vector<buffer_handle_t>& buffers) { 110 return NO_ERROR; 111 } 112 113 public: 114 uint32_t mType = INTERFACE_TYPE_NONE; 115 }; 116 117 #endif 118