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 EXYNOS_EXTERNAL_DISPLAY_H
18 #define EXYNOS_EXTERNAL_DISPLAY_H
19 
20 #include "ExynosDisplay.h"
21 #include <cutils/properties.h>
22 
23 #define EXTERNAL_DISPLAY_SKIP_LAYER   0x00000100
24 #define SKIP_EXTERNAL_FRAME 5
25 
26 class ExynosExternalDisplay : public ExynosDisplay {
27     public:
28         hwc2_config_t mActiveConfigIndex;
29 
30         /* Methods */
31         ExynosExternalDisplay(uint32_t index, ExynosDevice *device);
32         ~ExynosExternalDisplay();
33 
34         virtual void init();
35         virtual void deInit();
36 
37         int getDisplayConfigs(uint32_t* outNumConfigs, hwc2_config_t* outConfigs);
38         virtual int enable();
39         int disable();
40         void hotplug();
41 
42         /* validateDisplay(..., outNumTypes, outNumRequests)
43          * Descriptor: HWC2_FUNCTION_VALIDATE_DISPLAY
44          * HWC2_PFN_VALIDATE_DISPLAY
45          */
46         virtual int32_t validateDisplay(uint32_t* outNumTypes, uint32_t* outNumRequests);
47         virtual int32_t canSkipValidate();
48         virtual int32_t presentDisplay(int32_t* outRetireFence);
49         virtual int openExternalDisplay();
50         virtual void closeExternalDisplay();
51         virtual int32_t getActiveConfig(hwc2_config_t* outconfig);
52         virtual int32_t startPostProcessing();
53         virtual int32_t setClientTarget(
54                 buffer_handle_t target,
55                 int32_t acquireFence, int32_t /*android_dataspace_t*/ dataspace);
56         virtual int32_t setPowerMode(int32_t /*hwc2_power_mode_t*/ mode);
57         virtual void initDisplayInterface(uint32_t interfaceType);
58         bool checkRotate();
59         bool handleRotate();
60         virtual void handleHotplugEvent();
61 
62         bool mEnabled;
63         bool mBlanked;
64         bool mVirtualDisplayState;
65         bool mIsSkipFrame;
66         int mExternalHdrSupported;
67         bool mHpdStatus;
68         Mutex mExternalMutex;
69 
70         int mSkipFrameCount;
71         int mSkipStartFrame;
72     protected:
73         int getDVTimingsIndex(int preset);
74         virtual bool getHDRException(ExynosLayer *layer);
75     private:
76 };
77 
78 #endif
79 
80