blob: ce4723cb599b2c05d03d9049818c64665eda482a [file] [log] [blame]
Mathias Agopiane291f712012-05-13 22:49:06 -07001/*
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
Jesse Hall3f5b5222012-08-28 15:23:58 -070031#define HWC_HEADER_VERSION 1
Mathias Agopiane291f712012-05-13 22:49:06 -070032
Jesse Hall903811c2012-09-04 11:42:09 -070033#define HWC_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
Jesse Hall3f5b5222012-08-28 15:23:58 -070034
Jesse Hall3f5b5222012-08-28 15:23:58 -070035#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)
Mathias Agopian3b4732c2013-07-09 19:55:41 -070038#define HWC_DEVICE_API_VERSION_1_3 HARDWARE_DEVICE_API_VERSION_2(1, 3, HWC_HEADER_VERSION)
Mathias Agopiane291f712012-05-13 22:49:06 -070039
40enum {
41 /* hwc_composer_device_t::set failed in EGL */
42 HWC_EGL_ERROR = -1
43};
44
45/*
46 * hwc_layer_t::hints values
47 * Hints are set by the HAL and read by SurfaceFlinger
48 */
49enum {
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 */
72enum {
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 */
84enum {
85 /* this layer is to be drawn into the framebuffer by SurfaceFlinger */
86 HWC_FRAMEBUFFER = 0,
87
88 /* this layer will be handled in the HWC */
89 HWC_OVERLAY = 1,
90
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,
Jesse Halld18c83f2012-08-16 16:21:13 -070094
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,
Mathias Agopiane291f712012-05-13 22:49:06 -070098};
99
100/*
101 * hwc_layer_t::blending values
102 */
103enum {
104 /* no blending */
105 HWC_BLENDING_NONE = 0x0100,
106
107 /* ONE / ONE_MINUS_SRC_ALPHA */
108 HWC_BLENDING_PREMULT = 0x0105,
109
110 /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */
111 HWC_BLENDING_COVERAGE = 0x0405
112};
113
114/*
115 * hwc_layer_t::transform values
116 */
117enum {
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() */
131enum {
132 /*
Jesse Hall2c137592012-08-29 10:37:37 -0700133 * Must return 1 if the background layer is supported, 0 otherwise.
Mathias Agopiane291f712012-05-13 22:49:06 -0700134 */
135 HWC_BACKGROUND_LAYER_SUPPORTED = 0,
136
137 /*
Jesse Hall2c137592012-08-29 10:37:37 -0700138 * 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.
Mathias Agopiane291f712012-05-13 22:49:06 -0700142 */
143 HWC_VSYNC_PERIOD = 1,
Jesse Hall43b51d92012-08-22 11:42:57 -0700144
145 /*
Jesse Hall2c137592012-08-29 10:37:37 -0700146 * Availability: HWC_DEVICE_API_VERSION_1_1
147 * Returns a mask of supported display types.
Jesse Hall43b51d92012-08-22 11:42:57 -0700148 */
149 HWC_DISPLAY_TYPES_SUPPORTED = 2,
Mathias Agopiane291f712012-05-13 22:49:06 -0700150};
151
Jesse Hall2c137592012-08-29 10:37:37 -0700152/* display attributes returned by getDisplayAttributes() */
153enum {
154 /* Indicates the end of an attribute list */
155 HWC_DISPLAY_NO_ATTRIBUTE = 0,
156
157 /* The vsync period in nanoseconds */
158 HWC_DISPLAY_VSYNC_PERIOD = 1,
159
160 /* The number of pixels in the horizontal and vertical directions. */
Jesse Hall7cb03d72012-09-06 16:57:12 -0700161 HWC_DISPLAY_WIDTH = 2,
162 HWC_DISPLAY_HEIGHT = 3,
Jesse Hall2c137592012-08-29 10:37:37 -0700163
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 */
172 HWC_DISPLAY_DPI_X = 4,
173 HWC_DISPLAY_DPI_Y = 5,
174};
175
Mathias Agopiane291f712012-05-13 22:49:06 -0700176/* Allowed events for hwc_methods::eventControl() */
177enum {
178 HWC_EVENT_VSYNC = 0
179};
180
Jesse Hall43b51d92012-08-22 11:42:57 -0700181/* Display types and associated mask bits. */
182enum {
183 HWC_DISPLAY_PRIMARY = 0,
184 HWC_DISPLAY_EXTERNAL = 1, // HDMI, DP, etc.
185 HWC_NUM_DISPLAY_TYPES
186};
187
188enum {
189 HWC_DISPLAY_PRIMARY_BIT = 1 << HWC_DISPLAY_PRIMARY,
190 HWC_DISPLAY_EXTERNAL_BIT = 1 << HWC_DISPLAY_EXTERNAL,
191};
192
Mathias Agopiane291f712012-05-13 22:49:06 -0700193/*****************************************************************************/
194
195__END_DECLS
196
197#endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H */