Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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_HARDWARE_HWCOMPOSER2_H |
| 18 | #define ANDROID_HARDWARE_HWCOMPOSER2_H |
| 19 | |
Colin Cross | 248ec3d | 2016-10-06 16:53:00 -0700 | [diff] [blame] | 20 | #include <sys/cdefs.h> |
| 21 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 22 | #include <hardware/hardware.h> |
| 23 | |
| 24 | #include "hwcomposer_defs.h" |
| 25 | |
| 26 | __BEGIN_DECLS |
| 27 | |
| 28 | /* |
| 29 | * Enums |
| 30 | * |
| 31 | * For most of these enums, there is an invalid value defined to be 0. This is |
| 32 | * an attempt to catch uninitialized fields, and these values should not be |
| 33 | * used. |
| 34 | */ |
| 35 | |
| 36 | /* Display attributes queryable through getDisplayAttribute */ |
| 37 | typedef enum { |
| 38 | HWC2_ATTRIBUTE_INVALID = 0, |
| 39 | |
| 40 | /* Dimensions in pixels */ |
| 41 | HWC2_ATTRIBUTE_WIDTH = 1, |
| 42 | HWC2_ATTRIBUTE_HEIGHT = 2, |
| 43 | |
| 44 | /* Vsync period in nanoseconds */ |
| 45 | HWC2_ATTRIBUTE_VSYNC_PERIOD = 3, |
| 46 | |
| 47 | /* Dots per thousand inches (DPI * 1000). Scaling by 1000 allows these |
| 48 | * numbers to be stored in an int32_t without losing too much precision. If |
| 49 | * the DPI for a configuration is unavailable or is considered unreliable, |
| 50 | * the device may return -1 instead */ |
| 51 | HWC2_ATTRIBUTE_DPI_X = 4, |
| 52 | HWC2_ATTRIBUTE_DPI_Y = 5, |
| 53 | } hwc2_attribute_t; |
| 54 | |
| 55 | /* Blend modes, settable per layer */ |
| 56 | typedef enum { |
| 57 | HWC2_BLEND_MODE_INVALID = 0, |
| 58 | |
| 59 | /* colorOut = colorSrc */ |
| 60 | HWC2_BLEND_MODE_NONE = 1, |
| 61 | |
| 62 | /* colorOut = colorSrc + colorDst * (1 - alphaSrc) */ |
| 63 | HWC2_BLEND_MODE_PREMULTIPLIED = 2, |
| 64 | |
| 65 | /* colorOut = colorSrc * alphaSrc + colorDst * (1 - alphaSrc) */ |
| 66 | HWC2_BLEND_MODE_COVERAGE = 3, |
| 67 | } hwc2_blend_mode_t; |
| 68 | |
| 69 | /* See the 'Callbacks' section for more detailed descriptions of what these |
| 70 | * functions do */ |
| 71 | typedef enum { |
| 72 | HWC2_CALLBACK_INVALID = 0, |
| 73 | HWC2_CALLBACK_HOTPLUG = 1, |
| 74 | HWC2_CALLBACK_REFRESH = 2, |
| 75 | HWC2_CALLBACK_VSYNC = 3, |
| 76 | } hwc2_callback_descriptor_t; |
| 77 | |
| 78 | /* Optional capabilities which may be supported by some devices. The particular |
| 79 | * set of supported capabilities for a given device may be retrieved using |
| 80 | * getCapabilities. */ |
| 81 | typedef enum { |
| 82 | HWC2_CAPABILITY_INVALID = 0, |
| 83 | |
| 84 | /* Specifies that the device supports sideband stream layers, for which |
| 85 | * buffer content updates and other synchronization will not be provided |
| 86 | * through the usual validate/present cycle and must be handled by an |
| 87 | * external implementation-defined mechanism. Only changes to layer state |
| 88 | * (such as position, size, etc.) need to be performed through the |
| 89 | * validate/present cycle. */ |
| 90 | HWC2_CAPABILITY_SIDEBAND_STREAM = 1, |
Dan Stoza | d2168f7 | 2016-07-14 11:48:16 -0700 | [diff] [blame] | 91 | |
| 92 | /* Specifies that the device will apply a color transform even when either |
| 93 | * the client or the device has chosen that all layers should be composed by |
| 94 | * the client. This will prevent the client from applying the color |
| 95 | * transform during its composition step. */ |
| 96 | HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM = 2, |
Brian Anderson | 49018a5 | 2017-04-04 16:43:11 -0700 | [diff] [blame] | 97 | |
| 98 | /* Specifies that the present fence must not be used as an accurate |
| 99 | * representation of the actual present time of a frame. |
| 100 | * This capability must never be set by HWC2 devices. |
| 101 | * This capability may be set for HWC1 devices that use the |
| 102 | * HWC2On1Adapter where emulation of the present fence using the retire |
| 103 | * fence is not feasible. |
| 104 | * In the future, CTS tests will require present time to be reliable. |
| 105 | */ |
| 106 | HWC2_CAPABILITY_PRESENT_FENCE_IS_NOT_RELIABLE = 3, |
Fabien Sanglard | 9bdc0b6 | 2017-06-13 14:56:08 -0700 | [diff] [blame] | 107 | |
| 108 | /* Specifies that a device is able to skip the validateDisplay call before |
| 109 | * receiving a call to presentDisplay. The client will always skip |
| 110 | * validateDisplay and try to call presentDisplay regardless of the changes |
| 111 | * in the properties of the layers. If the device returns anything else than |
| 112 | * HWC2_ERROR_NONE, it will call validateDisplay then presentDisplay again. |
| 113 | * For this capability to be worthwhile the device implementation of |
| 114 | * presentDisplay should fail as fast as possible in the case a |
| 115 | * validateDisplay step is needed. |
| 116 | */ |
Peiyong Lin | fd05d13 | 2018-01-22 12:23:25 -0800 | [diff] [blame] | 117 | HWC2_CAPABILITY_SKIP_VALIDATE = 4, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 118 | } hwc2_capability_t; |
| 119 | |
| 120 | /* Possible composition types for a given layer */ |
| 121 | typedef enum { |
| 122 | HWC2_COMPOSITION_INVALID = 0, |
| 123 | |
| 124 | /* The client will composite this layer into the client target buffer |
| 125 | * (provided to the device through setClientTarget). |
| 126 | * |
| 127 | * The device must not request any composition type changes for layers of |
| 128 | * this type. */ |
| 129 | HWC2_COMPOSITION_CLIENT = 1, |
| 130 | |
| 131 | /* The device will handle the composition of this layer through a hardware |
| 132 | * overlay or other similar means. |
| 133 | * |
| 134 | * Upon validateDisplay, the device may request a change from this type to |
| 135 | * HWC2_COMPOSITION_CLIENT. */ |
| 136 | HWC2_COMPOSITION_DEVICE = 2, |
| 137 | |
| 138 | /* The device will render this layer using the color set through |
| 139 | * setLayerColor. If this functionality is not supported on a layer that the |
| 140 | * client sets to HWC2_COMPOSITION_SOLID_COLOR, the device must request that |
| 141 | * the composition type of that layer is changed to HWC2_COMPOSITION_CLIENT |
| 142 | * upon the next call to validateDisplay. |
| 143 | * |
| 144 | * Upon validateDisplay, the device may request a change from this type to |
| 145 | * HWC2_COMPOSITION_CLIENT. */ |
| 146 | HWC2_COMPOSITION_SOLID_COLOR = 3, |
| 147 | |
| 148 | /* Similar to DEVICE, but the position of this layer may also be set |
| 149 | * asynchronously through setCursorPosition. If this functionality is not |
| 150 | * supported on a layer that the client sets to HWC2_COMPOSITION_CURSOR, the |
| 151 | * device must request that the composition type of that layer is changed to |
| 152 | * HWC2_COMPOSITION_CLIENT upon the next call to validateDisplay. |
| 153 | * |
| 154 | * Upon validateDisplay, the device may request a change from this type to |
| 155 | * either HWC2_COMPOSITION_DEVICE or HWC2_COMPOSITION_CLIENT. Changing to |
| 156 | * HWC2_COMPOSITION_DEVICE will prevent the use of setCursorPosition but |
| 157 | * still permit the device to composite the layer. */ |
| 158 | HWC2_COMPOSITION_CURSOR = 4, |
| 159 | |
| 160 | /* The device will handle the composition of this layer, as well as its |
| 161 | * buffer updates and content synchronization. Only supported on devices |
| 162 | * which provide HWC2_CAPABILITY_SIDEBAND_STREAM. |
| 163 | * |
| 164 | * Upon validateDisplay, the device may request a change from this type to |
| 165 | * either HWC2_COMPOSITION_DEVICE or HWC2_COMPOSITION_CLIENT, but it is |
| 166 | * unlikely that content will display correctly in these cases. */ |
| 167 | HWC2_COMPOSITION_SIDEBAND = 5, |
| 168 | } hwc2_composition_t; |
| 169 | |
| 170 | /* Possible connection options from the hotplug callback */ |
| 171 | typedef enum { |
| 172 | HWC2_CONNECTION_INVALID = 0, |
| 173 | |
| 174 | /* The display has been connected */ |
| 175 | HWC2_CONNECTION_CONNECTED = 1, |
| 176 | |
| 177 | /* The display has been disconnected */ |
| 178 | HWC2_CONNECTION_DISCONNECTED = 2, |
| 179 | } hwc2_connection_t; |
| 180 | |
| 181 | /* Display requests returned by getDisplayRequests */ |
| 182 | typedef enum { |
| 183 | /* Instructs the client to provide a new client target buffer, even if no |
| 184 | * layers are marked for client composition. */ |
| 185 | HWC2_DISPLAY_REQUEST_FLIP_CLIENT_TARGET = 1 << 0, |
| 186 | |
| 187 | /* Instructs the client to write the result of client composition directly |
| 188 | * into the virtual display output buffer. If any of the layers are not |
| 189 | * marked as HWC2_COMPOSITION_CLIENT or the given display is not a virtual |
| 190 | * display, this request has no effect. */ |
| 191 | HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT = 1 << 1, |
| 192 | } hwc2_display_request_t; |
| 193 | |
| 194 | /* Display types returned by getDisplayType */ |
| 195 | typedef enum { |
| 196 | HWC2_DISPLAY_TYPE_INVALID = 0, |
| 197 | |
| 198 | /* All physical displays, including both internal displays and hotpluggable |
| 199 | * external displays */ |
| 200 | HWC2_DISPLAY_TYPE_PHYSICAL = 1, |
| 201 | |
| 202 | /* Virtual displays created by createVirtualDisplay */ |
| 203 | HWC2_DISPLAY_TYPE_VIRTUAL = 2, |
| 204 | } hwc2_display_type_t; |
| 205 | |
| 206 | /* Return codes from all functions */ |
| 207 | typedef enum { |
| 208 | HWC2_ERROR_NONE = 0, |
| 209 | HWC2_ERROR_BAD_CONFIG, |
| 210 | HWC2_ERROR_BAD_DISPLAY, |
| 211 | HWC2_ERROR_BAD_LAYER, |
| 212 | HWC2_ERROR_BAD_PARAMETER, |
| 213 | HWC2_ERROR_HAS_CHANGES, |
| 214 | HWC2_ERROR_NO_RESOURCES, |
| 215 | HWC2_ERROR_NOT_VALIDATED, |
| 216 | HWC2_ERROR_UNSUPPORTED, |
| 217 | } hwc2_error_t; |
| 218 | |
| 219 | /* Function descriptors for use with getFunction */ |
| 220 | typedef enum { |
| 221 | HWC2_FUNCTION_INVALID = 0, |
| 222 | HWC2_FUNCTION_ACCEPT_DISPLAY_CHANGES, |
| 223 | HWC2_FUNCTION_CREATE_LAYER, |
| 224 | HWC2_FUNCTION_CREATE_VIRTUAL_DISPLAY, |
| 225 | HWC2_FUNCTION_DESTROY_LAYER, |
| 226 | HWC2_FUNCTION_DESTROY_VIRTUAL_DISPLAY, |
| 227 | HWC2_FUNCTION_DUMP, |
| 228 | HWC2_FUNCTION_GET_ACTIVE_CONFIG, |
| 229 | HWC2_FUNCTION_GET_CHANGED_COMPOSITION_TYPES, |
| 230 | HWC2_FUNCTION_GET_CLIENT_TARGET_SUPPORT, |
| 231 | HWC2_FUNCTION_GET_COLOR_MODES, |
| 232 | HWC2_FUNCTION_GET_DISPLAY_ATTRIBUTE, |
| 233 | HWC2_FUNCTION_GET_DISPLAY_CONFIGS, |
| 234 | HWC2_FUNCTION_GET_DISPLAY_NAME, |
| 235 | HWC2_FUNCTION_GET_DISPLAY_REQUESTS, |
| 236 | HWC2_FUNCTION_GET_DISPLAY_TYPE, |
| 237 | HWC2_FUNCTION_GET_DOZE_SUPPORT, |
Dan Stoza | f601e97 | 2016-03-16 09:54:40 -0700 | [diff] [blame] | 238 | HWC2_FUNCTION_GET_HDR_CAPABILITIES, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 239 | HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT, |
| 240 | HWC2_FUNCTION_GET_RELEASE_FENCES, |
| 241 | HWC2_FUNCTION_PRESENT_DISPLAY, |
| 242 | HWC2_FUNCTION_REGISTER_CALLBACK, |
| 243 | HWC2_FUNCTION_SET_ACTIVE_CONFIG, |
| 244 | HWC2_FUNCTION_SET_CLIENT_TARGET, |
| 245 | HWC2_FUNCTION_SET_COLOR_MODE, |
| 246 | HWC2_FUNCTION_SET_COLOR_TRANSFORM, |
| 247 | HWC2_FUNCTION_SET_CURSOR_POSITION, |
| 248 | HWC2_FUNCTION_SET_LAYER_BLEND_MODE, |
| 249 | HWC2_FUNCTION_SET_LAYER_BUFFER, |
| 250 | HWC2_FUNCTION_SET_LAYER_COLOR, |
| 251 | HWC2_FUNCTION_SET_LAYER_COMPOSITION_TYPE, |
| 252 | HWC2_FUNCTION_SET_LAYER_DATASPACE, |
| 253 | HWC2_FUNCTION_SET_LAYER_DISPLAY_FRAME, |
| 254 | HWC2_FUNCTION_SET_LAYER_PLANE_ALPHA, |
| 255 | HWC2_FUNCTION_SET_LAYER_SIDEBAND_STREAM, |
| 256 | HWC2_FUNCTION_SET_LAYER_SOURCE_CROP, |
| 257 | HWC2_FUNCTION_SET_LAYER_SURFACE_DAMAGE, |
| 258 | HWC2_FUNCTION_SET_LAYER_TRANSFORM, |
| 259 | HWC2_FUNCTION_SET_LAYER_VISIBLE_REGION, |
| 260 | HWC2_FUNCTION_SET_LAYER_Z_ORDER, |
| 261 | HWC2_FUNCTION_SET_OUTPUT_BUFFER, |
| 262 | HWC2_FUNCTION_SET_POWER_MODE, |
| 263 | HWC2_FUNCTION_SET_VSYNC_ENABLED, |
| 264 | HWC2_FUNCTION_VALIDATE_DISPLAY, |
Peiyong Lin | fd05d13 | 2018-01-22 12:23:25 -0800 | [diff] [blame] | 265 | HWC2_FUNCTION_SET_LAYER_FLOAT_COLOR, |
Chia-I Wu | 28310aa | 2018-03-15 21:20:55 -0700 | [diff] [blame] | 266 | HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA, |
Courtney Goeltzenleuchter | 437ce43 | 2017-02-26 14:39:34 -0700 | [diff] [blame] | 267 | HWC2_FUNCTION_GET_PER_FRAME_METADATA_KEYS, |
| 268 | HWC2_FUNCTION_SET_READBACK_BUFFER, |
| 269 | HWC2_FUNCTION_GET_READBACK_BUFFER_ATTRIBUTES, |
Chia-I Wu | 28310aa | 2018-03-15 21:20:55 -0700 | [diff] [blame] | 270 | HWC2_FUNCTION_GET_READBACK_BUFFER_FENCE, |
| 271 | HWC2_FUNCTION_GET_RENDER_INTENTS, |
| 272 | HWC2_FUNCTION_SET_COLOR_MODE_WITH_RENDER_INTENT, |
Dominik Laskowski | 55cf6f0 | 2018-03-25 15:12:04 -0700 | [diff] [blame] | 273 | HWC2_FUNCTION_GET_DATASPACE_SATURATION_MATRIX, |
Peiyong Lin | 44819b9 | 2018-09-13 16:20:08 -0700 | [diff] [blame] | 274 | |
| 275 | // composer 2.3 |
| 276 | HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA, |
Peiyong Lin | f09421f | 2018-10-26 18:31:03 -0700 | [diff] [blame] | 277 | HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES, |
Peiyong Lin | 44819b9 | 2018-09-13 16:20:08 -0700 | [diff] [blame] | 278 | HWC2_FUNCTION_SET_LAYER_COLOR_TRANSFORM, |
Kevin DuBois | 1345887 | 2018-09-10 09:09:12 -0700 | [diff] [blame] | 279 | HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES, |
| 280 | HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED, |
| 281 | HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE, |
Valerie Hau | 69c5343 | 2018-11-13 09:07:44 -0800 | [diff] [blame] | 282 | HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS, |
Dan Gittik | 10510ff | 2019-01-18 19:30:24 +0000 | [diff] [blame^] | 283 | HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT, |
| 284 | HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 285 | } hwc2_function_descriptor_t; |
| 286 | |
Dan Stoza | f601e97 | 2016-03-16 09:54:40 -0700 | [diff] [blame] | 287 | /* Layer requests returned from getDisplayRequests */ |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 288 | typedef enum { |
| 289 | /* The client should clear its target with transparent pixels where this |
| 290 | * layer would be. The client may ignore this request if the layer must be |
| 291 | * blended. */ |
| 292 | HWC2_LAYER_REQUEST_CLEAR_CLIENT_TARGET = 1 << 0, |
| 293 | } hwc2_layer_request_t; |
| 294 | |
| 295 | /* Power modes for use with setPowerMode */ |
| 296 | typedef enum { |
| 297 | /* The display is fully off (blanked) */ |
| 298 | HWC2_POWER_MODE_OFF = 0, |
| 299 | |
| 300 | /* These are optional low power modes. getDozeSupport may be called to |
| 301 | * determine whether a given display supports these modes. */ |
| 302 | |
| 303 | /* The display is turned on and configured in a low power state that is |
| 304 | * suitable for presenting ambient information to the user, possibly with |
| 305 | * lower fidelity than HWC2_POWER_MODE_ON, but with greater efficiency. */ |
| 306 | HWC2_POWER_MODE_DOZE = 1, |
| 307 | |
| 308 | /* The display is configured as in HWC2_POWER_MODE_DOZE but may stop |
| 309 | * applying display updates from the client. This is effectively a hint to |
| 310 | * the device that drawing to the display has been suspended and that the |
| 311 | * the device should remain on in a low power state and continue displaying |
| 312 | * its current contents indefinitely until the power mode changes. |
| 313 | * |
| 314 | * This mode may also be used as a signal to enable hardware-based doze |
| 315 | * functionality. In this case, the device is free to take over the display |
| 316 | * and manage it autonomously to implement a low power always-on display. */ |
| 317 | HWC2_POWER_MODE_DOZE_SUSPEND = 3, |
| 318 | |
| 319 | /* The display is fully on */ |
| 320 | HWC2_POWER_MODE_ON = 2, |
| 321 | } hwc2_power_mode_t; |
| 322 | |
| 323 | /* Vsync values passed to setVsyncEnabled */ |
| 324 | typedef enum { |
| 325 | HWC2_VSYNC_INVALID = 0, |
| 326 | |
| 327 | /* Enable vsync */ |
| 328 | HWC2_VSYNC_ENABLE = 1, |
| 329 | |
| 330 | /* Disable vsync */ |
| 331 | HWC2_VSYNC_DISABLE = 2, |
| 332 | } hwc2_vsync_t; |
| 333 | |
Courtney Goeltzenleuchter | 437ce43 | 2017-02-26 14:39:34 -0700 | [diff] [blame] | 334 | /* MUST match HIDL's V2_2::IComposerClient::PerFrameMetadataKey */ |
| 335 | typedef enum { |
| 336 | /* SMPTE ST 2084:2014. |
| 337 | * Coordinates defined in CIE 1931 xy chromaticity space |
| 338 | */ |
| 339 | HWC2_DISPLAY_RED_PRIMARY_X = 0, |
| 340 | HWC2_DISPLAY_RED_PRIMARY_Y = 1, |
| 341 | HWC2_DISPLAY_GREEN_PRIMARY_X = 2, |
| 342 | HWC2_DISPLAY_GREEN_PRIMARY_Y = 3, |
| 343 | HWC2_DISPLAY_BLUE_PRIMARY_X = 4, |
| 344 | HWC2_DISPLAY_BLUE_PRIMARY_Y = 5, |
| 345 | HWC2_WHITE_POINT_X = 6, |
| 346 | HWC2_WHITE_POINT_Y = 7, |
| 347 | /* SMPTE ST 2084:2014. |
| 348 | * Units: nits |
| 349 | * max as defined by ST 2048: 10,000 nits |
| 350 | */ |
| 351 | HWC2_MAX_LUMINANCE = 8, |
| 352 | HWC2_MIN_LUMINANCE = 9, |
| 353 | |
| 354 | /* CTA 861.3 |
| 355 | * Units: nits |
| 356 | */ |
| 357 | HWC2_MAX_CONTENT_LIGHT_LEVEL = 10, |
| 358 | HWC2_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11, |
| 359 | } hwc2_per_frame_metadata_key_t; |
| 360 | |
Kevin DuBois | 1345887 | 2018-09-10 09:09:12 -0700 | [diff] [blame] | 361 | /* SetDisplayedContentSampling values passed to setDisplayedContentSamplingEnabled */ |
| 362 | typedef enum { |
| 363 | HWC2_DISPLAYED_CONTENT_SAMPLING_INVALID = 0, |
| 364 | |
| 365 | /* Enable displayed content sampling */ |
| 366 | HWC2_DISPLAYED_CONTENT_SAMPLING_ENABLE = 1, |
| 367 | |
| 368 | /* Disable displayed content sampling */ |
| 369 | HWC2_DISPLAYED_CONTENT_SAMPLING_DISABLE = 2, |
| 370 | } hwc2_displayed_content_sampling_t; |
| 371 | |
| 372 | typedef enum { |
| 373 | HWC2_FORMAT_COMPONENT_0 = 1 << 0, /* The first component (eg, for RGBA_8888, this is R) */ |
| 374 | HWC2_FORMAT_COMPONENT_1 = 1 << 1, /* The second component (eg, for RGBA_8888, this is G) */ |
| 375 | HWC2_FORMAT_COMPONENT_2 = 1 << 2, /* The third component (eg, for RGBA_8888, this is B) */ |
| 376 | HWC2_FORMAT_COMPONENT_3 = 1 << 3, /* The fourth component (eg, for RGBA_8888, this is A) */ |
| 377 | } hwc2_format_color_component_t; |
| 378 | |
Peiyong Lin | f09421f | 2018-10-26 18:31:03 -0700 | [diff] [blame] | 379 | /* Optional display capabilities which may be supported by some displays. |
| 380 | * The particular set of supported capabilities for a given display may be |
| 381 | * retrieved using getDisplayCapabilities. */ |
| 382 | typedef enum { |
| 383 | HWC2_DISPLAY_CAPABILITY_INVALID = 0, |
| 384 | |
| 385 | /** |
| 386 | * Specifies that the display must apply a color transform even when either |
| 387 | * the client or the device has chosen that all layers should be composed by |
| 388 | * the client. This prevents the client from applying the color transform |
| 389 | * during its composition step. |
| 390 | * If getDisplayCapabilities is supported, the global capability |
| 391 | * HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM is ignored. |
| 392 | * If getDisplayCapabilities is not supported, and the global capability |
| 393 | * HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM is returned by getCapabilities, |
| 394 | * then all displays must be treated as having |
| 395 | * HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM. |
| 396 | */ |
| 397 | HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM = 1, |
| 398 | |
| 399 | /** |
| 400 | * Specifies that the display supports PowerMode::DOZE and |
| 401 | * PowerMode::DOZE_SUSPEND. DOZE_SUSPEND may not provide any benefit |
| 402 | * over DOZE (see the definition of PowerMode for more information), |
| 403 | * but if both DOZE and DOZE_SUSPEND are no different from |
| 404 | * PowerMode::ON, the device must not claim support. |
| 405 | * HWC2_DISPLAY_CAPABILITY_DOZE must be returned by getDisplayCapabilities |
| 406 | * when getDozeSupport indicates the display supports PowerMode::DOZE and |
| 407 | * PowerMode::DOZE_SUSPEND. |
| 408 | */ |
| 409 | HWC2_DISPLAY_CAPABILITY_DOZE = 2, |
Dan Gittik | 10510ff | 2019-01-18 19:30:24 +0000 | [diff] [blame^] | 410 | |
| 411 | /** |
| 412 | * Specified that the display supports brightness operations. |
| 413 | */ |
| 414 | HWC2_DISPLAY_CAPABILITY_BRIGHTNESS = 3, |
Peiyong Lin | f09421f | 2018-10-26 18:31:03 -0700 | [diff] [blame] | 415 | } hwc2_display_capability_t; |
| 416 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 417 | /* |
| 418 | * Stringification Functions |
| 419 | */ |
| 420 | |
| 421 | #ifdef HWC2_INCLUDE_STRINGIFICATION |
| 422 | |
| 423 | static inline const char* getAttributeName(hwc2_attribute_t attribute) { |
| 424 | switch (attribute) { |
| 425 | case HWC2_ATTRIBUTE_INVALID: return "Invalid"; |
| 426 | case HWC2_ATTRIBUTE_WIDTH: return "Width"; |
| 427 | case HWC2_ATTRIBUTE_HEIGHT: return "Height"; |
| 428 | case HWC2_ATTRIBUTE_VSYNC_PERIOD: return "VsyncPeriod"; |
| 429 | case HWC2_ATTRIBUTE_DPI_X: return "DpiX"; |
| 430 | case HWC2_ATTRIBUTE_DPI_Y: return "DpiY"; |
| 431 | default: return "Unknown"; |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | static inline const char* getBlendModeName(hwc2_blend_mode_t mode) { |
| 436 | switch (mode) { |
| 437 | case HWC2_BLEND_MODE_INVALID: return "Invalid"; |
| 438 | case HWC2_BLEND_MODE_NONE: return "None"; |
| 439 | case HWC2_BLEND_MODE_PREMULTIPLIED: return "Premultiplied"; |
| 440 | case HWC2_BLEND_MODE_COVERAGE: return "Coverage"; |
| 441 | default: return "Unknown"; |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | static inline const char* getCallbackDescriptorName( |
| 446 | hwc2_callback_descriptor_t desc) { |
| 447 | switch (desc) { |
| 448 | case HWC2_CALLBACK_INVALID: return "Invalid"; |
| 449 | case HWC2_CALLBACK_HOTPLUG: return "Hotplug"; |
| 450 | case HWC2_CALLBACK_REFRESH: return "Refresh"; |
| 451 | case HWC2_CALLBACK_VSYNC: return "Vsync"; |
| 452 | default: return "Unknown"; |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | static inline const char* getCapabilityName(hwc2_capability_t capability) { |
| 457 | switch (capability) { |
| 458 | case HWC2_CAPABILITY_INVALID: return "Invalid"; |
| 459 | case HWC2_CAPABILITY_SIDEBAND_STREAM: return "SidebandStream"; |
Dan Stoza | d2168f7 | 2016-07-14 11:48:16 -0700 | [diff] [blame] | 460 | case HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM: |
| 461 | return "SkipClientColorTransform"; |
Brian Anderson | 49018a5 | 2017-04-04 16:43:11 -0700 | [diff] [blame] | 462 | case HWC2_CAPABILITY_PRESENT_FENCE_IS_NOT_RELIABLE: |
| 463 | return "PresentFenceIsNotReliable"; |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 464 | default: return "Unknown"; |
| 465 | } |
| 466 | } |
| 467 | |
| 468 | static inline const char* getCompositionName(hwc2_composition_t composition) { |
| 469 | switch (composition) { |
| 470 | case HWC2_COMPOSITION_INVALID: return "Invalid"; |
| 471 | case HWC2_COMPOSITION_CLIENT: return "Client"; |
| 472 | case HWC2_COMPOSITION_DEVICE: return "Device"; |
| 473 | case HWC2_COMPOSITION_SOLID_COLOR: return "SolidColor"; |
| 474 | case HWC2_COMPOSITION_CURSOR: return "Cursor"; |
| 475 | case HWC2_COMPOSITION_SIDEBAND: return "Sideband"; |
| 476 | default: return "Unknown"; |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | static inline const char* getConnectionName(hwc2_connection_t connection) { |
| 481 | switch (connection) { |
| 482 | case HWC2_CONNECTION_INVALID: return "Invalid"; |
| 483 | case HWC2_CONNECTION_CONNECTED: return "Connected"; |
| 484 | case HWC2_CONNECTION_DISCONNECTED: return "Disconnected"; |
| 485 | default: return "Unknown"; |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | static inline const char* getDisplayRequestName( |
| 490 | hwc2_display_request_t request) { |
Colin Cross | 248ec3d | 2016-10-06 16:53:00 -0700 | [diff] [blame] | 491 | switch (__BIONIC_CAST(static_cast, int, request)) { |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 492 | case 0: return "None"; |
| 493 | case HWC2_DISPLAY_REQUEST_FLIP_CLIENT_TARGET: return "FlipClientTarget"; |
| 494 | case HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT: |
| 495 | return "WriteClientTargetToOutput"; |
| 496 | case HWC2_DISPLAY_REQUEST_FLIP_CLIENT_TARGET | |
| 497 | HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT: |
| 498 | return "FlipClientTarget|WriteClientTargetToOutput"; |
| 499 | default: return "Unknown"; |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | static inline const char* getDisplayTypeName(hwc2_display_type_t type) { |
| 504 | switch (type) { |
| 505 | case HWC2_DISPLAY_TYPE_INVALID: return "Invalid"; |
| 506 | case HWC2_DISPLAY_TYPE_PHYSICAL: return "Physical"; |
| 507 | case HWC2_DISPLAY_TYPE_VIRTUAL: return "Virtual"; |
| 508 | default: return "Unknown"; |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | static inline const char* getErrorName(hwc2_error_t error) { |
| 513 | switch (error) { |
| 514 | case HWC2_ERROR_NONE: return "None"; |
| 515 | case HWC2_ERROR_BAD_CONFIG: return "BadConfig"; |
| 516 | case HWC2_ERROR_BAD_DISPLAY: return "BadDisplay"; |
| 517 | case HWC2_ERROR_BAD_LAYER: return "BadLayer"; |
| 518 | case HWC2_ERROR_BAD_PARAMETER: return "BadParameter"; |
| 519 | case HWC2_ERROR_HAS_CHANGES: return "HasChanges"; |
| 520 | case HWC2_ERROR_NO_RESOURCES: return "NoResources"; |
| 521 | case HWC2_ERROR_NOT_VALIDATED: return "NotValidated"; |
| 522 | case HWC2_ERROR_UNSUPPORTED: return "Unsupported"; |
| 523 | default: return "Unknown"; |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | static inline const char* getFunctionDescriptorName( |
| 528 | hwc2_function_descriptor_t desc) { |
| 529 | switch (desc) { |
| 530 | case HWC2_FUNCTION_INVALID: return "Invalid"; |
| 531 | case HWC2_FUNCTION_ACCEPT_DISPLAY_CHANGES: |
| 532 | return "AcceptDisplayChanges"; |
| 533 | case HWC2_FUNCTION_CREATE_LAYER: return "CreateLayer"; |
| 534 | case HWC2_FUNCTION_CREATE_VIRTUAL_DISPLAY: |
| 535 | return "CreateVirtualDisplay"; |
| 536 | case HWC2_FUNCTION_DESTROY_LAYER: return "DestroyLayer"; |
| 537 | case HWC2_FUNCTION_DESTROY_VIRTUAL_DISPLAY: |
| 538 | return "DestroyVirtualDisplay"; |
| 539 | case HWC2_FUNCTION_DUMP: return "Dump"; |
| 540 | case HWC2_FUNCTION_GET_ACTIVE_CONFIG: return "GetActiveConfig"; |
| 541 | case HWC2_FUNCTION_GET_CHANGED_COMPOSITION_TYPES: |
| 542 | return "GetChangedCompositionTypes"; |
| 543 | case HWC2_FUNCTION_GET_CLIENT_TARGET_SUPPORT: |
| 544 | return "GetClientTargetSupport"; |
| 545 | case HWC2_FUNCTION_GET_COLOR_MODES: return "GetColorModes"; |
| 546 | case HWC2_FUNCTION_GET_DISPLAY_ATTRIBUTE: return "GetDisplayAttribute"; |
| 547 | case HWC2_FUNCTION_GET_DISPLAY_CONFIGS: return "GetDisplayConfigs"; |
| 548 | case HWC2_FUNCTION_GET_DISPLAY_NAME: return "GetDisplayName"; |
| 549 | case HWC2_FUNCTION_GET_DISPLAY_REQUESTS: return "GetDisplayRequests"; |
| 550 | case HWC2_FUNCTION_GET_DISPLAY_TYPE: return "GetDisplayType"; |
| 551 | case HWC2_FUNCTION_GET_DOZE_SUPPORT: return "GetDozeSupport"; |
Dan Stoza | f601e97 | 2016-03-16 09:54:40 -0700 | [diff] [blame] | 552 | case HWC2_FUNCTION_GET_HDR_CAPABILITIES: return "GetHdrCapabilities"; |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 553 | case HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT: |
| 554 | return "GetMaxVirtualDisplayCount"; |
| 555 | case HWC2_FUNCTION_GET_RELEASE_FENCES: return "GetReleaseFences"; |
| 556 | case HWC2_FUNCTION_PRESENT_DISPLAY: return "PresentDisplay"; |
| 557 | case HWC2_FUNCTION_REGISTER_CALLBACK: return "RegisterCallback"; |
| 558 | case HWC2_FUNCTION_SET_ACTIVE_CONFIG: return "SetActiveConfig"; |
| 559 | case HWC2_FUNCTION_SET_CLIENT_TARGET: return "SetClientTarget"; |
| 560 | case HWC2_FUNCTION_SET_COLOR_MODE: return "SetColorMode"; |
| 561 | case HWC2_FUNCTION_SET_COLOR_TRANSFORM: return "SetColorTransform"; |
| 562 | case HWC2_FUNCTION_SET_CURSOR_POSITION: return "SetCursorPosition"; |
| 563 | case HWC2_FUNCTION_SET_LAYER_BLEND_MODE: return "SetLayerBlendMode"; |
| 564 | case HWC2_FUNCTION_SET_LAYER_BUFFER: return "SetLayerBuffer"; |
| 565 | case HWC2_FUNCTION_SET_LAYER_COLOR: return "SetLayerColor"; |
| 566 | case HWC2_FUNCTION_SET_LAYER_COMPOSITION_TYPE: |
| 567 | return "SetLayerCompositionType"; |
| 568 | case HWC2_FUNCTION_SET_LAYER_DATASPACE: return "SetLayerDataspace"; |
| 569 | case HWC2_FUNCTION_SET_LAYER_DISPLAY_FRAME: |
| 570 | return "SetLayerDisplayFrame"; |
| 571 | case HWC2_FUNCTION_SET_LAYER_PLANE_ALPHA: return "SetLayerPlaneAlpha"; |
| 572 | case HWC2_FUNCTION_SET_LAYER_SIDEBAND_STREAM: |
| 573 | return "SetLayerSidebandStream"; |
| 574 | case HWC2_FUNCTION_SET_LAYER_SOURCE_CROP: return "SetLayerSourceCrop"; |
| 575 | case HWC2_FUNCTION_SET_LAYER_SURFACE_DAMAGE: |
| 576 | return "SetLayerSurfaceDamage"; |
| 577 | case HWC2_FUNCTION_SET_LAYER_TRANSFORM: return "SetLayerTransform"; |
| 578 | case HWC2_FUNCTION_SET_LAYER_VISIBLE_REGION: |
| 579 | return "SetLayerVisibleRegion"; |
| 580 | case HWC2_FUNCTION_SET_LAYER_Z_ORDER: return "SetLayerZOrder"; |
| 581 | case HWC2_FUNCTION_SET_OUTPUT_BUFFER: return "SetOutputBuffer"; |
| 582 | case HWC2_FUNCTION_SET_POWER_MODE: return "SetPowerMode"; |
| 583 | case HWC2_FUNCTION_SET_VSYNC_ENABLED: return "SetVsyncEnabled"; |
| 584 | case HWC2_FUNCTION_VALIDATE_DISPLAY: return "ValidateDisplay"; |
Peiyong Lin | fd05d13 | 2018-01-22 12:23:25 -0800 | [diff] [blame] | 585 | case HWC2_FUNCTION_SET_LAYER_FLOAT_COLOR: return "SetLayerFloatColor"; |
Chia-I Wu | 28310aa | 2018-03-15 21:20:55 -0700 | [diff] [blame] | 586 | case HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA: return "SetLayerPerFrameMetadata"; |
Courtney Goeltzenleuchter | 437ce43 | 2017-02-26 14:39:34 -0700 | [diff] [blame] | 587 | case HWC2_FUNCTION_GET_PER_FRAME_METADATA_KEYS: return "GetPerFrameMetadataKeys"; |
| 588 | case HWC2_FUNCTION_SET_READBACK_BUFFER: return "SetReadbackBuffer"; |
| 589 | case HWC2_FUNCTION_GET_READBACK_BUFFER_ATTRIBUTES: return "GetReadbackBufferAttributes"; |
| 590 | case HWC2_FUNCTION_GET_READBACK_BUFFER_FENCE: return "GetReadbackBufferFence"; |
Chia-I Wu | 28310aa | 2018-03-15 21:20:55 -0700 | [diff] [blame] | 591 | case HWC2_FUNCTION_GET_RENDER_INTENTS: return "GetRenderIntents"; |
| 592 | case HWC2_FUNCTION_SET_COLOR_MODE_WITH_RENDER_INTENT: return "SetColorModeWithRenderIntent"; |
| 593 | case HWC2_FUNCTION_GET_DATASPACE_SATURATION_MATRIX: return "GetDataspaceSaturationMatrix"; |
Peiyong Lin | 44819b9 | 2018-09-13 16:20:08 -0700 | [diff] [blame] | 594 | |
| 595 | // composer 2.3 |
Dominik Laskowski | 55cf6f0 | 2018-03-25 15:12:04 -0700 | [diff] [blame] | 596 | case HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA: return "GetDisplayIdentificationData"; |
Peiyong Lin | f09421f | 2018-10-26 18:31:03 -0700 | [diff] [blame] | 597 | case HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES: return "GetDisplayCapabilities"; |
Peiyong Lin | 44819b9 | 2018-09-13 16:20:08 -0700 | [diff] [blame] | 598 | case HWC2_FUNCTION_SET_LAYER_COLOR_TRANSFORM: return "SetLayerColorTransform"; |
Kevin DuBois | 1345887 | 2018-09-10 09:09:12 -0700 | [diff] [blame] | 599 | case HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES: return "GetDisplayedContentSamplingAttributes"; |
| 600 | case HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED: return "SetDisplayedContentSamplingEnabled"; |
| 601 | case HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE: return "GetDisplayedContentSample"; |
Valerie Hau | 69c5343 | 2018-11-13 09:07:44 -0800 | [diff] [blame] | 602 | case HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS: return "SetLayerPerFrameMetadataBlobs"; |
Dan Gittik | 10510ff | 2019-01-18 19:30:24 +0000 | [diff] [blame^] | 603 | case HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT: return "GetDisplayBrightnessSupport"; |
| 604 | case HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS: return "SetDisplayBrightness"; |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 605 | default: return "Unknown"; |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | static inline const char* getLayerRequestName(hwc2_layer_request_t request) { |
Colin Cross | 248ec3d | 2016-10-06 16:53:00 -0700 | [diff] [blame] | 610 | switch (__BIONIC_CAST(static_cast, int, request)) { |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 611 | case 0: return "None"; |
| 612 | case HWC2_LAYER_REQUEST_CLEAR_CLIENT_TARGET: return "ClearClientTarget"; |
| 613 | default: return "Unknown"; |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | static inline const char* getPowerModeName(hwc2_power_mode_t mode) { |
| 618 | switch (mode) { |
| 619 | case HWC2_POWER_MODE_OFF: return "Off"; |
| 620 | case HWC2_POWER_MODE_DOZE_SUSPEND: return "DozeSuspend"; |
| 621 | case HWC2_POWER_MODE_DOZE: return "Doze"; |
| 622 | case HWC2_POWER_MODE_ON: return "On"; |
| 623 | default: return "Unknown"; |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | static inline const char* getTransformName(hwc_transform_t transform) { |
Colin Cross | 248ec3d | 2016-10-06 16:53:00 -0700 | [diff] [blame] | 628 | switch (__BIONIC_CAST(static_cast, int, transform)) { |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 629 | case 0: return "None"; |
| 630 | case HWC_TRANSFORM_FLIP_H: return "FlipH"; |
| 631 | case HWC_TRANSFORM_FLIP_V: return "FlipV"; |
| 632 | case HWC_TRANSFORM_ROT_90: return "Rotate90"; |
| 633 | case HWC_TRANSFORM_ROT_180: return "Rotate180"; |
| 634 | case HWC_TRANSFORM_ROT_270: return "Rotate270"; |
| 635 | case HWC_TRANSFORM_FLIP_H_ROT_90: return "FlipHRotate90"; |
| 636 | case HWC_TRANSFORM_FLIP_V_ROT_90: return "FlipVRotate90"; |
| 637 | default: return "Unknown"; |
| 638 | } |
| 639 | } |
| 640 | |
| 641 | static inline const char* getVsyncName(hwc2_vsync_t vsync) { |
| 642 | switch (vsync) { |
| 643 | case HWC2_VSYNC_INVALID: return "Invalid"; |
| 644 | case HWC2_VSYNC_ENABLE: return "Enable"; |
| 645 | case HWC2_VSYNC_DISABLE: return "Disable"; |
| 646 | default: return "Unknown"; |
| 647 | } |
| 648 | } |
| 649 | |
Kevin DuBois | 1345887 | 2018-09-10 09:09:12 -0700 | [diff] [blame] | 650 | static inline const char* getDisplayedContentSamplingName( |
| 651 | hwc2_displayed_content_sampling_t sampling) { |
| 652 | switch (sampling) { |
| 653 | case HWC2_DISPLAYED_CONTENT_SAMPLING_INVALID: return "Invalid"; |
| 654 | case HWC2_DISPLAYED_CONTENT_SAMPLING_ENABLE: return "Enable"; |
| 655 | case HWC2_DISPLAYED_CONTENT_SAMPLING_DISABLE: return "Disable"; |
| 656 | default: return "Unknown"; |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | static inline const char* getFormatColorComponentName(hwc2_format_color_component_t component) { |
| 661 | switch (component) { |
| 662 | case HWC2_FORMAT_COMPONENT_0: return "FirstComponent"; |
| 663 | case HWC2_FORMAT_COMPONENT_1: return "SecondComponent"; |
| 664 | case HWC2_FORMAT_COMPONENT_2: return "ThirdComponent"; |
| 665 | case HWC2_FORMAT_COMPONENT_3: return "FourthComponent"; |
| 666 | default: return "Unknown"; |
| 667 | } |
| 668 | } |
| 669 | |
Peiyong Lin | f09421f | 2018-10-26 18:31:03 -0700 | [diff] [blame] | 670 | static inline const char* getDisplayCapabilityName(hwc2_display_capability_t capability) { |
| 671 | switch (capability) { |
| 672 | case HWC2_DISPLAY_CAPABILITY_INVALID: return "Invalid"; |
| 673 | case HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM: |
| 674 | return "SkipClientColorTransform"; |
| 675 | case HWC2_DISPLAY_CAPABILITY_DOZE: |
| 676 | return "Doze"; |
Dan Gittik | 10510ff | 2019-01-18 19:30:24 +0000 | [diff] [blame^] | 677 | case HWC2_DISPLAY_CAPABILITY_BRIGHTNESS: |
| 678 | return "Brightness"; |
Peiyong Lin | f09421f | 2018-10-26 18:31:03 -0700 | [diff] [blame] | 679 | default: |
| 680 | return "Unknown"; |
| 681 | } |
| 682 | } |
| 683 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 684 | #define TO_STRING(E, T, printer) \ |
| 685 | inline std::string to_string(E value) { return printer(value); } \ |
| 686 | inline std::string to_string(T value) { return to_string(static_cast<E>(value)); } |
| 687 | #else // !HWC2_INCLUDE_STRINGIFICATION |
| 688 | #define TO_STRING(name, printer) |
| 689 | #endif // HWC2_INCLUDE_STRINGIFICATION |
| 690 | |
| 691 | /* |
| 692 | * C++11 features |
| 693 | */ |
| 694 | |
| 695 | #ifdef HWC2_USE_CPP11 |
| 696 | __END_DECLS |
| 697 | |
| 698 | #ifdef HWC2_INCLUDE_STRINGIFICATION |
| 699 | #include <string> |
| 700 | #endif |
| 701 | |
| 702 | namespace HWC2 { |
| 703 | |
| 704 | enum class Attribute : int32_t { |
| 705 | Invalid = HWC2_ATTRIBUTE_INVALID, |
| 706 | Width = HWC2_ATTRIBUTE_WIDTH, |
| 707 | Height = HWC2_ATTRIBUTE_HEIGHT, |
| 708 | VsyncPeriod = HWC2_ATTRIBUTE_VSYNC_PERIOD, |
| 709 | DpiX = HWC2_ATTRIBUTE_DPI_X, |
| 710 | DpiY = HWC2_ATTRIBUTE_DPI_Y, |
| 711 | }; |
| 712 | TO_STRING(hwc2_attribute_t, Attribute, getAttributeName) |
| 713 | |
| 714 | enum class BlendMode : int32_t { |
| 715 | Invalid = HWC2_BLEND_MODE_INVALID, |
| 716 | None = HWC2_BLEND_MODE_NONE, |
| 717 | Premultiplied = HWC2_BLEND_MODE_PREMULTIPLIED, |
| 718 | Coverage = HWC2_BLEND_MODE_COVERAGE, |
| 719 | }; |
| 720 | TO_STRING(hwc2_blend_mode_t, BlendMode, getBlendModeName) |
| 721 | |
| 722 | enum class Callback : int32_t { |
| 723 | Invalid = HWC2_CALLBACK_INVALID, |
| 724 | Hotplug = HWC2_CALLBACK_HOTPLUG, |
| 725 | Refresh = HWC2_CALLBACK_REFRESH, |
| 726 | Vsync = HWC2_CALLBACK_VSYNC, |
| 727 | }; |
| 728 | TO_STRING(hwc2_callback_descriptor_t, Callback, getCallbackDescriptorName) |
| 729 | |
| 730 | enum class Capability : int32_t { |
| 731 | Invalid = HWC2_CAPABILITY_INVALID, |
| 732 | SidebandStream = HWC2_CAPABILITY_SIDEBAND_STREAM, |
Dan Stoza | d2168f7 | 2016-07-14 11:48:16 -0700 | [diff] [blame] | 733 | SkipClientColorTransform = HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM, |
Brian Anderson | 49018a5 | 2017-04-04 16:43:11 -0700 | [diff] [blame] | 734 | PresentFenceIsNotReliable = HWC2_CAPABILITY_PRESENT_FENCE_IS_NOT_RELIABLE, |
Fabien Sanglard | 9bdc0b6 | 2017-06-13 14:56:08 -0700 | [diff] [blame] | 735 | SkipValidate = HWC2_CAPABILITY_SKIP_VALIDATE, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 736 | }; |
| 737 | TO_STRING(hwc2_capability_t, Capability, getCapabilityName) |
| 738 | |
| 739 | enum class Composition : int32_t { |
| 740 | Invalid = HWC2_COMPOSITION_INVALID, |
| 741 | Client = HWC2_COMPOSITION_CLIENT, |
| 742 | Device = HWC2_COMPOSITION_DEVICE, |
| 743 | SolidColor = HWC2_COMPOSITION_SOLID_COLOR, |
| 744 | Cursor = HWC2_COMPOSITION_CURSOR, |
| 745 | Sideband = HWC2_COMPOSITION_SIDEBAND, |
| 746 | }; |
| 747 | TO_STRING(hwc2_composition_t, Composition, getCompositionName) |
| 748 | |
| 749 | enum class Connection : int32_t { |
| 750 | Invalid = HWC2_CONNECTION_INVALID, |
| 751 | Connected = HWC2_CONNECTION_CONNECTED, |
| 752 | Disconnected = HWC2_CONNECTION_DISCONNECTED, |
| 753 | }; |
| 754 | TO_STRING(hwc2_connection_t, Connection, getConnectionName) |
| 755 | |
| 756 | enum class DisplayRequest : int32_t { |
| 757 | FlipClientTarget = HWC2_DISPLAY_REQUEST_FLIP_CLIENT_TARGET, |
| 758 | WriteClientTargetToOutput = |
| 759 | HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT, |
| 760 | }; |
| 761 | TO_STRING(hwc2_display_request_t, DisplayRequest, getDisplayRequestName) |
| 762 | |
| 763 | enum class DisplayType : int32_t { |
| 764 | Invalid = HWC2_DISPLAY_TYPE_INVALID, |
| 765 | Physical = HWC2_DISPLAY_TYPE_PHYSICAL, |
| 766 | Virtual = HWC2_DISPLAY_TYPE_VIRTUAL, |
| 767 | }; |
| 768 | TO_STRING(hwc2_display_type_t, DisplayType, getDisplayTypeName) |
| 769 | |
| 770 | enum class Error : int32_t { |
| 771 | None = HWC2_ERROR_NONE, |
| 772 | BadConfig = HWC2_ERROR_BAD_CONFIG, |
| 773 | BadDisplay = HWC2_ERROR_BAD_DISPLAY, |
| 774 | BadLayer = HWC2_ERROR_BAD_LAYER, |
| 775 | BadParameter = HWC2_ERROR_BAD_PARAMETER, |
| 776 | HasChanges = HWC2_ERROR_HAS_CHANGES, |
| 777 | NoResources = HWC2_ERROR_NO_RESOURCES, |
| 778 | NotValidated = HWC2_ERROR_NOT_VALIDATED, |
| 779 | Unsupported = HWC2_ERROR_UNSUPPORTED, |
| 780 | }; |
| 781 | TO_STRING(hwc2_error_t, Error, getErrorName) |
| 782 | |
| 783 | enum class FunctionDescriptor : int32_t { |
| 784 | Invalid = HWC2_FUNCTION_INVALID, |
| 785 | AcceptDisplayChanges = HWC2_FUNCTION_ACCEPT_DISPLAY_CHANGES, |
| 786 | CreateLayer = HWC2_FUNCTION_CREATE_LAYER, |
| 787 | CreateVirtualDisplay = HWC2_FUNCTION_CREATE_VIRTUAL_DISPLAY, |
| 788 | DestroyLayer = HWC2_FUNCTION_DESTROY_LAYER, |
| 789 | DestroyVirtualDisplay = HWC2_FUNCTION_DESTROY_VIRTUAL_DISPLAY, |
| 790 | Dump = HWC2_FUNCTION_DUMP, |
| 791 | GetActiveConfig = HWC2_FUNCTION_GET_ACTIVE_CONFIG, |
| 792 | GetChangedCompositionTypes = HWC2_FUNCTION_GET_CHANGED_COMPOSITION_TYPES, |
| 793 | GetClientTargetSupport = HWC2_FUNCTION_GET_CLIENT_TARGET_SUPPORT, |
| 794 | GetColorModes = HWC2_FUNCTION_GET_COLOR_MODES, |
| 795 | GetDisplayAttribute = HWC2_FUNCTION_GET_DISPLAY_ATTRIBUTE, |
| 796 | GetDisplayConfigs = HWC2_FUNCTION_GET_DISPLAY_CONFIGS, |
| 797 | GetDisplayName = HWC2_FUNCTION_GET_DISPLAY_NAME, |
| 798 | GetDisplayRequests = HWC2_FUNCTION_GET_DISPLAY_REQUESTS, |
| 799 | GetDisplayType = HWC2_FUNCTION_GET_DISPLAY_TYPE, |
| 800 | GetDozeSupport = HWC2_FUNCTION_GET_DOZE_SUPPORT, |
Dan Stoza | f601e97 | 2016-03-16 09:54:40 -0700 | [diff] [blame] | 801 | GetHdrCapabilities = HWC2_FUNCTION_GET_HDR_CAPABILITIES, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 802 | GetMaxVirtualDisplayCount = HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT, |
| 803 | GetReleaseFences = HWC2_FUNCTION_GET_RELEASE_FENCES, |
| 804 | PresentDisplay = HWC2_FUNCTION_PRESENT_DISPLAY, |
| 805 | RegisterCallback = HWC2_FUNCTION_REGISTER_CALLBACK, |
| 806 | SetActiveConfig = HWC2_FUNCTION_SET_ACTIVE_CONFIG, |
| 807 | SetClientTarget = HWC2_FUNCTION_SET_CLIENT_TARGET, |
| 808 | SetColorMode = HWC2_FUNCTION_SET_COLOR_MODE, |
| 809 | SetColorTransform = HWC2_FUNCTION_SET_COLOR_TRANSFORM, |
| 810 | SetCursorPosition = HWC2_FUNCTION_SET_CURSOR_POSITION, |
| 811 | SetLayerBlendMode = HWC2_FUNCTION_SET_LAYER_BLEND_MODE, |
| 812 | SetLayerBuffer = HWC2_FUNCTION_SET_LAYER_BUFFER, |
| 813 | SetLayerColor = HWC2_FUNCTION_SET_LAYER_COLOR, |
| 814 | SetLayerCompositionType = HWC2_FUNCTION_SET_LAYER_COMPOSITION_TYPE, |
| 815 | SetLayerDataspace = HWC2_FUNCTION_SET_LAYER_DATASPACE, |
| 816 | SetLayerDisplayFrame = HWC2_FUNCTION_SET_LAYER_DISPLAY_FRAME, |
| 817 | SetLayerPlaneAlpha = HWC2_FUNCTION_SET_LAYER_PLANE_ALPHA, |
| 818 | SetLayerSidebandStream = HWC2_FUNCTION_SET_LAYER_SIDEBAND_STREAM, |
| 819 | SetLayerSourceCrop = HWC2_FUNCTION_SET_LAYER_SOURCE_CROP, |
| 820 | SetLayerSurfaceDamage = HWC2_FUNCTION_SET_LAYER_SURFACE_DAMAGE, |
| 821 | SetLayerTransform = HWC2_FUNCTION_SET_LAYER_TRANSFORM, |
| 822 | SetLayerVisibleRegion = HWC2_FUNCTION_SET_LAYER_VISIBLE_REGION, |
| 823 | SetLayerZOrder = HWC2_FUNCTION_SET_LAYER_Z_ORDER, |
| 824 | SetOutputBuffer = HWC2_FUNCTION_SET_OUTPUT_BUFFER, |
| 825 | SetPowerMode = HWC2_FUNCTION_SET_POWER_MODE, |
| 826 | SetVsyncEnabled = HWC2_FUNCTION_SET_VSYNC_ENABLED, |
| 827 | ValidateDisplay = HWC2_FUNCTION_VALIDATE_DISPLAY, |
Peiyong Lin | fd05d13 | 2018-01-22 12:23:25 -0800 | [diff] [blame] | 828 | SetLayerFloatColor = HWC2_FUNCTION_SET_LAYER_FLOAT_COLOR, |
Chia-I Wu | 28310aa | 2018-03-15 21:20:55 -0700 | [diff] [blame] | 829 | SetLayerPerFrameMetadata = HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA, |
Courtney Goeltzenleuchter | 437ce43 | 2017-02-26 14:39:34 -0700 | [diff] [blame] | 830 | GetPerFrameMetadataKeys = HWC2_FUNCTION_GET_PER_FRAME_METADATA_KEYS, |
| 831 | SetReadbackBuffer = HWC2_FUNCTION_SET_READBACK_BUFFER, |
| 832 | GetReadbackBufferAttributes = HWC2_FUNCTION_GET_READBACK_BUFFER_ATTRIBUTES, |
| 833 | GetReadbackBufferFence = HWC2_FUNCTION_GET_READBACK_BUFFER_FENCE, |
Chia-I Wu | 28310aa | 2018-03-15 21:20:55 -0700 | [diff] [blame] | 834 | GetRenderIntents = HWC2_FUNCTION_GET_RENDER_INTENTS, |
| 835 | SetColorModeWithRenderIntent = HWC2_FUNCTION_SET_COLOR_MODE_WITH_RENDER_INTENT, |
| 836 | GetDataspaceSaturationMatrix = HWC2_FUNCTION_GET_DATASPACE_SATURATION_MATRIX, |
Peiyong Lin | 44819b9 | 2018-09-13 16:20:08 -0700 | [diff] [blame] | 837 | |
| 838 | // composer 2.3 |
Dominik Laskowski | 55cf6f0 | 2018-03-25 15:12:04 -0700 | [diff] [blame] | 839 | GetDisplayIdentificationData = HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA, |
Peiyong Lin | f09421f | 2018-10-26 18:31:03 -0700 | [diff] [blame] | 840 | GetDisplayCapabilities = HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES, |
Peiyong Lin | 44819b9 | 2018-09-13 16:20:08 -0700 | [diff] [blame] | 841 | SetLayerColorTransform = HWC2_FUNCTION_SET_LAYER_COLOR_TRANSFORM, |
Kevin DuBois | 1345887 | 2018-09-10 09:09:12 -0700 | [diff] [blame] | 842 | GetDisplayedContentSamplingAttributes = HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES, |
| 843 | SetDisplayedContentSamplingEnabled = HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED, |
| 844 | GetDisplayedContentSample = HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE, |
Valerie Hau | 69c5343 | 2018-11-13 09:07:44 -0800 | [diff] [blame] | 845 | SetLayerPerFrameMetadataBlobs = HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS, |
Dan Gittik | 10510ff | 2019-01-18 19:30:24 +0000 | [diff] [blame^] | 846 | GetDisplayBrightnessSupport = HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT, |
| 847 | SetDisplayBrightness = HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 848 | }; |
| 849 | TO_STRING(hwc2_function_descriptor_t, FunctionDescriptor, |
| 850 | getFunctionDescriptorName) |
| 851 | |
| 852 | enum class LayerRequest : int32_t { |
| 853 | ClearClientTarget = HWC2_LAYER_REQUEST_CLEAR_CLIENT_TARGET, |
| 854 | }; |
| 855 | TO_STRING(hwc2_layer_request_t, LayerRequest, getLayerRequestName) |
| 856 | |
| 857 | enum class PowerMode : int32_t { |
| 858 | Off = HWC2_POWER_MODE_OFF, |
| 859 | DozeSuspend = HWC2_POWER_MODE_DOZE_SUSPEND, |
| 860 | Doze = HWC2_POWER_MODE_DOZE, |
| 861 | On = HWC2_POWER_MODE_ON, |
| 862 | }; |
| 863 | TO_STRING(hwc2_power_mode_t, PowerMode, getPowerModeName) |
| 864 | |
| 865 | enum class Transform : int32_t { |
| 866 | None = 0, |
| 867 | FlipH = HWC_TRANSFORM_FLIP_H, |
| 868 | FlipV = HWC_TRANSFORM_FLIP_V, |
| 869 | Rotate90 = HWC_TRANSFORM_ROT_90, |
| 870 | Rotate180 = HWC_TRANSFORM_ROT_180, |
| 871 | Rotate270 = HWC_TRANSFORM_ROT_270, |
| 872 | FlipHRotate90 = HWC_TRANSFORM_FLIP_H_ROT_90, |
| 873 | FlipVRotate90 = HWC_TRANSFORM_FLIP_V_ROT_90, |
| 874 | }; |
| 875 | TO_STRING(hwc_transform_t, Transform, getTransformName) |
| 876 | |
| 877 | enum class Vsync : int32_t { |
| 878 | Invalid = HWC2_VSYNC_INVALID, |
| 879 | Enable = HWC2_VSYNC_ENABLE, |
| 880 | Disable = HWC2_VSYNC_DISABLE, |
| 881 | }; |
| 882 | TO_STRING(hwc2_vsync_t, Vsync, getVsyncName) |
| 883 | |
Peiyong Lin | f09421f | 2018-10-26 18:31:03 -0700 | [diff] [blame] | 884 | enum class DisplayCapability : int32_t { |
| 885 | Invalid = HWC2_DISPLAY_CAPABILITY_INVALID, |
| 886 | SkipClientColorTransform = HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM, |
| 887 | Doze = HWC2_DISPLAY_CAPABILITY_DOZE, |
Dan Gittik | 10510ff | 2019-01-18 19:30:24 +0000 | [diff] [blame^] | 888 | Brightness = HWC2_DISPLAY_CAPABILITY_BRIGHTNESS, |
Peiyong Lin | f09421f | 2018-10-26 18:31:03 -0700 | [diff] [blame] | 889 | }; |
| 890 | TO_STRING(hwc2_display_capability_t, DisplayCapability, getDisplayCapabilityName) |
| 891 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 892 | } // namespace HWC2 |
| 893 | |
| 894 | __BEGIN_DECLS |
| 895 | #endif // HWC2_USE_CPP11 |
| 896 | |
| 897 | /* |
| 898 | * Typedefs |
| 899 | */ |
| 900 | |
| 901 | typedef void (*hwc2_function_pointer_t)(); |
| 902 | |
| 903 | typedef void* hwc2_callback_data_t; |
| 904 | typedef uint32_t hwc2_config_t; |
| 905 | typedef uint64_t hwc2_display_t; |
| 906 | typedef uint64_t hwc2_layer_t; |
| 907 | |
| 908 | /* |
| 909 | * Device Struct |
| 910 | */ |
| 911 | |
| 912 | typedef struct hwc2_device { |
| 913 | /* Must be the first member of this struct, since a pointer to this struct |
| 914 | * will be generated by casting from a hw_device_t* */ |
| 915 | struct hw_device_t common; |
| 916 | |
| 917 | /* getCapabilities(..., outCount, outCapabilities) |
| 918 | * |
| 919 | * Provides a list of capabilities (described in the definition of |
| 920 | * hwc2_capability_t above) supported by this device. This list must |
| 921 | * not change after the device has been loaded. |
| 922 | * |
| 923 | * Parameters: |
| 924 | * outCount - if outCapabilities was NULL, the number of capabilities |
| 925 | * which would have been returned; if outCapabilities was not NULL, |
| 926 | * the number of capabilities returned, which must not exceed the |
| 927 | * value stored in outCount prior to the call |
| 928 | * outCapabilities - a list of capabilities supported by this device; may |
| 929 | * be NULL, in which case this function must write into outCount the |
| 930 | * number of capabilities which would have been written into |
| 931 | * outCapabilities |
| 932 | */ |
| 933 | void (*getCapabilities)(struct hwc2_device* device, uint32_t* outCount, |
| 934 | int32_t* /*hwc2_capability_t*/ outCapabilities); |
| 935 | |
| 936 | /* getFunction(..., descriptor) |
| 937 | * |
| 938 | * Returns a function pointer which implements the requested description. |
| 939 | * |
| 940 | * Parameters: |
| 941 | * descriptor - the function to return |
| 942 | * |
| 943 | * Returns either a function pointer implementing the requested descriptor |
| 944 | * or NULL if the described function is not supported by this device. |
| 945 | */ |
| 946 | hwc2_function_pointer_t (*getFunction)(struct hwc2_device* device, |
| 947 | int32_t /*hwc2_function_descriptor_t*/ descriptor); |
| 948 | } hwc2_device_t; |
| 949 | |
| 950 | static inline int hwc2_open(const struct hw_module_t* module, |
| 951 | hwc2_device_t** device) { |
| 952 | return module->methods->open(module, HWC_HARDWARE_COMPOSER, |
Colin Cross | cc8d9f9 | 2016-10-06 16:44:23 -0700 | [diff] [blame] | 953 | TO_HW_DEVICE_T_OPEN(device)); |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 954 | } |
| 955 | |
| 956 | static inline int hwc2_close(hwc2_device_t* device) { |
| 957 | return device->common.close(&device->common); |
| 958 | } |
| 959 | |
| 960 | /* |
| 961 | * Callbacks |
| 962 | * |
| 963 | * All of these callbacks take as their first parameter the callbackData which |
| 964 | * was provided at the time of callback registration, so this parameter is |
| 965 | * omitted from the described parameter lists. |
| 966 | */ |
| 967 | |
| 968 | /* hotplug(..., display, connected) |
| 969 | * Descriptor: HWC2_CALLBACK_HOTPLUG |
| 970 | * Will be provided to all HWC2 devices |
| 971 | * |
| 972 | * Notifies the client that the given display has either been connected or |
| 973 | * disconnected. Every active display (even a built-in physical display) must |
| 974 | * trigger at least one hotplug notification, even if it only occurs immediately |
| 975 | * after callback registration. |
| 976 | * |
| 977 | * The client may call back into the device on the same thread to query display |
| 978 | * properties (such as width, height, and vsync period), and other threads may |
| 979 | * call into the device while the callback is in progress. The device must |
| 980 | * serialize calls to this callback such that only one thread is calling it at a |
| 981 | * time. |
| 982 | * |
| 983 | * Displays which have been connected are assumed to be in HWC2_POWER_MODE_OFF, |
| 984 | * and the vsync callback should not be called for a display until vsync has |
| 985 | * been enabled with setVsyncEnabled. |
| 986 | * |
| 987 | * Parameters: |
| 988 | * display - the display which has been hotplugged |
| 989 | * connected - whether the display has been connected or disconnected |
| 990 | */ |
| 991 | typedef void (*HWC2_PFN_HOTPLUG)(hwc2_callback_data_t callbackData, |
| 992 | hwc2_display_t display, int32_t /*hwc2_connection_t*/ connected); |
| 993 | |
| 994 | /* refresh(..., display) |
| 995 | * Descriptor: HWC2_CALLBACK_REFRESH |
| 996 | * Will be provided to all HWC2 devices |
| 997 | * |
| 998 | * Notifies the client to trigger a screen refresh. This forces all layer state |
| 999 | * for this display to be resent, and the display to be validated and presented, |
| 1000 | * even if there have been no changes. |
| 1001 | * |
| 1002 | * This refresh will occur some time after the callback is initiated, but not |
| 1003 | * necessarily before it returns. This thread, however, is guaranteed not to |
| 1004 | * call back into the device, thus it is safe to trigger this callback from |
| 1005 | * other functions which call into the device. |
| 1006 | * |
| 1007 | * Parameters: |
| 1008 | * display - the display to refresh |
| 1009 | */ |
| 1010 | typedef void (*HWC2_PFN_REFRESH)(hwc2_callback_data_t callbackData, |
| 1011 | hwc2_display_t display); |
| 1012 | |
| 1013 | /* vsync(..., display, timestamp) |
| 1014 | * Descriptor: HWC2_CALLBACK_VSYNC |
| 1015 | * Will be provided to all HWC2 devices |
| 1016 | * |
| 1017 | * Notifies the client that a vsync event has occurred. This callback must |
| 1018 | * only be triggered when vsync is enabled for this display (through |
| 1019 | * setVsyncEnabled). |
| 1020 | * |
| 1021 | * This callback should be triggered from a thread of at least |
| 1022 | * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible, typically |
| 1023 | * less than 0.5 ms. This thread is guaranteed not to call back into the device. |
| 1024 | * |
| 1025 | * Parameters: |
| 1026 | * display - the display which has received a vsync event |
| 1027 | * timestamp - the CLOCK_MONOTONIC time at which the vsync event occurred, in |
| 1028 | * nanoseconds |
| 1029 | */ |
| 1030 | typedef void (*HWC2_PFN_VSYNC)(hwc2_callback_data_t callbackData, |
| 1031 | hwc2_display_t display, int64_t timestamp); |
| 1032 | |
| 1033 | /* |
| 1034 | * Device Functions |
| 1035 | * |
| 1036 | * All of these functions take as their first parameter a device pointer, so |
| 1037 | * this parameter is omitted from the described parameter lists. |
| 1038 | */ |
| 1039 | |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1040 | /* createVirtualDisplay(..., width, height, format, outDisplay) |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1041 | * Descriptor: HWC2_FUNCTION_CREATE_VIRTUAL_DISPLAY |
| 1042 | * Must be provided by all HWC2 devices |
| 1043 | * |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1044 | * Creates a new virtual display with the given width and height. The format |
| 1045 | * passed into this function is the default format requested by the consumer of |
| 1046 | * the virtual display output buffers. If a different format will be returned by |
| 1047 | * the device, it should be returned in this parameter so it can be set properly |
| 1048 | * when handing the buffers to the consumer. |
| 1049 | * |
| 1050 | * The display will be assumed to be on from the time the first frame is |
| 1051 | * presented until the display is destroyed. |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1052 | * |
| 1053 | * Parameters: |
| 1054 | * width - width in pixels |
| 1055 | * height - height in pixels |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1056 | * format - prior to the call, the default output buffer format selected by |
| 1057 | * the consumer; after the call, the format the device will produce |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1058 | * outDisplay - the newly-created virtual display; pointer will be non-NULL |
| 1059 | * |
| 1060 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1061 | * HWC2_ERROR_UNSUPPORTED - the width or height is too large for the device to |
| 1062 | * be able to create a virtual display |
| 1063 | * HWC2_ERROR_NO_RESOURCES - the device is unable to create a new virtual |
| 1064 | * display at this time |
| 1065 | */ |
| 1066 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_CREATE_VIRTUAL_DISPLAY)( |
| 1067 | hwc2_device_t* device, uint32_t width, uint32_t height, |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1068 | int32_t* /*android_pixel_format_t*/ format, hwc2_display_t* outDisplay); |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1069 | |
| 1070 | /* destroyVirtualDisplay(..., display) |
| 1071 | * Descriptor: HWC2_FUNCTION_DESTROY_VIRTUAL_DISPLAY |
| 1072 | * Must be provided by all HWC2 devices |
| 1073 | * |
| 1074 | * Destroys a virtual display. After this call all resources consumed by this |
| 1075 | * display may be freed by the device and any operations performed on this |
| 1076 | * display should fail. |
| 1077 | * |
| 1078 | * Parameters: |
| 1079 | * display - the virtual display to destroy |
| 1080 | * |
| 1081 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1082 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1083 | * HWC2_ERROR_BAD_PARAMETER - the display handle which was passed in does not |
| 1084 | * refer to a virtual display |
| 1085 | */ |
| 1086 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_DESTROY_VIRTUAL_DISPLAY)( |
| 1087 | hwc2_device_t* device, hwc2_display_t display); |
| 1088 | |
| 1089 | /* dump(..., outSize, outBuffer) |
| 1090 | * Descriptor: HWC2_FUNCTION_DUMP |
| 1091 | * Must be provided by all HWC2 devices |
| 1092 | * |
| 1093 | * Retrieves implementation-defined debug information, which will be displayed |
| 1094 | * during, for example, `dumpsys SurfaceFlinger`. |
| 1095 | * |
| 1096 | * If called with outBuffer == NULL, the device should store a copy of the |
| 1097 | * desired output and return its length in bytes in outSize. If the device |
| 1098 | * already has a stored copy, that copy should be purged and replaced with a |
| 1099 | * fresh copy. |
| 1100 | * |
| 1101 | * If called with outBuffer != NULL, the device should copy its stored version |
| 1102 | * of the output into outBuffer and store how many bytes of data it copied into |
| 1103 | * outSize. Prior to this call, the client will have populated outSize with the |
| 1104 | * maximum number of bytes outBuffer can hold. The device must not write more |
| 1105 | * than this amount into outBuffer. If the device does not currently have a |
| 1106 | * stored copy, then it should return 0 in outSize. |
| 1107 | * |
| 1108 | * Any data written into outBuffer need not be null-terminated. |
| 1109 | * |
| 1110 | * Parameters: |
| 1111 | * outSize - if outBuffer was NULL, the number of bytes needed to copy the |
| 1112 | * device's stored output; if outBuffer was not NULL, the number of bytes |
| 1113 | * written into it, which must not exceed the value stored in outSize |
| 1114 | * prior to the call; pointer will be non-NULL |
| 1115 | * outBuffer - the buffer to write the dump output into; may be NULL as |
| 1116 | * described above; data written into this buffer need not be |
| 1117 | * null-terminated |
| 1118 | */ |
| 1119 | typedef void (*HWC2_PFN_DUMP)(hwc2_device_t* device, uint32_t* outSize, |
| 1120 | char* outBuffer); |
| 1121 | |
| 1122 | /* getMaxVirtualDisplayCount(...) |
| 1123 | * Descriptor: HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT |
| 1124 | * Must be provided by all HWC2 devices |
| 1125 | * |
| 1126 | * Returns the maximum number of virtual displays supported by this device |
| 1127 | * (which may be 0). The client will not attempt to create more than this many |
| 1128 | * virtual displays on this device. This number must not change for the lifetime |
| 1129 | * of the device. |
| 1130 | */ |
| 1131 | typedef uint32_t (*HWC2_PFN_GET_MAX_VIRTUAL_DISPLAY_COUNT)( |
| 1132 | hwc2_device_t* device); |
| 1133 | |
| 1134 | /* registerCallback(..., descriptor, callbackData, pointer) |
| 1135 | * Descriptor: HWC2_FUNCTION_REGISTER_CALLBACK |
| 1136 | * Must be provided by all HWC2 devices |
| 1137 | * |
| 1138 | * Provides a callback for the device to call. All callbacks take a callbackData |
| 1139 | * item as the first parameter, so this value should be stored with the callback |
| 1140 | * for later use. The callbackData may differ from one callback to another. If |
| 1141 | * this function is called multiple times with the same descriptor, later |
| 1142 | * callbacks replace earlier ones. |
| 1143 | * |
| 1144 | * Parameters: |
| 1145 | * descriptor - which callback should be set |
| 1146 | * callBackdata - opaque data which must be passed back through the callback |
| 1147 | * pointer - a non-NULL function pointer corresponding to the descriptor |
| 1148 | * |
| 1149 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1150 | * HWC2_ERROR_BAD_PARAMETER - descriptor was invalid |
| 1151 | */ |
| 1152 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_REGISTER_CALLBACK)( |
| 1153 | hwc2_device_t* device, |
| 1154 | int32_t /*hwc2_callback_descriptor_t*/ descriptor, |
| 1155 | hwc2_callback_data_t callbackData, hwc2_function_pointer_t pointer); |
| 1156 | |
Chia-I Wu | 28310aa | 2018-03-15 21:20:55 -0700 | [diff] [blame] | 1157 | /* getDataspaceSaturationMatrix(..., dataspace, outMatrix) |
| 1158 | * Descriptor: HWC2_FUNCTION_GET_DATASPACE_SATURATION_MATRIX |
| 1159 | * Provided by HWC2 devices which don't return nullptr function pointer. |
| 1160 | * |
| 1161 | * Get the saturation matrix of the specified dataspace. The saturation matrix |
| 1162 | * can be used to approximate the dataspace saturation operation performed by |
| 1163 | * the HWC2 device when non-colorimetric mapping is allowed. It is to be |
| 1164 | * applied on linear pixel values. |
| 1165 | * |
| 1166 | * Parameters: |
| 1167 | * dataspace - the dataspace to query for |
| 1168 | * outMatrix - a column-major 4x4 matrix (16 floats). It must be an identity |
| 1169 | * matrix unless dataspace is HAL_DATASPACE_SRGB_LINEAR. |
| 1170 | * |
| 1171 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1172 | * HWC2_ERROR_BAD_PARAMETER - dataspace was invalid |
| 1173 | */ |
| 1174 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DATASPACE_SATURATION_MATRIX)( |
| 1175 | hwc2_device_t* device, int32_t /*android_dataspace_t*/ dataspace, |
| 1176 | float* outMatrix); |
| 1177 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1178 | /* |
| 1179 | * Display Functions |
| 1180 | * |
| 1181 | * All of these functions take as their first two parameters a device pointer |
| 1182 | * and a display handle, so these parameters are omitted from the described |
| 1183 | * parameter lists. |
| 1184 | */ |
| 1185 | |
| 1186 | /* acceptDisplayChanges(...) |
| 1187 | * Descriptor: HWC2_FUNCTION_ACCEPT_DISPLAY_CHANGES |
| 1188 | * Must be provided by all HWC2 devices |
| 1189 | * |
| 1190 | * Accepts the changes required by the device from the previous validateDisplay |
| 1191 | * call (which may be queried using getChangedCompositionTypes) and revalidates |
| 1192 | * the display. This function is equivalent to requesting the changed types from |
| 1193 | * getChangedCompositionTypes, setting those types on the corresponding layers, |
| 1194 | * and then calling validateDisplay again. |
| 1195 | * |
| 1196 | * After this call it must be valid to present this display. Calling this after |
| 1197 | * validateDisplay returns 0 changes must succeed with HWC2_ERROR_NONE, but |
| 1198 | * should have no other effect. |
| 1199 | * |
| 1200 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1201 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1202 | * HWC2_ERROR_NOT_VALIDATED - validateDisplay has not been called |
| 1203 | */ |
| 1204 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_ACCEPT_DISPLAY_CHANGES)( |
| 1205 | hwc2_device_t* device, hwc2_display_t display); |
| 1206 | |
| 1207 | /* createLayer(..., outLayer) |
| 1208 | * Descriptor: HWC2_FUNCTION_CREATE_LAYER |
| 1209 | * Must be provided by all HWC2 devices |
| 1210 | * |
| 1211 | * Creates a new layer on the given display. |
| 1212 | * |
| 1213 | * Parameters: |
| 1214 | * outLayer - the handle of the new layer; pointer will be non-NULL |
| 1215 | * |
| 1216 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1217 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1218 | * HWC2_ERROR_NO_RESOURCES - the device was unable to create this layer |
| 1219 | */ |
| 1220 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_CREATE_LAYER)(hwc2_device_t* device, |
| 1221 | hwc2_display_t display, hwc2_layer_t* outLayer); |
| 1222 | |
| 1223 | /* destroyLayer(..., layer) |
| 1224 | * Descriptor: HWC2_FUNCTION_DESTROY_LAYER |
| 1225 | * Must be provided by all HWC2 devices |
| 1226 | * |
| 1227 | * Destroys the given layer. |
| 1228 | * |
| 1229 | * Parameters: |
| 1230 | * layer - the handle of the layer to destroy |
| 1231 | * |
| 1232 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1233 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1234 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1235 | */ |
| 1236 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_DESTROY_LAYER)( |
| 1237 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer); |
| 1238 | |
| 1239 | /* getActiveConfig(..., outConfig) |
| 1240 | * Descriptor: HWC2_FUNCTION_GET_ACTIVE_CONFIG |
| 1241 | * Must be provided by all HWC2 devices |
| 1242 | * |
| 1243 | * Retrieves which display configuration is currently active. |
| 1244 | * |
| 1245 | * If no display configuration is currently active, this function must return |
| 1246 | * HWC2_ERROR_BAD_CONFIG and place no configuration handle in outConfig. It is |
| 1247 | * the responsibility of the client to call setActiveConfig with a valid |
| 1248 | * configuration before attempting to present anything on the display. |
| 1249 | * |
| 1250 | * Parameters: |
| 1251 | * outConfig - the currently active display configuration; pointer will be |
| 1252 | * non-NULL |
| 1253 | * |
| 1254 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1255 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1256 | * HWC2_ERROR_BAD_CONFIG - no configuration is currently active |
| 1257 | */ |
| 1258 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_ACTIVE_CONFIG)( |
| 1259 | hwc2_device_t* device, hwc2_display_t display, |
| 1260 | hwc2_config_t* outConfig); |
| 1261 | |
| 1262 | /* getChangedCompositionTypes(..., outNumElements, outLayers, outTypes) |
| 1263 | * Descriptor: HWC2_FUNCTION_GET_CHANGED_COMPOSITION_TYPES |
| 1264 | * Must be provided by all HWC2 devices |
| 1265 | * |
| 1266 | * Retrieves the layers for which the device requires a different composition |
| 1267 | * type than had been set prior to the last call to validateDisplay. The client |
| 1268 | * will either update its state with these types and call acceptDisplayChanges, |
| 1269 | * or will set new types and attempt to validate the display again. |
| 1270 | * |
| 1271 | * outLayers and outTypes may be NULL to retrieve the number of elements which |
| 1272 | * will be returned. The number of elements returned must be the same as the |
| 1273 | * value returned in outNumTypes from the last call to validateDisplay. |
| 1274 | * |
| 1275 | * Parameters: |
| 1276 | * outNumElements - if outLayers or outTypes were NULL, the number of layers |
| 1277 | * and types which would have been returned; if both were non-NULL, the |
| 1278 | * number of elements returned in outLayers and outTypes, which must not |
| 1279 | * exceed the value stored in outNumElements prior to the call; pointer |
| 1280 | * will be non-NULL |
| 1281 | * outLayers - an array of layer handles |
| 1282 | * outTypes - an array of composition types, each corresponding to an element |
| 1283 | * of outLayers |
| 1284 | * |
| 1285 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1286 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1287 | * HWC2_ERROR_NOT_VALIDATED - validateDisplay has not been called for this |
| 1288 | * display |
| 1289 | */ |
| 1290 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_CHANGED_COMPOSITION_TYPES)( |
| 1291 | hwc2_device_t* device, hwc2_display_t display, |
| 1292 | uint32_t* outNumElements, hwc2_layer_t* outLayers, |
| 1293 | int32_t* /*hwc2_composition_t*/ outTypes); |
| 1294 | |
| 1295 | /* getClientTargetSupport(..., width, height, format, dataspace) |
| 1296 | * Descriptor: HWC2_FUNCTION_GET_CLIENT_TARGET_SUPPORT |
| 1297 | * Must be provided by all HWC2 devices |
| 1298 | * |
| 1299 | * Returns whether a client target with the given properties can be handled by |
| 1300 | * the device. |
| 1301 | * |
| 1302 | * The valid formats can be found in android_pixel_format_t in |
| 1303 | * <system/graphics.h>. |
| 1304 | * |
| 1305 | * For more about dataspaces, see setLayerDataspace. |
| 1306 | * |
| 1307 | * This function must return true for a client target with width and height |
| 1308 | * equal to the active display configuration dimensions, |
| 1309 | * HAL_PIXEL_FORMAT_RGBA_8888, and HAL_DATASPACE_UNKNOWN. It is not required to |
| 1310 | * return true for any other configuration. |
| 1311 | * |
| 1312 | * Parameters: |
| 1313 | * width - client target width in pixels |
| 1314 | * height - client target height in pixels |
| 1315 | * format - client target format |
| 1316 | * dataspace - client target dataspace, as described in setLayerDataspace |
| 1317 | * |
| 1318 | * Returns HWC2_ERROR_NONE if the given configuration is supported or one of the |
| 1319 | * following errors: |
| 1320 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1321 | * HWC2_ERROR_UNSUPPORTED - the given configuration is not supported |
| 1322 | */ |
| 1323 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_CLIENT_TARGET_SUPPORT)( |
| 1324 | hwc2_device_t* device, hwc2_display_t display, uint32_t width, |
| 1325 | uint32_t height, int32_t /*android_pixel_format_t*/ format, |
| 1326 | int32_t /*android_dataspace_t*/ dataspace); |
| 1327 | |
| 1328 | /* getColorModes(..., outNumModes, outModes) |
| 1329 | * Descriptor: HWC2_FUNCTION_GET_COLOR_MODES |
| 1330 | * Must be provided by all HWC2 devices |
| 1331 | * |
| 1332 | * Returns the color modes supported on this display. |
| 1333 | * |
| 1334 | * The valid color modes can be found in android_color_mode_t in |
| 1335 | * <system/graphics.h>. All HWC2 devices must support at least |
| 1336 | * HAL_COLOR_MODE_NATIVE. |
| 1337 | * |
| 1338 | * outNumModes may be NULL to retrieve the number of modes which will be |
| 1339 | * returned. |
| 1340 | * |
| 1341 | * Parameters: |
| 1342 | * outNumModes - if outModes was NULL, the number of modes which would have |
| 1343 | * been returned; if outModes was not NULL, the number of modes returned, |
| 1344 | * which must not exceed the value stored in outNumModes prior to the |
| 1345 | * call; pointer will be non-NULL |
| 1346 | * outModes - an array of color modes |
| 1347 | * |
| 1348 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1349 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1350 | */ |
| 1351 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_COLOR_MODES)( |
| 1352 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumModes, |
| 1353 | int32_t* /*android_color_mode_t*/ outModes); |
| 1354 | |
Chia-I Wu | 28310aa | 2018-03-15 21:20:55 -0700 | [diff] [blame] | 1355 | /* getRenderIntents(..., mode, outNumIntents, outIntents) |
| 1356 | * Descriptor: HWC2_FUNCTION_GET_RENDER_INTENTS |
| 1357 | * Provided by HWC2 devices which don't return nullptr function pointer. |
| 1358 | * |
| 1359 | * Returns the render intents supported on this display. |
| 1360 | * |
| 1361 | * The valid render intents can be found in android_render_intent_v1_1_t in |
| 1362 | * <system/graphics.h>. All HWC2 devices must support at least |
| 1363 | * HAL_RENDER_INTENT_COLORIMETRIC. |
| 1364 | * |
| 1365 | * outNumIntents may be NULL to retrieve the number of intents which will be |
| 1366 | * returned. |
| 1367 | * |
| 1368 | * Parameters: |
| 1369 | * mode - the color mode to query the render intents for |
| 1370 | * outNumIntents - if outIntents was NULL, the number of intents which would |
| 1371 | * have been returned; if outIntents was not NULL, the number of intents |
| 1372 | * returned, which must not exceed the value stored in outNumIntents |
| 1373 | * prior to the call; pointer will be non-NULL |
| 1374 | * outIntents - an array of render intents |
| 1375 | * |
| 1376 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1377 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1378 | */ |
| 1379 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_RENDER_INTENTS)( |
| 1380 | hwc2_device_t* device, hwc2_display_t display, int32_t mode, |
| 1381 | uint32_t* outNumIntents, |
| 1382 | int32_t* /*android_render_intent_v1_1_t*/ outIntents); |
| 1383 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1384 | /* getDisplayAttribute(..., config, attribute, outValue) |
| 1385 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_ATTRIBUTE |
| 1386 | * Must be provided by all HWC2 devices |
| 1387 | * |
| 1388 | * Returns a display attribute value for a particular display configuration. |
| 1389 | * |
| 1390 | * Any attribute which is not supported or for which the value is unknown by the |
| 1391 | * device must return a value of -1. |
| 1392 | * |
| 1393 | * Parameters: |
| 1394 | * config - the display configuration for which to return attribute values |
| 1395 | * attribute - the attribute to query |
| 1396 | * outValue - the value of the attribute; the pointer will be non-NULL |
| 1397 | * |
| 1398 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1399 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1400 | * HWC2_ERROR_BAD_CONFIG - config does not name a valid configuration for this |
| 1401 | * display |
| 1402 | */ |
| 1403 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_ATTRIBUTE)( |
| 1404 | hwc2_device_t* device, hwc2_display_t display, hwc2_config_t config, |
| 1405 | int32_t /*hwc2_attribute_t*/ attribute, int32_t* outValue); |
| 1406 | |
| 1407 | /* getDisplayConfigs(..., outNumConfigs, outConfigs) |
| 1408 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_CONFIGS |
| 1409 | * Must be provided by all HWC2 devices |
| 1410 | * |
| 1411 | * Returns handles for all of the valid display configurations on this display. |
| 1412 | * |
| 1413 | * outConfigs may be NULL to retrieve the number of elements which will be |
| 1414 | * returned. |
| 1415 | * |
| 1416 | * Parameters: |
| 1417 | * outNumConfigs - if outConfigs was NULL, the number of configurations which |
| 1418 | * would have been returned; if outConfigs was not NULL, the number of |
| 1419 | * configurations returned, which must not exceed the value stored in |
| 1420 | * outNumConfigs prior to the call; pointer will be non-NULL |
| 1421 | * outConfigs - an array of configuration handles |
| 1422 | * |
| 1423 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1424 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1425 | */ |
| 1426 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_CONFIGS)( |
| 1427 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumConfigs, |
| 1428 | hwc2_config_t* outConfigs); |
| 1429 | |
| 1430 | /* getDisplayName(..., outSize, outName) |
| 1431 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_NAME |
| 1432 | * Must be provided by all HWC2 devices |
| 1433 | * |
| 1434 | * Returns a human-readable version of the display's name. |
| 1435 | * |
| 1436 | * outName may be NULL to retrieve the length of the name. |
| 1437 | * |
| 1438 | * Parameters: |
| 1439 | * outSize - if outName was NULL, the number of bytes needed to return the |
| 1440 | * name if outName was not NULL, the number of bytes written into it, |
| 1441 | * which must not exceed the value stored in outSize prior to the call; |
| 1442 | * pointer will be non-NULL |
| 1443 | * outName - the display's name |
| 1444 | * |
| 1445 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1446 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1447 | */ |
| 1448 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_NAME)( |
| 1449 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outSize, |
| 1450 | char* outName); |
| 1451 | |
| 1452 | /* getDisplayRequests(..., outDisplayRequests, outNumElements, outLayers, |
| 1453 | * outLayerRequests) |
| 1454 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_REQUESTS |
| 1455 | * Must be provided by all HWC2 devices |
| 1456 | * |
| 1457 | * Returns the display requests and the layer requests required for the last |
| 1458 | * validated configuration. |
| 1459 | * |
| 1460 | * Display requests provide information about how the client should handle the |
| 1461 | * client target. Layer requests provide information about how the client |
| 1462 | * should handle an individual layer. |
| 1463 | * |
| 1464 | * If outLayers or outLayerRequests is NULL, the required number of layers and |
| 1465 | * requests must be returned in outNumElements, but this number may also be |
| 1466 | * obtained from validateDisplay as outNumRequests (outNumElements must be equal |
| 1467 | * to the value returned in outNumRequests from the last call to |
| 1468 | * validateDisplay). |
| 1469 | * |
| 1470 | * Parameters: |
| 1471 | * outDisplayRequests - the display requests for the current validated state |
| 1472 | * outNumElements - if outLayers or outLayerRequests were NULL, the number of |
| 1473 | * elements which would have been returned, which must be equal to the |
| 1474 | * value returned in outNumRequests from the last validateDisplay call on |
| 1475 | * this display; if both were not NULL, the number of elements in |
| 1476 | * outLayers and outLayerRequests, which must not exceed the value stored |
| 1477 | * in outNumElements prior to the call; pointer will be non-NULL |
| 1478 | * outLayers - an array of layers which all have at least one request |
| 1479 | * outLayerRequests - the requests corresponding to each element of outLayers |
| 1480 | * |
| 1481 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1482 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1483 | * HWC2_ERROR_NOT_VALIDATED - validateDisplay has not been called for this |
| 1484 | * display |
| 1485 | */ |
| 1486 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_REQUESTS)( |
| 1487 | hwc2_device_t* device, hwc2_display_t display, |
| 1488 | int32_t* /*hwc2_display_request_t*/ outDisplayRequests, |
| 1489 | uint32_t* outNumElements, hwc2_layer_t* outLayers, |
| 1490 | int32_t* /*hwc2_layer_request_t*/ outLayerRequests); |
| 1491 | |
| 1492 | /* getDisplayType(..., outType) |
| 1493 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_TYPE |
| 1494 | * Must be provided by all HWC2 devices |
| 1495 | * |
| 1496 | * Returns whether the given display is a physical or virtual display. |
| 1497 | * |
| 1498 | * Parameters: |
| 1499 | * outType - the type of the display; pointer will be non-NULL |
| 1500 | * |
| 1501 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1502 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1503 | */ |
| 1504 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_TYPE)( |
| 1505 | hwc2_device_t* device, hwc2_display_t display, |
| 1506 | int32_t* /*hwc2_display_type_t*/ outType); |
| 1507 | |
Dominik Laskowski | 55cf6f0 | 2018-03-25 15:12:04 -0700 | [diff] [blame] | 1508 | /* getDisplayIdentificationData(..., outPort, outDataSize, outData) |
| 1509 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA |
| 1510 | * Optional for HWC2 devices |
| 1511 | * |
| 1512 | * If supported, getDisplayIdentificationData returns the port and data that |
| 1513 | * describe a physical display. The port is a unique number that identifies a |
| 1514 | * physical connector (e.g. eDP, HDMI) for display output. The data blob is |
| 1515 | * parsed to determine its format, typically EDID 1.3 as specified in VESA |
| 1516 | * E-EDID Standard Release A Revision 1. |
| 1517 | * |
| 1518 | * Devices for which display identification is unsupported must return null when |
| 1519 | * getFunction is called with HWC2_FUNCTION_GET_DISPLAY_IDENTIFICATION_DATA. |
| 1520 | * |
| 1521 | * Parameters: |
| 1522 | * outPort - the connector to which the display is connected; |
| 1523 | * pointer will be non-NULL |
| 1524 | * outDataSize - if outData is NULL, the size in bytes of the data which would |
| 1525 | * have been returned; if outData is not NULL, the size of outData, which |
| 1526 | * must not exceed the value stored in outDataSize prior to the call; |
| 1527 | * pointer will be non-NULL |
| 1528 | * outData - the EDID 1.3 blob identifying the display |
| 1529 | * |
| 1530 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1531 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1532 | */ |
| 1533 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_IDENTIFICATION_DATA)( |
| 1534 | hwc2_device_t* device, hwc2_display_t display, uint8_t* outPort, |
| 1535 | uint32_t* outDataSize, uint8_t* outData); |
| 1536 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1537 | /* getDozeSupport(..., outSupport) |
| 1538 | * Descriptor: HWC2_FUNCTION_GET_DOZE_SUPPORT |
| 1539 | * Must be provided by all HWC2 devices |
| 1540 | * |
| 1541 | * Returns whether the given display supports HWC2_POWER_MODE_DOZE and |
| 1542 | * HWC2_POWER_MODE_DOZE_SUSPEND. DOZE_SUSPEND may not provide any benefit over |
| 1543 | * DOZE (see the definition of hwc2_power_mode_t for more information), but if |
| 1544 | * both DOZE and DOZE_SUSPEND are no different from HWC2_POWER_MODE_ON, the |
| 1545 | * device should not claim support. |
| 1546 | * |
| 1547 | * Parameters: |
| 1548 | * outSupport - whether the display supports doze modes (1 for yes, 0 for no); |
| 1549 | * pointer will be non-NULL |
| 1550 | * |
| 1551 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1552 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1553 | */ |
| 1554 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DOZE_SUPPORT)( |
| 1555 | hwc2_device_t* device, hwc2_display_t display, int32_t* outSupport); |
| 1556 | |
Dan Stoza | f601e97 | 2016-03-16 09:54:40 -0700 | [diff] [blame] | 1557 | /* getHdrCapabilities(..., outNumTypes, outTypes, outMaxLuminance, |
| 1558 | * outMaxAverageLuminance, outMinLuminance) |
| 1559 | * Descriptor: HWC2_FUNCTION_GET_HDR_CAPABILITIES |
| 1560 | * Must be provided by all HWC2 devices |
| 1561 | * |
| 1562 | * Returns the high dynamic range (HDR) capabilities of the given display, which |
| 1563 | * are invariant with regard to the active configuration. |
| 1564 | * |
| 1565 | * Displays which are not HDR-capable must return no types in outTypes and set |
| 1566 | * outNumTypes to 0. |
| 1567 | * |
| 1568 | * If outTypes is NULL, the required number of HDR types must be returned in |
| 1569 | * outNumTypes. |
| 1570 | * |
| 1571 | * Parameters: |
| 1572 | * outNumTypes - if outTypes was NULL, the number of types which would have |
| 1573 | * been returned; if it was not NULL, the number of types stored in |
| 1574 | * outTypes, which must not exceed the value stored in outNumTypes prior |
| 1575 | * to the call; pointer will be non-NULL |
| 1576 | * outTypes - an array of HDR types, may have 0 elements if the display is not |
| 1577 | * HDR-capable |
| 1578 | * outMaxLuminance - the desired content maximum luminance for this display in |
| 1579 | * cd/m^2; pointer will be non-NULL |
| 1580 | * outMaxAverageLuminance - the desired content maximum frame-average |
| 1581 | * luminance for this display in cd/m^2; pointer will be non-NULL |
| 1582 | * outMinLuminance - the desired content minimum luminance for this display in |
| 1583 | * cd/m^2; pointer will be non-NULL |
| 1584 | * |
| 1585 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1586 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1587 | */ |
| 1588 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_HDR_CAPABILITIES)( |
| 1589 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumTypes, |
| 1590 | int32_t* /*android_hdr_t*/ outTypes, float* outMaxLuminance, |
| 1591 | float* outMaxAverageLuminance, float* outMinLuminance); |
| 1592 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1593 | /* getReleaseFences(..., outNumElements, outLayers, outFences) |
| 1594 | * Descriptor: HWC2_FUNCTION_GET_RELEASE_FENCES |
| 1595 | * Must be provided by all HWC2 devices |
| 1596 | * |
| 1597 | * Retrieves the release fences for device layers on this display which will |
| 1598 | * receive new buffer contents this frame. |
| 1599 | * |
| 1600 | * A release fence is a file descriptor referring to a sync fence object which |
| 1601 | * will be signaled after the device has finished reading from the buffer |
| 1602 | * presented in the prior frame. This indicates that it is safe to start writing |
| 1603 | * to the buffer again. If a given layer's fence is not returned from this |
| 1604 | * function, it will be assumed that the buffer presented on the previous frame |
| 1605 | * is ready to be written. |
| 1606 | * |
| 1607 | * The fences returned by this function should be unique for each layer (even if |
| 1608 | * they point to the same underlying sync object), and ownership of the fences |
| 1609 | * is transferred to the client, which is responsible for closing them. |
| 1610 | * |
| 1611 | * If outLayers or outFences is NULL, the required number of layers and fences |
| 1612 | * must be returned in outNumElements. |
| 1613 | * |
| 1614 | * Parameters: |
| 1615 | * outNumElements - if outLayers or outFences were NULL, the number of |
| 1616 | * elements which would have been returned; if both were not NULL, the |
| 1617 | * number of elements in outLayers and outFences, which must not exceed |
| 1618 | * the value stored in outNumElements prior to the call; pointer will be |
| 1619 | * non-NULL |
| 1620 | * outLayers - an array of layer handles |
| 1621 | * outFences - an array of sync fence file descriptors as described above, |
| 1622 | * each corresponding to an element of outLayers |
| 1623 | * |
| 1624 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1625 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1626 | */ |
| 1627 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_RELEASE_FENCES)( |
| 1628 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumElements, |
| 1629 | hwc2_layer_t* outLayers, int32_t* outFences); |
| 1630 | |
Dan Stoza | ef26482 | 2016-07-13 14:51:09 -0700 | [diff] [blame] | 1631 | /* presentDisplay(..., outPresentFence) |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1632 | * Descriptor: HWC2_FUNCTION_PRESENT_DISPLAY |
| 1633 | * Must be provided by all HWC2 devices |
| 1634 | * |
| 1635 | * Presents the current display contents on the screen (or in the case of |
| 1636 | * virtual displays, into the output buffer). |
| 1637 | * |
| 1638 | * Prior to calling this function, the display must be successfully validated |
| 1639 | * with validateDisplay. Note that setLayerBuffer and setLayerSurfaceDamage |
| 1640 | * specifically do not count as layer state, so if there are no other changes |
| 1641 | * to the layer state (or to the buffer's properties as described in |
| 1642 | * setLayerBuffer), then it is safe to call this function without first |
| 1643 | * validating the display. |
| 1644 | * |
Dan Stoza | ef26482 | 2016-07-13 14:51:09 -0700 | [diff] [blame] | 1645 | * If this call succeeds, outPresentFence will be populated with a file |
| 1646 | * descriptor referring to a present sync fence object. For physical displays, |
| 1647 | * this fence will be signaled at the vsync when the result of composition of |
| 1648 | * this frame starts to appear (for video-mode panels) or starts to transfer to |
| 1649 | * panel memory (for command-mode panels). For virtual displays, this fence will |
| 1650 | * be signaled when writes to the output buffer have completed and it is safe to |
| 1651 | * read from it. |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1652 | * |
| 1653 | * Parameters: |
Dan Stoza | ef26482 | 2016-07-13 14:51:09 -0700 | [diff] [blame] | 1654 | * outPresentFence - a sync fence file descriptor as described above; pointer |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1655 | * will be non-NULL |
| 1656 | * |
| 1657 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1658 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1659 | * HWC2_ERROR_NO_RESOURCES - no valid output buffer has been set for a virtual |
| 1660 | * display |
| 1661 | * HWC2_ERROR_NOT_VALIDATED - validateDisplay has not successfully been called |
| 1662 | * for this display |
| 1663 | */ |
| 1664 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_PRESENT_DISPLAY)( |
Dan Stoza | ef26482 | 2016-07-13 14:51:09 -0700 | [diff] [blame] | 1665 | hwc2_device_t* device, hwc2_display_t display, |
| 1666 | int32_t* outPresentFence); |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1667 | |
| 1668 | /* setActiveConfig(..., config) |
| 1669 | * Descriptor: HWC2_FUNCTION_SET_ACTIVE_CONFIG |
| 1670 | * Must be provided by all HWC2 devices |
| 1671 | * |
| 1672 | * Sets the active configuration for this display. Upon returning, the given |
| 1673 | * display configuration should be active and remain so until either this |
| 1674 | * function is called again or the display is disconnected. |
| 1675 | * |
| 1676 | * Parameters: |
| 1677 | * config - the new display configuration |
| 1678 | * |
| 1679 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1680 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1681 | * HWC2_ERROR_BAD_CONFIG - the configuration handle passed in is not valid for |
| 1682 | * this display |
| 1683 | */ |
| 1684 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_ACTIVE_CONFIG)( |
| 1685 | hwc2_device_t* device, hwc2_display_t display, hwc2_config_t config); |
| 1686 | |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1687 | /* setClientTarget(..., target, acquireFence, dataspace, damage) |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1688 | * Descriptor: HWC2_FUNCTION_SET_CLIENT_TARGET |
| 1689 | * Must be provided by all HWC2 devices |
| 1690 | * |
| 1691 | * Sets the buffer handle which will receive the output of client composition. |
| 1692 | * Layers marked as HWC2_COMPOSITION_CLIENT will be composited into this buffer |
| 1693 | * prior to the call to presentDisplay, and layers not marked as |
| 1694 | * HWC2_COMPOSITION_CLIENT should be composited with this buffer by the device. |
| 1695 | * |
Dan Stoza | 3abcfa5 | 2016-05-04 12:21:06 -0700 | [diff] [blame] | 1696 | * The buffer handle provided may be null if no layers are being composited by |
| 1697 | * the client. This must not result in an error (unless an invalid display |
| 1698 | * handle is also provided). |
| 1699 | * |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1700 | * Also provides a file descriptor referring to an acquire sync fence object, |
| 1701 | * which will be signaled when it is safe to read from the client target buffer. |
| 1702 | * If it is already safe to read from this buffer, -1 may be passed instead. |
| 1703 | * The device must ensure that it is safe for the client to close this file |
| 1704 | * descriptor at any point after this function is called. |
| 1705 | * |
| 1706 | * For more about dataspaces, see setLayerDataspace. |
| 1707 | * |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1708 | * The damage parameter describes a surface damage region as defined in the |
| 1709 | * description of setLayerSurfaceDamage. |
| 1710 | * |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1711 | * Will be called before presentDisplay if any of the layers are marked as |
| 1712 | * HWC2_COMPOSITION_CLIENT. If no layers are so marked, then it is not |
| 1713 | * necessary to call this function. It is not necessary to call validateDisplay |
| 1714 | * after changing the target through this function. |
| 1715 | * |
| 1716 | * Parameters: |
| 1717 | * target - the new target buffer |
| 1718 | * acquireFence - a sync fence file descriptor as described above |
| 1719 | * dataspace - the dataspace of the buffer, as described in setLayerDataspace |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1720 | * damage - the surface damage region |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1721 | * |
| 1722 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1723 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1724 | * HWC2_ERROR_BAD_PARAMETER - the new target handle was invalid |
| 1725 | */ |
| 1726 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_CLIENT_TARGET)( |
| 1727 | hwc2_device_t* device, hwc2_display_t display, buffer_handle_t target, |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1728 | int32_t acquireFence, int32_t /*android_dataspace_t*/ dataspace, |
| 1729 | hwc_region_t damage); |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1730 | |
Dan Stoza | c46e96a | 2016-03-24 10:12:15 -0700 | [diff] [blame] | 1731 | /* setColorMode(..., mode) |
| 1732 | * Descriptor: HWC2_FUNCTION_SET_COLOR_MODE |
| 1733 | * Must be provided by all HWC2 devices |
| 1734 | * |
| 1735 | * Sets the color mode of the given display. |
| 1736 | * |
Chia-I Wu | 28310aa | 2018-03-15 21:20:55 -0700 | [diff] [blame] | 1737 | * This must be called outside of validateDisplay/presentDisplay, and it takes |
| 1738 | * effect on next presentDisplay. |
Dan Stoza | c46e96a | 2016-03-24 10:12:15 -0700 | [diff] [blame] | 1739 | * |
| 1740 | * The valid color modes can be found in android_color_mode_t in |
| 1741 | * <system/graphics.h>. All HWC2 devices must support at least |
| 1742 | * HAL_COLOR_MODE_NATIVE, and displays are assumed to be in this mode upon |
| 1743 | * hotplug. |
| 1744 | * |
| 1745 | * Parameters: |
| 1746 | * mode - the mode to set |
| 1747 | * |
| 1748 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1749 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1750 | * HWC2_ERROR_BAD_PARAMETER - mode is not a valid color mode |
| 1751 | * HWC2_ERROR_UNSUPPORTED - mode is not supported on this display |
| 1752 | */ |
| 1753 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_COLOR_MODE)( |
| 1754 | hwc2_device_t* device, hwc2_display_t display, |
| 1755 | int32_t /*android_color_mode_t*/ mode); |
| 1756 | |
Chia-I Wu | 28310aa | 2018-03-15 21:20:55 -0700 | [diff] [blame] | 1757 | /* setColorModeWithIntent(..., mode, intent) |
| 1758 | * Descriptor: HWC2_FUNCTION_SET_COLOR_MODE_WITH_RENDER_INTENT |
| 1759 | * Provided by HWC2 devices which don't return nullptr function pointer. |
| 1760 | * |
| 1761 | * This must be called outside of validateDisplay/presentDisplay, and it takes |
| 1762 | * effect on next presentDisplay. |
| 1763 | * |
| 1764 | * The valid color modes and render intents can be found in |
| 1765 | * android_color_mode_t and android_render_intent_v1_1_t in |
| 1766 | * <system/graphics.h>. All HWC2 devices must support at least |
| 1767 | * HAL_COLOR_MODE_NATIVE and HAL_RENDER_INTENT_COLORIMETRIC, and displays are |
| 1768 | * assumed to be in this mode and intent upon hotplug. |
| 1769 | * |
| 1770 | * Parameters: |
| 1771 | * mode - the mode to set |
| 1772 | * intent - the intent to set |
| 1773 | * |
| 1774 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1775 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1776 | * HWC2_ERROR_BAD_PARAMETER - mode/intent is not a valid color mode or |
| 1777 | * render intent |
| 1778 | * HWC2_ERROR_UNSUPPORTED - mode or intent is not supported on this display |
| 1779 | */ |
| 1780 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_COLOR_MODE_WITH_RENDER_INTENT)( |
| 1781 | hwc2_device_t* device, hwc2_display_t display, |
| 1782 | int32_t /*android_color_mode_t*/ mode, |
| 1783 | int32_t /*android_render_intent_v1_1_t */ intent); |
| 1784 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1785 | /* setColorTransform(..., matrix, hint) |
| 1786 | * Descriptor: HWC2_FUNCTION_SET_COLOR_TRANSFORM |
| 1787 | * Must be provided by all HWC2 devices |
| 1788 | * |
| 1789 | * Sets a color transform which will be applied after composition. |
| 1790 | * |
| 1791 | * If hint is not HAL_COLOR_TRANSFORM_ARBITRARY, then the device may use the |
| 1792 | * hint to apply the desired color transform instead of using the color matrix |
| 1793 | * directly. |
| 1794 | * |
| 1795 | * If the device is not capable of either using the hint or the matrix to apply |
| 1796 | * the desired color transform, it should force all layers to client composition |
| 1797 | * during validateDisplay. |
| 1798 | * |
Dan Stoza | d2168f7 | 2016-07-14 11:48:16 -0700 | [diff] [blame] | 1799 | * If HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM is present, then the client |
| 1800 | * will never apply the color transform during client composition, even if all |
| 1801 | * layers are being composed by the client. |
| 1802 | * |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1803 | * The matrix provided is an affine color transformation of the following form: |
| 1804 | * |
| 1805 | * |r.r r.g r.b 0| |
| 1806 | * |g.r g.g g.b 0| |
| 1807 | * |b.r b.g b.b 0| |
| 1808 | * |Tr Tg Tb 1| |
| 1809 | * |
| 1810 | * This matrix will be provided in row-major form: {r.r, r.g, r.b, 0, g.r, ...}. |
| 1811 | * |
| 1812 | * Given a matrix of this form and an input color [R_in, G_in, B_in], the output |
| 1813 | * color [R_out, G_out, B_out] will be: |
| 1814 | * |
| 1815 | * R_out = R_in * r.r + G_in * g.r + B_in * b.r + Tr |
Dan Stoza | 5dfbe33 | 2016-03-24 09:23:11 -0700 | [diff] [blame] | 1816 | * G_out = R_in * r.g + G_in * g.g + B_in * b.g + Tg |
| 1817 | * B_out = R_in * r.b + G_in * g.b + B_in * b.b + Tb |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1818 | * |
| 1819 | * Parameters: |
| 1820 | * matrix - a 4x4 transform matrix (16 floats) as described above |
| 1821 | * hint - a hint value which may be used instead of the given matrix unless it |
| 1822 | * is HAL_COLOR_TRANSFORM_ARBITRARY |
| 1823 | * |
| 1824 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1825 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1826 | * HWC2_ERROR_BAD_PARAMETER - hint is not a valid color transform hint |
| 1827 | */ |
| 1828 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_COLOR_TRANSFORM)( |
Dan Stoza | c46e96a | 2016-03-24 10:12:15 -0700 | [diff] [blame] | 1829 | hwc2_device_t* device, hwc2_display_t display, const float* matrix, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1830 | int32_t /*android_color_transform_t*/ hint); |
| 1831 | |
Courtney Goeltzenleuchter | 437ce43 | 2017-02-26 14:39:34 -0700 | [diff] [blame] | 1832 | /* getPerFrameMetadataKeys(..., outKeys) |
| 1833 | * Descriptor: HWC2_FUNCTION_GET_PER_FRAME_METADATA_KEYS |
| 1834 | * Optional for HWC2 devices |
| 1835 | * |
| 1836 | * If supported (getFunction(HWC2_FUNCTION_GET_PER_FRAME_METADATA_KEYS) is non-null), |
| 1837 | * getPerFrameMetadataKeys returns the list of supported PerFrameMetadataKeys |
| 1838 | * which are invariant with regard to the active configuration. |
| 1839 | * |
| 1840 | * Devices which are not HDR-capable, must return null when getFunction is called |
| 1841 | * with HWC2_FUNCTION_GET_PER_FRAME_METADATA_KEYS. |
| 1842 | * |
| 1843 | * If outKeys is NULL, the required number of PerFrameMetadataKey keys |
| 1844 | * must be returned in outNumKeys. |
| 1845 | * |
| 1846 | * Parameters: |
| 1847 | * outNumKeys - if outKeys is NULL, the number of keys which would have |
| 1848 | * been returned; if outKeys is not NULL, the number of keys stored in |
| 1849 | * outKeys, which must not exceed the value stored in outNumKeys prior |
| 1850 | * to the call; pointer will be non-NULL |
| 1851 | * outKeys - an array of hwc2_per_frame_metadata_key_t keys |
| 1852 | * |
| 1853 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1854 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1855 | */ |
| 1856 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_PER_FRAME_METADATA_KEYS)( |
| 1857 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumKeys, |
| 1858 | int32_t* /*hwc2_per_frame_metadata_key_t*/ outKeys); |
| 1859 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1860 | /* setOutputBuffer(..., buffer, releaseFence) |
| 1861 | * Descriptor: HWC2_FUNCTION_SET_OUTPUT_BUFFER |
| 1862 | * Must be provided by all HWC2 devices |
| 1863 | * |
| 1864 | * Sets the output buffer for a virtual display. That is, the buffer to which |
| 1865 | * the composition result will be written. |
| 1866 | * |
| 1867 | * Also provides a file descriptor referring to a release sync fence object, |
| 1868 | * which will be signaled when it is safe to write to the output buffer. If it |
| 1869 | * is already safe to write to the output buffer, -1 may be passed instead. The |
| 1870 | * device must ensure that it is safe for the client to close this file |
| 1871 | * descriptor at any point after this function is called. |
| 1872 | * |
| 1873 | * Must be called at least once before presentDisplay, but does not have any |
| 1874 | * interaction with layer state or display validation. |
| 1875 | * |
| 1876 | * Parameters: |
| 1877 | * buffer - the new output buffer |
| 1878 | * releaseFence - a sync fence file descriptor as described above |
| 1879 | * |
| 1880 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1881 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1882 | * HWC2_ERROR_BAD_PARAMETER - the new output buffer handle was invalid |
| 1883 | * HWC2_ERROR_UNSUPPORTED - display does not refer to a virtual display |
| 1884 | */ |
| 1885 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_OUTPUT_BUFFER)( |
| 1886 | hwc2_device_t* device, hwc2_display_t display, buffer_handle_t buffer, |
| 1887 | int32_t releaseFence); |
| 1888 | |
| 1889 | /* setPowerMode(..., mode) |
| 1890 | * Descriptor: HWC2_FUNCTION_SET_POWER_MODE |
| 1891 | * Must be provided by all HWC2 devices |
| 1892 | * |
| 1893 | * Sets the power mode of the given display. The transition must be complete |
| 1894 | * when this function returns. It is valid to call this function multiple times |
| 1895 | * with the same power mode. |
| 1896 | * |
| 1897 | * All displays must support HWC2_POWER_MODE_ON and HWC2_POWER_MODE_OFF. Whether |
| 1898 | * a display supports HWC2_POWER_MODE_DOZE or HWC2_POWER_MODE_DOZE_SUSPEND may |
| 1899 | * be queried using getDozeSupport. |
| 1900 | * |
| 1901 | * Parameters: |
| 1902 | * mode - the new power mode |
| 1903 | * |
| 1904 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1905 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1906 | * HWC2_ERROR_BAD_PARAMETER - mode was not a valid power mode |
| 1907 | * HWC2_ERROR_UNSUPPORTED - mode was a valid power mode, but is not supported |
| 1908 | * on this display |
| 1909 | */ |
| 1910 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_POWER_MODE)( |
| 1911 | hwc2_device_t* device, hwc2_display_t display, |
| 1912 | int32_t /*hwc2_power_mode_t*/ mode); |
| 1913 | |
Courtney Goeltzenleuchter | 437ce43 | 2017-02-26 14:39:34 -0700 | [diff] [blame] | 1914 | /* getReadbackBufferAttributes(..., outFormat, outDataspace) |
| 1915 | * Optional for HWC2 devices |
| 1916 | * |
| 1917 | * Returns the format which should be used when allocating a buffer for use by |
| 1918 | * device readback as well as the dataspace in which its contents should be |
| 1919 | * interpreted. |
| 1920 | * |
| 1921 | * If readback is not supported by this HWC implementation, this call will also |
| 1922 | * be able to return HWC2_ERROR_UNSUPPORTED so we can fall back to another method. |
| 1923 | * Returning NULL to a getFunction request for this function will also indicate |
| 1924 | * that readback is not supported. |
| 1925 | * |
| 1926 | * The width and height of this buffer will be those of the currently-active |
| 1927 | * display configuration, and the usage flags will consist of the following: |
| 1928 | * BufferUsage::CPU_READ | BufferUsage::GPU_TEXTURE | |
| 1929 | * BufferUsage::COMPOSER_OUTPUT |
| 1930 | * |
| 1931 | * The format and dataspace provided must be sufficient such that if a |
| 1932 | * correctly-configured buffer is passed into setReadbackBuffer, filled by |
| 1933 | * the device, and then displayed by the client as a full-screen buffer, the |
| 1934 | * output of the display remains the same (subject to the note about protected |
| 1935 | * content in the description of setReadbackBuffer). |
| 1936 | * |
Dan Stoza | af153e0 | 2018-05-15 13:09:51 -0700 | [diff] [blame] | 1937 | * If the active configuration or color mode of this display has changed since |
| 1938 | * the previous call to this function, it will be called again prior to setting |
| 1939 | * a readback buffer such that the returned format and dataspace can be updated |
| 1940 | * accordingly. |
| 1941 | * |
Courtney Goeltzenleuchter | 437ce43 | 2017-02-26 14:39:34 -0700 | [diff] [blame] | 1942 | * Parameters: |
| 1943 | * outFormat - the format the client should use when allocating a device |
Dan Stoza | af153e0 | 2018-05-15 13:09:51 -0700 | [diff] [blame] | 1944 | * readback buffer; pointer will be non-NULL |
Courtney Goeltzenleuchter | 437ce43 | 2017-02-26 14:39:34 -0700 | [diff] [blame] | 1945 | * outDataspace - the dataspace the client will use when interpreting the |
Dan Stoza | af153e0 | 2018-05-15 13:09:51 -0700 | [diff] [blame] | 1946 | * contents of a device readback buffer; pointer will be non-NULL |
Courtney Goeltzenleuchter | 437ce43 | 2017-02-26 14:39:34 -0700 | [diff] [blame] | 1947 | * |
| 1948 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1949 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
Courtney Goeltzenleuchter | 437ce43 | 2017-02-26 14:39:34 -0700 | [diff] [blame] | 1950 | * |
| 1951 | * See also: |
| 1952 | * setReadbackBuffer |
| 1953 | * getReadbackBufferFence |
| 1954 | */ |
| 1955 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_READBACK_BUFFER_ATTRIBUTES)( |
| 1956 | hwc2_device_t* device, hwc2_display_t display, |
| 1957 | int32_t* /*android_pixel_format_t*/ outFormat, |
| 1958 | int32_t* /*android_dataspace_t*/ outDataspace); |
| 1959 | |
| 1960 | /* getReadbackBufferFence(..., outFence) |
| 1961 | * Optional for HWC2 devices |
| 1962 | * |
| 1963 | * Returns an acquire sync fence file descriptor which will signal when the |
| 1964 | * buffer provided to setReadbackBuffer has been filled by the device and is |
| 1965 | * safe for the client to read. |
| 1966 | * |
| 1967 | * If it is already safe to read from this buffer, -1 may be returned instead. |
| 1968 | * The client takes ownership of this file descriptor and is responsible for |
| 1969 | * closing it when it is no longer needed. |
| 1970 | * |
| 1971 | * This function will be called immediately after the composition cycle being |
| 1972 | * captured into the readback buffer. The complete ordering of a readback buffer |
| 1973 | * capture is as follows: |
| 1974 | * |
| 1975 | * getReadbackBufferAttributes |
| 1976 | * // Readback buffer is allocated |
| 1977 | * // Many frames may pass |
| 1978 | * |
| 1979 | * setReadbackBuffer |
| 1980 | * validateDisplay |
| 1981 | * presentDisplay |
| 1982 | * getReadbackBufferFence |
| 1983 | * // Implicitly wait on the acquire fence before accessing the buffer |
| 1984 | * |
| 1985 | * Parameters: |
| 1986 | * outFence - a sync fence file descriptor as described above; pointer |
| 1987 | * will be non-NULL |
| 1988 | * |
| 1989 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1990 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
Dan Stoza | af153e0 | 2018-05-15 13:09:51 -0700 | [diff] [blame] | 1991 | * HWC2_ERROR_NO_RESOURCES - the readback operation was successful, but |
| 1992 | * resulted in a different validate result than would have occurred |
| 1993 | * without readback |
| 1994 | * HWC2_ERROR_UNSUPPORTED - the readback operation was unsuccessful because |
| 1995 | * of resource constraints, the presence of protected content, or other |
| 1996 | * reasons; -1 must be returned in outFence |
Courtney Goeltzenleuchter | 437ce43 | 2017-02-26 14:39:34 -0700 | [diff] [blame] | 1997 | */ |
| 1998 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_READBACK_BUFFER_FENCE)( |
| 1999 | hwc2_device_t* device, hwc2_display_t display, |
| 2000 | int32_t* outFence); |
| 2001 | |
| 2002 | /* setReadbackBuffer(..., buffer, releaseFence) |
| 2003 | * Optional for HWC2 devices |
| 2004 | * |
| 2005 | * Sets the readback buffer to be filled with the contents of the next |
| 2006 | * composition performed for this display (i.e., the contents present at the |
| 2007 | * time of the next validateDisplay/presentDisplay cycle). |
| 2008 | * |
| 2009 | * This buffer will have been allocated as described in |
| 2010 | * getReadbackBufferAttributes and will be interpreted as being in the dataspace |
| 2011 | * provided by the same. |
| 2012 | * |
| 2013 | * If there is hardware protected content on the display at the time of the next |
| 2014 | * composition, the area of the readback buffer covered by such content must be |
| 2015 | * completely black. Any areas of the buffer not covered by such content may |
| 2016 | * optionally be black as well. |
| 2017 | * |
| 2018 | * The release fence file descriptor provided works identically to the one |
| 2019 | * described for setOutputBuffer. |
| 2020 | * |
| 2021 | * This function will not be called between any call to validateDisplay and a |
| 2022 | * subsequent call to presentDisplay. |
| 2023 | * |
| 2024 | * Parameters: |
| 2025 | * buffer - the new readback buffer |
| 2026 | * releaseFence - a sync fence file descriptor as described in setOutputBuffer |
| 2027 | * |
| 2028 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2029 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 2030 | * HWC2_ERROR_BAD_PARAMETER - the new readback buffer handle was invalid |
| 2031 | * |
| 2032 | * See also: |
| 2033 | * getReadbackBufferAttributes |
| 2034 | * getReadbackBufferFence |
| 2035 | */ |
| 2036 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_READBACK_BUFFER)( |
| 2037 | hwc2_device_t* device, hwc2_display_t display, |
| 2038 | buffer_handle_t buffer, int32_t releaseFence); |
| 2039 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 2040 | /* setVsyncEnabled(..., enabled) |
| 2041 | * Descriptor: HWC2_FUNCTION_SET_VSYNC_ENABLED |
| 2042 | * Must be provided by all HWC2 devices |
| 2043 | * |
| 2044 | * Enables or disables the vsync signal for the given display. Virtual displays |
| 2045 | * never generate vsync callbacks, and any attempt to enable vsync for a virtual |
| 2046 | * display though this function must return HWC2_ERROR_NONE and have no other |
| 2047 | * effect. |
| 2048 | * |
| 2049 | * Parameters: |
| 2050 | * enabled - whether to enable or disable vsync |
| 2051 | * |
| 2052 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2053 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 2054 | * HWC2_ERROR_BAD_PARAMETER - enabled was an invalid value |
| 2055 | */ |
| 2056 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_VSYNC_ENABLED)( |
| 2057 | hwc2_device_t* device, hwc2_display_t display, |
| 2058 | int32_t /*hwc2_vsync_t*/ enabled); |
| 2059 | |
| 2060 | /* validateDisplay(..., outNumTypes, outNumRequests) |
| 2061 | * Descriptor: HWC2_FUNCTION_VALIDATE_DISPLAY |
| 2062 | * Must be provided by all HWC2 devices |
| 2063 | * |
| 2064 | * Instructs the device to inspect all of the layer state and determine if |
| 2065 | * there are any composition type changes necessary before presenting the |
| 2066 | * display. Permitted changes are described in the definition of |
| 2067 | * hwc2_composition_t above. |
| 2068 | * |
| 2069 | * Also returns the number of layer requests required |
| 2070 | * by the given layer configuration. |
| 2071 | * |
| 2072 | * Parameters: |
| 2073 | * outNumTypes - the number of composition type changes required by the |
| 2074 | * device; if greater than 0, the client must either set and validate new |
| 2075 | * types, or call acceptDisplayChanges to accept the changes returned by |
| 2076 | * getChangedCompositionTypes; must be the same as the number of changes |
| 2077 | * returned by getChangedCompositionTypes (see the declaration of that |
| 2078 | * function for more information); pointer will be non-NULL |
| 2079 | * outNumRequests - the number of layer requests required by this layer |
| 2080 | * configuration; must be equal to the number of layer requests returned |
| 2081 | * by getDisplayRequests (see the declaration of that function for |
| 2082 | * more information); pointer will be non-NULL |
| 2083 | * |
| 2084 | * Returns HWC2_ERROR_NONE if no changes are necessary and it is safe to present |
| 2085 | * the display using the current layer state. Otherwise returns one of the |
| 2086 | * following errors: |
| 2087 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 2088 | * HWC2_ERROR_HAS_CHANGES - outNumTypes was greater than 0 (see parameter list |
| 2089 | * for more information) |
| 2090 | */ |
| 2091 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_VALIDATE_DISPLAY)( |
| 2092 | hwc2_device_t* device, hwc2_display_t display, |
| 2093 | uint32_t* outNumTypes, uint32_t* outNumRequests); |
| 2094 | |
| 2095 | /* |
| 2096 | * Layer Functions |
| 2097 | * |
| 2098 | * These are functions which operate on layers, but which do not modify state |
| 2099 | * that must be validated before use. See also 'Layer State Functions' below. |
| 2100 | * |
| 2101 | * All of these functions take as their first three parameters a device pointer, |
| 2102 | * a display handle for the display which contains the layer, and a layer |
| 2103 | * handle, so these parameters are omitted from the described parameter lists. |
| 2104 | */ |
| 2105 | |
| 2106 | /* setCursorPosition(..., x, y) |
| 2107 | * Descriptor: HWC2_FUNCTION_SET_CURSOR_POSITION |
| 2108 | * Must be provided by all HWC2 devices |
| 2109 | * |
| 2110 | * Asynchonously sets the position of a cursor layer. |
| 2111 | * |
| 2112 | * Prior to validateDisplay, a layer may be marked as HWC2_COMPOSITION_CURSOR. |
| 2113 | * If validation succeeds (i.e., the device does not request a composition |
| 2114 | * change for that layer), then once a buffer has been set for the layer and it |
| 2115 | * has been presented, its position may be set by this function at any time |
| 2116 | * between presentDisplay and any subsequent validateDisplay calls for this |
| 2117 | * display. |
| 2118 | * |
| 2119 | * Once validateDisplay is called, this function will not be called again until |
| 2120 | * the validate/present sequence is completed. |
| 2121 | * |
| 2122 | * May be called from any thread so long as it is not interleaved with the |
| 2123 | * validate/present sequence as described above. |
| 2124 | * |
| 2125 | * Parameters: |
| 2126 | * x - the new x coordinate (in pixels from the left of the screen) |
| 2127 | * y - the new y coordinate (in pixels from the top of the screen) |
| 2128 | * |
| 2129 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2130 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 2131 | * HWC2_ERROR_BAD_LAYER - the layer is invalid or is not currently marked as |
| 2132 | * HWC2_COMPOSITION_CURSOR |
| 2133 | * HWC2_ERROR_NOT_VALIDATED - the device is currently in the middle of the |
| 2134 | * validate/present sequence |
| 2135 | */ |
| 2136 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_CURSOR_POSITION)( |
| 2137 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2138 | int32_t x, int32_t y); |
| 2139 | |
| 2140 | /* setLayerBuffer(..., buffer, acquireFence) |
| 2141 | * Descriptor: HWC2_FUNCTION_SET_LAYER_BUFFER |
| 2142 | * Must be provided by all HWC2 devices |
| 2143 | * |
| 2144 | * Sets the buffer handle to be displayed for this layer. If the buffer |
| 2145 | * properties set at allocation time (width, height, format, and usage) have not |
| 2146 | * changed since the previous frame, it is not necessary to call validateDisplay |
| 2147 | * before calling presentDisplay unless new state needs to be validated in the |
| 2148 | * interim. |
| 2149 | * |
| 2150 | * Also provides a file descriptor referring to an acquire sync fence object, |
| 2151 | * which will be signaled when it is safe to read from the given buffer. If it |
| 2152 | * is already safe to read from the buffer, -1 may be passed instead. The |
| 2153 | * device must ensure that it is safe for the client to close this file |
| 2154 | * descriptor at any point after this function is called. |
| 2155 | * |
| 2156 | * This function must return HWC2_ERROR_NONE and have no other effect if called |
| 2157 | * for a layer with a composition type of HWC2_COMPOSITION_SOLID_COLOR (because |
| 2158 | * it has no buffer) or HWC2_COMPOSITION_SIDEBAND or HWC2_COMPOSITION_CLIENT |
| 2159 | * (because synchronization and buffer updates for these layers are handled |
| 2160 | * elsewhere). |
| 2161 | * |
| 2162 | * Parameters: |
| 2163 | * buffer - the buffer handle to set |
| 2164 | * acquireFence - a sync fence file descriptor as described above |
| 2165 | * |
| 2166 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2167 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2168 | * HWC2_ERROR_BAD_PARAMETER - the buffer handle passed in was invalid |
| 2169 | */ |
| 2170 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_BUFFER)( |
| 2171 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2172 | buffer_handle_t buffer, int32_t acquireFence); |
| 2173 | |
| 2174 | /* setLayerSurfaceDamage(..., damage) |
| 2175 | * Descriptor: HWC2_FUNCTION_SET_LAYER_SURFACE_DAMAGE |
| 2176 | * Must be provided by all HWC2 devices |
| 2177 | * |
| 2178 | * Provides the region of the source buffer which has been modified since the |
| 2179 | * last frame. This region does not need to be validated before calling |
| 2180 | * presentDisplay. |
| 2181 | * |
| 2182 | * Once set through this function, the damage region remains the same until a |
| 2183 | * subsequent call to this function. |
| 2184 | * |
| 2185 | * If damage.numRects > 0, then it may be assumed that any portion of the source |
| 2186 | * buffer not covered by one of the rects has not been modified this frame. If |
| 2187 | * damage.numRects == 0, then the whole source buffer must be treated as if it |
| 2188 | * has been modified. |
| 2189 | * |
| 2190 | * If the layer's contents are not modified relative to the prior frame, damage |
| 2191 | * will contain exactly one empty rect([0, 0, 0, 0]). |
| 2192 | * |
| 2193 | * The damage rects are relative to the pre-transformed buffer, and their origin |
| 2194 | * is the top-left corner. They will not exceed the dimensions of the latched |
| 2195 | * buffer. |
| 2196 | * |
| 2197 | * Parameters: |
| 2198 | * damage - the new surface damage region |
| 2199 | * |
| 2200 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2201 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2202 | */ |
| 2203 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_SURFACE_DAMAGE)( |
| 2204 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2205 | hwc_region_t damage); |
| 2206 | |
Chia-I Wu | 28310aa | 2018-03-15 21:20:55 -0700 | [diff] [blame] | 2207 | /* setLayerPerFrameMetadata(..., numMetadata, metadata) |
| 2208 | * Descriptor: HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA |
| 2209 | * Optional for HWC2 devices |
| 2210 | * |
| 2211 | * If supported (getFunction(HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA) is |
| 2212 | * non-null), sets the metadata for the given display for all following |
| 2213 | * frames. |
| 2214 | * |
| 2215 | * Upon returning from this function, the metadata change must have |
| 2216 | * fully taken effect. |
| 2217 | * |
| 2218 | * This function will only be called if getPerFrameMetadataKeys is non-NULL |
| 2219 | * and returns at least one key. |
| 2220 | * |
| 2221 | * Parameters: |
| 2222 | * numElements is the number of elements in each of the keys and metadata arrays |
| 2223 | * keys is a pointer to the array of keys. |
| 2224 | * outMetadata is a pointer to the corresponding array of metadata. |
| 2225 | * |
| 2226 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2227 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 2228 | * HWC2_ERROR_BAD_PARAMETER - metadata is not valid |
| 2229 | * HWC2_ERROR_UNSUPPORTED - metadata is not supported on this display |
| 2230 | */ |
| 2231 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_PER_FRAME_METADATA)( |
| 2232 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2233 | uint32_t numElements, const int32_t* /*hw2_per_frame_metadata_key_t*/ keys, |
| 2234 | const float* metadata); |
| 2235 | |
Valerie Hau | 69c5343 | 2018-11-13 09:07:44 -0800 | [diff] [blame] | 2236 | /* setLayerPerFrameMetadataBlobs(...,numElements, keys, sizes, blobs) |
| 2237 | * Descriptor: HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS |
| 2238 | * Optional for HWC2 devices |
| 2239 | * |
| 2240 | * If supported, (getFunction(HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS) |
| 2241 | * is non-null), sets the metadata for the given display and layer. |
| 2242 | * |
| 2243 | * Upon returning from this function, the metadata change must have fully taken |
| 2244 | * effect. |
| 2245 | * |
| 2246 | * This function must only be called if getPerFrameMetadataKeys is non-NULL |
| 2247 | * and returns at least one key that corresponds to a blob type. |
| 2248 | * |
| 2249 | * Current valid blob type keys are: HDR10_PLUS_SEI |
| 2250 | * |
| 2251 | * Parameters: |
| 2252 | * numElements is the number of elements in each of the keys, sizes, and |
| 2253 | * metadata arrays |
| 2254 | * keys is a pointer to an array of keys. Current valid keys are those listed |
| 2255 | * above as valid blob type keys. |
| 2256 | * sizes is a pointer to an array of unsigned ints specifying the sizes of |
| 2257 | * each metadata blob |
| 2258 | * metadata is a pointer to a blob of data holding all blobs contiguously in |
| 2259 | * memory |
| 2260 | * |
| 2261 | * Returns HWC2_ERROR_NONE or one of the following erros: |
| 2262 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 2263 | * HWC2_ERROR_BAD_PARAMETER - sizes of keys and metadata parameters does |
| 2264 | * not match numElements, numElements < 0, or keys contains a |
| 2265 | * non-valid key (see above for current valid blob type keys). |
| 2266 | * HWC2_ERROR_UNSUPPORTED - metadata is not supported on this display |
| 2267 | */ |
| 2268 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_PER_FRAME_METADATA_BLOBS)( |
| 2269 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2270 | uint32_t numElements, const int32_t* keys, const uint32_t* sizes, |
| 2271 | const uint8_t* metadata); |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 2272 | /* |
| 2273 | * Layer State Functions |
| 2274 | * |
| 2275 | * These functions modify the state of a given layer. They do not take effect |
| 2276 | * until the display configuration is successfully validated with |
| 2277 | * validateDisplay and the display contents are presented with presentDisplay. |
| 2278 | * |
| 2279 | * All of these functions take as their first three parameters a device pointer, |
| 2280 | * a display handle for the display which contains the layer, and a layer |
| 2281 | * handle, so these parameters are omitted from the described parameter lists. |
| 2282 | */ |
| 2283 | |
| 2284 | /* setLayerBlendMode(..., mode) |
| 2285 | * Descriptor: HWC2_FUNCTION_SET_LAYER_BLEND_MODE |
| 2286 | * Must be provided by all HWC2 devices |
| 2287 | * |
| 2288 | * Sets the blend mode of the given layer. |
| 2289 | * |
| 2290 | * Parameters: |
| 2291 | * mode - the new blend mode |
| 2292 | * |
| 2293 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2294 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2295 | * HWC2_ERROR_BAD_PARAMETER - an invalid blend mode was passed in |
| 2296 | */ |
| 2297 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_BLEND_MODE)( |
| 2298 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2299 | int32_t /*hwc2_blend_mode_t*/ mode); |
| 2300 | |
| 2301 | /* setLayerColor(..., color) |
| 2302 | * Descriptor: HWC2_FUNCTION_SET_LAYER_COLOR |
| 2303 | * Must be provided by all HWC2 devices |
| 2304 | * |
| 2305 | * Sets the color of the given layer. If the composition type of the layer is |
| 2306 | * not HWC2_COMPOSITION_SOLID_COLOR, this call must return HWC2_ERROR_NONE and |
| 2307 | * have no other effect. |
| 2308 | * |
| 2309 | * Parameters: |
| 2310 | * color - the new color |
| 2311 | * |
| 2312 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2313 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2314 | */ |
| 2315 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_COLOR)( |
| 2316 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2317 | hwc_color_t color); |
| 2318 | |
Peiyong Lin | fd05d13 | 2018-01-22 12:23:25 -0800 | [diff] [blame] | 2319 | /* setLayerFloatColor(..., color) |
| 2320 | * Descriptor: HWC2_FUNCTION_SET_LAYER_FLOAT_COLOR |
| 2321 | * Provided by HWC2 devices which don't return nullptr function pointer. |
| 2322 | * |
| 2323 | * Sets the color of the given layer. If the composition type of the layer is |
| 2324 | * not HWC2_COMPOSITION_SOLID_COLOR, this call must return HWC2_ERROR_NONE and |
| 2325 | * have no other effect. |
| 2326 | * |
| 2327 | * Parameters: |
| 2328 | * color - the new color in float type, rage is [0.0, 1.0], the colorspace is |
| 2329 | * defined by the dataspace that gets set by calling setLayerDataspace. |
| 2330 | * |
| 2331 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2332 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2333 | */ |
| 2334 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_FLOAT_COLOR)( |
| 2335 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2336 | hwc_float_color_t color); |
| 2337 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 2338 | /* setLayerCompositionType(..., type) |
| 2339 | * Descriptor: HWC2_FUNCTION_SET_LAYER_COMPOSITION_TYPE |
| 2340 | * Must be provided by all HWC2 devices |
| 2341 | * |
| 2342 | * Sets the desired composition type of the given layer. During validateDisplay, |
| 2343 | * the device may request changes to the composition types of any of the layers |
| 2344 | * as described in the definition of hwc2_composition_t above. |
| 2345 | * |
| 2346 | * Parameters: |
| 2347 | * type - the new composition type |
| 2348 | * |
| 2349 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2350 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2351 | * HWC2_ERROR_BAD_PARAMETER - an invalid composition type was passed in |
| 2352 | * HWC2_ERROR_UNSUPPORTED - a valid composition type was passed in, but it is |
| 2353 | * not supported by this device |
| 2354 | */ |
| 2355 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_COMPOSITION_TYPE)( |
| 2356 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2357 | int32_t /*hwc2_composition_t*/ type); |
| 2358 | |
| 2359 | /* setLayerDataspace(..., dataspace) |
| 2360 | * Descriptor: HWC2_FUNCTION_SET_LAYER_DATASPACE |
| 2361 | * Must be provided by all HWC2 devices |
| 2362 | * |
| 2363 | * Sets the dataspace that the current buffer on this layer is in. |
| 2364 | * |
| 2365 | * The dataspace provides more information about how to interpret the buffer |
| 2366 | * contents, such as the encoding standard and color transform. |
| 2367 | * |
| 2368 | * See the values of android_dataspace_t in <system/graphics.h> for more |
| 2369 | * information. |
| 2370 | * |
| 2371 | * Parameters: |
| 2372 | * dataspace - the new dataspace |
| 2373 | * |
| 2374 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2375 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2376 | */ |
| 2377 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_DATASPACE)( |
| 2378 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2379 | int32_t /*android_dataspace_t*/ dataspace); |
| 2380 | |
| 2381 | /* setLayerDisplayFrame(..., frame) |
| 2382 | * Descriptor: HWC2_FUNCTION_SET_LAYER_DISPLAY_FRAME |
| 2383 | * Must be provided by all HWC2 devices |
| 2384 | * |
| 2385 | * Sets the display frame (the portion of the display covered by a layer) of the |
| 2386 | * given layer. This frame will not exceed the display dimensions. |
| 2387 | * |
| 2388 | * Parameters: |
| 2389 | * frame - the new display frame |
| 2390 | * |
| 2391 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2392 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2393 | */ |
| 2394 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_DISPLAY_FRAME)( |
| 2395 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2396 | hwc_rect_t frame); |
| 2397 | |
| 2398 | /* setLayerPlaneAlpha(..., alpha) |
| 2399 | * Descriptor: HWC2_FUNCTION_SET_LAYER_PLANE_ALPHA |
| 2400 | * Must be provided by all HWC2 devices |
| 2401 | * |
| 2402 | * Sets an alpha value (a floating point value in the range [0.0, 1.0]) which |
| 2403 | * will be applied to the whole layer. It can be conceptualized as a |
| 2404 | * preprocessing step which applies the following function: |
| 2405 | * if (blendMode == HWC2_BLEND_MODE_PREMULTIPLIED) |
| 2406 | * out.rgb = in.rgb * planeAlpha |
| 2407 | * out.a = in.a * planeAlpha |
| 2408 | * |
| 2409 | * If the device does not support this operation on a layer which is marked |
| 2410 | * HWC2_COMPOSITION_DEVICE, it must request a composition type change to |
| 2411 | * HWC2_COMPOSITION_CLIENT upon the next validateDisplay call. |
| 2412 | * |
| 2413 | * Parameters: |
| 2414 | * alpha - the plane alpha value to apply |
| 2415 | * |
| 2416 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2417 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2418 | */ |
| 2419 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_PLANE_ALPHA)( |
| 2420 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2421 | float alpha); |
| 2422 | |
| 2423 | /* setLayerSidebandStream(..., stream) |
| 2424 | * Descriptor: HWC2_FUNCTION_SET_LAYER_SIDEBAND_STREAM |
| 2425 | * Provided by HWC2 devices which support HWC2_CAPABILITY_SIDEBAND_STREAM |
| 2426 | * |
| 2427 | * Sets the sideband stream for this layer. If the composition type of the given |
| 2428 | * layer is not HWC2_COMPOSITION_SIDEBAND, this call must return HWC2_ERROR_NONE |
| 2429 | * and have no other effect. |
| 2430 | * |
| 2431 | * Parameters: |
| 2432 | * stream - the new sideband stream |
| 2433 | * |
| 2434 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2435 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2436 | * HWC2_ERROR_BAD_PARAMETER - an invalid sideband stream was passed in |
| 2437 | */ |
| 2438 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_SIDEBAND_STREAM)( |
| 2439 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2440 | const native_handle_t* stream); |
| 2441 | |
| 2442 | /* setLayerSourceCrop(..., crop) |
| 2443 | * Descriptor: HWC2_FUNCTION_SET_LAYER_SOURCE_CROP |
| 2444 | * Must be provided by all HWC2 devices |
| 2445 | * |
| 2446 | * Sets the source crop (the portion of the source buffer which will fill the |
| 2447 | * display frame) of the given layer. This crop rectangle will not exceed the |
| 2448 | * dimensions of the latched buffer. |
| 2449 | * |
| 2450 | * If the device is not capable of supporting a true float source crop (i.e., it |
| 2451 | * will truncate or round the floats to integers), it should set this layer to |
| 2452 | * HWC2_COMPOSITION_CLIENT when crop is non-integral for the most accurate |
| 2453 | * rendering. |
| 2454 | * |
| 2455 | * If the device cannot support float source crops, but still wants to handle |
| 2456 | * the layer, it should use the following code (or similar) to convert to |
| 2457 | * an integer crop: |
| 2458 | * intCrop.left = (int) ceilf(crop.left); |
| 2459 | * intCrop.top = (int) ceilf(crop.top); |
| 2460 | * intCrop.right = (int) floorf(crop.right); |
| 2461 | * intCrop.bottom = (int) floorf(crop.bottom); |
| 2462 | * |
| 2463 | * Parameters: |
| 2464 | * crop - the new source crop |
| 2465 | * |
| 2466 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2467 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2468 | */ |
| 2469 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_SOURCE_CROP)( |
| 2470 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2471 | hwc_frect_t crop); |
| 2472 | |
| 2473 | /* setLayerTransform(..., transform) |
| 2474 | * Descriptor: HWC2_FUNCTION_SET_LAYER_TRANSFORM |
| 2475 | * Must be provided by all HWC2 devices |
| 2476 | * |
| 2477 | * Sets the transform (rotation/flip) of the given layer. |
| 2478 | * |
| 2479 | * Parameters: |
| 2480 | * transform - the new transform |
| 2481 | * |
| 2482 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2483 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2484 | * HWC2_ERROR_BAD_PARAMETER - an invalid transform was passed in |
| 2485 | */ |
| 2486 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_TRANSFORM)( |
| 2487 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2488 | int32_t /*hwc_transform_t*/ transform); |
| 2489 | |
| 2490 | /* setLayerVisibleRegion(..., visible) |
| 2491 | * Descriptor: HWC2_FUNCTION_SET_LAYER_VISIBLE_REGION |
| 2492 | * Must be provided by all HWC2 devices |
| 2493 | * |
| 2494 | * Specifies the portion of the layer that is visible, including portions under |
| 2495 | * translucent areas of other layers. The region is in screen space, and will |
| 2496 | * not exceed the dimensions of the screen. |
| 2497 | * |
| 2498 | * Parameters: |
| 2499 | * visible - the new visible region, in screen space |
| 2500 | * |
| 2501 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2502 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2503 | */ |
| 2504 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_VISIBLE_REGION)( |
| 2505 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2506 | hwc_region_t visible); |
| 2507 | |
| 2508 | /* setLayerZOrder(..., z) |
| 2509 | * Descriptor: HWC2_FUNCTION_SET_LAYER_Z_ORDER |
| 2510 | * Must be provided by all HWC2 devices |
| 2511 | * |
| 2512 | * Sets the desired Z order (height) of the given layer. A layer with a greater |
| 2513 | * Z value occludes a layer with a lesser Z value. |
| 2514 | * |
| 2515 | * Parameters: |
| 2516 | * z - the new Z order |
| 2517 | * |
| 2518 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2519 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2520 | */ |
| 2521 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_Z_ORDER)( |
| 2522 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2523 | uint32_t z); |
| 2524 | |
Peiyong Lin | 44819b9 | 2018-09-13 16:20:08 -0700 | [diff] [blame] | 2525 | /* setLayerColorTransform(..., matrix) |
| 2526 | * Descriptor: HWC2_FUNCTION_SET_LAYER_COLOR_TRANSFORM |
| 2527 | * Optional by all HWC2 devices |
| 2528 | * |
| 2529 | * Sets a matrix for color transform which will be applied on this layer |
| 2530 | * before composition. |
| 2531 | * |
| 2532 | * If the device is not capable of apply the matrix on this layer, it must force |
| 2533 | * this layer to client composition during VALIDATE_DISPLAY. |
| 2534 | * |
| 2535 | * The matrix provided is an affine color transformation of the following form: |
| 2536 | * |
| 2537 | * |r.r r.g r.b 0| |
| 2538 | * |g.r g.g g.b 0| |
| 2539 | * |b.r b.g b.b 0| |
| 2540 | * |Tr Tg Tb 1| |
| 2541 | * |
| 2542 | * This matrix must be provided in row-major form: |
| 2543 | * |
| 2544 | * {r.r, r.g, r.b, 0, g.r, ...}. |
| 2545 | * |
| 2546 | * Given a matrix of this form and an input color [R_in, G_in, B_in], |
| 2547 | * the input color must first be converted to linear space |
| 2548 | * [R_linear, G_linear, B_linear], then the output linear color |
| 2549 | * [R_out_linear, G_out_linear, B_out_linear] will be: |
| 2550 | * |
| 2551 | * R_out_linear = R_linear * r.r + G_linear * g.r + B_linear * b.r + Tr |
| 2552 | * G_out_linear = R_linear * r.g + G_linear * g.g + B_linear * b.g + Tg |
| 2553 | * B_out_linear = R_linear * r.b + G_linear * g.b + B_linear * b.b + Tb |
| 2554 | * |
| 2555 | * [R_out_linear, G_out_linear, B_out_linear] must then be converted to |
| 2556 | * gamma space: [R_out, G_out, B_out] before blending. |
| 2557 | * |
| 2558 | * Parameters: |
| 2559 | * matrix - a 4x4 transform matrix (16 floats) as described above |
| 2560 | * |
| 2561 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2562 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 2563 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 2564 | */ |
| 2565 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_COLOR_TRANSFORM)( |
| 2566 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 2567 | const float* matrix); |
| 2568 | |
Kevin DuBois | 1345887 | 2018-09-10 09:09:12 -0700 | [diff] [blame] | 2569 | /* getDisplayedContentSamplingAttributes(..., |
| 2570 | * format, dataspace, supported_components, max_frames) |
| 2571 | * Descriptor: HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES |
| 2572 | * Optional by all HWC2 devices |
| 2573 | * |
| 2574 | * Query for what types of color sampling the hardware supports. |
| 2575 | * |
| 2576 | * Parameters: |
| 2577 | * format - The format of the sampled pixels; pointer will be non-NULL |
| 2578 | * dataspace - The dataspace of the sampled pixels; pointer will be non-NULL |
| 2579 | * supported_components - The mask of which components can be sampled; pointer |
| 2580 | * will be non-NULL |
| 2581 | * |
| 2582 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2583 | * HWC2_ERROR_BAD_DISPLAY when an invalid display was passed in, or |
| 2584 | * HWC2_ERROR_UNSUPPORTED when there is no efficient way to sample. |
| 2585 | */ |
| 2586 | typedef int32_t (*HWC2_PFN_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES)( |
| 2587 | hwc2_device_t* device, hwc2_display_t display, |
| 2588 | int32_t* /* android_pixel_format_t */ format, |
| 2589 | int32_t* /* android_dataspace_t */ dataspace, |
| 2590 | uint8_t* /* mask of android_component_t */ supported_components); |
| 2591 | |
| 2592 | /* setDisplayedContentSamplingEnabled(..., enabled) |
| 2593 | * Descriptor: HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED |
| 2594 | * Optional by all HWC2 devices |
| 2595 | * |
| 2596 | * Enables or disables the collection of color content statistics |
| 2597 | * on this display. |
| 2598 | * |
| 2599 | * Sampling occurs on the contents of the final composition on this display |
| 2600 | * (i.e., the contents presented on screen). |
| 2601 | * |
| 2602 | * Sampling support is optional, and is set to DISABLE by default. |
| 2603 | * On each call to ENABLE, all collected statistics will be reset. |
| 2604 | * |
| 2605 | * Sample data can be queried via getDisplayedContentSample(). |
| 2606 | * |
| 2607 | * Parameters: |
| 2608 | * enabled - indicates whether to enable or disable sampling. |
| 2609 | * component_mask - The mask of which components should be sampled. |
| 2610 | * If zero, all supported components are to be enabled. |
| 2611 | * max_frames - is the maximum number of frames that should be stored before |
| 2612 | * discard. The sample represents the most-recently posted frames. |
| 2613 | * |
| 2614 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2615 | * HWC2_ERROR_BAD_DISPLAY when an invalid display handle was passed in, |
| 2616 | * HWC2_ERROR_BAD_PARAMETER when enabled was an invalid value, or |
| 2617 | * HWC2_ERROR_NO_RESOURCES when the requested ringbuffer size via max_frames |
| 2618 | * was not available. |
| 2619 | * HWC2_ERROR_UNSUPPORTED when there is no efficient way to sample. |
| 2620 | */ |
| 2621 | typedef int32_t (*HWC2_PFN_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED)( |
| 2622 | hwc2_device_t* device, hwc2_display_t display, |
| 2623 | int32_t /*hwc2_displayed_content_sampling_t*/ enabled, |
| 2624 | uint8_t /* mask of android_component_t */ component_mask, |
| 2625 | uint64_t max_frames); |
| 2626 | |
| 2627 | /* getDisplayedContentSample(..., component, max_frames, timestamp, |
| 2628 | * samples_size, samples, frame_count) |
| 2629 | * Descriptor: HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE |
| 2630 | * Optional by all HWC2 devices |
| 2631 | * |
| 2632 | * Collects the results of display content color sampling for display. |
| 2633 | * |
| 2634 | * Collection of data can occur whether the sampling is in ENABLE or |
| 2635 | * DISABLE state. |
| 2636 | * |
| 2637 | * Parameters: |
| 2638 | * max_frames - is the maximum number of frames that should be represented in |
| 2639 | * the sample. The sample represents the most-recently posted frames. |
| 2640 | * If max_frames is 0, all frames are to be represented by the sample. |
| 2641 | * timestamp - is the timestamp after which any frames were posted that should |
| 2642 | * be included in the sample. Timestamp is CLOCK_MONOTONIC. |
| 2643 | * If timestamp is 0, do not filter from the sample by time. |
| 2644 | * frame_count - The number of frames represented by this sample; pointer will |
| 2645 | * be non-NULL. |
| 2646 | * samples_size - The sizes of the color histogram representing the color |
| 2647 | * sampling. Sample_sizes are indexed in the same order as |
| 2648 | * HWC2_FORMAT_COMPONENT_. |
| 2649 | * samples - The arrays of data corresponding to the sampling data. Samples are |
| 2650 | * indexed in the same order as HWC2_FORMAT_COMPONENT_. |
| 2651 | * The size of each sample is the samples_size for the same index. |
| 2652 | * Each components sample is an array that is to be filled with the |
| 2653 | * evenly-weighted buckets of a histogram counting how many times a pixel |
| 2654 | * of the given component was displayed onscreen. Caller owns the data and |
| 2655 | * pointer may be NULL to query samples_size. |
| 2656 | * |
| 2657 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2658 | * HWC2_ERROR_BAD_DISPLAY when an invalid display was passed in, or |
| 2659 | * HWC2_ERROR_UNSUPPORTED when there is no efficient way to sample, or |
| 2660 | * HWC2_ERROR_BAD_PARAMETER when the component is not supported by the hardware. |
| 2661 | */ |
| 2662 | typedef int32_t (*HWC2_PFN_GET_DISPLAYED_CONTENT_SAMPLE)( |
| 2663 | hwc2_device_t* device, hwc2_display_t display, |
| 2664 | uint64_t max_frames, uint64_t timestamp, |
| 2665 | uint64_t* frame_count, int32_t samples_size[4], uint64_t* samples[4]); |
| 2666 | |
Peiyong Lin | f09421f | 2018-10-26 18:31:03 -0700 | [diff] [blame] | 2667 | /* getDisplayCapabilities(..., outCapabilities) |
| 2668 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES |
| 2669 | * Required for HWC2 devices for composer 2.3 |
| 2670 | * Optional for HWC2 devices for composer 2.1 and 2.2 |
| 2671 | * |
| 2672 | * getDisplayCapabilities returns a list of supported capabilities |
| 2673 | * (as described in the definition of Capability above). |
| 2674 | * This list must not change after initialization. |
| 2675 | * |
| 2676 | * Parameters: |
| 2677 | * outNumCapabilities - if outCapabilities was nullptr, returns the number of capabilities |
| 2678 | * if outCapabilities was not nullptr, returns the number of capabilities stored in |
| 2679 | * outCapabilities, which must not exceed the value stored in outNumCapabilities prior |
| 2680 | * to the call; pointer will be non-NULL |
| 2681 | * outCapabilities - a list of supported capabilities. |
| 2682 | * |
| 2683 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2684 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 2685 | */ |
| 2686 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_CAPABILITIES)( |
| 2687 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumCapabilities, |
| 2688 | uint32_t* outCapabilities); |
| 2689 | |
Dan Gittik | 10510ff | 2019-01-18 19:30:24 +0000 | [diff] [blame^] | 2690 | /* getDisplayBrightnessSupport(displayToken) |
| 2691 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT |
| 2692 | * Required for HWC2 devices for composer 2.3 |
| 2693 | * Optional for HWC2 devices for composer 2.1 and 2.2 |
| 2694 | * |
| 2695 | * getDisplayBrightnessSupport returns whether brightness operations are supported on a display. |
| 2696 | * |
| 2697 | * Parameters: |
| 2698 | * outSupport - whether the display supports operations. |
| 2699 | * |
| 2700 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2701 | * HWC2_ERROR_BAD_DISPLAY when the display is invalid. |
| 2702 | */ |
| 2703 | typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_GET_DISPLAY_BRIGHTNESS_SUPPORT)(hwc2_device_t* device, |
| 2704 | hwc2_display_t display, bool* outSupport); |
| 2705 | |
| 2706 | /* setDisplayBrightness(displayToken, brightnesss) |
| 2707 | * Descriptor: HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS |
| 2708 | * Required for HWC2 devices for composer 2.3 |
| 2709 | * Optional for HWC2 devices for composer 2.1 and 2.2 |
| 2710 | * |
| 2711 | * setDisplayBrightness sets the brightness of a display. |
| 2712 | * |
| 2713 | * Parameters: |
| 2714 | * brightness - a number between 0.0f (minimum brightness) and 1.0f (maximum brightness), or |
| 2715 | * -1.0f to turn the backlight off. |
| 2716 | * |
| 2717 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 2718 | * HWC2_ERROR_BAD_DISPLAY when the display is invalid, or |
| 2719 | * HWC2_ERROR_UNSUPPORTED when brightness operations are not supported, or |
| 2720 | * HWC2_ERROR_BAD_PARAMETER when the brightness is invalid, or |
| 2721 | * HWC2_ERROR_NO_RESOURCES when the brightness cannot be applied. |
| 2722 | */ |
| 2723 | typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_SET_DISPLAY_BRIGHTNESS)(hwc2_device_t* device, |
| 2724 | hwc2_display_t display, float brightness); |
| 2725 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 2726 | __END_DECLS |
| 2727 | |
| 2728 | #endif |