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_IHWC_H_
18 #define ANDROID_EXYNOS_IHWC_H_
19 
20 #include <stdint.h>
21 #include <sys/types.h>
22 #include <vector>
23 
24 #include <utils/Errors.h>
25 #include <utils/RefBase.h>
26 #include <binder/IInterface.h>
27 
28 namespace android {
29 
30 class IExynosHWCService : public IInterface {
31 public:
32 
33     DECLARE_META_INTERFACE(ExynosHWCService);
34 
35     virtual int addVirtualDisplayDevice() = 0;
36     virtual int destroyVirtualDisplayDevice() = 0;
37 
38     /*
39      * setWFDMode() function sets the WFD operation Mode.
40      * It enables / disables the WFD.
41      */
42     virtual int setWFDMode(unsigned int mode) = 0;
43     virtual int getWFDMode() = 0;
44     virtual int sendWFDCommand(int32_t cmd, int32_t ext1, int32_t ext2) = 0;
45     virtual int setSecureVDSMode(unsigned int mode) = 0;
46     virtual int setWFDOutputResolution(unsigned int width, unsigned int height) = 0;
47     virtual int getWFDOutputResolution(unsigned int* width, unsigned int* height) = 0;
48     virtual void setPresentationMode(bool use) = 0;
49     virtual int getPresentationMode(void) = 0;
50     virtual int setVDSGlesFormat(int format) = 0;
51     virtual int getExternalDisplayConfigs() = 0;
52     virtual int setExternalDisplayConfig(unsigned int index) = 0;
53     virtual int setExternalVsyncEnabled(unsigned int index) = 0;
54     virtual int getExternalHdrCapabilities() = 0;
55     virtual void setBootFinished(void) = 0;
56     virtual void enableMPP(uint32_t physicalType, uint32_t physicalIndex, uint32_t logicalIndex, uint32_t enable) = 0;
57     virtual void setScaleDownRatio(uint32_t physicalType, uint32_t physicalIndex,
58             uint32_t logicalIndex, uint32_t scaleDownRatio) = 0;
59     virtual void setHWCDebug(int debug) = 0;
60     virtual uint32_t getHWCDebug() = 0;
61     virtual void setHWCFenceDebug(uint32_t ipNum, uint32_t fenceNum, uint32_t mode) = 0;
62     virtual void getHWCFenceDebug() = 0;
63     virtual int setHWCCtl(uint32_t display, uint32_t ctrl, int32_t val) = 0;
64 
65     virtual int setDDIScaler(uint32_t display_id, uint32_t width, uint32_t height) = 0;
66 
67     virtual int32_t setDisplayDeviceMode(int32_t display_id, int32_t mode) = 0;
68     virtual int32_t setPanelGammaTableSource(int32_t display_id, int32_t type, int32_t source) = 0;
69     virtual void setLbeCtrl(uint32_t display_id, uint32_t state, uint32_t lux) = 0;
70     virtual int32_t setDisplayBrightness(int32_t display_id, float brightness) = 0;
71     virtual int32_t ignoreDisplayBrightnessUpdateRequests(int32_t displayId, bool ignore) = 0;
72     virtual int32_t setDisplayBrightnessNits(int32_t displayId, float nits) = 0;
73     virtual int32_t setDisplayBrightnessDbv(int32_t displayId, uint32_t dbv) = 0;
74     virtual int32_t setDisplayLhbm(int32_t display_id, uint32_t on) = 0;
75     virtual int32_t setMinIdleRefreshRate(uint32_t display_id, int32_t refresh_rate) = 0;
76     virtual int32_t setRefreshRateThrottle(uint32_t display_id, int32_t throttle) = 0;
77     virtual int32_t setDisplayRCDLayerEnabled(uint32_t displayIndex, bool enable) = 0;
78     virtual int32_t triggerDisplayIdleEnter(uint32_t displayIndex, uint32_t idleTeRefreshRate) = 0;
79     virtual int32_t setDisplayDbm(int32_t display_id, uint32_t on) = 0;
80     virtual int32_t setDisplayMultiThreadedPresent(const int32_t& displayId,
81                                                    const bool& enable) = 0;
82     virtual int32_t triggerRefreshRateIndicatorUpdate(uint32_t displayId, uint32_t refreshRate) = 0;
83     virtual int32_t dumpBuffers(uint32_t displayId, int32_t count) = 0;
84     virtual int32_t setPresentTimeoutController(uint32_t displayId, uint32_t controllerType) = 0;
85     virtual int32_t setPresentTimeoutParameters(
86             uint32_t displayId, int timeoutNs,
87             const std::vector<std::pair<uint32_t, uint32_t>>& settings) = 0;
88     virtual int32_t setFixedTe2Rate(uint32_t displayId, int32_t rateHz) = 0;
89 };
90 
91 /* Native Interface */
92 class BnExynosHWCService : public BnInterface<IExynosHWCService> {
93 public:
94     virtual status_t    onTransact( uint32_t code,
95                                     const Parcel& data,
96                                     Parcel* reply,
97                                     uint32_t flags = 0);
98 
99 };
100 }
101 #endif
102