hwcomposer_defs.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 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_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H
18 #define ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H
19 
20 #include <stdint.h>
21 #include <sys/cdefs.h>
22 
23 #include <hardware/gralloc.h>
24 #include <hardware/hardware.h>
25 #include <cutils/native_handle.h>
26 
27 __BEGIN_DECLS
28 
29 /*****************************************************************************/
30 
31 #define HWC_HEADER_VERSION 1
32 
33 #define HWC_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
34 
35 #define HWC_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION_2(1, 0, HWC_HEADER_VERSION)
36 #define HWC_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION_2(1, 1, HWC_HEADER_VERSION)
37 #define HWC_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION_2(1, 2, HWC_HEADER_VERSION)
38 #define HWC_DEVICE_API_VERSION_1_3 HARDWARE_DEVICE_API_VERSION_2(1, 3, HWC_HEADER_VERSION)
39 #define HWC_DEVICE_API_VERSION_1_4 HARDWARE_DEVICE_API_VERSION_2(1, 4, HWC_HEADER_VERSION)
40 
41 enum {
42  /* hwc_composer_device_t::set failed in EGL */
44 };
45 
46 /*
47  * hwc_layer_t::hints values
48  * Hints are set by the HAL and read by SurfaceFlinger
49  */
50 enum {
51  /*
52  * HWC can set the HWC_HINT_TRIPLE_BUFFER hint to indicate to SurfaceFlinger
53  * that it should triple buffer this layer. Typically HWC does this when
54  * the layer will be unavailable for use for an extended period of time,
55  * e.g. if the display will be fetching data directly from the layer and
56  * the layer can not be modified until after the next set().
57  */
58  HWC_HINT_TRIPLE_BUFFER = 0x00000001,
59 
60  /*
61  * HWC sets HWC_HINT_CLEAR_FB to tell SurfaceFlinger that it should clear the
62  * framebuffer with transparent pixels where this layer would be.
63  * SurfaceFlinger will only honor this flag when the layer has no blending
64  *
65  */
66  HWC_HINT_CLEAR_FB = 0x00000002
67 };
68 
69 /*
70  * hwc_layer_t::flags values
71  * Flags are set by SurfaceFlinger and read by the HAL
72  */
73 enum {
74  /*
75  * HWC_SKIP_LAYER is set by SurfaceFlnger to indicate that the HAL
76  * shall not consider this layer for composition as it will be handled
77  * by SurfaceFlinger (just as if compositionType was set to HWC_OVERLAY).
78  */
79  HWC_SKIP_LAYER = 0x00000001,
80 
81  /*
82  * HWC_IS_CURSOR_LAYER is set by surfaceflinger to indicate that this
83  * layer is being used as a cursor on this particular display, and that
84  * surfaceflinger can potentially perform asynchronous position updates for
85  * this layer. If a call to prepare() returns HWC_CURSOR_OVERLAY for the
86  * composition type of this layer, then the hwcomposer will allow async
87  * position updates to this layer via setCursorPositionAsync().
88  */
89  HWC_IS_CURSOR_LAYER = 0x00000002
90 };
91 
92 /*
93  * hwc_layer_t::compositionType values
94  */
95 enum {
96  /* this layer is to be drawn into the framebuffer by SurfaceFlinger */
98 
99  /* this layer will be handled in the HWC */
101 
102  /* this is the background layer. it's used to set the background color.
103  * there is only a single background layer */
105 
106  /* this layer holds the result of compositing the HWC_FRAMEBUFFER layers.
107  * Added in HWC_DEVICE_API_VERSION_1_1. */
109 
110  /* this layer's contents are taken from a sideband buffer stream.
111  * Added in HWC_DEVICE_API_VERSION_1_4. */
113 
114  /* this layer's composition will be handled by hwcomposer by dedicated
115  cursor overlay hardware. hwcomposer will also all async position updates
116  of this layer outside of the normal prepare()/set() loop. Added in
117  HWC_DEVICE_API_VERSION_1_4. */
119  };
120 /*
121  * hwc_layer_t::blending values
122  */
123 enum {
124  /* no blending */
126 
127  /* ONE / ONE_MINUS_SRC_ALPHA */
129 
130  /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */
132 };
133 
134 /*
135  * hwc_layer_t::transform values
136  */
137 enum {
138  /* flip source image horizontally */
139  HWC_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H,
140  /* flip source image vertically */
141  HWC_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
142  /* rotate source image 90 degrees clock-wise */
143  HWC_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
144  /* rotate source image 180 degrees */
145  HWC_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
146  /* rotate source image 270 degrees clock-wise */
147  HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
148 };
149 
150 /* attributes queriable with query() */
151 enum {
152  /*
153  * Must return 1 if the background layer is supported, 0 otherwise.
154  */
156 
157  /*
158  * Returns the vsync period in nanoseconds.
159  *
160  * This query is not used for HWC_DEVICE_API_VERSION_1_1 and later.
161  * Instead, the per-display attribute HWC_DISPLAY_VSYNC_PERIOD is used.
162  */
164 
165  /*
166  * Availability: HWC_DEVICE_API_VERSION_1_1
167  * Returns a mask of supported display types.
168  */
170 };
171 
172 /* display attributes returned by getDisplayAttributes() */
173 enum {
174  /* Indicates the end of an attribute list */
176 
177  /* The vsync period in nanoseconds */
179 
180  /* The number of pixels in the horizontal and vertical directions. */
183 
184  /* The number of pixels per thousand inches of this configuration.
185  *
186  * Scaling DPI by 1000 allows it to be stored in an int without losing
187  * too much precision.
188  *
189  * If the DPI for a configuration is unavailable or the HWC implementation
190  * considers it unreliable, it should set these attributes to zero.
191  */
194 };
195 
196 /* Allowed events for hwc_methods::eventControl() */
197 enum {
199 };
200 
201 /* Display types and associated mask bits. */
202 enum {
204  HWC_DISPLAY_EXTERNAL = 1, // HDMI, DP, etc.
206 
209 };
210 
211 enum {
215 };
216 
217 /* Display power modes */
218 enum {
219  /* The display is turned off (blanked). */
221  /* The display is turned on and configured in a low power state
222  * that is suitable for presenting ambient information to the user,
223  * possibly with lower fidelity than normal but greater efficiency. */
225  /* The display is turned on normally. */
227  /* The display is configured as in HWC_POWER_MODE_DOZE but may
228  * stop applying frame buffer updates from the graphics subsystem.
229  * This power mode is effectively a hint from the doze dream to
230  * tell the hardware that it is done drawing to the display for the
231  * time being and that the display should remain on in a low power
232  * state and continue showing its current contents indefinitely
233  * until the mode changes.
234  *
235  * This mode may also be used as a signal to enable hardware-based doze
236  * functionality. In this case, the doze dream is effectively
237  * indicating that the hardware is free to take over the display
238  * and manage it autonomously to implement low power always-on display
239  * functionality. */
241 };
242 
243 /*****************************************************************************/
244 
245 __END_DECLS
246 
247 #endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H */