OSDN Git Service

Fix MosaicDisplay.
[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 #include <hwcrect.h>
23
24 #include <vector>
25 #include <unordered_map>
26
27 namespace hwcomposer {
28
29 template <typename T>
30 using HwcRect = Rect<T>;
31
32 typedef std::vector<HwcRect<int>> HwcRegion;
33
34 enum class HWCBlending : int32_t {
35   kBlendingNone = 0x0100,
36   kBlendingPremult = 0x0105,
37   kBlendingCoverage = 0x0405,
38 };
39
40 enum HWCTransform {
41   kIdentity = 0,
42   kReflectX = 1 << 0,
43   kReflectY = 1 << 1,
44   kTransform90 = 1 << 2,
45   kTransform180 = 1 << 3,
46   kTransform270 = 1 << 4,
47   kTransform45 = kTransform90 | kReflectY,
48   kTransform135 = kTransform90 | kReflectX,
49   kMaxTransform = 8
50 };
51
52 enum HWCRotation {
53   kRotateNone = 0,
54   kRotate90,
55   kRotate180,
56   kRotate270,
57   kMaxRotate
58 };
59
60 enum HWCLayerType {
61   kLayerNormal = 0,
62   kLayerCursor = 1,
63   kLayerProtected = 2,
64   kLayerVideo = 3
65 };
66
67 enum class HWCDisplayAttribute : int32_t {
68   kWidth = 1,
69   kHeight = 2,
70   kRefreshRate = 3,
71   kDpiX = 4,
72   kDpiY = 5
73 };
74
75 enum class DisplayType : int32_t {
76   kInternal = 0,
77   kExternal = 1,
78   kVirtual = 2,
79   kLogical = 3,
80   kMosaic = 4,
81   kNested = 5
82 };
83
84 enum DisplayPowerMode {
85   kOff = 0,         // Display is off
86   kDoze = 1,        // Display is off and used by the app during any inactivity
87                     // when the device is on battery
88   kOn = 2,          // Display is on
89   kDozeSuspend = 3  // Dispaly in low power mode and stop applying
90                     // updates from the client
91 };
92
93 enum HWCColorTransform {
94   kIdentical = 0,       // Applies no transform to the output color
95   kArbitraryMatrix = 1  // Applies an arbitrary transform defined by a 4x4 affine matrix
96 };
97
98 enum class HWCColorControl : int32_t {
99   kColorHue = 0,
100   kColorSaturation = 1,
101   kColorBrightness = 2,
102   kColorContrast = 3,
103   kColorSharpness = 4
104 };
105
106 struct EnumClassHash {
107   template <typename T>
108   std::size_t operator()(T t) const {
109     return static_cast<std::size_t>(t);
110   }
111 };
112
113 struct HWCColorProp {
114   float value_ = 0.0;
115   bool use_default_ = true;
116 };
117
118 using HWCColorMap =
119     std::unordered_map<HWCColorControl, HWCColorProp, EnumClassHash>;
120
121 }  // namespace hwcomposer
122 #endif  // PUBLIC_HWCDEFS_H_