Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / hwcplus / include / hardware / hwcomposer_defs.h
blobc69a4bca430886fb59bd8dae69dcbb874fff8e0c
1 /*
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
20 #include <stdint.h>
21 #include <sys/cdefs.h>
23 #include <hardware/gralloc.h>
24 #include <hardware/hardware.h>
25 #include <cutils/native_handle.h>
27 __BEGIN_DECLS
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_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)
40 enum {
41 /* hwc_composer_device_t::set failed in EGL */
42 HWC_EGL_ERROR = -1
46 * hwc_layer_t::hints values
47 * Hints are set by the HAL and read by SurfaceFlinger
49 enum {
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().
57 HWC_HINT_TRIPLE_BUFFER = 0x00000001,
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
65 HWC_HINT_CLEAR_FB = 0x00000002
69 * hwc_layer_t::flags values
70 * Flags are set by SurfaceFlinger and read by the HAL
72 enum {
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).
78 HWC_SKIP_LAYER = 0x00000001,
82 * hwc_layer_t::compositionType values
84 enum {
85 /* this layer is to be drawn into the framebuffer by SurfaceFlinger */
86 HWC_FRAMEBUFFER = 0,
88 /* this layer will be handled in the HWC */
89 HWC_OVERLAY = 1,
91 /* this is the background layer. it's used to set the background color.
92 * there is only a single background layer */
93 HWC_BACKGROUND = 2,
95 /* this layer holds the result of compositing the HWC_FRAMEBUFFER layers.
96 * Added in HWC_DEVICE_API_VERSION_1_1. */
97 HWC_FRAMEBUFFER_TARGET = 3,
101 * hwc_layer_t::blending values
103 enum {
104 /* no blending */
105 HWC_BLENDING_NONE = 0x0100,
107 /* ONE / ONE_MINUS_SRC_ALPHA */
108 HWC_BLENDING_PREMULT = 0x0105,
110 /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */
111 HWC_BLENDING_COVERAGE = 0x0405
115 * hwc_layer_t::transform values
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,
130 /* attributes queriable with query() */
131 enum {
133 * Must return 1 if the background layer is supported, 0 otherwise.
135 HWC_BACKGROUND_LAYER_SUPPORTED = 0,
138 * Returns the vsync period in nanoseconds.
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.
143 HWC_VSYNC_PERIOD = 1,
146 * Availability: HWC_DEVICE_API_VERSION_1_1
147 * Returns a mask of supported display types.
149 HWC_DISPLAY_TYPES_SUPPORTED = 2,
152 /* display attributes returned by getDisplayAttributes() */
153 enum {
154 /* Indicates the end of an attribute list */
155 HWC_DISPLAY_NO_ATTRIBUTE = 0,
157 /* The vsync period in nanoseconds */
158 HWC_DISPLAY_VSYNC_PERIOD = 1,
160 /* The number of pixels in the horizontal and vertical directions. */
161 HWC_DISPLAY_WIDTH = 2,
162 HWC_DISPLAY_HEIGHT = 3,
164 /* The number of pixels per thousand inches of this configuration.
166 * Scaling DPI by 1000 allows it to be stored in an int without losing
167 * too much precision.
169 * If the DPI for a configuration is unavailable or the HWC implementation
170 * considers it unreliable, it should set these attributes to zero.
172 HWC_DISPLAY_DPI_X = 4,
173 HWC_DISPLAY_DPI_Y = 5,
176 /* Allowed events for hwc_methods::eventControl() */
177 enum {
178 HWC_EVENT_VSYNC = 0
181 /* Display types and associated mask bits. */
182 enum {
183 HWC_DISPLAY_PRIMARY = 0,
184 HWC_DISPLAY_EXTERNAL = 1, // HDMI, DP, etc.
185 HWC_DISPLAY_VIRTUAL = 2,
187 HWC_NUM_PHYSICAL_DISPLAY_TYPES = 2,
188 HWC_NUM_DISPLAY_TYPES = 3,
191 enum {
192 HWC_DISPLAY_PRIMARY_BIT = 1 << HWC_DISPLAY_PRIMARY,
193 HWC_DISPLAY_EXTERNAL_BIT = 1 << HWC_DISPLAY_EXTERNAL,
194 HWC_DISPLAY_VIRTUAL_BIT = 1 << HWC_DISPLAY_VIRTUAL,
197 /*****************************************************************************/
199 __END_DECLS
201 #endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H */