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