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, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 107 | } hwc2_capability_t; |
| 108 | |
| 109 | /* Possible composition types for a given layer */ |
| 110 | typedef enum { |
| 111 | HWC2_COMPOSITION_INVALID = 0, |
| 112 | |
| 113 | /* The client will composite this layer into the client target buffer |
| 114 | * (provided to the device through setClientTarget). |
| 115 | * |
| 116 | * The device must not request any composition type changes for layers of |
| 117 | * this type. */ |
| 118 | HWC2_COMPOSITION_CLIENT = 1, |
| 119 | |
| 120 | /* The device will handle the composition of this layer through a hardware |
| 121 | * overlay or other similar means. |
| 122 | * |
| 123 | * Upon validateDisplay, the device may request a change from this type to |
| 124 | * HWC2_COMPOSITION_CLIENT. */ |
| 125 | HWC2_COMPOSITION_DEVICE = 2, |
| 126 | |
| 127 | /* The device will render this layer using the color set through |
| 128 | * setLayerColor. If this functionality is not supported on a layer that the |
| 129 | * client sets to HWC2_COMPOSITION_SOLID_COLOR, the device must request that |
| 130 | * the composition type of that layer is changed to HWC2_COMPOSITION_CLIENT |
| 131 | * upon the next call to validateDisplay. |
| 132 | * |
| 133 | * Upon validateDisplay, the device may request a change from this type to |
| 134 | * HWC2_COMPOSITION_CLIENT. */ |
| 135 | HWC2_COMPOSITION_SOLID_COLOR = 3, |
| 136 | |
| 137 | /* Similar to DEVICE, but the position of this layer may also be set |
| 138 | * asynchronously through setCursorPosition. If this functionality is not |
| 139 | * supported on a layer that the client sets to HWC2_COMPOSITION_CURSOR, the |
| 140 | * device must request that the composition type of that layer is changed to |
| 141 | * HWC2_COMPOSITION_CLIENT upon the next call to validateDisplay. |
| 142 | * |
| 143 | * Upon validateDisplay, the device may request a change from this type to |
| 144 | * either HWC2_COMPOSITION_DEVICE or HWC2_COMPOSITION_CLIENT. Changing to |
| 145 | * HWC2_COMPOSITION_DEVICE will prevent the use of setCursorPosition but |
| 146 | * still permit the device to composite the layer. */ |
| 147 | HWC2_COMPOSITION_CURSOR = 4, |
| 148 | |
| 149 | /* The device will handle the composition of this layer, as well as its |
| 150 | * buffer updates and content synchronization. Only supported on devices |
| 151 | * which provide HWC2_CAPABILITY_SIDEBAND_STREAM. |
| 152 | * |
| 153 | * Upon validateDisplay, the device may request a change from this type to |
| 154 | * either HWC2_COMPOSITION_DEVICE or HWC2_COMPOSITION_CLIENT, but it is |
| 155 | * unlikely that content will display correctly in these cases. */ |
| 156 | HWC2_COMPOSITION_SIDEBAND = 5, |
| 157 | } hwc2_composition_t; |
| 158 | |
| 159 | /* Possible connection options from the hotplug callback */ |
| 160 | typedef enum { |
| 161 | HWC2_CONNECTION_INVALID = 0, |
| 162 | |
| 163 | /* The display has been connected */ |
| 164 | HWC2_CONNECTION_CONNECTED = 1, |
| 165 | |
| 166 | /* The display has been disconnected */ |
| 167 | HWC2_CONNECTION_DISCONNECTED = 2, |
| 168 | } hwc2_connection_t; |
| 169 | |
| 170 | /* Display requests returned by getDisplayRequests */ |
| 171 | typedef enum { |
| 172 | /* Instructs the client to provide a new client target buffer, even if no |
| 173 | * layers are marked for client composition. */ |
| 174 | HWC2_DISPLAY_REQUEST_FLIP_CLIENT_TARGET = 1 << 0, |
| 175 | |
| 176 | /* Instructs the client to write the result of client composition directly |
| 177 | * into the virtual display output buffer. If any of the layers are not |
| 178 | * marked as HWC2_COMPOSITION_CLIENT or the given display is not a virtual |
| 179 | * display, this request has no effect. */ |
| 180 | HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT = 1 << 1, |
| 181 | } hwc2_display_request_t; |
| 182 | |
| 183 | /* Display types returned by getDisplayType */ |
| 184 | typedef enum { |
| 185 | HWC2_DISPLAY_TYPE_INVALID = 0, |
| 186 | |
| 187 | /* All physical displays, including both internal displays and hotpluggable |
| 188 | * external displays */ |
| 189 | HWC2_DISPLAY_TYPE_PHYSICAL = 1, |
| 190 | |
| 191 | /* Virtual displays created by createVirtualDisplay */ |
| 192 | HWC2_DISPLAY_TYPE_VIRTUAL = 2, |
| 193 | } hwc2_display_type_t; |
| 194 | |
| 195 | /* Return codes from all functions */ |
| 196 | typedef enum { |
| 197 | HWC2_ERROR_NONE = 0, |
| 198 | HWC2_ERROR_BAD_CONFIG, |
| 199 | HWC2_ERROR_BAD_DISPLAY, |
| 200 | HWC2_ERROR_BAD_LAYER, |
| 201 | HWC2_ERROR_BAD_PARAMETER, |
| 202 | HWC2_ERROR_HAS_CHANGES, |
| 203 | HWC2_ERROR_NO_RESOURCES, |
| 204 | HWC2_ERROR_NOT_VALIDATED, |
| 205 | HWC2_ERROR_UNSUPPORTED, |
| 206 | } hwc2_error_t; |
| 207 | |
| 208 | /* Function descriptors for use with getFunction */ |
| 209 | typedef enum { |
| 210 | HWC2_FUNCTION_INVALID = 0, |
| 211 | HWC2_FUNCTION_ACCEPT_DISPLAY_CHANGES, |
| 212 | HWC2_FUNCTION_CREATE_LAYER, |
| 213 | HWC2_FUNCTION_CREATE_VIRTUAL_DISPLAY, |
| 214 | HWC2_FUNCTION_DESTROY_LAYER, |
| 215 | HWC2_FUNCTION_DESTROY_VIRTUAL_DISPLAY, |
| 216 | HWC2_FUNCTION_DUMP, |
| 217 | HWC2_FUNCTION_GET_ACTIVE_CONFIG, |
| 218 | HWC2_FUNCTION_GET_CHANGED_COMPOSITION_TYPES, |
| 219 | HWC2_FUNCTION_GET_CLIENT_TARGET_SUPPORT, |
| 220 | HWC2_FUNCTION_GET_COLOR_MODES, |
| 221 | HWC2_FUNCTION_GET_DISPLAY_ATTRIBUTE, |
| 222 | HWC2_FUNCTION_GET_DISPLAY_CONFIGS, |
| 223 | HWC2_FUNCTION_GET_DISPLAY_NAME, |
| 224 | HWC2_FUNCTION_GET_DISPLAY_REQUESTS, |
| 225 | HWC2_FUNCTION_GET_DISPLAY_TYPE, |
| 226 | HWC2_FUNCTION_GET_DOZE_SUPPORT, |
Dan Stoza | f601e97 | 2016-03-16 09:54:40 -0700 | [diff] [blame] | 227 | HWC2_FUNCTION_GET_HDR_CAPABILITIES, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 228 | HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT, |
| 229 | HWC2_FUNCTION_GET_RELEASE_FENCES, |
| 230 | HWC2_FUNCTION_PRESENT_DISPLAY, |
| 231 | HWC2_FUNCTION_REGISTER_CALLBACK, |
| 232 | HWC2_FUNCTION_SET_ACTIVE_CONFIG, |
| 233 | HWC2_FUNCTION_SET_CLIENT_TARGET, |
| 234 | HWC2_FUNCTION_SET_COLOR_MODE, |
| 235 | HWC2_FUNCTION_SET_COLOR_TRANSFORM, |
| 236 | HWC2_FUNCTION_SET_CURSOR_POSITION, |
| 237 | HWC2_FUNCTION_SET_LAYER_BLEND_MODE, |
| 238 | HWC2_FUNCTION_SET_LAYER_BUFFER, |
| 239 | HWC2_FUNCTION_SET_LAYER_COLOR, |
| 240 | HWC2_FUNCTION_SET_LAYER_COMPOSITION_TYPE, |
| 241 | HWC2_FUNCTION_SET_LAYER_DATASPACE, |
| 242 | HWC2_FUNCTION_SET_LAYER_DISPLAY_FRAME, |
| 243 | HWC2_FUNCTION_SET_LAYER_PLANE_ALPHA, |
| 244 | HWC2_FUNCTION_SET_LAYER_SIDEBAND_STREAM, |
| 245 | HWC2_FUNCTION_SET_LAYER_SOURCE_CROP, |
| 246 | HWC2_FUNCTION_SET_LAYER_SURFACE_DAMAGE, |
| 247 | HWC2_FUNCTION_SET_LAYER_TRANSFORM, |
| 248 | HWC2_FUNCTION_SET_LAYER_VISIBLE_REGION, |
| 249 | HWC2_FUNCTION_SET_LAYER_Z_ORDER, |
| 250 | HWC2_FUNCTION_SET_OUTPUT_BUFFER, |
| 251 | HWC2_FUNCTION_SET_POWER_MODE, |
| 252 | HWC2_FUNCTION_SET_VSYNC_ENABLED, |
| 253 | HWC2_FUNCTION_VALIDATE_DISPLAY, |
| 254 | } hwc2_function_descriptor_t; |
| 255 | |
Dan Stoza | f601e97 | 2016-03-16 09:54:40 -0700 | [diff] [blame] | 256 | /* Layer requests returned from getDisplayRequests */ |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 257 | typedef enum { |
| 258 | /* The client should clear its target with transparent pixels where this |
| 259 | * layer would be. The client may ignore this request if the layer must be |
| 260 | * blended. */ |
| 261 | HWC2_LAYER_REQUEST_CLEAR_CLIENT_TARGET = 1 << 0, |
| 262 | } hwc2_layer_request_t; |
| 263 | |
| 264 | /* Power modes for use with setPowerMode */ |
| 265 | typedef enum { |
| 266 | /* The display is fully off (blanked) */ |
| 267 | HWC2_POWER_MODE_OFF = 0, |
| 268 | |
| 269 | /* These are optional low power modes. getDozeSupport may be called to |
| 270 | * determine whether a given display supports these modes. */ |
| 271 | |
| 272 | /* The display is turned on and configured in a low power state that is |
| 273 | * suitable for presenting ambient information to the user, possibly with |
| 274 | * lower fidelity than HWC2_POWER_MODE_ON, but with greater efficiency. */ |
| 275 | HWC2_POWER_MODE_DOZE = 1, |
| 276 | |
| 277 | /* The display is configured as in HWC2_POWER_MODE_DOZE but may stop |
| 278 | * applying display updates from the client. This is effectively a hint to |
| 279 | * the device that drawing to the display has been suspended and that the |
| 280 | * the device should remain on in a low power state and continue displaying |
| 281 | * its current contents indefinitely until the power mode changes. |
| 282 | * |
| 283 | * This mode may also be used as a signal to enable hardware-based doze |
| 284 | * functionality. In this case, the device is free to take over the display |
| 285 | * and manage it autonomously to implement a low power always-on display. */ |
| 286 | HWC2_POWER_MODE_DOZE_SUSPEND = 3, |
| 287 | |
| 288 | /* The display is fully on */ |
| 289 | HWC2_POWER_MODE_ON = 2, |
| 290 | } hwc2_power_mode_t; |
| 291 | |
| 292 | /* Vsync values passed to setVsyncEnabled */ |
| 293 | typedef enum { |
| 294 | HWC2_VSYNC_INVALID = 0, |
| 295 | |
| 296 | /* Enable vsync */ |
| 297 | HWC2_VSYNC_ENABLE = 1, |
| 298 | |
| 299 | /* Disable vsync */ |
| 300 | HWC2_VSYNC_DISABLE = 2, |
| 301 | } hwc2_vsync_t; |
| 302 | |
| 303 | /* |
| 304 | * Stringification Functions |
| 305 | */ |
| 306 | |
| 307 | #ifdef HWC2_INCLUDE_STRINGIFICATION |
| 308 | |
| 309 | static inline const char* getAttributeName(hwc2_attribute_t attribute) { |
| 310 | switch (attribute) { |
| 311 | case HWC2_ATTRIBUTE_INVALID: return "Invalid"; |
| 312 | case HWC2_ATTRIBUTE_WIDTH: return "Width"; |
| 313 | case HWC2_ATTRIBUTE_HEIGHT: return "Height"; |
| 314 | case HWC2_ATTRIBUTE_VSYNC_PERIOD: return "VsyncPeriod"; |
| 315 | case HWC2_ATTRIBUTE_DPI_X: return "DpiX"; |
| 316 | case HWC2_ATTRIBUTE_DPI_Y: return "DpiY"; |
| 317 | default: return "Unknown"; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | static inline const char* getBlendModeName(hwc2_blend_mode_t mode) { |
| 322 | switch (mode) { |
| 323 | case HWC2_BLEND_MODE_INVALID: return "Invalid"; |
| 324 | case HWC2_BLEND_MODE_NONE: return "None"; |
| 325 | case HWC2_BLEND_MODE_PREMULTIPLIED: return "Premultiplied"; |
| 326 | case HWC2_BLEND_MODE_COVERAGE: return "Coverage"; |
| 327 | default: return "Unknown"; |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | static inline const char* getCallbackDescriptorName( |
| 332 | hwc2_callback_descriptor_t desc) { |
| 333 | switch (desc) { |
| 334 | case HWC2_CALLBACK_INVALID: return "Invalid"; |
| 335 | case HWC2_CALLBACK_HOTPLUG: return "Hotplug"; |
| 336 | case HWC2_CALLBACK_REFRESH: return "Refresh"; |
| 337 | case HWC2_CALLBACK_VSYNC: return "Vsync"; |
| 338 | default: return "Unknown"; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | static inline const char* getCapabilityName(hwc2_capability_t capability) { |
| 343 | switch (capability) { |
| 344 | case HWC2_CAPABILITY_INVALID: return "Invalid"; |
| 345 | case HWC2_CAPABILITY_SIDEBAND_STREAM: return "SidebandStream"; |
Dan Stoza | d2168f7 | 2016-07-14 11:48:16 -0700 | [diff] [blame] | 346 | case HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM: |
| 347 | return "SkipClientColorTransform"; |
Brian Anderson | 49018a5 | 2017-04-04 16:43:11 -0700 | [diff] [blame^] | 348 | case HWC2_CAPABILITY_PRESENT_FENCE_IS_NOT_RELIABLE: |
| 349 | return "PresentFenceIsNotReliable"; |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 350 | default: return "Unknown"; |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | static inline const char* getCompositionName(hwc2_composition_t composition) { |
| 355 | switch (composition) { |
| 356 | case HWC2_COMPOSITION_INVALID: return "Invalid"; |
| 357 | case HWC2_COMPOSITION_CLIENT: return "Client"; |
| 358 | case HWC2_COMPOSITION_DEVICE: return "Device"; |
| 359 | case HWC2_COMPOSITION_SOLID_COLOR: return "SolidColor"; |
| 360 | case HWC2_COMPOSITION_CURSOR: return "Cursor"; |
| 361 | case HWC2_COMPOSITION_SIDEBAND: return "Sideband"; |
| 362 | default: return "Unknown"; |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | static inline const char* getConnectionName(hwc2_connection_t connection) { |
| 367 | switch (connection) { |
| 368 | case HWC2_CONNECTION_INVALID: return "Invalid"; |
| 369 | case HWC2_CONNECTION_CONNECTED: return "Connected"; |
| 370 | case HWC2_CONNECTION_DISCONNECTED: return "Disconnected"; |
| 371 | default: return "Unknown"; |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | static inline const char* getDisplayRequestName( |
| 376 | hwc2_display_request_t request) { |
Colin Cross | 248ec3d | 2016-10-06 16:53:00 -0700 | [diff] [blame] | 377 | switch (__BIONIC_CAST(static_cast, int, request)) { |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 378 | case 0: return "None"; |
| 379 | case HWC2_DISPLAY_REQUEST_FLIP_CLIENT_TARGET: return "FlipClientTarget"; |
| 380 | case HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT: |
| 381 | return "WriteClientTargetToOutput"; |
| 382 | case HWC2_DISPLAY_REQUEST_FLIP_CLIENT_TARGET | |
| 383 | HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT: |
| 384 | return "FlipClientTarget|WriteClientTargetToOutput"; |
| 385 | default: return "Unknown"; |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | static inline const char* getDisplayTypeName(hwc2_display_type_t type) { |
| 390 | switch (type) { |
| 391 | case HWC2_DISPLAY_TYPE_INVALID: return "Invalid"; |
| 392 | case HWC2_DISPLAY_TYPE_PHYSICAL: return "Physical"; |
| 393 | case HWC2_DISPLAY_TYPE_VIRTUAL: return "Virtual"; |
| 394 | default: return "Unknown"; |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | static inline const char* getErrorName(hwc2_error_t error) { |
| 399 | switch (error) { |
| 400 | case HWC2_ERROR_NONE: return "None"; |
| 401 | case HWC2_ERROR_BAD_CONFIG: return "BadConfig"; |
| 402 | case HWC2_ERROR_BAD_DISPLAY: return "BadDisplay"; |
| 403 | case HWC2_ERROR_BAD_LAYER: return "BadLayer"; |
| 404 | case HWC2_ERROR_BAD_PARAMETER: return "BadParameter"; |
| 405 | case HWC2_ERROR_HAS_CHANGES: return "HasChanges"; |
| 406 | case HWC2_ERROR_NO_RESOURCES: return "NoResources"; |
| 407 | case HWC2_ERROR_NOT_VALIDATED: return "NotValidated"; |
| 408 | case HWC2_ERROR_UNSUPPORTED: return "Unsupported"; |
| 409 | default: return "Unknown"; |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | static inline const char* getFunctionDescriptorName( |
| 414 | hwc2_function_descriptor_t desc) { |
| 415 | switch (desc) { |
| 416 | case HWC2_FUNCTION_INVALID: return "Invalid"; |
| 417 | case HWC2_FUNCTION_ACCEPT_DISPLAY_CHANGES: |
| 418 | return "AcceptDisplayChanges"; |
| 419 | case HWC2_FUNCTION_CREATE_LAYER: return "CreateLayer"; |
| 420 | case HWC2_FUNCTION_CREATE_VIRTUAL_DISPLAY: |
| 421 | return "CreateVirtualDisplay"; |
| 422 | case HWC2_FUNCTION_DESTROY_LAYER: return "DestroyLayer"; |
| 423 | case HWC2_FUNCTION_DESTROY_VIRTUAL_DISPLAY: |
| 424 | return "DestroyVirtualDisplay"; |
| 425 | case HWC2_FUNCTION_DUMP: return "Dump"; |
| 426 | case HWC2_FUNCTION_GET_ACTIVE_CONFIG: return "GetActiveConfig"; |
| 427 | case HWC2_FUNCTION_GET_CHANGED_COMPOSITION_TYPES: |
| 428 | return "GetChangedCompositionTypes"; |
| 429 | case HWC2_FUNCTION_GET_CLIENT_TARGET_SUPPORT: |
| 430 | return "GetClientTargetSupport"; |
| 431 | case HWC2_FUNCTION_GET_COLOR_MODES: return "GetColorModes"; |
| 432 | case HWC2_FUNCTION_GET_DISPLAY_ATTRIBUTE: return "GetDisplayAttribute"; |
| 433 | case HWC2_FUNCTION_GET_DISPLAY_CONFIGS: return "GetDisplayConfigs"; |
| 434 | case HWC2_FUNCTION_GET_DISPLAY_NAME: return "GetDisplayName"; |
| 435 | case HWC2_FUNCTION_GET_DISPLAY_REQUESTS: return "GetDisplayRequests"; |
| 436 | case HWC2_FUNCTION_GET_DISPLAY_TYPE: return "GetDisplayType"; |
| 437 | case HWC2_FUNCTION_GET_DOZE_SUPPORT: return "GetDozeSupport"; |
Dan Stoza | f601e97 | 2016-03-16 09:54:40 -0700 | [diff] [blame] | 438 | case HWC2_FUNCTION_GET_HDR_CAPABILITIES: return "GetHdrCapabilities"; |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 439 | case HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT: |
| 440 | return "GetMaxVirtualDisplayCount"; |
| 441 | case HWC2_FUNCTION_GET_RELEASE_FENCES: return "GetReleaseFences"; |
| 442 | case HWC2_FUNCTION_PRESENT_DISPLAY: return "PresentDisplay"; |
| 443 | case HWC2_FUNCTION_REGISTER_CALLBACK: return "RegisterCallback"; |
| 444 | case HWC2_FUNCTION_SET_ACTIVE_CONFIG: return "SetActiveConfig"; |
| 445 | case HWC2_FUNCTION_SET_CLIENT_TARGET: return "SetClientTarget"; |
| 446 | case HWC2_FUNCTION_SET_COLOR_MODE: return "SetColorMode"; |
| 447 | case HWC2_FUNCTION_SET_COLOR_TRANSFORM: return "SetColorTransform"; |
| 448 | case HWC2_FUNCTION_SET_CURSOR_POSITION: return "SetCursorPosition"; |
| 449 | case HWC2_FUNCTION_SET_LAYER_BLEND_MODE: return "SetLayerBlendMode"; |
| 450 | case HWC2_FUNCTION_SET_LAYER_BUFFER: return "SetLayerBuffer"; |
| 451 | case HWC2_FUNCTION_SET_LAYER_COLOR: return "SetLayerColor"; |
| 452 | case HWC2_FUNCTION_SET_LAYER_COMPOSITION_TYPE: |
| 453 | return "SetLayerCompositionType"; |
| 454 | case HWC2_FUNCTION_SET_LAYER_DATASPACE: return "SetLayerDataspace"; |
| 455 | case HWC2_FUNCTION_SET_LAYER_DISPLAY_FRAME: |
| 456 | return "SetLayerDisplayFrame"; |
| 457 | case HWC2_FUNCTION_SET_LAYER_PLANE_ALPHA: return "SetLayerPlaneAlpha"; |
| 458 | case HWC2_FUNCTION_SET_LAYER_SIDEBAND_STREAM: |
| 459 | return "SetLayerSidebandStream"; |
| 460 | case HWC2_FUNCTION_SET_LAYER_SOURCE_CROP: return "SetLayerSourceCrop"; |
| 461 | case HWC2_FUNCTION_SET_LAYER_SURFACE_DAMAGE: |
| 462 | return "SetLayerSurfaceDamage"; |
| 463 | case HWC2_FUNCTION_SET_LAYER_TRANSFORM: return "SetLayerTransform"; |
| 464 | case HWC2_FUNCTION_SET_LAYER_VISIBLE_REGION: |
| 465 | return "SetLayerVisibleRegion"; |
| 466 | case HWC2_FUNCTION_SET_LAYER_Z_ORDER: return "SetLayerZOrder"; |
| 467 | case HWC2_FUNCTION_SET_OUTPUT_BUFFER: return "SetOutputBuffer"; |
| 468 | case HWC2_FUNCTION_SET_POWER_MODE: return "SetPowerMode"; |
| 469 | case HWC2_FUNCTION_SET_VSYNC_ENABLED: return "SetVsyncEnabled"; |
| 470 | case HWC2_FUNCTION_VALIDATE_DISPLAY: return "ValidateDisplay"; |
| 471 | default: return "Unknown"; |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | static inline const char* getLayerRequestName(hwc2_layer_request_t request) { |
Colin Cross | 248ec3d | 2016-10-06 16:53:00 -0700 | [diff] [blame] | 476 | switch (__BIONIC_CAST(static_cast, int, request)) { |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 477 | case 0: return "None"; |
| 478 | case HWC2_LAYER_REQUEST_CLEAR_CLIENT_TARGET: return "ClearClientTarget"; |
| 479 | default: return "Unknown"; |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | static inline const char* getPowerModeName(hwc2_power_mode_t mode) { |
| 484 | switch (mode) { |
| 485 | case HWC2_POWER_MODE_OFF: return "Off"; |
| 486 | case HWC2_POWER_MODE_DOZE_SUSPEND: return "DozeSuspend"; |
| 487 | case HWC2_POWER_MODE_DOZE: return "Doze"; |
| 488 | case HWC2_POWER_MODE_ON: return "On"; |
| 489 | default: return "Unknown"; |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | static inline const char* getTransformName(hwc_transform_t transform) { |
Colin Cross | 248ec3d | 2016-10-06 16:53:00 -0700 | [diff] [blame] | 494 | switch (__BIONIC_CAST(static_cast, int, transform)) { |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 495 | case 0: return "None"; |
| 496 | case HWC_TRANSFORM_FLIP_H: return "FlipH"; |
| 497 | case HWC_TRANSFORM_FLIP_V: return "FlipV"; |
| 498 | case HWC_TRANSFORM_ROT_90: return "Rotate90"; |
| 499 | case HWC_TRANSFORM_ROT_180: return "Rotate180"; |
| 500 | case HWC_TRANSFORM_ROT_270: return "Rotate270"; |
| 501 | case HWC_TRANSFORM_FLIP_H_ROT_90: return "FlipHRotate90"; |
| 502 | case HWC_TRANSFORM_FLIP_V_ROT_90: return "FlipVRotate90"; |
| 503 | default: return "Unknown"; |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | static inline const char* getVsyncName(hwc2_vsync_t vsync) { |
| 508 | switch (vsync) { |
| 509 | case HWC2_VSYNC_INVALID: return "Invalid"; |
| 510 | case HWC2_VSYNC_ENABLE: return "Enable"; |
| 511 | case HWC2_VSYNC_DISABLE: return "Disable"; |
| 512 | default: return "Unknown"; |
| 513 | } |
| 514 | } |
| 515 | |
| 516 | #define TO_STRING(E, T, printer) \ |
| 517 | inline std::string to_string(E value) { return printer(value); } \ |
| 518 | inline std::string to_string(T value) { return to_string(static_cast<E>(value)); } |
| 519 | #else // !HWC2_INCLUDE_STRINGIFICATION |
| 520 | #define TO_STRING(name, printer) |
| 521 | #endif // HWC2_INCLUDE_STRINGIFICATION |
| 522 | |
| 523 | /* |
| 524 | * C++11 features |
| 525 | */ |
| 526 | |
| 527 | #ifdef HWC2_USE_CPP11 |
| 528 | __END_DECLS |
| 529 | |
| 530 | #ifdef HWC2_INCLUDE_STRINGIFICATION |
| 531 | #include <string> |
| 532 | #endif |
| 533 | |
| 534 | namespace HWC2 { |
| 535 | |
| 536 | enum class Attribute : int32_t { |
| 537 | Invalid = HWC2_ATTRIBUTE_INVALID, |
| 538 | Width = HWC2_ATTRIBUTE_WIDTH, |
| 539 | Height = HWC2_ATTRIBUTE_HEIGHT, |
| 540 | VsyncPeriod = HWC2_ATTRIBUTE_VSYNC_PERIOD, |
| 541 | DpiX = HWC2_ATTRIBUTE_DPI_X, |
| 542 | DpiY = HWC2_ATTRIBUTE_DPI_Y, |
| 543 | }; |
| 544 | TO_STRING(hwc2_attribute_t, Attribute, getAttributeName) |
| 545 | |
| 546 | enum class BlendMode : int32_t { |
| 547 | Invalid = HWC2_BLEND_MODE_INVALID, |
| 548 | None = HWC2_BLEND_MODE_NONE, |
| 549 | Premultiplied = HWC2_BLEND_MODE_PREMULTIPLIED, |
| 550 | Coverage = HWC2_BLEND_MODE_COVERAGE, |
| 551 | }; |
| 552 | TO_STRING(hwc2_blend_mode_t, BlendMode, getBlendModeName) |
| 553 | |
| 554 | enum class Callback : int32_t { |
| 555 | Invalid = HWC2_CALLBACK_INVALID, |
| 556 | Hotplug = HWC2_CALLBACK_HOTPLUG, |
| 557 | Refresh = HWC2_CALLBACK_REFRESH, |
| 558 | Vsync = HWC2_CALLBACK_VSYNC, |
| 559 | }; |
| 560 | TO_STRING(hwc2_callback_descriptor_t, Callback, getCallbackDescriptorName) |
| 561 | |
| 562 | enum class Capability : int32_t { |
| 563 | Invalid = HWC2_CAPABILITY_INVALID, |
| 564 | SidebandStream = HWC2_CAPABILITY_SIDEBAND_STREAM, |
Dan Stoza | d2168f7 | 2016-07-14 11:48:16 -0700 | [diff] [blame] | 565 | SkipClientColorTransform = HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM, |
Brian Anderson | 49018a5 | 2017-04-04 16:43:11 -0700 | [diff] [blame^] | 566 | PresentFenceIsNotReliable = HWC2_CAPABILITY_PRESENT_FENCE_IS_NOT_RELIABLE, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 567 | }; |
| 568 | TO_STRING(hwc2_capability_t, Capability, getCapabilityName) |
| 569 | |
| 570 | enum class Composition : int32_t { |
| 571 | Invalid = HWC2_COMPOSITION_INVALID, |
| 572 | Client = HWC2_COMPOSITION_CLIENT, |
| 573 | Device = HWC2_COMPOSITION_DEVICE, |
| 574 | SolidColor = HWC2_COMPOSITION_SOLID_COLOR, |
| 575 | Cursor = HWC2_COMPOSITION_CURSOR, |
| 576 | Sideband = HWC2_COMPOSITION_SIDEBAND, |
| 577 | }; |
| 578 | TO_STRING(hwc2_composition_t, Composition, getCompositionName) |
| 579 | |
| 580 | enum class Connection : int32_t { |
| 581 | Invalid = HWC2_CONNECTION_INVALID, |
| 582 | Connected = HWC2_CONNECTION_CONNECTED, |
| 583 | Disconnected = HWC2_CONNECTION_DISCONNECTED, |
| 584 | }; |
| 585 | TO_STRING(hwc2_connection_t, Connection, getConnectionName) |
| 586 | |
| 587 | enum class DisplayRequest : int32_t { |
| 588 | FlipClientTarget = HWC2_DISPLAY_REQUEST_FLIP_CLIENT_TARGET, |
| 589 | WriteClientTargetToOutput = |
| 590 | HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT, |
| 591 | }; |
| 592 | TO_STRING(hwc2_display_request_t, DisplayRequest, getDisplayRequestName) |
| 593 | |
| 594 | enum class DisplayType : int32_t { |
| 595 | Invalid = HWC2_DISPLAY_TYPE_INVALID, |
| 596 | Physical = HWC2_DISPLAY_TYPE_PHYSICAL, |
| 597 | Virtual = HWC2_DISPLAY_TYPE_VIRTUAL, |
| 598 | }; |
| 599 | TO_STRING(hwc2_display_type_t, DisplayType, getDisplayTypeName) |
| 600 | |
| 601 | enum class Error : int32_t { |
| 602 | None = HWC2_ERROR_NONE, |
| 603 | BadConfig = HWC2_ERROR_BAD_CONFIG, |
| 604 | BadDisplay = HWC2_ERROR_BAD_DISPLAY, |
| 605 | BadLayer = HWC2_ERROR_BAD_LAYER, |
| 606 | BadParameter = HWC2_ERROR_BAD_PARAMETER, |
| 607 | HasChanges = HWC2_ERROR_HAS_CHANGES, |
| 608 | NoResources = HWC2_ERROR_NO_RESOURCES, |
| 609 | NotValidated = HWC2_ERROR_NOT_VALIDATED, |
| 610 | Unsupported = HWC2_ERROR_UNSUPPORTED, |
| 611 | }; |
| 612 | TO_STRING(hwc2_error_t, Error, getErrorName) |
| 613 | |
| 614 | enum class FunctionDescriptor : int32_t { |
| 615 | Invalid = HWC2_FUNCTION_INVALID, |
| 616 | AcceptDisplayChanges = HWC2_FUNCTION_ACCEPT_DISPLAY_CHANGES, |
| 617 | CreateLayer = HWC2_FUNCTION_CREATE_LAYER, |
| 618 | CreateVirtualDisplay = HWC2_FUNCTION_CREATE_VIRTUAL_DISPLAY, |
| 619 | DestroyLayer = HWC2_FUNCTION_DESTROY_LAYER, |
| 620 | DestroyVirtualDisplay = HWC2_FUNCTION_DESTROY_VIRTUAL_DISPLAY, |
| 621 | Dump = HWC2_FUNCTION_DUMP, |
| 622 | GetActiveConfig = HWC2_FUNCTION_GET_ACTIVE_CONFIG, |
| 623 | GetChangedCompositionTypes = HWC2_FUNCTION_GET_CHANGED_COMPOSITION_TYPES, |
| 624 | GetClientTargetSupport = HWC2_FUNCTION_GET_CLIENT_TARGET_SUPPORT, |
| 625 | GetColorModes = HWC2_FUNCTION_GET_COLOR_MODES, |
| 626 | GetDisplayAttribute = HWC2_FUNCTION_GET_DISPLAY_ATTRIBUTE, |
| 627 | GetDisplayConfigs = HWC2_FUNCTION_GET_DISPLAY_CONFIGS, |
| 628 | GetDisplayName = HWC2_FUNCTION_GET_DISPLAY_NAME, |
| 629 | GetDisplayRequests = HWC2_FUNCTION_GET_DISPLAY_REQUESTS, |
| 630 | GetDisplayType = HWC2_FUNCTION_GET_DISPLAY_TYPE, |
| 631 | GetDozeSupport = HWC2_FUNCTION_GET_DOZE_SUPPORT, |
Dan Stoza | f601e97 | 2016-03-16 09:54:40 -0700 | [diff] [blame] | 632 | GetHdrCapabilities = HWC2_FUNCTION_GET_HDR_CAPABILITIES, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 633 | GetMaxVirtualDisplayCount = HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT, |
| 634 | GetReleaseFences = HWC2_FUNCTION_GET_RELEASE_FENCES, |
| 635 | PresentDisplay = HWC2_FUNCTION_PRESENT_DISPLAY, |
| 636 | RegisterCallback = HWC2_FUNCTION_REGISTER_CALLBACK, |
| 637 | SetActiveConfig = HWC2_FUNCTION_SET_ACTIVE_CONFIG, |
| 638 | SetClientTarget = HWC2_FUNCTION_SET_CLIENT_TARGET, |
| 639 | SetColorMode = HWC2_FUNCTION_SET_COLOR_MODE, |
| 640 | SetColorTransform = HWC2_FUNCTION_SET_COLOR_TRANSFORM, |
| 641 | SetCursorPosition = HWC2_FUNCTION_SET_CURSOR_POSITION, |
| 642 | SetLayerBlendMode = HWC2_FUNCTION_SET_LAYER_BLEND_MODE, |
| 643 | SetLayerBuffer = HWC2_FUNCTION_SET_LAYER_BUFFER, |
| 644 | SetLayerColor = HWC2_FUNCTION_SET_LAYER_COLOR, |
| 645 | SetLayerCompositionType = HWC2_FUNCTION_SET_LAYER_COMPOSITION_TYPE, |
| 646 | SetLayerDataspace = HWC2_FUNCTION_SET_LAYER_DATASPACE, |
| 647 | SetLayerDisplayFrame = HWC2_FUNCTION_SET_LAYER_DISPLAY_FRAME, |
| 648 | SetLayerPlaneAlpha = HWC2_FUNCTION_SET_LAYER_PLANE_ALPHA, |
| 649 | SetLayerSidebandStream = HWC2_FUNCTION_SET_LAYER_SIDEBAND_STREAM, |
| 650 | SetLayerSourceCrop = HWC2_FUNCTION_SET_LAYER_SOURCE_CROP, |
| 651 | SetLayerSurfaceDamage = HWC2_FUNCTION_SET_LAYER_SURFACE_DAMAGE, |
| 652 | SetLayerTransform = HWC2_FUNCTION_SET_LAYER_TRANSFORM, |
| 653 | SetLayerVisibleRegion = HWC2_FUNCTION_SET_LAYER_VISIBLE_REGION, |
| 654 | SetLayerZOrder = HWC2_FUNCTION_SET_LAYER_Z_ORDER, |
| 655 | SetOutputBuffer = HWC2_FUNCTION_SET_OUTPUT_BUFFER, |
| 656 | SetPowerMode = HWC2_FUNCTION_SET_POWER_MODE, |
| 657 | SetVsyncEnabled = HWC2_FUNCTION_SET_VSYNC_ENABLED, |
| 658 | ValidateDisplay = HWC2_FUNCTION_VALIDATE_DISPLAY, |
| 659 | }; |
| 660 | TO_STRING(hwc2_function_descriptor_t, FunctionDescriptor, |
| 661 | getFunctionDescriptorName) |
| 662 | |
| 663 | enum class LayerRequest : int32_t { |
| 664 | ClearClientTarget = HWC2_LAYER_REQUEST_CLEAR_CLIENT_TARGET, |
| 665 | }; |
| 666 | TO_STRING(hwc2_layer_request_t, LayerRequest, getLayerRequestName) |
| 667 | |
| 668 | enum class PowerMode : int32_t { |
| 669 | Off = HWC2_POWER_MODE_OFF, |
| 670 | DozeSuspend = HWC2_POWER_MODE_DOZE_SUSPEND, |
| 671 | Doze = HWC2_POWER_MODE_DOZE, |
| 672 | On = HWC2_POWER_MODE_ON, |
| 673 | }; |
| 674 | TO_STRING(hwc2_power_mode_t, PowerMode, getPowerModeName) |
| 675 | |
| 676 | enum class Transform : int32_t { |
| 677 | None = 0, |
| 678 | FlipH = HWC_TRANSFORM_FLIP_H, |
| 679 | FlipV = HWC_TRANSFORM_FLIP_V, |
| 680 | Rotate90 = HWC_TRANSFORM_ROT_90, |
| 681 | Rotate180 = HWC_TRANSFORM_ROT_180, |
| 682 | Rotate270 = HWC_TRANSFORM_ROT_270, |
| 683 | FlipHRotate90 = HWC_TRANSFORM_FLIP_H_ROT_90, |
| 684 | FlipVRotate90 = HWC_TRANSFORM_FLIP_V_ROT_90, |
| 685 | }; |
| 686 | TO_STRING(hwc_transform_t, Transform, getTransformName) |
| 687 | |
| 688 | enum class Vsync : int32_t { |
| 689 | Invalid = HWC2_VSYNC_INVALID, |
| 690 | Enable = HWC2_VSYNC_ENABLE, |
| 691 | Disable = HWC2_VSYNC_DISABLE, |
| 692 | }; |
| 693 | TO_STRING(hwc2_vsync_t, Vsync, getVsyncName) |
| 694 | |
| 695 | } // namespace HWC2 |
| 696 | |
| 697 | __BEGIN_DECLS |
| 698 | #endif // HWC2_USE_CPP11 |
| 699 | |
| 700 | /* |
| 701 | * Typedefs |
| 702 | */ |
| 703 | |
| 704 | typedef void (*hwc2_function_pointer_t)(); |
| 705 | |
| 706 | typedef void* hwc2_callback_data_t; |
| 707 | typedef uint32_t hwc2_config_t; |
| 708 | typedef uint64_t hwc2_display_t; |
| 709 | typedef uint64_t hwc2_layer_t; |
| 710 | |
| 711 | /* |
| 712 | * Device Struct |
| 713 | */ |
| 714 | |
| 715 | typedef struct hwc2_device { |
| 716 | /* Must be the first member of this struct, since a pointer to this struct |
| 717 | * will be generated by casting from a hw_device_t* */ |
| 718 | struct hw_device_t common; |
| 719 | |
| 720 | /* getCapabilities(..., outCount, outCapabilities) |
| 721 | * |
| 722 | * Provides a list of capabilities (described in the definition of |
| 723 | * hwc2_capability_t above) supported by this device. This list must |
| 724 | * not change after the device has been loaded. |
| 725 | * |
| 726 | * Parameters: |
| 727 | * outCount - if outCapabilities was NULL, the number of capabilities |
| 728 | * which would have been returned; if outCapabilities was not NULL, |
| 729 | * the number of capabilities returned, which must not exceed the |
| 730 | * value stored in outCount prior to the call |
| 731 | * outCapabilities - a list of capabilities supported by this device; may |
| 732 | * be NULL, in which case this function must write into outCount the |
| 733 | * number of capabilities which would have been written into |
| 734 | * outCapabilities |
| 735 | */ |
| 736 | void (*getCapabilities)(struct hwc2_device* device, uint32_t* outCount, |
| 737 | int32_t* /*hwc2_capability_t*/ outCapabilities); |
| 738 | |
| 739 | /* getFunction(..., descriptor) |
| 740 | * |
| 741 | * Returns a function pointer which implements the requested description. |
| 742 | * |
| 743 | * Parameters: |
| 744 | * descriptor - the function to return |
| 745 | * |
| 746 | * Returns either a function pointer implementing the requested descriptor |
| 747 | * or NULL if the described function is not supported by this device. |
| 748 | */ |
| 749 | hwc2_function_pointer_t (*getFunction)(struct hwc2_device* device, |
| 750 | int32_t /*hwc2_function_descriptor_t*/ descriptor); |
| 751 | } hwc2_device_t; |
| 752 | |
| 753 | static inline int hwc2_open(const struct hw_module_t* module, |
| 754 | hwc2_device_t** device) { |
| 755 | return module->methods->open(module, HWC_HARDWARE_COMPOSER, |
Colin Cross | cc8d9f9 | 2016-10-06 16:44:23 -0700 | [diff] [blame] | 756 | TO_HW_DEVICE_T_OPEN(device)); |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 757 | } |
| 758 | |
| 759 | static inline int hwc2_close(hwc2_device_t* device) { |
| 760 | return device->common.close(&device->common); |
| 761 | } |
| 762 | |
| 763 | /* |
| 764 | * Callbacks |
| 765 | * |
| 766 | * All of these callbacks take as their first parameter the callbackData which |
| 767 | * was provided at the time of callback registration, so this parameter is |
| 768 | * omitted from the described parameter lists. |
| 769 | */ |
| 770 | |
| 771 | /* hotplug(..., display, connected) |
| 772 | * Descriptor: HWC2_CALLBACK_HOTPLUG |
| 773 | * Will be provided to all HWC2 devices |
| 774 | * |
| 775 | * Notifies the client that the given display has either been connected or |
| 776 | * disconnected. Every active display (even a built-in physical display) must |
| 777 | * trigger at least one hotplug notification, even if it only occurs immediately |
| 778 | * after callback registration. |
| 779 | * |
| 780 | * The client may call back into the device on the same thread to query display |
| 781 | * properties (such as width, height, and vsync period), and other threads may |
| 782 | * call into the device while the callback is in progress. The device must |
| 783 | * serialize calls to this callback such that only one thread is calling it at a |
| 784 | * time. |
| 785 | * |
| 786 | * Displays which have been connected are assumed to be in HWC2_POWER_MODE_OFF, |
| 787 | * and the vsync callback should not be called for a display until vsync has |
| 788 | * been enabled with setVsyncEnabled. |
| 789 | * |
| 790 | * Parameters: |
| 791 | * display - the display which has been hotplugged |
| 792 | * connected - whether the display has been connected or disconnected |
| 793 | */ |
| 794 | typedef void (*HWC2_PFN_HOTPLUG)(hwc2_callback_data_t callbackData, |
| 795 | hwc2_display_t display, int32_t /*hwc2_connection_t*/ connected); |
| 796 | |
| 797 | /* refresh(..., display) |
| 798 | * Descriptor: HWC2_CALLBACK_REFRESH |
| 799 | * Will be provided to all HWC2 devices |
| 800 | * |
| 801 | * Notifies the client to trigger a screen refresh. This forces all layer state |
| 802 | * for this display to be resent, and the display to be validated and presented, |
| 803 | * even if there have been no changes. |
| 804 | * |
| 805 | * This refresh will occur some time after the callback is initiated, but not |
| 806 | * necessarily before it returns. This thread, however, is guaranteed not to |
| 807 | * call back into the device, thus it is safe to trigger this callback from |
| 808 | * other functions which call into the device. |
| 809 | * |
| 810 | * Parameters: |
| 811 | * display - the display to refresh |
| 812 | */ |
| 813 | typedef void (*HWC2_PFN_REFRESH)(hwc2_callback_data_t callbackData, |
| 814 | hwc2_display_t display); |
| 815 | |
| 816 | /* vsync(..., display, timestamp) |
| 817 | * Descriptor: HWC2_CALLBACK_VSYNC |
| 818 | * Will be provided to all HWC2 devices |
| 819 | * |
| 820 | * Notifies the client that a vsync event has occurred. This callback must |
| 821 | * only be triggered when vsync is enabled for this display (through |
| 822 | * setVsyncEnabled). |
| 823 | * |
| 824 | * This callback should be triggered from a thread of at least |
| 825 | * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible, typically |
| 826 | * less than 0.5 ms. This thread is guaranteed not to call back into the device. |
| 827 | * |
| 828 | * Parameters: |
| 829 | * display - the display which has received a vsync event |
| 830 | * timestamp - the CLOCK_MONOTONIC time at which the vsync event occurred, in |
| 831 | * nanoseconds |
| 832 | */ |
| 833 | typedef void (*HWC2_PFN_VSYNC)(hwc2_callback_data_t callbackData, |
| 834 | hwc2_display_t display, int64_t timestamp); |
| 835 | |
| 836 | /* |
| 837 | * Device Functions |
| 838 | * |
| 839 | * All of these functions take as their first parameter a device pointer, so |
| 840 | * this parameter is omitted from the described parameter lists. |
| 841 | */ |
| 842 | |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 843 | /* createVirtualDisplay(..., width, height, format, outDisplay) |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 844 | * Descriptor: HWC2_FUNCTION_CREATE_VIRTUAL_DISPLAY |
| 845 | * Must be provided by all HWC2 devices |
| 846 | * |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 847 | * Creates a new virtual display with the given width and height. The format |
| 848 | * passed into this function is the default format requested by the consumer of |
| 849 | * the virtual display output buffers. If a different format will be returned by |
| 850 | * the device, it should be returned in this parameter so it can be set properly |
| 851 | * when handing the buffers to the consumer. |
| 852 | * |
| 853 | * The display will be assumed to be on from the time the first frame is |
| 854 | * presented until the display is destroyed. |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 855 | * |
| 856 | * Parameters: |
| 857 | * width - width in pixels |
| 858 | * height - height in pixels |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 859 | * format - prior to the call, the default output buffer format selected by |
| 860 | * the consumer; after the call, the format the device will produce |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 861 | * outDisplay - the newly-created virtual display; pointer will be non-NULL |
| 862 | * |
| 863 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 864 | * HWC2_ERROR_UNSUPPORTED - the width or height is too large for the device to |
| 865 | * be able to create a virtual display |
| 866 | * HWC2_ERROR_NO_RESOURCES - the device is unable to create a new virtual |
| 867 | * display at this time |
| 868 | */ |
| 869 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_CREATE_VIRTUAL_DISPLAY)( |
| 870 | hwc2_device_t* device, uint32_t width, uint32_t height, |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 871 | int32_t* /*android_pixel_format_t*/ format, hwc2_display_t* outDisplay); |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 872 | |
| 873 | /* destroyVirtualDisplay(..., display) |
| 874 | * Descriptor: HWC2_FUNCTION_DESTROY_VIRTUAL_DISPLAY |
| 875 | * Must be provided by all HWC2 devices |
| 876 | * |
| 877 | * Destroys a virtual display. After this call all resources consumed by this |
| 878 | * display may be freed by the device and any operations performed on this |
| 879 | * display should fail. |
| 880 | * |
| 881 | * Parameters: |
| 882 | * display - the virtual display to destroy |
| 883 | * |
| 884 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 885 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 886 | * HWC2_ERROR_BAD_PARAMETER - the display handle which was passed in does not |
| 887 | * refer to a virtual display |
| 888 | */ |
| 889 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_DESTROY_VIRTUAL_DISPLAY)( |
| 890 | hwc2_device_t* device, hwc2_display_t display); |
| 891 | |
| 892 | /* dump(..., outSize, outBuffer) |
| 893 | * Descriptor: HWC2_FUNCTION_DUMP |
| 894 | * Must be provided by all HWC2 devices |
| 895 | * |
| 896 | * Retrieves implementation-defined debug information, which will be displayed |
| 897 | * during, for example, `dumpsys SurfaceFlinger`. |
| 898 | * |
| 899 | * If called with outBuffer == NULL, the device should store a copy of the |
| 900 | * desired output and return its length in bytes in outSize. If the device |
| 901 | * already has a stored copy, that copy should be purged and replaced with a |
| 902 | * fresh copy. |
| 903 | * |
| 904 | * If called with outBuffer != NULL, the device should copy its stored version |
| 905 | * of the output into outBuffer and store how many bytes of data it copied into |
| 906 | * outSize. Prior to this call, the client will have populated outSize with the |
| 907 | * maximum number of bytes outBuffer can hold. The device must not write more |
| 908 | * than this amount into outBuffer. If the device does not currently have a |
| 909 | * stored copy, then it should return 0 in outSize. |
| 910 | * |
| 911 | * Any data written into outBuffer need not be null-terminated. |
| 912 | * |
| 913 | * Parameters: |
| 914 | * outSize - if outBuffer was NULL, the number of bytes needed to copy the |
| 915 | * device's stored output; if outBuffer was not NULL, the number of bytes |
| 916 | * written into it, which must not exceed the value stored in outSize |
| 917 | * prior to the call; pointer will be non-NULL |
| 918 | * outBuffer - the buffer to write the dump output into; may be NULL as |
| 919 | * described above; data written into this buffer need not be |
| 920 | * null-terminated |
| 921 | */ |
| 922 | typedef void (*HWC2_PFN_DUMP)(hwc2_device_t* device, uint32_t* outSize, |
| 923 | char* outBuffer); |
| 924 | |
| 925 | /* getMaxVirtualDisplayCount(...) |
| 926 | * Descriptor: HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT |
| 927 | * Must be provided by all HWC2 devices |
| 928 | * |
| 929 | * Returns the maximum number of virtual displays supported by this device |
| 930 | * (which may be 0). The client will not attempt to create more than this many |
| 931 | * virtual displays on this device. This number must not change for the lifetime |
| 932 | * of the device. |
| 933 | */ |
| 934 | typedef uint32_t (*HWC2_PFN_GET_MAX_VIRTUAL_DISPLAY_COUNT)( |
| 935 | hwc2_device_t* device); |
| 936 | |
| 937 | /* registerCallback(..., descriptor, callbackData, pointer) |
| 938 | * Descriptor: HWC2_FUNCTION_REGISTER_CALLBACK |
| 939 | * Must be provided by all HWC2 devices |
| 940 | * |
| 941 | * Provides a callback for the device to call. All callbacks take a callbackData |
| 942 | * item as the first parameter, so this value should be stored with the callback |
| 943 | * for later use. The callbackData may differ from one callback to another. If |
| 944 | * this function is called multiple times with the same descriptor, later |
| 945 | * callbacks replace earlier ones. |
| 946 | * |
| 947 | * Parameters: |
| 948 | * descriptor - which callback should be set |
| 949 | * callBackdata - opaque data which must be passed back through the callback |
| 950 | * pointer - a non-NULL function pointer corresponding to the descriptor |
| 951 | * |
| 952 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 953 | * HWC2_ERROR_BAD_PARAMETER - descriptor was invalid |
| 954 | */ |
| 955 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_REGISTER_CALLBACK)( |
| 956 | hwc2_device_t* device, |
| 957 | int32_t /*hwc2_callback_descriptor_t*/ descriptor, |
| 958 | hwc2_callback_data_t callbackData, hwc2_function_pointer_t pointer); |
| 959 | |
| 960 | /* |
| 961 | * Display Functions |
| 962 | * |
| 963 | * All of these functions take as their first two parameters a device pointer |
| 964 | * and a display handle, so these parameters are omitted from the described |
| 965 | * parameter lists. |
| 966 | */ |
| 967 | |
| 968 | /* acceptDisplayChanges(...) |
| 969 | * Descriptor: HWC2_FUNCTION_ACCEPT_DISPLAY_CHANGES |
| 970 | * Must be provided by all HWC2 devices |
| 971 | * |
| 972 | * Accepts the changes required by the device from the previous validateDisplay |
| 973 | * call (which may be queried using getChangedCompositionTypes) and revalidates |
| 974 | * the display. This function is equivalent to requesting the changed types from |
| 975 | * getChangedCompositionTypes, setting those types on the corresponding layers, |
| 976 | * and then calling validateDisplay again. |
| 977 | * |
| 978 | * After this call it must be valid to present this display. Calling this after |
| 979 | * validateDisplay returns 0 changes must succeed with HWC2_ERROR_NONE, but |
| 980 | * should have no other effect. |
| 981 | * |
| 982 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 983 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 984 | * HWC2_ERROR_NOT_VALIDATED - validateDisplay has not been called |
| 985 | */ |
| 986 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_ACCEPT_DISPLAY_CHANGES)( |
| 987 | hwc2_device_t* device, hwc2_display_t display); |
| 988 | |
| 989 | /* createLayer(..., outLayer) |
| 990 | * Descriptor: HWC2_FUNCTION_CREATE_LAYER |
| 991 | * Must be provided by all HWC2 devices |
| 992 | * |
| 993 | * Creates a new layer on the given display. |
| 994 | * |
| 995 | * Parameters: |
| 996 | * outLayer - the handle of the new layer; pointer will be non-NULL |
| 997 | * |
| 998 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 999 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1000 | * HWC2_ERROR_NO_RESOURCES - the device was unable to create this layer |
| 1001 | */ |
| 1002 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_CREATE_LAYER)(hwc2_device_t* device, |
| 1003 | hwc2_display_t display, hwc2_layer_t* outLayer); |
| 1004 | |
| 1005 | /* destroyLayer(..., layer) |
| 1006 | * Descriptor: HWC2_FUNCTION_DESTROY_LAYER |
| 1007 | * Must be provided by all HWC2 devices |
| 1008 | * |
| 1009 | * Destroys the given layer. |
| 1010 | * |
| 1011 | * Parameters: |
| 1012 | * layer - the handle of the layer to destroy |
| 1013 | * |
| 1014 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1015 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1016 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1017 | */ |
| 1018 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_DESTROY_LAYER)( |
| 1019 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer); |
| 1020 | |
| 1021 | /* getActiveConfig(..., outConfig) |
| 1022 | * Descriptor: HWC2_FUNCTION_GET_ACTIVE_CONFIG |
| 1023 | * Must be provided by all HWC2 devices |
| 1024 | * |
| 1025 | * Retrieves which display configuration is currently active. |
| 1026 | * |
| 1027 | * If no display configuration is currently active, this function must return |
| 1028 | * HWC2_ERROR_BAD_CONFIG and place no configuration handle in outConfig. It is |
| 1029 | * the responsibility of the client to call setActiveConfig with a valid |
| 1030 | * configuration before attempting to present anything on the display. |
| 1031 | * |
| 1032 | * Parameters: |
| 1033 | * outConfig - the currently active display configuration; pointer will be |
| 1034 | * non-NULL |
| 1035 | * |
| 1036 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1037 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1038 | * HWC2_ERROR_BAD_CONFIG - no configuration is currently active |
| 1039 | */ |
| 1040 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_ACTIVE_CONFIG)( |
| 1041 | hwc2_device_t* device, hwc2_display_t display, |
| 1042 | hwc2_config_t* outConfig); |
| 1043 | |
| 1044 | /* getChangedCompositionTypes(..., outNumElements, outLayers, outTypes) |
| 1045 | * Descriptor: HWC2_FUNCTION_GET_CHANGED_COMPOSITION_TYPES |
| 1046 | * Must be provided by all HWC2 devices |
| 1047 | * |
| 1048 | * Retrieves the layers for which the device requires a different composition |
| 1049 | * type than had been set prior to the last call to validateDisplay. The client |
| 1050 | * will either update its state with these types and call acceptDisplayChanges, |
| 1051 | * or will set new types and attempt to validate the display again. |
| 1052 | * |
| 1053 | * outLayers and outTypes may be NULL to retrieve the number of elements which |
| 1054 | * will be returned. The number of elements returned must be the same as the |
| 1055 | * value returned in outNumTypes from the last call to validateDisplay. |
| 1056 | * |
| 1057 | * Parameters: |
| 1058 | * outNumElements - if outLayers or outTypes were NULL, the number of layers |
| 1059 | * and types which would have been returned; if both were non-NULL, the |
| 1060 | * number of elements returned in outLayers and outTypes, which must not |
| 1061 | * exceed the value stored in outNumElements prior to the call; pointer |
| 1062 | * will be non-NULL |
| 1063 | * outLayers - an array of layer handles |
| 1064 | * outTypes - an array of composition types, each corresponding to an element |
| 1065 | * of outLayers |
| 1066 | * |
| 1067 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1068 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1069 | * HWC2_ERROR_NOT_VALIDATED - validateDisplay has not been called for this |
| 1070 | * display |
| 1071 | */ |
| 1072 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_CHANGED_COMPOSITION_TYPES)( |
| 1073 | hwc2_device_t* device, hwc2_display_t display, |
| 1074 | uint32_t* outNumElements, hwc2_layer_t* outLayers, |
| 1075 | int32_t* /*hwc2_composition_t*/ outTypes); |
| 1076 | |
| 1077 | /* getClientTargetSupport(..., width, height, format, dataspace) |
| 1078 | * Descriptor: HWC2_FUNCTION_GET_CLIENT_TARGET_SUPPORT |
| 1079 | * Must be provided by all HWC2 devices |
| 1080 | * |
| 1081 | * Returns whether a client target with the given properties can be handled by |
| 1082 | * the device. |
| 1083 | * |
| 1084 | * The valid formats can be found in android_pixel_format_t in |
| 1085 | * <system/graphics.h>. |
| 1086 | * |
| 1087 | * For more about dataspaces, see setLayerDataspace. |
| 1088 | * |
| 1089 | * This function must return true for a client target with width and height |
| 1090 | * equal to the active display configuration dimensions, |
| 1091 | * HAL_PIXEL_FORMAT_RGBA_8888, and HAL_DATASPACE_UNKNOWN. It is not required to |
| 1092 | * return true for any other configuration. |
| 1093 | * |
| 1094 | * Parameters: |
| 1095 | * width - client target width in pixels |
| 1096 | * height - client target height in pixels |
| 1097 | * format - client target format |
| 1098 | * dataspace - client target dataspace, as described in setLayerDataspace |
| 1099 | * |
| 1100 | * Returns HWC2_ERROR_NONE if the given configuration is supported or one of the |
| 1101 | * following errors: |
| 1102 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1103 | * HWC2_ERROR_UNSUPPORTED - the given configuration is not supported |
| 1104 | */ |
| 1105 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_CLIENT_TARGET_SUPPORT)( |
| 1106 | hwc2_device_t* device, hwc2_display_t display, uint32_t width, |
| 1107 | uint32_t height, int32_t /*android_pixel_format_t*/ format, |
| 1108 | int32_t /*android_dataspace_t*/ dataspace); |
| 1109 | |
| 1110 | /* getColorModes(..., outNumModes, outModes) |
| 1111 | * Descriptor: HWC2_FUNCTION_GET_COLOR_MODES |
| 1112 | * Must be provided by all HWC2 devices |
| 1113 | * |
| 1114 | * Returns the color modes supported on this display. |
| 1115 | * |
| 1116 | * The valid color modes can be found in android_color_mode_t in |
| 1117 | * <system/graphics.h>. All HWC2 devices must support at least |
| 1118 | * HAL_COLOR_MODE_NATIVE. |
| 1119 | * |
| 1120 | * outNumModes may be NULL to retrieve the number of modes which will be |
| 1121 | * returned. |
| 1122 | * |
| 1123 | * Parameters: |
| 1124 | * outNumModes - if outModes was NULL, the number of modes which would have |
| 1125 | * been returned; if outModes was not NULL, the number of modes returned, |
| 1126 | * which must not exceed the value stored in outNumModes prior to the |
| 1127 | * call; pointer will be non-NULL |
| 1128 | * outModes - an array of color modes |
| 1129 | * |
| 1130 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1131 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1132 | */ |
| 1133 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_COLOR_MODES)( |
| 1134 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumModes, |
| 1135 | int32_t* /*android_color_mode_t*/ outModes); |
| 1136 | |
| 1137 | /* getDisplayAttribute(..., config, attribute, outValue) |
| 1138 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_ATTRIBUTE |
| 1139 | * Must be provided by all HWC2 devices |
| 1140 | * |
| 1141 | * Returns a display attribute value for a particular display configuration. |
| 1142 | * |
| 1143 | * Any attribute which is not supported or for which the value is unknown by the |
| 1144 | * device must return a value of -1. |
| 1145 | * |
| 1146 | * Parameters: |
| 1147 | * config - the display configuration for which to return attribute values |
| 1148 | * attribute - the attribute to query |
| 1149 | * outValue - the value of the attribute; the pointer will be non-NULL |
| 1150 | * |
| 1151 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1152 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1153 | * HWC2_ERROR_BAD_CONFIG - config does not name a valid configuration for this |
| 1154 | * display |
| 1155 | */ |
| 1156 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_ATTRIBUTE)( |
| 1157 | hwc2_device_t* device, hwc2_display_t display, hwc2_config_t config, |
| 1158 | int32_t /*hwc2_attribute_t*/ attribute, int32_t* outValue); |
| 1159 | |
| 1160 | /* getDisplayConfigs(..., outNumConfigs, outConfigs) |
| 1161 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_CONFIGS |
| 1162 | * Must be provided by all HWC2 devices |
| 1163 | * |
| 1164 | * Returns handles for all of the valid display configurations on this display. |
| 1165 | * |
| 1166 | * outConfigs may be NULL to retrieve the number of elements which will be |
| 1167 | * returned. |
| 1168 | * |
| 1169 | * Parameters: |
| 1170 | * outNumConfigs - if outConfigs was NULL, the number of configurations which |
| 1171 | * would have been returned; if outConfigs was not NULL, the number of |
| 1172 | * configurations returned, which must not exceed the value stored in |
| 1173 | * outNumConfigs prior to the call; pointer will be non-NULL |
| 1174 | * outConfigs - an array of configuration handles |
| 1175 | * |
| 1176 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1177 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1178 | */ |
| 1179 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_CONFIGS)( |
| 1180 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumConfigs, |
| 1181 | hwc2_config_t* outConfigs); |
| 1182 | |
| 1183 | /* getDisplayName(..., outSize, outName) |
| 1184 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_NAME |
| 1185 | * Must be provided by all HWC2 devices |
| 1186 | * |
| 1187 | * Returns a human-readable version of the display's name. |
| 1188 | * |
| 1189 | * outName may be NULL to retrieve the length of the name. |
| 1190 | * |
| 1191 | * Parameters: |
| 1192 | * outSize - if outName was NULL, the number of bytes needed to return the |
| 1193 | * name if outName was not NULL, the number of bytes written into it, |
| 1194 | * which must not exceed the value stored in outSize prior to the call; |
| 1195 | * pointer will be non-NULL |
| 1196 | * outName - the display's name |
| 1197 | * |
| 1198 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1199 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1200 | */ |
| 1201 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_NAME)( |
| 1202 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outSize, |
| 1203 | char* outName); |
| 1204 | |
| 1205 | /* getDisplayRequests(..., outDisplayRequests, outNumElements, outLayers, |
| 1206 | * outLayerRequests) |
| 1207 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_REQUESTS |
| 1208 | * Must be provided by all HWC2 devices |
| 1209 | * |
| 1210 | * Returns the display requests and the layer requests required for the last |
| 1211 | * validated configuration. |
| 1212 | * |
| 1213 | * Display requests provide information about how the client should handle the |
| 1214 | * client target. Layer requests provide information about how the client |
| 1215 | * should handle an individual layer. |
| 1216 | * |
| 1217 | * If outLayers or outLayerRequests is NULL, the required number of layers and |
| 1218 | * requests must be returned in outNumElements, but this number may also be |
| 1219 | * obtained from validateDisplay as outNumRequests (outNumElements must be equal |
| 1220 | * to the value returned in outNumRequests from the last call to |
| 1221 | * validateDisplay). |
| 1222 | * |
| 1223 | * Parameters: |
| 1224 | * outDisplayRequests - the display requests for the current validated state |
| 1225 | * outNumElements - if outLayers or outLayerRequests were NULL, the number of |
| 1226 | * elements which would have been returned, which must be equal to the |
| 1227 | * value returned in outNumRequests from the last validateDisplay call on |
| 1228 | * this display; if both were not NULL, the number of elements in |
| 1229 | * outLayers and outLayerRequests, which must not exceed the value stored |
| 1230 | * in outNumElements prior to the call; pointer will be non-NULL |
| 1231 | * outLayers - an array of layers which all have at least one request |
| 1232 | * outLayerRequests - the requests corresponding to each element of outLayers |
| 1233 | * |
| 1234 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1235 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1236 | * HWC2_ERROR_NOT_VALIDATED - validateDisplay has not been called for this |
| 1237 | * display |
| 1238 | */ |
| 1239 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_REQUESTS)( |
| 1240 | hwc2_device_t* device, hwc2_display_t display, |
| 1241 | int32_t* /*hwc2_display_request_t*/ outDisplayRequests, |
| 1242 | uint32_t* outNumElements, hwc2_layer_t* outLayers, |
| 1243 | int32_t* /*hwc2_layer_request_t*/ outLayerRequests); |
| 1244 | |
| 1245 | /* getDisplayType(..., outType) |
| 1246 | * Descriptor: HWC2_FUNCTION_GET_DISPLAY_TYPE |
| 1247 | * Must be provided by all HWC2 devices |
| 1248 | * |
| 1249 | * Returns whether the given display is a physical or virtual display. |
| 1250 | * |
| 1251 | * Parameters: |
| 1252 | * outType - the type of the display; pointer will be 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 | */ |
| 1257 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_TYPE)( |
| 1258 | hwc2_device_t* device, hwc2_display_t display, |
| 1259 | int32_t* /*hwc2_display_type_t*/ outType); |
| 1260 | |
| 1261 | /* getDozeSupport(..., outSupport) |
| 1262 | * Descriptor: HWC2_FUNCTION_GET_DOZE_SUPPORT |
| 1263 | * Must be provided by all HWC2 devices |
| 1264 | * |
| 1265 | * Returns whether the given display supports HWC2_POWER_MODE_DOZE and |
| 1266 | * HWC2_POWER_MODE_DOZE_SUSPEND. DOZE_SUSPEND may not provide any benefit over |
| 1267 | * DOZE (see the definition of hwc2_power_mode_t for more information), but if |
| 1268 | * both DOZE and DOZE_SUSPEND are no different from HWC2_POWER_MODE_ON, the |
| 1269 | * device should not claim support. |
| 1270 | * |
| 1271 | * Parameters: |
| 1272 | * outSupport - whether the display supports doze modes (1 for yes, 0 for no); |
| 1273 | * pointer will be non-NULL |
| 1274 | * |
| 1275 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1276 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1277 | */ |
| 1278 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DOZE_SUPPORT)( |
| 1279 | hwc2_device_t* device, hwc2_display_t display, int32_t* outSupport); |
| 1280 | |
Dan Stoza | f601e97 | 2016-03-16 09:54:40 -0700 | [diff] [blame] | 1281 | /* getHdrCapabilities(..., outNumTypes, outTypes, outMaxLuminance, |
| 1282 | * outMaxAverageLuminance, outMinLuminance) |
| 1283 | * Descriptor: HWC2_FUNCTION_GET_HDR_CAPABILITIES |
| 1284 | * Must be provided by all HWC2 devices |
| 1285 | * |
| 1286 | * Returns the high dynamic range (HDR) capabilities of the given display, which |
| 1287 | * are invariant with regard to the active configuration. |
| 1288 | * |
| 1289 | * Displays which are not HDR-capable must return no types in outTypes and set |
| 1290 | * outNumTypes to 0. |
| 1291 | * |
| 1292 | * If outTypes is NULL, the required number of HDR types must be returned in |
| 1293 | * outNumTypes. |
| 1294 | * |
| 1295 | * Parameters: |
| 1296 | * outNumTypes - if outTypes was NULL, the number of types which would have |
| 1297 | * been returned; if it was not NULL, the number of types stored in |
| 1298 | * outTypes, which must not exceed the value stored in outNumTypes prior |
| 1299 | * to the call; pointer will be non-NULL |
| 1300 | * outTypes - an array of HDR types, may have 0 elements if the display is not |
| 1301 | * HDR-capable |
| 1302 | * outMaxLuminance - the desired content maximum luminance for this display in |
| 1303 | * cd/m^2; pointer will be non-NULL |
| 1304 | * outMaxAverageLuminance - the desired content maximum frame-average |
| 1305 | * luminance for this display in cd/m^2; pointer will be non-NULL |
| 1306 | * outMinLuminance - the desired content minimum luminance for this display in |
| 1307 | * cd/m^2; pointer will be non-NULL |
| 1308 | * |
| 1309 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1310 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1311 | */ |
| 1312 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_HDR_CAPABILITIES)( |
| 1313 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumTypes, |
| 1314 | int32_t* /*android_hdr_t*/ outTypes, float* outMaxLuminance, |
| 1315 | float* outMaxAverageLuminance, float* outMinLuminance); |
| 1316 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1317 | /* getReleaseFences(..., outNumElements, outLayers, outFences) |
| 1318 | * Descriptor: HWC2_FUNCTION_GET_RELEASE_FENCES |
| 1319 | * Must be provided by all HWC2 devices |
| 1320 | * |
| 1321 | * Retrieves the release fences for device layers on this display which will |
| 1322 | * receive new buffer contents this frame. |
| 1323 | * |
| 1324 | * A release fence is a file descriptor referring to a sync fence object which |
| 1325 | * will be signaled after the device has finished reading from the buffer |
| 1326 | * presented in the prior frame. This indicates that it is safe to start writing |
| 1327 | * to the buffer again. If a given layer's fence is not returned from this |
| 1328 | * function, it will be assumed that the buffer presented on the previous frame |
| 1329 | * is ready to be written. |
| 1330 | * |
| 1331 | * The fences returned by this function should be unique for each layer (even if |
| 1332 | * they point to the same underlying sync object), and ownership of the fences |
| 1333 | * is transferred to the client, which is responsible for closing them. |
| 1334 | * |
| 1335 | * If outLayers or outFences is NULL, the required number of layers and fences |
| 1336 | * must be returned in outNumElements. |
| 1337 | * |
| 1338 | * Parameters: |
| 1339 | * outNumElements - if outLayers or outFences were NULL, the number of |
| 1340 | * elements which would have been returned; if both were not NULL, the |
| 1341 | * number of elements in outLayers and outFences, which must not exceed |
| 1342 | * the value stored in outNumElements prior to the call; pointer will be |
| 1343 | * non-NULL |
| 1344 | * outLayers - an array of layer handles |
| 1345 | * outFences - an array of sync fence file descriptors as described above, |
| 1346 | * each corresponding to an element of outLayers |
| 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_RELEASE_FENCES)( |
| 1352 | hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumElements, |
| 1353 | hwc2_layer_t* outLayers, int32_t* outFences); |
| 1354 | |
Dan Stoza | ef26482 | 2016-07-13 14:51:09 -0700 | [diff] [blame] | 1355 | /* presentDisplay(..., outPresentFence) |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1356 | * Descriptor: HWC2_FUNCTION_PRESENT_DISPLAY |
| 1357 | * Must be provided by all HWC2 devices |
| 1358 | * |
| 1359 | * Presents the current display contents on the screen (or in the case of |
| 1360 | * virtual displays, into the output buffer). |
| 1361 | * |
| 1362 | * Prior to calling this function, the display must be successfully validated |
| 1363 | * with validateDisplay. Note that setLayerBuffer and setLayerSurfaceDamage |
| 1364 | * specifically do not count as layer state, so if there are no other changes |
| 1365 | * to the layer state (or to the buffer's properties as described in |
| 1366 | * setLayerBuffer), then it is safe to call this function without first |
| 1367 | * validating the display. |
| 1368 | * |
Dan Stoza | ef26482 | 2016-07-13 14:51:09 -0700 | [diff] [blame] | 1369 | * If this call succeeds, outPresentFence will be populated with a file |
| 1370 | * descriptor referring to a present sync fence object. For physical displays, |
| 1371 | * this fence will be signaled at the vsync when the result of composition of |
| 1372 | * this frame starts to appear (for video-mode panels) or starts to transfer to |
| 1373 | * panel memory (for command-mode panels). For virtual displays, this fence will |
| 1374 | * be signaled when writes to the output buffer have completed and it is safe to |
| 1375 | * read from it. |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1376 | * |
| 1377 | * Parameters: |
Dan Stoza | ef26482 | 2016-07-13 14:51:09 -0700 | [diff] [blame] | 1378 | * outPresentFence - a sync fence file descriptor as described above; pointer |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1379 | * will be non-NULL |
| 1380 | * |
| 1381 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1382 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1383 | * HWC2_ERROR_NO_RESOURCES - no valid output buffer has been set for a virtual |
| 1384 | * display |
| 1385 | * HWC2_ERROR_NOT_VALIDATED - validateDisplay has not successfully been called |
| 1386 | * for this display |
| 1387 | */ |
| 1388 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_PRESENT_DISPLAY)( |
Dan Stoza | ef26482 | 2016-07-13 14:51:09 -0700 | [diff] [blame] | 1389 | hwc2_device_t* device, hwc2_display_t display, |
| 1390 | int32_t* outPresentFence); |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1391 | |
| 1392 | /* setActiveConfig(..., config) |
| 1393 | * Descriptor: HWC2_FUNCTION_SET_ACTIVE_CONFIG |
| 1394 | * Must be provided by all HWC2 devices |
| 1395 | * |
| 1396 | * Sets the active configuration for this display. Upon returning, the given |
| 1397 | * display configuration should be active and remain so until either this |
| 1398 | * function is called again or the display is disconnected. |
| 1399 | * |
| 1400 | * Parameters: |
| 1401 | * config - the new display configuration |
| 1402 | * |
| 1403 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1404 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1405 | * HWC2_ERROR_BAD_CONFIG - the configuration handle passed in is not valid for |
| 1406 | * this display |
| 1407 | */ |
| 1408 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_ACTIVE_CONFIG)( |
| 1409 | hwc2_device_t* device, hwc2_display_t display, hwc2_config_t config); |
| 1410 | |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1411 | /* setClientTarget(..., target, acquireFence, dataspace, damage) |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1412 | * Descriptor: HWC2_FUNCTION_SET_CLIENT_TARGET |
| 1413 | * Must be provided by all HWC2 devices |
| 1414 | * |
| 1415 | * Sets the buffer handle which will receive the output of client composition. |
| 1416 | * Layers marked as HWC2_COMPOSITION_CLIENT will be composited into this buffer |
| 1417 | * prior to the call to presentDisplay, and layers not marked as |
| 1418 | * HWC2_COMPOSITION_CLIENT should be composited with this buffer by the device. |
| 1419 | * |
Dan Stoza | 3abcfa5 | 2016-05-04 12:21:06 -0700 | [diff] [blame] | 1420 | * The buffer handle provided may be null if no layers are being composited by |
| 1421 | * the client. This must not result in an error (unless an invalid display |
| 1422 | * handle is also provided). |
| 1423 | * |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1424 | * Also provides a file descriptor referring to an acquire sync fence object, |
| 1425 | * which will be signaled when it is safe to read from the client target buffer. |
| 1426 | * If it is already safe to read from this buffer, -1 may be passed instead. |
| 1427 | * The device must ensure that it is safe for the client to close this file |
| 1428 | * descriptor at any point after this function is called. |
| 1429 | * |
| 1430 | * For more about dataspaces, see setLayerDataspace. |
| 1431 | * |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1432 | * The damage parameter describes a surface damage region as defined in the |
| 1433 | * description of setLayerSurfaceDamage. |
| 1434 | * |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1435 | * Will be called before presentDisplay if any of the layers are marked as |
| 1436 | * HWC2_COMPOSITION_CLIENT. If no layers are so marked, then it is not |
| 1437 | * necessary to call this function. It is not necessary to call validateDisplay |
| 1438 | * after changing the target through this function. |
| 1439 | * |
| 1440 | * Parameters: |
| 1441 | * target - the new target buffer |
| 1442 | * acquireFence - a sync fence file descriptor as described above |
| 1443 | * dataspace - the dataspace of the buffer, as described in setLayerDataspace |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1444 | * damage - the surface damage region |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1445 | * |
| 1446 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1447 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1448 | * HWC2_ERROR_BAD_PARAMETER - the new target handle was invalid |
| 1449 | */ |
| 1450 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_CLIENT_TARGET)( |
| 1451 | hwc2_device_t* device, hwc2_display_t display, buffer_handle_t target, |
Dan Stoza | 68cd375 | 2016-05-20 13:30:42 -0700 | [diff] [blame] | 1452 | int32_t acquireFence, int32_t /*android_dataspace_t*/ dataspace, |
| 1453 | hwc_region_t damage); |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1454 | |
Dan Stoza | c46e96a | 2016-03-24 10:12:15 -0700 | [diff] [blame] | 1455 | /* setColorMode(..., mode) |
| 1456 | * Descriptor: HWC2_FUNCTION_SET_COLOR_MODE |
| 1457 | * Must be provided by all HWC2 devices |
| 1458 | * |
| 1459 | * Sets the color mode of the given display. |
| 1460 | * |
| 1461 | * Upon returning from this function, the color mode change must have fully |
| 1462 | * taken effect. |
| 1463 | * |
| 1464 | * The valid color modes can be found in android_color_mode_t in |
| 1465 | * <system/graphics.h>. All HWC2 devices must support at least |
| 1466 | * HAL_COLOR_MODE_NATIVE, and displays are assumed to be in this mode upon |
| 1467 | * hotplug. |
| 1468 | * |
| 1469 | * Parameters: |
| 1470 | * mode - the mode to set |
| 1471 | * |
| 1472 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1473 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1474 | * HWC2_ERROR_BAD_PARAMETER - mode is not a valid color mode |
| 1475 | * HWC2_ERROR_UNSUPPORTED - mode is not supported on this display |
| 1476 | */ |
| 1477 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_COLOR_MODE)( |
| 1478 | hwc2_device_t* device, hwc2_display_t display, |
| 1479 | int32_t /*android_color_mode_t*/ mode); |
| 1480 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1481 | /* setColorTransform(..., matrix, hint) |
| 1482 | * Descriptor: HWC2_FUNCTION_SET_COLOR_TRANSFORM |
| 1483 | * Must be provided by all HWC2 devices |
| 1484 | * |
| 1485 | * Sets a color transform which will be applied after composition. |
| 1486 | * |
| 1487 | * If hint is not HAL_COLOR_TRANSFORM_ARBITRARY, then the device may use the |
| 1488 | * hint to apply the desired color transform instead of using the color matrix |
| 1489 | * directly. |
| 1490 | * |
| 1491 | * If the device is not capable of either using the hint or the matrix to apply |
| 1492 | * the desired color transform, it should force all layers to client composition |
| 1493 | * during validateDisplay. |
| 1494 | * |
Dan Stoza | d2168f7 | 2016-07-14 11:48:16 -0700 | [diff] [blame] | 1495 | * If HWC2_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM is present, then the client |
| 1496 | * will never apply the color transform during client composition, even if all |
| 1497 | * layers are being composed by the client. |
| 1498 | * |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1499 | * The matrix provided is an affine color transformation of the following form: |
| 1500 | * |
| 1501 | * |r.r r.g r.b 0| |
| 1502 | * |g.r g.g g.b 0| |
| 1503 | * |b.r b.g b.b 0| |
| 1504 | * |Tr Tg Tb 1| |
| 1505 | * |
| 1506 | * This matrix will be provided in row-major form: {r.r, r.g, r.b, 0, g.r, ...}. |
| 1507 | * |
| 1508 | * Given a matrix of this form and an input color [R_in, G_in, B_in], the output |
| 1509 | * color [R_out, G_out, B_out] will be: |
| 1510 | * |
| 1511 | * 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] | 1512 | * G_out = R_in * r.g + G_in * g.g + B_in * b.g + Tg |
| 1513 | * 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] | 1514 | * |
| 1515 | * Parameters: |
| 1516 | * matrix - a 4x4 transform matrix (16 floats) as described above |
| 1517 | * hint - a hint value which may be used instead of the given matrix unless it |
| 1518 | * is HAL_COLOR_TRANSFORM_ARBITRARY |
| 1519 | * |
| 1520 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1521 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1522 | * HWC2_ERROR_BAD_PARAMETER - hint is not a valid color transform hint |
| 1523 | */ |
| 1524 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_COLOR_TRANSFORM)( |
Dan Stoza | c46e96a | 2016-03-24 10:12:15 -0700 | [diff] [blame] | 1525 | hwc2_device_t* device, hwc2_display_t display, const float* matrix, |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1526 | int32_t /*android_color_transform_t*/ hint); |
| 1527 | |
Dan Stoza | 4e9221b | 2015-09-02 15:43:39 -0700 | [diff] [blame] | 1528 | /* setOutputBuffer(..., buffer, releaseFence) |
| 1529 | * Descriptor: HWC2_FUNCTION_SET_OUTPUT_BUFFER |
| 1530 | * Must be provided by all HWC2 devices |
| 1531 | * |
| 1532 | * Sets the output buffer for a virtual display. That is, the buffer to which |
| 1533 | * the composition result will be written. |
| 1534 | * |
| 1535 | * Also provides a file descriptor referring to a release sync fence object, |
| 1536 | * which will be signaled when it is safe to write to the output buffer. If it |
| 1537 | * is already safe to write to the output buffer, -1 may be passed instead. The |
| 1538 | * device must ensure that it is safe for the client to close this file |
| 1539 | * descriptor at any point after this function is called. |
| 1540 | * |
| 1541 | * Must be called at least once before presentDisplay, but does not have any |
| 1542 | * interaction with layer state or display validation. |
| 1543 | * |
| 1544 | * Parameters: |
| 1545 | * buffer - the new output buffer |
| 1546 | * releaseFence - a sync fence file descriptor as described above |
| 1547 | * |
| 1548 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1549 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1550 | * HWC2_ERROR_BAD_PARAMETER - the new output buffer handle was invalid |
| 1551 | * HWC2_ERROR_UNSUPPORTED - display does not refer to a virtual display |
| 1552 | */ |
| 1553 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_OUTPUT_BUFFER)( |
| 1554 | hwc2_device_t* device, hwc2_display_t display, buffer_handle_t buffer, |
| 1555 | int32_t releaseFence); |
| 1556 | |
| 1557 | /* setPowerMode(..., mode) |
| 1558 | * Descriptor: HWC2_FUNCTION_SET_POWER_MODE |
| 1559 | * Must be provided by all HWC2 devices |
| 1560 | * |
| 1561 | * Sets the power mode of the given display. The transition must be complete |
| 1562 | * when this function returns. It is valid to call this function multiple times |
| 1563 | * with the same power mode. |
| 1564 | * |
| 1565 | * All displays must support HWC2_POWER_MODE_ON and HWC2_POWER_MODE_OFF. Whether |
| 1566 | * a display supports HWC2_POWER_MODE_DOZE or HWC2_POWER_MODE_DOZE_SUSPEND may |
| 1567 | * be queried using getDozeSupport. |
| 1568 | * |
| 1569 | * Parameters: |
| 1570 | * mode - the new power mode |
| 1571 | * |
| 1572 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1573 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1574 | * HWC2_ERROR_BAD_PARAMETER - mode was not a valid power mode |
| 1575 | * HWC2_ERROR_UNSUPPORTED - mode was a valid power mode, but is not supported |
| 1576 | * on this display |
| 1577 | */ |
| 1578 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_POWER_MODE)( |
| 1579 | hwc2_device_t* device, hwc2_display_t display, |
| 1580 | int32_t /*hwc2_power_mode_t*/ mode); |
| 1581 | |
| 1582 | /* setVsyncEnabled(..., enabled) |
| 1583 | * Descriptor: HWC2_FUNCTION_SET_VSYNC_ENABLED |
| 1584 | * Must be provided by all HWC2 devices |
| 1585 | * |
| 1586 | * Enables or disables the vsync signal for the given display. Virtual displays |
| 1587 | * never generate vsync callbacks, and any attempt to enable vsync for a virtual |
| 1588 | * display though this function must return HWC2_ERROR_NONE and have no other |
| 1589 | * effect. |
| 1590 | * |
| 1591 | * Parameters: |
| 1592 | * enabled - whether to enable or disable vsync |
| 1593 | * |
| 1594 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1595 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1596 | * HWC2_ERROR_BAD_PARAMETER - enabled was an invalid value |
| 1597 | */ |
| 1598 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_VSYNC_ENABLED)( |
| 1599 | hwc2_device_t* device, hwc2_display_t display, |
| 1600 | int32_t /*hwc2_vsync_t*/ enabled); |
| 1601 | |
| 1602 | /* validateDisplay(..., outNumTypes, outNumRequests) |
| 1603 | * Descriptor: HWC2_FUNCTION_VALIDATE_DISPLAY |
| 1604 | * Must be provided by all HWC2 devices |
| 1605 | * |
| 1606 | * Instructs the device to inspect all of the layer state and determine if |
| 1607 | * there are any composition type changes necessary before presenting the |
| 1608 | * display. Permitted changes are described in the definition of |
| 1609 | * hwc2_composition_t above. |
| 1610 | * |
| 1611 | * Also returns the number of layer requests required |
| 1612 | * by the given layer configuration. |
| 1613 | * |
| 1614 | * Parameters: |
| 1615 | * outNumTypes - the number of composition type changes required by the |
| 1616 | * device; if greater than 0, the client must either set and validate new |
| 1617 | * types, or call acceptDisplayChanges to accept the changes returned by |
| 1618 | * getChangedCompositionTypes; must be the same as the number of changes |
| 1619 | * returned by getChangedCompositionTypes (see the declaration of that |
| 1620 | * function for more information); pointer will be non-NULL |
| 1621 | * outNumRequests - the number of layer requests required by this layer |
| 1622 | * configuration; must be equal to the number of layer requests returned |
| 1623 | * by getDisplayRequests (see the declaration of that function for |
| 1624 | * more information); pointer will be non-NULL |
| 1625 | * |
| 1626 | * Returns HWC2_ERROR_NONE if no changes are necessary and it is safe to present |
| 1627 | * the display using the current layer state. Otherwise returns one of the |
| 1628 | * following errors: |
| 1629 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1630 | * HWC2_ERROR_HAS_CHANGES - outNumTypes was greater than 0 (see parameter list |
| 1631 | * for more information) |
| 1632 | */ |
| 1633 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_VALIDATE_DISPLAY)( |
| 1634 | hwc2_device_t* device, hwc2_display_t display, |
| 1635 | uint32_t* outNumTypes, uint32_t* outNumRequests); |
| 1636 | |
| 1637 | /* |
| 1638 | * Layer Functions |
| 1639 | * |
| 1640 | * These are functions which operate on layers, but which do not modify state |
| 1641 | * that must be validated before use. See also 'Layer State Functions' below. |
| 1642 | * |
| 1643 | * All of these functions take as their first three parameters a device pointer, |
| 1644 | * a display handle for the display which contains the layer, and a layer |
| 1645 | * handle, so these parameters are omitted from the described parameter lists. |
| 1646 | */ |
| 1647 | |
| 1648 | /* setCursorPosition(..., x, y) |
| 1649 | * Descriptor: HWC2_FUNCTION_SET_CURSOR_POSITION |
| 1650 | * Must be provided by all HWC2 devices |
| 1651 | * |
| 1652 | * Asynchonously sets the position of a cursor layer. |
| 1653 | * |
| 1654 | * Prior to validateDisplay, a layer may be marked as HWC2_COMPOSITION_CURSOR. |
| 1655 | * If validation succeeds (i.e., the device does not request a composition |
| 1656 | * change for that layer), then once a buffer has been set for the layer and it |
| 1657 | * has been presented, its position may be set by this function at any time |
| 1658 | * between presentDisplay and any subsequent validateDisplay calls for this |
| 1659 | * display. |
| 1660 | * |
| 1661 | * Once validateDisplay is called, this function will not be called again until |
| 1662 | * the validate/present sequence is completed. |
| 1663 | * |
| 1664 | * May be called from any thread so long as it is not interleaved with the |
| 1665 | * validate/present sequence as described above. |
| 1666 | * |
| 1667 | * Parameters: |
| 1668 | * x - the new x coordinate (in pixels from the left of the screen) |
| 1669 | * y - the new y coordinate (in pixels from the top of the screen) |
| 1670 | * |
| 1671 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1672 | * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in |
| 1673 | * HWC2_ERROR_BAD_LAYER - the layer is invalid or is not currently marked as |
| 1674 | * HWC2_COMPOSITION_CURSOR |
| 1675 | * HWC2_ERROR_NOT_VALIDATED - the device is currently in the middle of the |
| 1676 | * validate/present sequence |
| 1677 | */ |
| 1678 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_CURSOR_POSITION)( |
| 1679 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1680 | int32_t x, int32_t y); |
| 1681 | |
| 1682 | /* setLayerBuffer(..., buffer, acquireFence) |
| 1683 | * Descriptor: HWC2_FUNCTION_SET_LAYER_BUFFER |
| 1684 | * Must be provided by all HWC2 devices |
| 1685 | * |
| 1686 | * Sets the buffer handle to be displayed for this layer. If the buffer |
| 1687 | * properties set at allocation time (width, height, format, and usage) have not |
| 1688 | * changed since the previous frame, it is not necessary to call validateDisplay |
| 1689 | * before calling presentDisplay unless new state needs to be validated in the |
| 1690 | * interim. |
| 1691 | * |
| 1692 | * Also provides a file descriptor referring to an acquire sync fence object, |
| 1693 | * which will be signaled when it is safe to read from the given buffer. If it |
| 1694 | * is already safe to read from the buffer, -1 may be passed instead. The |
| 1695 | * device must ensure that it is safe for the client to close this file |
| 1696 | * descriptor at any point after this function is called. |
| 1697 | * |
| 1698 | * This function must return HWC2_ERROR_NONE and have no other effect if called |
| 1699 | * for a layer with a composition type of HWC2_COMPOSITION_SOLID_COLOR (because |
| 1700 | * it has no buffer) or HWC2_COMPOSITION_SIDEBAND or HWC2_COMPOSITION_CLIENT |
| 1701 | * (because synchronization and buffer updates for these layers are handled |
| 1702 | * elsewhere). |
| 1703 | * |
| 1704 | * Parameters: |
| 1705 | * buffer - the buffer handle to set |
| 1706 | * acquireFence - a sync fence file descriptor as described above |
| 1707 | * |
| 1708 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1709 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1710 | * HWC2_ERROR_BAD_PARAMETER - the buffer handle passed in was invalid |
| 1711 | */ |
| 1712 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_BUFFER)( |
| 1713 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1714 | buffer_handle_t buffer, int32_t acquireFence); |
| 1715 | |
| 1716 | /* setLayerSurfaceDamage(..., damage) |
| 1717 | * Descriptor: HWC2_FUNCTION_SET_LAYER_SURFACE_DAMAGE |
| 1718 | * Must be provided by all HWC2 devices |
| 1719 | * |
| 1720 | * Provides the region of the source buffer which has been modified since the |
| 1721 | * last frame. This region does not need to be validated before calling |
| 1722 | * presentDisplay. |
| 1723 | * |
| 1724 | * Once set through this function, the damage region remains the same until a |
| 1725 | * subsequent call to this function. |
| 1726 | * |
| 1727 | * If damage.numRects > 0, then it may be assumed that any portion of the source |
| 1728 | * buffer not covered by one of the rects has not been modified this frame. If |
| 1729 | * damage.numRects == 0, then the whole source buffer must be treated as if it |
| 1730 | * has been modified. |
| 1731 | * |
| 1732 | * If the layer's contents are not modified relative to the prior frame, damage |
| 1733 | * will contain exactly one empty rect([0, 0, 0, 0]). |
| 1734 | * |
| 1735 | * The damage rects are relative to the pre-transformed buffer, and their origin |
| 1736 | * is the top-left corner. They will not exceed the dimensions of the latched |
| 1737 | * buffer. |
| 1738 | * |
| 1739 | * Parameters: |
| 1740 | * damage - the new surface damage region |
| 1741 | * |
| 1742 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1743 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1744 | */ |
| 1745 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_SURFACE_DAMAGE)( |
| 1746 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1747 | hwc_region_t damage); |
| 1748 | |
| 1749 | /* |
| 1750 | * Layer State Functions |
| 1751 | * |
| 1752 | * These functions modify the state of a given layer. They do not take effect |
| 1753 | * until the display configuration is successfully validated with |
| 1754 | * validateDisplay and the display contents are presented with presentDisplay. |
| 1755 | * |
| 1756 | * All of these functions take as their first three parameters a device pointer, |
| 1757 | * a display handle for the display which contains the layer, and a layer |
| 1758 | * handle, so these parameters are omitted from the described parameter lists. |
| 1759 | */ |
| 1760 | |
| 1761 | /* setLayerBlendMode(..., mode) |
| 1762 | * Descriptor: HWC2_FUNCTION_SET_LAYER_BLEND_MODE |
| 1763 | * Must be provided by all HWC2 devices |
| 1764 | * |
| 1765 | * Sets the blend mode of the given layer. |
| 1766 | * |
| 1767 | * Parameters: |
| 1768 | * mode - the new blend mode |
| 1769 | * |
| 1770 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1771 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1772 | * HWC2_ERROR_BAD_PARAMETER - an invalid blend mode was passed in |
| 1773 | */ |
| 1774 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_BLEND_MODE)( |
| 1775 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1776 | int32_t /*hwc2_blend_mode_t*/ mode); |
| 1777 | |
| 1778 | /* setLayerColor(..., color) |
| 1779 | * Descriptor: HWC2_FUNCTION_SET_LAYER_COLOR |
| 1780 | * Must be provided by all HWC2 devices |
| 1781 | * |
| 1782 | * Sets the color of the given layer. If the composition type of the layer is |
| 1783 | * not HWC2_COMPOSITION_SOLID_COLOR, this call must return HWC2_ERROR_NONE and |
| 1784 | * have no other effect. |
| 1785 | * |
| 1786 | * Parameters: |
| 1787 | * color - the new color |
| 1788 | * |
| 1789 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1790 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1791 | */ |
| 1792 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_COLOR)( |
| 1793 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1794 | hwc_color_t color); |
| 1795 | |
| 1796 | /* setLayerCompositionType(..., type) |
| 1797 | * Descriptor: HWC2_FUNCTION_SET_LAYER_COMPOSITION_TYPE |
| 1798 | * Must be provided by all HWC2 devices |
| 1799 | * |
| 1800 | * Sets the desired composition type of the given layer. During validateDisplay, |
| 1801 | * the device may request changes to the composition types of any of the layers |
| 1802 | * as described in the definition of hwc2_composition_t above. |
| 1803 | * |
| 1804 | * Parameters: |
| 1805 | * type - the new composition type |
| 1806 | * |
| 1807 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1808 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1809 | * HWC2_ERROR_BAD_PARAMETER - an invalid composition type was passed in |
| 1810 | * HWC2_ERROR_UNSUPPORTED - a valid composition type was passed in, but it is |
| 1811 | * not supported by this device |
| 1812 | */ |
| 1813 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_COMPOSITION_TYPE)( |
| 1814 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1815 | int32_t /*hwc2_composition_t*/ type); |
| 1816 | |
| 1817 | /* setLayerDataspace(..., dataspace) |
| 1818 | * Descriptor: HWC2_FUNCTION_SET_LAYER_DATASPACE |
| 1819 | * Must be provided by all HWC2 devices |
| 1820 | * |
| 1821 | * Sets the dataspace that the current buffer on this layer is in. |
| 1822 | * |
| 1823 | * The dataspace provides more information about how to interpret the buffer |
| 1824 | * contents, such as the encoding standard and color transform. |
| 1825 | * |
| 1826 | * See the values of android_dataspace_t in <system/graphics.h> for more |
| 1827 | * information. |
| 1828 | * |
| 1829 | * Parameters: |
| 1830 | * dataspace - the new dataspace |
| 1831 | * |
| 1832 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1833 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1834 | */ |
| 1835 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_DATASPACE)( |
| 1836 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1837 | int32_t /*android_dataspace_t*/ dataspace); |
| 1838 | |
| 1839 | /* setLayerDisplayFrame(..., frame) |
| 1840 | * Descriptor: HWC2_FUNCTION_SET_LAYER_DISPLAY_FRAME |
| 1841 | * Must be provided by all HWC2 devices |
| 1842 | * |
| 1843 | * Sets the display frame (the portion of the display covered by a layer) of the |
| 1844 | * given layer. This frame will not exceed the display dimensions. |
| 1845 | * |
| 1846 | * Parameters: |
| 1847 | * frame - the new display frame |
| 1848 | * |
| 1849 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1850 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1851 | */ |
| 1852 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_DISPLAY_FRAME)( |
| 1853 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1854 | hwc_rect_t frame); |
| 1855 | |
| 1856 | /* setLayerPlaneAlpha(..., alpha) |
| 1857 | * Descriptor: HWC2_FUNCTION_SET_LAYER_PLANE_ALPHA |
| 1858 | * Must be provided by all HWC2 devices |
| 1859 | * |
| 1860 | * Sets an alpha value (a floating point value in the range [0.0, 1.0]) which |
| 1861 | * will be applied to the whole layer. It can be conceptualized as a |
| 1862 | * preprocessing step which applies the following function: |
| 1863 | * if (blendMode == HWC2_BLEND_MODE_PREMULTIPLIED) |
| 1864 | * out.rgb = in.rgb * planeAlpha |
| 1865 | * out.a = in.a * planeAlpha |
| 1866 | * |
| 1867 | * If the device does not support this operation on a layer which is marked |
| 1868 | * HWC2_COMPOSITION_DEVICE, it must request a composition type change to |
| 1869 | * HWC2_COMPOSITION_CLIENT upon the next validateDisplay call. |
| 1870 | * |
| 1871 | * Parameters: |
| 1872 | * alpha - the plane alpha value to apply |
| 1873 | * |
| 1874 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1875 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1876 | */ |
| 1877 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_PLANE_ALPHA)( |
| 1878 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1879 | float alpha); |
| 1880 | |
| 1881 | /* setLayerSidebandStream(..., stream) |
| 1882 | * Descriptor: HWC2_FUNCTION_SET_LAYER_SIDEBAND_STREAM |
| 1883 | * Provided by HWC2 devices which support HWC2_CAPABILITY_SIDEBAND_STREAM |
| 1884 | * |
| 1885 | * Sets the sideband stream for this layer. If the composition type of the given |
| 1886 | * layer is not HWC2_COMPOSITION_SIDEBAND, this call must return HWC2_ERROR_NONE |
| 1887 | * and have no other effect. |
| 1888 | * |
| 1889 | * Parameters: |
| 1890 | * stream - the new sideband stream |
| 1891 | * |
| 1892 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1893 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1894 | * HWC2_ERROR_BAD_PARAMETER - an invalid sideband stream was passed in |
| 1895 | */ |
| 1896 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_SIDEBAND_STREAM)( |
| 1897 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1898 | const native_handle_t* stream); |
| 1899 | |
| 1900 | /* setLayerSourceCrop(..., crop) |
| 1901 | * Descriptor: HWC2_FUNCTION_SET_LAYER_SOURCE_CROP |
| 1902 | * Must be provided by all HWC2 devices |
| 1903 | * |
| 1904 | * Sets the source crop (the portion of the source buffer which will fill the |
| 1905 | * display frame) of the given layer. This crop rectangle will not exceed the |
| 1906 | * dimensions of the latched buffer. |
| 1907 | * |
| 1908 | * If the device is not capable of supporting a true float source crop (i.e., it |
| 1909 | * will truncate or round the floats to integers), it should set this layer to |
| 1910 | * HWC2_COMPOSITION_CLIENT when crop is non-integral for the most accurate |
| 1911 | * rendering. |
| 1912 | * |
| 1913 | * If the device cannot support float source crops, but still wants to handle |
| 1914 | * the layer, it should use the following code (or similar) to convert to |
| 1915 | * an integer crop: |
| 1916 | * intCrop.left = (int) ceilf(crop.left); |
| 1917 | * intCrop.top = (int) ceilf(crop.top); |
| 1918 | * intCrop.right = (int) floorf(crop.right); |
| 1919 | * intCrop.bottom = (int) floorf(crop.bottom); |
| 1920 | * |
| 1921 | * Parameters: |
| 1922 | * crop - the new source crop |
| 1923 | * |
| 1924 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1925 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1926 | */ |
| 1927 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_SOURCE_CROP)( |
| 1928 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1929 | hwc_frect_t crop); |
| 1930 | |
| 1931 | /* setLayerTransform(..., transform) |
| 1932 | * Descriptor: HWC2_FUNCTION_SET_LAYER_TRANSFORM |
| 1933 | * Must be provided by all HWC2 devices |
| 1934 | * |
| 1935 | * Sets the transform (rotation/flip) of the given layer. |
| 1936 | * |
| 1937 | * Parameters: |
| 1938 | * transform - the new transform |
| 1939 | * |
| 1940 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1941 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1942 | * HWC2_ERROR_BAD_PARAMETER - an invalid transform was passed in |
| 1943 | */ |
| 1944 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_TRANSFORM)( |
| 1945 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1946 | int32_t /*hwc_transform_t*/ transform); |
| 1947 | |
| 1948 | /* setLayerVisibleRegion(..., visible) |
| 1949 | * Descriptor: HWC2_FUNCTION_SET_LAYER_VISIBLE_REGION |
| 1950 | * Must be provided by all HWC2 devices |
| 1951 | * |
| 1952 | * Specifies the portion of the layer that is visible, including portions under |
| 1953 | * translucent areas of other layers. The region is in screen space, and will |
| 1954 | * not exceed the dimensions of the screen. |
| 1955 | * |
| 1956 | * Parameters: |
| 1957 | * visible - the new visible region, in screen space |
| 1958 | * |
| 1959 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1960 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1961 | */ |
| 1962 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_VISIBLE_REGION)( |
| 1963 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1964 | hwc_region_t visible); |
| 1965 | |
| 1966 | /* setLayerZOrder(..., z) |
| 1967 | * Descriptor: HWC2_FUNCTION_SET_LAYER_Z_ORDER |
| 1968 | * Must be provided by all HWC2 devices |
| 1969 | * |
| 1970 | * Sets the desired Z order (height) of the given layer. A layer with a greater |
| 1971 | * Z value occludes a layer with a lesser Z value. |
| 1972 | * |
| 1973 | * Parameters: |
| 1974 | * z - the new Z order |
| 1975 | * |
| 1976 | * Returns HWC2_ERROR_NONE or one of the following errors: |
| 1977 | * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in |
| 1978 | */ |
| 1979 | typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_Z_ORDER)( |
| 1980 | hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, |
| 1981 | uint32_t z); |
| 1982 | |
| 1983 | __END_DECLS |
| 1984 | |
| 1985 | #endif |