2 * Copyright (C) 2010 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H
18 #define ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H
21 #include <sys/cdefs.h>
23 #include <hardware/gralloc.h>
24 #include <hardware/hardware.h>
25 #include <cutils/native_handle.h>
29 /*****************************************************************************/
31 #define HWC_HEADER_VERSION 1
33 #define HWC_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
35 #define HWC_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION_2(0, 1, HWC_HEADER_VERSION)
36 #define HWC_DEVICE_API_VERSION_0_2 HARDWARE_DEVICE_API_VERSION_2(0, 2, HWC_HEADER_VERSION)
37 #define HWC_DEVICE_API_VERSION_0_3 HARDWARE_DEVICE_API_VERSION_2(0, 3, HWC_HEADER_VERSION)
38 #define HWC_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION_2(1, 0, HWC_HEADER_VERSION)
39 #define HWC_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION_2(1, 1, HWC_HEADER_VERSION)
40 #define HWC_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION_2(1, 2, HWC_HEADER_VERSION)
43 /* hwc_composer_device_t::set failed in EGL */
48 * hwc_layer_t::hints values
49 * Hints are set by the HAL and read by SurfaceFlinger
53 * HWC can set the HWC_HINT_TRIPLE_BUFFER hint to indicate to SurfaceFlinger
54 * that it should triple buffer this layer. Typically HWC does this when
55 * the layer will be unavailable for use for an extended period of time,
56 * e.g. if the display will be fetching data directly from the layer and
57 * the layer can not be modified until after the next set().
59 HWC_HINT_TRIPLE_BUFFER
= 0x00000001,
62 * HWC sets HWC_HINT_CLEAR_FB to tell SurfaceFlinger that it should clear the
63 * framebuffer with transparent pixels where this layer would be.
64 * SurfaceFlinger will only honor this flag when the layer has no blending
67 HWC_HINT_CLEAR_FB
= 0x00000002
71 * hwc_layer_t::flags values
72 * Flags are set by SurfaceFlinger and read by the HAL
76 * HWC_SKIP_LAYER is set by SurfaceFlnger to indicate that the HAL
77 * shall not consider this layer for composition as it will be handled
78 * by SurfaceFlinger (just as if compositionType was set to HWC_OVERLAY).
80 HWC_SKIP_LAYER
= 0x00000001,
84 * hwc_layer_t::compositionType values
87 /* this layer is to be drawn into the framebuffer by SurfaceFlinger */
90 /* this layer will be handled in the HWC */
93 /* this is the background layer. it's used to set the background color.
94 * there is only a single background layer */
97 /* this layer holds the result of compositing the HWC_FRAMEBUFFER layers.
98 * Added in HWC_DEVICE_API_VERSION_1_1. */
99 HWC_FRAMEBUFFER_TARGET
= 3,
103 * hwc_layer_t::blending values
107 HWC_BLENDING_NONE
= 0x0100,
109 /* ONE / ONE_MINUS_SRC_ALPHA */
110 HWC_BLENDING_PREMULT
= 0x0105,
112 /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */
113 HWC_BLENDING_COVERAGE
= 0x0405
117 * hwc_layer_t::transform values
120 /* flip source image horizontally */
121 HWC_TRANSFORM_FLIP_H
= HAL_TRANSFORM_FLIP_H
,
122 /* flip source image vertically */
123 HWC_TRANSFORM_FLIP_V
= HAL_TRANSFORM_FLIP_V
,
124 /* rotate source image 90 degrees clock-wise */
125 HWC_TRANSFORM_ROT_90
= HAL_TRANSFORM_ROT_90
,
126 /* rotate source image 180 degrees */
127 HWC_TRANSFORM_ROT_180
= HAL_TRANSFORM_ROT_180
,
128 /* rotate source image 270 degrees clock-wise */
129 HWC_TRANSFORM_ROT_270
= HAL_TRANSFORM_ROT_270
,
132 /* attributes queriable with query() */
135 * Availability: HWC_DEVICE_API_VERSION_0_2
136 * Must return 1 if the background layer is supported, 0 otherwise.
138 HWC_BACKGROUND_LAYER_SUPPORTED
= 0,
141 * Availability: HWC_DEVICE_API_VERSION_0_3
142 * Returns the vsync period in nanoseconds.
144 * This query is not used for HWC_DEVICE_API_VERSION_1_1 and later.
145 * Instead, the per-display attribute HWC_DISPLAY_VSYNC_PERIOD is used.
147 HWC_VSYNC_PERIOD
= 1,
150 * Availability: HWC_DEVICE_API_VERSION_1_1
151 * Returns a mask of supported display types.
153 HWC_DISPLAY_TYPES_SUPPORTED
= 2,
156 /* display attributes returned by getDisplayAttributes() */
158 /* Indicates the end of an attribute list */
159 HWC_DISPLAY_NO_ATTRIBUTE
= 0,
161 /* The vsync period in nanoseconds */
162 HWC_DISPLAY_VSYNC_PERIOD
= 1,
164 /* The number of pixels in the horizontal and vertical directions. */
165 HWC_DISPLAY_WIDTH
= 2,
166 HWC_DISPLAY_HEIGHT
= 3,
168 /* The number of pixels per thousand inches of this configuration.
170 * Scaling DPI by 1000 allows it to be stored in an int without losing
171 * too much precision.
173 * If the DPI for a configuration is unavailable or the HWC implementation
174 * considers it unreliable, it should set these attributes to zero.
176 HWC_DISPLAY_DPI_X
= 4,
177 HWC_DISPLAY_DPI_Y
= 5,
180 /* Allowed events for hwc_methods::eventControl() */
183 HWC_EVENT_ORIENTATION
// To notify HWC about the device orientation
186 /* Display types and associated mask bits. */
188 HWC_DISPLAY_PRIMARY
= 0,
189 HWC_DISPLAY_EXTERNAL
= 1, // HDMI, DP, etc.
190 HWC_NUM_DISPLAY_TYPES
194 HWC_DISPLAY_PRIMARY_BIT
= 1 << HWC_DISPLAY_PRIMARY
,
195 HWC_DISPLAY_EXTERNAL_BIT
= 1 << HWC_DISPLAY_EXTERNAL
,
198 /*****************************************************************************/
202 #endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H */