OSDN Git Service

Supporting Planes Reservation
[android-x86/external-IA-Hardware-Composer.git] / public / hwcdefs.h
1 /*
2 // Copyright (c) 2016 Intel Corporation
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 PUBLIC_HWCDEFS_H_
18 #define PUBLIC_HWCDEFS_H_
19
20 #include <stdint.h>
21
22 #ifdef __cplusplus
23 #include <hwcrect.h>
24
25 #include <unordered_map>
26 #include <vector>
27
28 namespace hwcomposer {
29
30 template <typename T>
31 using HwcRect = Rect<T>;
32
33 typedef std::vector<HwcRect<int>> HwcRegion;
34
35 enum class HWCBlending : int32_t {
36   kBlendingNone = 0x0100,
37   kBlendingPremult = 0x0105,
38   kBlendingCoverage = 0x0405,
39 };
40
41 // Enumerations for content protection.
42 enum HWCContentProtection {
43   kUnSupported = 0,  // Content Protection is not supported.
44   kUnDesired = 1,    // Content Protection is not required.
45   kDesired = 2       // Content Protection is desired.
46 };
47
48 enum HWCContentType {
49   kInvalid,        // Used when disabling HDCP.
50   kCONTENT_TYPE0,  // Can support any HDCP specifiction.
51   kCONTENT_TYPE1,  // Can support only HDCP 2.2 and higher specification.
52 };
53
54 enum HWCTransform : uint32_t {
55   kIdentity = 0,
56   kReflectX = 1 << 0,
57   kReflectY = 1 << 1,
58   kTransform90 = 1 << 2,
59   kTransform180 = 1 << 3,
60   kTransform270 = 1 << 4,
61   kTransform45 = kTransform90 | kReflectY,
62   kTransform135 = kTransform90 | kReflectX,
63   kMaxTransform = 8
64 };
65
66 enum HWCRotation {
67   kRotateNone = 0,
68   kRotate90,
69   kRotate180,
70   kRotate270,
71   kMaxRotate
72 };
73
74 enum HWCLayerType {
75   kLayerNormal = 0,
76   kLayerCursor = 1,
77   kLayerProtected = 2,
78   kLayerVideo = 3,
79   kLayerSolidColor = 4,
80 };
81
82 enum class HWCDisplayAttribute : int32_t {
83   kWidth = 1,
84   kHeight = 2,
85   kRefreshRate = 3,
86   kDpiX = 4,
87   kDpiY = 5
88 };
89
90 enum class DisplayType : int32_t {
91   kInternal = 0,
92   kExternal = 1,
93   kVirtual = 2,
94   kLogical = 3,
95   kMosaic = 4,
96 };
97 #endif  //__cplusplus
98
99 enum DisplayPowerMode {
100   kOff = 0,         // Display is off
101   kDoze = 1,        // Display is off and used by the app during any inactivity
102                     // when the device is on battery
103   kOn = 2,          // Display is on
104   kDozeSuspend = 3  // Dispaly in low power mode and stop applying
105                     // updates from the client
106 };
107
108 enum HWCColorTransform {
109   // Applies no transform to the output color
110   kIdentical = 0,
111   // Applies an arbitrary transform defined by a 4x4 affine matrix
112   kArbitraryMatrix = 1
113 };
114
115 #ifdef __cplusplus
116 enum class HWCColorControl : int32_t {
117   kColorHue = 0,
118   kColorSaturation = 1,
119   kColorBrightness = 2,
120   kColorContrast = 3,
121   kColorSharpness = 4
122 };
123
124 enum class HWCDeinterlaceFlag : int32_t {
125   kDeinterlaceFlagNone = 0,
126   kDeinterlaceFlagForce = 1,
127   kDeinterlaceFlagAuto = 2
128 };
129
130 enum class HWCDeinterlaceControl : int32_t {
131   kDeinterlaceNone = 0,
132   kDeinterlaceBob = 1,
133   kDeinterlaceWeave = 2,
134   kDeinterlaceMotionAdaptive = 3,
135   kDeinterlaceMotionCompensated = 4
136 };
137
138 enum class HWCScalingRunTimeSetting : int32_t {
139   kScalingModeNone = 0,        // use default scaling mode.
140   kScalingModeFast = 1,        // use fast scaling mode.
141   kScalingModeHighQuality = 2  // use high quality scaling mode.
142 };
143
144 struct EnumClassHash {
145   template <typename T>
146   std::size_t operator()(T t) const {
147     return static_cast<std::size_t>(t);
148   }
149 };
150
151 struct HWCColorProp {
152   float value_ = 0.0;
153   bool use_default_ = true;
154 };
155
156 struct HWCDeinterlaceProp {
157   HWCDeinterlaceFlag flag_;
158   HWCDeinterlaceControl mode_;
159 };
160
161 using HWCColorMap =
162     std::unordered_map<HWCColorControl, HWCColorProp, EnumClassHash>;
163
164 }  // namespace hwcomposer
165 #endif  // __cplusplus
166
167 #endif  // PUBLIC_HWCDEFS_H_