Android Hardware Abstraction Layer
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 
40 enum {
41  /* hwc_composer_device_t::set failed in EGL */
43 };
44 
45 /*
46  * hwc_layer_t::hints values
47  * Hints are set by the HAL and read by SurfaceFlinger
48  */
49 enum {
50  /*
51  * HWC can set the HWC_HINT_TRIPLE_BUFFER hint to indicate to SurfaceFlinger
52  * that it should triple buffer this layer. Typically HWC does this when
53  * the layer will be unavailable for use for an extended period of time,
54  * e.g. if the display will be fetching data directly from the layer and
55  * the layer can not be modified until after the next set().
56  */
57  HWC_HINT_TRIPLE_BUFFER = 0x00000001,
58 
59  /*
60  * HWC sets HWC_HINT_CLEAR_FB to tell SurfaceFlinger that it should clear the
61  * framebuffer with transparent pixels where this layer would be.
62  * SurfaceFlinger will only honor this flag when the layer has no blending
63  *
64  */
65  HWC_HINT_CLEAR_FB = 0x00000002
66 };
67 
68 /*
69  * hwc_layer_t::flags values
70  * Flags are set by SurfaceFlinger and read by the HAL
71  */
72 enum {
73  /*
74  * HWC_SKIP_LAYER is set by SurfaceFlnger to indicate that the HAL
75  * shall not consider this layer for composition as it will be handled
76  * by SurfaceFlinger (just as if compositionType was set to HWC_OVERLAY).
77  */
78  HWC_SKIP_LAYER = 0x00000001,
79 };
80 
81 /*
82  * hwc_layer_t::compositionType values
83  */
84 enum {
85  /* this layer is to be drawn into the framebuffer by SurfaceFlinger */
87 
88  /* this layer will be handled in the HWC */
90 
91  /* this is the background layer. it's used to set the background color.
92  * there is only a single background layer */
94 
95  /* this layer holds the result of compositing the HWC_FRAMEBUFFER layers.
96  * Added in HWC_DEVICE_API_VERSION_1_1. */
98 };
99 
100 /*
101  * hwc_layer_t::blending values
102  */
103 enum {
104  /* no blending */
106 
107  /* ONE / ONE_MINUS_SRC_ALPHA */
109 
110  /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */
112 };
113 
114 /*
115  * hwc_layer_t::transform values
116  */
117 enum {
118  /* flip source image horizontally */
119  HWC_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H,
120  /* flip source image vertically */
121  HWC_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
122  /* rotate source image 90 degrees clock-wise */
123  HWC_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
124  /* rotate source image 180 degrees */
125  HWC_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
126  /* rotate source image 270 degrees clock-wise */
127  HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
128 };
129 
130 /* attributes queriable with query() */
131 enum {
132  /*
133  * Must return 1 if the background layer is supported, 0 otherwise.
134  */
136 
137  /*
138  * Returns the vsync period in nanoseconds.
139  *
140  * This query is not used for HWC_DEVICE_API_VERSION_1_1 and later.
141  * Instead, the per-display attribute HWC_DISPLAY_VSYNC_PERIOD is used.
142  */
144 
145  /*
146  * Availability: HWC_DEVICE_API_VERSION_1_1
147  * Returns a mask of supported display types.
148  */
150 };
151 
152 /* display attributes returned by getDisplayAttributes() */
153 enum {
154  /* Indicates the end of an attribute list */
156 
157  /* The vsync period in nanoseconds */
159 
160  /* The number of pixels in the horizontal and vertical directions. */
163 
164  /* The number of pixels per thousand inches of this configuration.
165  *
166  * Scaling DPI by 1000 allows it to be stored in an int without losing
167  * too much precision.
168  *
169  * If the DPI for a configuration is unavailable or the HWC implementation
170  * considers it unreliable, it should set these attributes to zero.
171  */
174 };
175 
176 /* Allowed events for hwc_methods::eventControl() */
177 enum {
179 };
180 
181 /* Display types and associated mask bits. */
182 enum {
184  HWC_DISPLAY_EXTERNAL = 1, // HDMI, DP, etc.
186 
189 };
190 
191 enum {
195 };
196 
197 /*****************************************************************************/
198 
199 __END_DECLS
200 
201 #endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H */