blob: f0f97fc9805093464be223d41bd0d8f8ad652f1d [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
31#define HWC_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
32
33#define HWC_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION(0, 1)
34#define HWC_DEVICE_API_VERSION_0_2 HARDWARE_DEVICE_API_VERSION(0, 2)
35#define HWC_DEVICE_API_VERSION_0_3 HARDWARE_DEVICE_API_VERSION(0, 3)
Jesse Halld479ad22012-06-05 23:41:37 -070036#define HWC_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
Jesse Hallf4e46242012-08-21 15:24:55 -070037#define HWC_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION(1, 1)
Mathias Agopiane291f712012-05-13 22:49:06 -070038
39enum {
40 /* hwc_composer_device_t::set failed in EGL */
41 HWC_EGL_ERROR = -1
42};
43
44/*
45 * hwc_layer_t::hints values
46 * Hints are set by the HAL and read by SurfaceFlinger
47 */
48enum {
49 /*
50 * HWC can set the HWC_HINT_TRIPLE_BUFFER hint to indicate to SurfaceFlinger
51 * that it should triple buffer this layer. Typically HWC does this when
52 * the layer will be unavailable for use for an extended period of time,
53 * e.g. if the display will be fetching data directly from the layer and
54 * the layer can not be modified until after the next set().
55 */
56 HWC_HINT_TRIPLE_BUFFER = 0x00000001,
57
58 /*
59 * HWC sets HWC_HINT_CLEAR_FB to tell SurfaceFlinger that it should clear the
60 * framebuffer with transparent pixels where this layer would be.
61 * SurfaceFlinger will only honor this flag when the layer has no blending
62 *
63 */
64 HWC_HINT_CLEAR_FB = 0x00000002
65};
66
67/*
68 * hwc_layer_t::flags values
69 * Flags are set by SurfaceFlinger and read by the HAL
70 */
71enum {
72 /*
73 * HWC_SKIP_LAYER is set by SurfaceFlnger to indicate that the HAL
74 * shall not consider this layer for composition as it will be handled
75 * by SurfaceFlinger (just as if compositionType was set to HWC_OVERLAY).
76 */
77 HWC_SKIP_LAYER = 0x00000001,
78};
79
80/*
81 * hwc_layer_t::compositionType values
82 */
83enum {
84 /* this layer is to be drawn into the framebuffer by SurfaceFlinger */
85 HWC_FRAMEBUFFER = 0,
86
87 /* this layer will be handled in the HWC */
88 HWC_OVERLAY = 1,
89
90 /* this is the background layer. it's used to set the background color.
91 * there is only a single background layer */
92 HWC_BACKGROUND = 2,
Jesse Halld18c83f2012-08-16 16:21:13 -070093
94 /* this layer holds the result of compositing the HWC_FRAMEBUFFER layers.
95 * Added in HWC_DEVICE_API_VERSION_1_1. */
96 HWC_FRAMEBUFFER_TARGET = 3,
Mathias Agopiane291f712012-05-13 22:49:06 -070097};
98
99/*
100 * hwc_layer_t::blending values
101 */
102enum {
103 /* no blending */
104 HWC_BLENDING_NONE = 0x0100,
105
106 /* ONE / ONE_MINUS_SRC_ALPHA */
107 HWC_BLENDING_PREMULT = 0x0105,
108
109 /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */
110 HWC_BLENDING_COVERAGE = 0x0405
111};
112
113/*
114 * hwc_layer_t::transform values
115 */
116enum {
117 /* flip source image horizontally */
118 HWC_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H,
119 /* flip source image vertically */
120 HWC_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
121 /* rotate source image 90 degrees clock-wise */
122 HWC_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
123 /* rotate source image 180 degrees */
124 HWC_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
125 /* rotate source image 270 degrees clock-wise */
126 HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
127};
128
129/* attributes queriable with query() */
130enum {
131 /*
132 * availability: HWC_DEVICE_API_VERSION_0_2
133 * must return 1 if the background layer is supported, 0 otherwise
134 */
135 HWC_BACKGROUND_LAYER_SUPPORTED = 0,
136
137 /*
138 * availability: HWC_DEVICE_API_VERSION_0_3
139 * returns the vsync period in nanosecond
140 */
141 HWC_VSYNC_PERIOD = 1,
Jesse Hall43b51d92012-08-22 11:42:57 -0700142
143 /*
144 * availability: HWC_DEVICE_API_VERSION_1_1
145 * returns a mask of supported display types
146 */
147 HWC_DISPLAY_TYPES_SUPPORTED = 2,
Mathias Agopiane291f712012-05-13 22:49:06 -0700148};
149
150/* Allowed events for hwc_methods::eventControl() */
151enum {
152 HWC_EVENT_VSYNC = 0
153};
154
Jesse Hall43b51d92012-08-22 11:42:57 -0700155/* Display types and associated mask bits. */
156enum {
157 HWC_DISPLAY_PRIMARY = 0,
158 HWC_DISPLAY_EXTERNAL = 1, // HDMI, DP, etc.
159 HWC_NUM_DISPLAY_TYPES
160};
161
162enum {
163 HWC_DISPLAY_PRIMARY_BIT = 1 << HWC_DISPLAY_PRIMARY,
164 HWC_DISPLAY_EXTERNAL_BIT = 1 << HWC_DISPLAY_EXTERNAL,
165};
166
Mathias Agopiane291f712012-05-13 22:49:06 -0700167/*****************************************************************************/
168
169__END_DECLS
170
171#endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H */