Mathias Agopian | e291f71 | 2012-05-13 22:49:06 -0700 | [diff] [blame] | 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 | |
Jesse Hall | 3f5b522 | 2012-08-28 15:23:58 -0700 | [diff] [blame] | 31 | #define HWC_HEADER_VERSION 1 |
Mathias Agopian | e291f71 | 2012-05-13 22:49:06 -0700 | [diff] [blame] | 32 | |
Jesse Hall | 903811c | 2012-09-04 11:42:09 -0700 | [diff] [blame] | 33 | #define HWC_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1) |
Jesse Hall | 3f5b522 | 2012-08-28 15:23:58 -0700 | [diff] [blame] | 34 | |
Jesse Hall | 3f5b522 | 2012-08-28 15:23:58 -0700 | [diff] [blame] | 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) |
Mathias Agopian | 3b4732c | 2013-07-09 19:55:41 -0700 | [diff] [blame] | 38 | #define HWC_DEVICE_API_VERSION_1_3 HARDWARE_DEVICE_API_VERSION_2(1, 3, HWC_HEADER_VERSION) |
Jesse Hall | 8c79c08 | 2014-02-13 15:38:56 -0800 | [diff] [blame] | 39 | #define HWC_DEVICE_API_VERSION_1_4 HARDWARE_DEVICE_API_VERSION_2(1, 4, HWC_HEADER_VERSION) |
Mathias Agopian | e291f71 | 2012-05-13 22:49:06 -0700 | [diff] [blame] | 40 | |
| 41 | enum { |
| 42 | /* hwc_composer_device_t::set failed in EGL */ |
| 43 | HWC_EGL_ERROR = -1 |
| 44 | }; |
| 45 | |
| 46 | /* |
| 47 | * hwc_layer_t::hints values |
| 48 | * Hints are set by the HAL and read by SurfaceFlinger |
| 49 | */ |
| 50 | enum { |
| 51 | /* |
| 52 | * HWC can set the HWC_HINT_TRIPLE_BUFFER hint to indicate to SurfaceFlinger |
| 53 | * that it should triple buffer this layer. Typically HWC does this when |
| 54 | * the layer will be unavailable for use for an extended period of time, |
| 55 | * e.g. if the display will be fetching data directly from the layer and |
| 56 | * the layer can not be modified until after the next set(). |
| 57 | */ |
| 58 | HWC_HINT_TRIPLE_BUFFER = 0x00000001, |
| 59 | |
| 60 | /* |
| 61 | * HWC sets HWC_HINT_CLEAR_FB to tell SurfaceFlinger that it should clear the |
| 62 | * framebuffer with transparent pixels where this layer would be. |
| 63 | * SurfaceFlinger will only honor this flag when the layer has no blending |
| 64 | * |
| 65 | */ |
| 66 | HWC_HINT_CLEAR_FB = 0x00000002 |
| 67 | }; |
| 68 | |
| 69 | /* |
| 70 | * hwc_layer_t::flags values |
| 71 | * Flags are set by SurfaceFlinger and read by the HAL |
| 72 | */ |
| 73 | enum { |
| 74 | /* |
| 75 | * HWC_SKIP_LAYER is set by SurfaceFlnger to indicate that the HAL |
| 76 | * shall not consider this layer for composition as it will be handled |
| 77 | * by SurfaceFlinger (just as if compositionType was set to HWC_OVERLAY). |
| 78 | */ |
| 79 | HWC_SKIP_LAYER = 0x00000001, |
| 80 | }; |
| 81 | |
| 82 | /* |
| 83 | * hwc_layer_t::compositionType values |
| 84 | */ |
| 85 | enum { |
| 86 | /* this layer is to be drawn into the framebuffer by SurfaceFlinger */ |
| 87 | HWC_FRAMEBUFFER = 0, |
| 88 | |
| 89 | /* this layer will be handled in the HWC */ |
| 90 | HWC_OVERLAY = 1, |
| 91 | |
| 92 | /* this is the background layer. it's used to set the background color. |
| 93 | * there is only a single background layer */ |
| 94 | HWC_BACKGROUND = 2, |
Jesse Hall | d18c83f | 2012-08-16 16:21:13 -0700 | [diff] [blame] | 95 | |
| 96 | /* this layer holds the result of compositing the HWC_FRAMEBUFFER layers. |
| 97 | * Added in HWC_DEVICE_API_VERSION_1_1. */ |
| 98 | HWC_FRAMEBUFFER_TARGET = 3, |
Jesse Hall | 8c79c08 | 2014-02-13 15:38:56 -0800 | [diff] [blame] | 99 | |
| 100 | /* this layer's contents are taken from a sideband buffer stream. |
| 101 | * Added in HWC_DEVICE_API_VERSION_1_4. */ |
| 102 | HWC_SIDEBAND = 4, |
Mathias Agopian | e291f71 | 2012-05-13 22:49:06 -0700 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | /* |
| 106 | * hwc_layer_t::blending values |
| 107 | */ |
| 108 | enum { |
| 109 | /* no blending */ |
| 110 | HWC_BLENDING_NONE = 0x0100, |
| 111 | |
| 112 | /* ONE / ONE_MINUS_SRC_ALPHA */ |
| 113 | HWC_BLENDING_PREMULT = 0x0105, |
| 114 | |
| 115 | /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */ |
| 116 | HWC_BLENDING_COVERAGE = 0x0405 |
| 117 | }; |
| 118 | |
| 119 | /* |
| 120 | * hwc_layer_t::transform values |
| 121 | */ |
| 122 | enum { |
| 123 | /* flip source image horizontally */ |
| 124 | HWC_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H, |
| 125 | /* flip source image vertically */ |
| 126 | HWC_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V, |
| 127 | /* rotate source image 90 degrees clock-wise */ |
| 128 | HWC_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90, |
| 129 | /* rotate source image 180 degrees */ |
| 130 | HWC_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180, |
| 131 | /* rotate source image 270 degrees clock-wise */ |
| 132 | HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270, |
| 133 | }; |
| 134 | |
| 135 | /* attributes queriable with query() */ |
| 136 | enum { |
| 137 | /* |
Jesse Hall | 2c13759 | 2012-08-29 10:37:37 -0700 | [diff] [blame] | 138 | * Must return 1 if the background layer is supported, 0 otherwise. |
Mathias Agopian | e291f71 | 2012-05-13 22:49:06 -0700 | [diff] [blame] | 139 | */ |
| 140 | HWC_BACKGROUND_LAYER_SUPPORTED = 0, |
| 141 | |
| 142 | /* |
Jesse Hall | 2c13759 | 2012-08-29 10:37:37 -0700 | [diff] [blame] | 143 | * Returns the vsync period in nanoseconds. |
| 144 | * |
| 145 | * This query is not used for HWC_DEVICE_API_VERSION_1_1 and later. |
| 146 | * Instead, the per-display attribute HWC_DISPLAY_VSYNC_PERIOD is used. |
Mathias Agopian | e291f71 | 2012-05-13 22:49:06 -0700 | [diff] [blame] | 147 | */ |
| 148 | HWC_VSYNC_PERIOD = 1, |
Jesse Hall | 43b51d9 | 2012-08-22 11:42:57 -0700 | [diff] [blame] | 149 | |
| 150 | /* |
Jesse Hall | 2c13759 | 2012-08-29 10:37:37 -0700 | [diff] [blame] | 151 | * Availability: HWC_DEVICE_API_VERSION_1_1 |
| 152 | * Returns a mask of supported display types. |
Jesse Hall | 43b51d9 | 2012-08-22 11:42:57 -0700 | [diff] [blame] | 153 | */ |
| 154 | HWC_DISPLAY_TYPES_SUPPORTED = 2, |
Mathias Agopian | e291f71 | 2012-05-13 22:49:06 -0700 | [diff] [blame] | 155 | }; |
| 156 | |
Jesse Hall | 2c13759 | 2012-08-29 10:37:37 -0700 | [diff] [blame] | 157 | /* display attributes returned by getDisplayAttributes() */ |
| 158 | enum { |
| 159 | /* Indicates the end of an attribute list */ |
| 160 | HWC_DISPLAY_NO_ATTRIBUTE = 0, |
| 161 | |
| 162 | /* The vsync period in nanoseconds */ |
| 163 | HWC_DISPLAY_VSYNC_PERIOD = 1, |
| 164 | |
| 165 | /* The number of pixels in the horizontal and vertical directions. */ |
Jesse Hall | 7cb03d7 | 2012-09-06 16:57:12 -0700 | [diff] [blame] | 166 | HWC_DISPLAY_WIDTH = 2, |
| 167 | HWC_DISPLAY_HEIGHT = 3, |
Jesse Hall | 2c13759 | 2012-08-29 10:37:37 -0700 | [diff] [blame] | 168 | |
| 169 | /* The number of pixels per thousand inches of this configuration. |
| 170 | * |
| 171 | * Scaling DPI by 1000 allows it to be stored in an int without losing |
| 172 | * too much precision. |
| 173 | * |
| 174 | * If the DPI for a configuration is unavailable or the HWC implementation |
| 175 | * considers it unreliable, it should set these attributes to zero. |
| 176 | */ |
| 177 | HWC_DISPLAY_DPI_X = 4, |
| 178 | HWC_DISPLAY_DPI_Y = 5, |
| 179 | }; |
| 180 | |
Mathias Agopian | e291f71 | 2012-05-13 22:49:06 -0700 | [diff] [blame] | 181 | /* Allowed events for hwc_methods::eventControl() */ |
| 182 | enum { |
| 183 | HWC_EVENT_VSYNC = 0 |
| 184 | }; |
| 185 | |
Jesse Hall | 43b51d9 | 2012-08-22 11:42:57 -0700 | [diff] [blame] | 186 | /* Display types and associated mask bits. */ |
| 187 | enum { |
| 188 | HWC_DISPLAY_PRIMARY = 0, |
| 189 | HWC_DISPLAY_EXTERNAL = 1, // HDMI, DP, etc. |
Jesse Hall | fc0ff2a | 2013-08-16 11:13:36 -0700 | [diff] [blame] | 190 | HWC_DISPLAY_VIRTUAL = 2, |
| 191 | |
| 192 | HWC_NUM_PHYSICAL_DISPLAY_TYPES = 2, |
| 193 | HWC_NUM_DISPLAY_TYPES = 3, |
Jesse Hall | 43b51d9 | 2012-08-22 11:42:57 -0700 | [diff] [blame] | 194 | }; |
| 195 | |
| 196 | enum { |
| 197 | HWC_DISPLAY_PRIMARY_BIT = 1 << HWC_DISPLAY_PRIMARY, |
| 198 | HWC_DISPLAY_EXTERNAL_BIT = 1 << HWC_DISPLAY_EXTERNAL, |
Jesse Hall | fc0ff2a | 2013-08-16 11:13:36 -0700 | [diff] [blame] | 199 | HWC_DISPLAY_VIRTUAL_BIT = 1 << HWC_DISPLAY_VIRTUAL, |
Jesse Hall | 43b51d9 | 2012-08-22 11:42:57 -0700 | [diff] [blame] | 200 | }; |
| 201 | |
Prashant Malani | 02b3198 | 2014-05-25 20:41:20 -0700 | [diff] [blame^] | 202 | /* Display power modes */ |
| 203 | enum { |
| 204 | HWC_POWER_MODE_OFF = 0, |
| 205 | HWC_POWER_MODE_DOZE = 1, |
| 206 | HWC_POWER_MODE_NORMAL = 2, |
| 207 | }; |
| 208 | |
Mathias Agopian | e291f71 | 2012-05-13 22:49:06 -0700 | [diff] [blame] | 209 | /*****************************************************************************/ |
| 210 | |
| 211 | __END_DECLS |
| 212 | |
| 213 | #endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H */ |