hwcomposer_defs.h revision e291f71e0a25ac9bb39fb754c599b710ab8f59d5
1/*
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)
36
37
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,
92};
93
94/*
95 * hwc_layer_t::blending values
96 */
97enum {
98    /* no blending */
99    HWC_BLENDING_NONE     = 0x0100,
100
101    /* ONE / ONE_MINUS_SRC_ALPHA */
102    HWC_BLENDING_PREMULT  = 0x0105,
103
104    /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */
105    HWC_BLENDING_COVERAGE = 0x0405
106};
107
108/*
109 * hwc_layer_t::transform values
110 */
111enum {
112    /* flip source image horizontally */
113    HWC_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H,
114    /* flip source image vertically */
115    HWC_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
116    /* rotate source image 90 degrees clock-wise */
117    HWC_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
118    /* rotate source image 180 degrees */
119    HWC_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
120    /* rotate source image 270 degrees clock-wise */
121    HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
122};
123
124/* attributes queriable with query() */
125enum {
126    /*
127     * availability: HWC_DEVICE_API_VERSION_0_2
128     * must return 1 if the background layer is supported, 0 otherwise
129     */
130    HWC_BACKGROUND_LAYER_SUPPORTED      = 0,
131
132    /*
133     * availability: HWC_DEVICE_API_VERSION_0_3
134     * returns the vsync period in nanosecond
135     */
136    HWC_VSYNC_PERIOD                    = 1,
137};
138
139/* Allowed events for hwc_methods::eventControl() */
140enum {
141    HWC_EVENT_VSYNC     = 0
142};
143
144/*****************************************************************************/
145
146__END_DECLS
147
148#endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H */
149