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 <sys/types.h>
21 #include <hardware/hwcomposer2.h>
22 #include <utils/Errors.h>
23 #include "ExynosHWCHelper.h"
24 
25 class ExynosDisplay;
26 
27 using namespace android;
28 class ExynosDisplayInterface {
29     protected:
30         ExynosDisplay *mExynosDisplay = NULL;
31     public:
32         virtual ~ExynosDisplayInterface();
init(ExynosDisplay * __unused exynosDisplay)33         virtual void init(ExynosDisplay* __unused exynosDisplay) {};
setPowerMode(int32_t __unused mode)34         virtual int32_t setPowerMode(int32_t __unused mode) {return NO_ERROR;};
setLowPowerMode()35         virtual int32_t setLowPowerMode() { return HWC2_ERROR_UNSUPPORTED; };
isDozeModeAvailable()36         virtual bool isDozeModeAvailable() const { return false; };
setVsyncEnabled(uint32_t __unused enabled)37         virtual int32_t setVsyncEnabled(uint32_t __unused enabled) {return NO_ERROR;};
38         virtual int32_t getDisplayConfigs(
39                 uint32_t* outNumConfigs,
40                 hwc2_config_t* outConfigs);
dumpDisplayConfigs()41         virtual void dumpDisplayConfigs() {};
supportDataspace(int32_t __unused dataspace)42         virtual bool supportDataspace(int32_t __unused dataspace) { return true; };
43         virtual int32_t getColorModes(uint32_t* outNumModes, int32_t* outModes);
setColorMode(int32_t __unused mode)44         virtual int32_t setColorMode(int32_t __unused mode) {return NO_ERROR;};
setActiveConfig(hwc2_config_t __unused config)45         virtual int32_t setActiveConfig(hwc2_config_t __unused config) {return NO_ERROR;};
46         virtual int32_t setActiveConfigWithConstraints(
47                 hwc2_config_t __unused config, bool __unused test = false)
48         {return NO_ERROR;};
49         virtual int32_t getDisplayVsyncPeriod(hwc2_vsync_period_t* outVsyncPeriod);
getConfigChangeDuration()50         virtual int32_t getConfigChangeDuration() {return 0;};
setCursorPositionAsync(uint32_t __unused x_pos,uint32_t __unused y_pos)51         virtual int32_t setCursorPositionAsync(uint32_t __unused x_pos,
52                 uint32_t __unused y_pos) {return NO_ERROR;};
53         virtual int32_t updateHdrCapabilities();
deliverWinConfigData()54         virtual int32_t deliverWinConfigData() {return NO_ERROR;};
55         virtual int32_t clearDisplay(bool __unused needModeClear = false) {return NO_ERROR;};
disableSelfRefresh(uint32_t __unused disable)56         virtual int32_t disableSelfRefresh(uint32_t __unused disable) {return NO_ERROR;};
setForcePanic()57         virtual int32_t setForcePanic() {return NO_ERROR;};
getDisplayFd()58         virtual int getDisplayFd() {return -1;};
getMaxWindowNum()59         virtual uint32_t getMaxWindowNum() {return 0;};
setColorTransform(const float * __unused matrix,int32_t __unused hint)60         virtual int32_t setColorTransform(const float* __unused matrix,
61                 int32_t __unused hint) {return HWC2_ERROR_UNSUPPORTED;}
getRenderIntents(int32_t __unused mode,uint32_t * __unused outNumIntents,int32_t * __unused outIntents)62         virtual int32_t getRenderIntents(int32_t __unused mode, uint32_t* __unused outNumIntents,
63                 int32_t* __unused outIntents) {return 0;}
setColorModeWithRenderIntent(int32_t __unused mode,int32_t __unused intent)64         virtual int32_t setColorModeWithRenderIntent(int32_t __unused mode, int32_t __unused intent) {return 0;}
65         virtual int32_t getReadbackBufferAttributes(int32_t* /*android_pixel_format_t*/ outFormat,
66                 int32_t* /*android_dataspace_t*/ outDataspace);
67         /* HWC 2.3 APIs */
getDisplayIdentificationData(uint8_t * __unused outPort,uint32_t * __unused outDataSize,uint8_t * __unused outData)68         virtual int32_t getDisplayIdentificationData(uint8_t* __unused outPort,
69                 uint32_t* __unused outDataSize, uint8_t* __unused outData) {return 0;}
70 
71         /* frameUpdate: true if the brightness change needs to sync with next frame update */
updateBrightness(bool __unused syncFrame)72         virtual int32_t updateBrightness(bool __unused syncFrame) { return HWC2_ERROR_UNSUPPORTED; }
getSdrDimRatio()73         virtual float getSdrDimRatio() { return 1.0; }
74         bool isPrimary();
75         /* For HWC 2.4 APIs */
getVsyncAppliedTime(hwc2_config_t __unused config,int64_t * __unused actualChangeTime)76         virtual int32_t getVsyncAppliedTime(hwc2_config_t __unused config, int64_t* __unused actualChangeTime) {return NO_ERROR;}
destroyLayer(ExynosLayer * __unused layer)77         virtual void destroyLayer(ExynosLayer* __unused layer){};
78 
waitVBlank()79         virtual int32_t waitVBlank() { return 0; };
80     public:
81         uint32_t mType = INTERFACE_TYPE_NONE;
82 };
83 
84 #endif
85