1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup Display 18 * @{ 19 * 20 * @brief Defines driver functions of the display module. 21 * 22 * This module provides driver functions for the graphics subsystem, including graphics layer management, 23 * device control, graphics hardware acceleration, display memory management, and callbacks. 24 * @since 1.0 25 * @version 2.0 26 */ 27 28 /** 29 * @file display_device.h 30 * 31 * @brief Declares control functions of the display device. 32 * 33 * @since 1.0 34 * @version 2.0 35 */ 36 37 #ifndef DISPLAY_DEVICE_H 38 #define DISPLAY_DEVICE_H 39 #include "display_type.h" 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 /* * 46 * @brief Called when a hot plug event occurs. 47 * 48 * This callback must be registered by calling <b>RegHotPlugCallback</b>. 49 * 50 * @param devId Indicates the ID of the display device. This ID is generated by the HDI implementation layer and 51 * transferred to the graphics service through the current callback. It identifies the display device to connect. 52 * @param connected Indicates the connection status of the display device. The value <b>true</b> means that the 53 * display device is connected, and <b>false</b> means the opposite. 54 * @param data Indicates the private data carried by the graphics service. This parameter carries the private data 55 * address transferred when <b>RegHotPlugCallback</b> is called. For details, see {@link RegHotPlugCallback}. 56 * 57 * 58 * @since 1.0 59 * @version 1.0 60 */ 61 typedef void (*HotPlugCallback)(uint32_t devId, bool connected, void *data); 62 63 /* * 64 * @brief Called when a VBLANK event occurs. 65 * 66 * This callback must be registered by calling <b>RegDisplayVBlankCallback</b>. 67 * 68 * @param sequence Indicates the VBLANK sequence, which is an accumulated value. 69 * @param ns Indicates the timestamp (in ns) of the VBLANK event. 70 * @param data Indicates the pointer to the private data carried by the graphics service. This parameter carries 71 * the address passed when <b>RegDisplayVBlankCallback</b> is called. 72 * 73 * @since 1.0 74 * @version 1.0 75 */ 76 typedef void (*VBlankCallback)(unsigned int sequence, uint64_t ns, void *data); 77 78 /* * 79 * @brief Called when the graphics service needs to refresh data frames. 80 * 81 * This callback must be registered by calling <b>RegDisplayRefreshCallback</b>. 82 * 83 * @param devId Indicates the ID of the display device. 84 * @param data Indicates the pointer to the private data carried by the graphics service. This parameter carries 85 * the address passed when <b>RegDisplayRefreshCallback</b> is called. 86 * 87 * @since 1.0 88 * @version 1.0 89 */ 90 typedef void (*RefreshCallback)(uint32_t devId, void *data); 91 92 typedef void (*ComposerDeathCallback)(void *data); 93 94 /** 95 * @brief Defines pointers to the functions of the display device. 96 */ 97 typedef struct { 98 /* * 99 * @brief Registers the callback to be invoked when a hot plug event occurs. 100 * 101 * @param callback Indicates the instance used to notify the graphics service of a hot plug event occurred. 102 * @param data Indicates the pointer to the private data returned to the graphics service in the 103 * <b>HotPlugCallback</b> callback. 104 * 105 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 106 * in {@link DispErrCode} otherwise. 107 * @since 1.0 108 * @version 1.0 109 */ 110 int32_t (*RegHotPlugCallback)(HotPlugCallback callback, void *data); 111 112 /* * 113 * @brief Registers the callback to be invoked when a VBLANK event occurs. 114 * 115 * @param devId Indicates the ID of the display device. 116 * @param callback Indicates the instance used to notify the graphics service of the VBLANK event occurred when 117 * <b>DisplayVsync</b> is enabled. 118 * @param data Indicates the pointer to the private data returned to the graphics service in the 119 * <b>VBlankCallback</b> callback. 120 * 121 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 122 * in {@link DispErrCode} otherwise. 123 * @since 1.0 124 * @version 1.0 125 */ 126 int32_t (*RegDisplayVBlankCallback)(uint32_t devId, VBlankCallback callback, void *data); 127 128 /* * 129 * @brief Called when the graphics service needs to refresh data frames. 130 * 131 * @param devId Indicates the ID of the display device. 132 * @param callback Indicates the instance used to notify the graphics service of the request for refreshing 133 * data frames. 134 * @param data Indicates the pointer to the private data returned to the graphics service in the 135 * <b>RefreshCallback</b> callback. 136 * 137 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 138 * in {@link DispErrCode} otherwise. 139 * @since 1.0 140 * @version 1.0 141 */ 142 int32_t (*RegDisplayRefreshCallback)(uint32_t devId, RefreshCallback callback, void *data); 143 144 /* * 145 * @brief Obtains the capabilities of a display device. 146 * 147 * @param devId Indicates the ID of the display device. 148 * @param info Indicates the pointer to the capabilities supported by the display device. For details, 149 * see {@link DisplayCapability}. 150 * 151 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 152 * in {@link DispErrCode} otherwise. 153 * @since 1.0 154 * @version 1.0 155 */ 156 int32_t (*GetDisplayCapability)(uint32_t devId, DisplayCapability *info); 157 158 /* * 159 * @brief Obtains the display modes supported by a display device. 160 * 161 * @param devId Indicates the ID of the display device. 162 * @param num Indicates the pointer to the number of modes supported by the display device. 163 * @param modes Indicates the pointer to the information about all modes supported by the display device, 164 * including all supported resolutions and refresh rates. Each mode has an ID, which will be used when 165 * the mode is set or obtained. For details, see {@link DisplayModeInfo}. 166 * 167 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 168 * in {@link DispErrCode} otherwise. 169 * @since 1.0 170 * @version 1.0 171 */ 172 int32_t (*GetDisplaySupportedModes)(uint32_t devId, uint32_t *num, DisplayModeInfo *modes); 173 174 /* * 175 * @brief Obtains the current display mode of a display device. 176 * 177 * @param devId Indicates the ID of the display device. 178 * @param modeId indicates the pointer to the ID of the current display mode of the device. The display mode ID 179 * is written by this API. 180 * 181 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 182 * in {@link DispErrCode} otherwise. 183 * @since 1.0 184 * @version 1.0 185 */ 186 int32_t (*GetDisplayMode)(uint32_t devId, uint32_t *modeId); 187 188 /* * 189 * @brief Sets the display mode of a display device. 190 * 191 * @param devId Indicates the ID of the display device. 192 * @param modeId Indicates the ID of the display mode. The device is switched to the display mode specified by 193 * this parameter in this interface. 194 * 195 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 196 * in {@link DispErrCode} otherwise. 197 * @since 1.0 198 * @version 1.0 199 */ 200 int32_t (*SetDisplayMode)(uint32_t devId, uint32_t modeId); 201 202 /* * 203 * @brief Obtains the power status of a display device. 204 * 205 * @param devId Indicates the ID of the display device. 206 * @param status Indicates the pointer to the power status of the device. The status is written by this interface. 207 * 208 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 209 * in {@link DispErrCode} otherwise. 210 * @since 1.0 211 * @version 1.0 212 */ 213 int32_t (*GetDisplayPowerStatus)(uint32_t devId, DispPowerStatus *status); 214 215 /* * 216 * @brief Sets the power status of a display device. 217 * 218 * @param devId Indicates the ID of the display device. 219 * @param status Indicates the power status to set. 220 * 221 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 222 * in {@link DispErrCode} otherwise. 223 * @since 1.0 224 * @version 1.0 225 */ 226 int32_t (*SetDisplayPowerStatus)(uint32_t devId, DispPowerStatus status); 227 228 /* * 229 * @brief Obtains the backlight value of a display device. 230 * 231 * @param devId Indicates the ID of the display device. 232 * @param level Indicates the pointer to the backlight value of the device. The backlight value is written 233 * by this interface. 234 * 235 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 236 * in {@link DispErrCode} otherwise. 237 * @since 1.0 238 * @version 1.0 239 */ 240 int32_t (*GetDisplayBacklight)(uint32_t devId, uint32_t *level); 241 242 /* * 243 * @brief Sets the backlight value for a display device. 244 * 245 * @param devId Indicates the ID of the display device. 246 * @param level Indicates the backlight value to set. 247 * 248 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 249 * in {@link DispErrCode} otherwise. 250 * @since 1.0 251 * @version 1.0 252 */ 253 int32_t (*SetDisplayBacklight)(uint32_t devId, uint32_t level); 254 255 /* * 256 * @brief Obtains the property for a display device. 257 * 258 * @param devId Indicates the ID of the display device. 259 * @param id Indicates the property ID returned by <b>GetDisplayCapability</b>. 260 * @param value Indicates the property to get. 261 * 262 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 263 * in {@link DispErrCode} otherwise. 264 * @since 1.0 265 * @version 1.0 266 */ 267 int32_t (*GetDisplayProperty)(uint32_t devId, uint32_t id, uint64_t *value); 268 269 /* * 270 * @brief Sets the property for a display device. 271 * 272 * @param devId Indicates the ID of the display device. 273 * @param id Indicates the property ID returned by <b>GetDisplayCapability</b>. 274 * @param value Indicates the property to set. 275 * 276 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 277 * in {@link DispErrCode} otherwise. 278 * @since 1.0 279 * @version 1.0 280 */ 281 int32_t (*SetDisplayProperty)(uint32_t devId, uint32_t id, uint64_t value); 282 283 /* * 284 * @brief Prepares for the composition to be performed by a display device. 285 * 286 * Before the composition, the graphics service needs to notify the display device of the preparation to be made 287 * through this interface. 288 * 289 * @param devId Indicates the ID of the display device. 290 * @param needFlushFb Indicates the pointer that specifies whether the graphics service needs to reset the display 291 * framebuffer by using <b>SetDisplayClientBuffer</b> before the commit operation. 292 * The value <b>true</b> means that the framebuffer needs to be reset, and <b>false</b> means the opposite. 293 * 294 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 295 * in {@link DispErrCode} otherwise. 296 * @since 1.0 297 * @version 1.0 298 */ 299 int32_t (*PrepareDisplayLayers)(uint32_t devId, bool *needFlushFb); 300 301 /* * 302 * @brief Obtains the layers whose composition types have changed. 303 * 304 * In the preparation for composition, the display device changes the composition type for each layer based on 305 * the composition capability of the device. This function returns the layers whose composition types have changed. 306 * 307 * @param devId Indicates the ID of the display device. 308 * @param num Indicates the pointer to the number of layers whose composition types have changed. 309 * @param Layers Indicates the pointer to the start address of the layer array. 310 * @param type Indicates the pointer to the start address of the composition type array. 311 * 312 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 313 * in {@link DispErrCode} otherwise. 314 * @since 1.0 315 * @version 1.0 316 */ 317 int32_t (*GetDisplayCompChange)(uint32_t devId, uint32_t *num, uint32_t *Layers, int32_t *type); 318 319 /* * 320 * @brief Sets the cropped region for a display device. 321 * 322 * You can use this interface to set the cropped region of the client buffer of the display device. 323 * The cropped region cannot exceed the size of the client buffer. 324 * 325 * @param devId Indicates the ID of the display device. 326 * @param rect Indicates the pointer to the cropped region of the client buffer. 327 * 328 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 329 * in {@link DispErrCode} otherwise. 330 * @since 1.0 331 * @version 1.0 332 */ 333 int32_t (*SetDisplayClientCrop)(uint32_t devId, IRect *rect); 334 335 /* * 336 * @brief Sets the display region for a display device. 337 * 338 * @param devId Indicates the ID of the display device. 339 * @param rect Indicates the pointer to the display region. 340 * 341 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 342 * in {@link DispErrCode} otherwise. 343 * @since 1.0 344 * @version 1.0 345 */ 346 int32_t (*SetDisplayClientDestRect)(uint32_t devId, IRect *rect); 347 348 /* * 349 * @brief Sets the display buffer for a display device. 350 * 351 * The display buffer stores the hardware composition result of the display device. 352 * 353 * @param devId Indicates the ID of the display device. 354 * @param buffer Indicates the pointer to the display buffer. 355 * @param fence Indicates the sync fence that specifies whether the display buffer can be accessed. The display 356 * buffer is created and released by the graphics service. It can be accessed only when the sync fence is in the 357 * signaled state. 358 * 359 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 360 * in {@link DispErrCode} otherwise. 361 * @since 1.0 362 * @version 1.0 363 */ 364 int32_t (*SetDisplayClientBuffer)(uint32_t devId, const BufferHandle *buffer, int32_t fence); 365 366 /* * 367 * @brief Sets the dirty region for a display device. 368 * 369 * The dirty region consists of multiple rectangular regions. The rectangular regions can be refreshed based on 370 * the settings. 371 * 372 * @param devId Indicates the ID of the display device. 373 * @param num Indicates the number of rectangles. 374 * @param rect Indicates the pointer to the start address of the rectangle array. 375 * 376 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 377 * in {@link DispErrCode} otherwise. 378 * @since 1.0 379 * @version 1.0 380 */ 381 int32_t (*SetDisplayClientDamage)(uint32_t devId, uint32_t num, IRect *rect); 382 383 /* * 384 * @brief Enables or disables the vertical sync signal. 385 * 386 * When the vertical sync signal is generated, the <b>VBlankCallback</b> callback registered 387 * by <b>RegDisplayVBlankCallback</b> will be invoked. The vertical sync signal must be enabled when the graphics 388 * service needs to refresh the display, and disabled when display refresh is not required. The display does not 389 * need to refresh when <b>VBlankCallback</b> is invoked and the graphics service composes layers and sends the 390 * composition result to the device for display. 391 * 392 * @param devId Indicates the ID of the display device. 393 * @param enabled Specifies whether to enable the vertical sync signal. The value <b>true</b> means to enable the 394 * vertical sync signal, and <b>false</b> means to disable it. 395 * 396 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 397 * in {@link DispErrCode}otherwise. 398 * @since 1.0 399 * @version 1.0 400 */ 401 int32_t (*SetDisplayVsyncEnabled)(uint32_t devId, bool enabled); 402 403 /* * 404 * @brief Obtains the fences of the display layers after the commit operation. 405 * 406 * @param devId Indicates the ID of the display device. 407 * @param num Indicates the pointer to the number of layers. 408 * @param layers Indicates the pointer to the start address of the layer array. 409 * @param fences Indicates the pointer to the start address of the fence array. 410 * 411 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 412 * in {@link DispErrCode} otherwise. 413 * @since 1.0 414 * @version 1.0 415 */ 416 int32_t (*GetDisplayReleaseFence)(uint32_t devId, uint32_t *num, uint32_t *layers, int32_t *fences); 417 418 /* * 419 * @brief Obtains the color gamuts supported by a display device. 420 * 421 * @param devId Indicates the ID of the display device. 422 * @param num Indicates the pointer to the number of color gamuts supported by the display device. 423 * @param gamuts Indicates the pointer to the information about all color gamuts supported by the display device. 424 * 425 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 426 * in {@link DispErrCode} otherwise. 427 * @since 1.0 428 * @version 1.0 429 */ 430 int32_t (*GetDisplaySupportedColorGamuts)(uint32_t devId, uint32_t *num, ColorGamut *gamuts); 431 432 /* * 433 * @brief Obtains the color gamut of a display device. 434 * 435 * @param devId Indicates the ID of the display device. 436 * @param gamut Indicates the pointer to the color gamut of the device. The color gamut is written 437 * by this interface. 438 * 439 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 440 * in {@link DispErrCode} otherwise. 441 * @since 1.0 442 * @version 1.0 443 */ 444 int32_t (*GetDisplayColorGamut)(uint32_t devId, ColorGamut *gamut); 445 446 /* * 447 * @brief Sets the color gamut for a display device. 448 * 449 * @param devId Indicates the ID of the display device. 450 * @param gamut Indicates the color gamut to set. 451 * 452 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 453 * in {@link DispErrCode} otherwise. 454 * @since 1.0 455 * @version 1.0 456 */ 457 int32_t (*SetDisplayColorGamut)(uint32_t devId, ColorGamut gamut); 458 459 /* * 460 * @brief Obtains the gamut map of a display device. 461 * 462 * @param devId Indicates the ID of the display device. 463 * @param gamutMap Indicates the pointer to the gamut map of the device. The gamut map is written 464 * by this interface. 465 * 466 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 467 * in {@link DispErrCode} otherwise. 468 * @since 1.0 469 * @version 1.0 470 */ 471 int32_t (*GetDisplayGamutMap)(uint32_t devId, GamutMap *gamutMap); 472 473 /* * 474 * @brief Sets the gamut map for a display device. 475 * 476 * @param devId Indicates the ID of the display device. 477 * @param gamutMap Indicates the gamut map to set. 478 * 479 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 480 * in {@link DispErrCode} otherwise. 481 * @since 1.0 482 * @version 1.0 483 */ 484 int32_t (*SetDisplayGamutMap)(uint32_t devId, GamutMap gamutMap); 485 486 /* * 487 * @brief Sets a 4x4 color transformation matrix for a display device. 488 * 489 * @param devId Indicates the ID of the display device. 490 * @param matrix Indicates the pointer to the 4x4 color transformation matrix to set. 491 * 492 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 493 * in {@link DispErrCode} otherwise. 494 * @since 1.0 495 * @version 1.0 496 */ 497 int32_t (*SetDisplayColorTransform)(uint32_t devId, const float *matrix); 498 499 /* * 500 * @brief Obtains the HDR capability of a display device. 501 * 502 * @param devId Indicates the ID of the display device. 503 * @param info Indicates the pointer to the HDR capability of the device. The <b>info</b> is written 504 * by this interface. 505 * 506 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 507 * in {@link DispErrCode} otherwise. 508 * @since 1.0 509 * @version 1.0 510 */ 511 int32_t (*GetHDRCapabilityInfos)(uint32_t devId, HDRCapability *info); 512 513 /* * 514 * @brief Obtains the HDR metadata keys supported by a display device. 515 * 516 * @param devId Indicates the ID of the display device. 517 * @param num Indicates the pointer to the number of metadata keys supported by the display device. 518 * @param keys Indicates the pointer to the information about all HDR metadata keys supported by the display device. 519 * 520 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 521 * in {@link DispErrCode} otherwise. 522 * @since 1.0 523 * @version 1.0 524 */ 525 int32_t (*GetSupportedMetadataKey)(uint32_t devId, uint32_t *num, HDRMetadataKey *keys); 526 527 /* * 528 * @brief Commits the request for composition and display. 529 * 530 * If there is a hardware composition layer, the composition is performed and the composition result is sent to 531 * the hardware for display. 532 * 533 * @param devId Indicates the ID of the display device. 534 * @param fences Indicates the pointer to the start address of the fence array. 535 * 536 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 537 * in {@link DispErrCode} otherwise. 538 * @since 1.0 539 * @version 1.0 540 */ 541 int32_t (*Commit)(uint32_t devId, int32_t *fence); 542 543 /* * 544 * @brief Invokes the display device commands. 545 * 546 * This function extends the APIs between the graphics service and implementation layer, eliminating the need 547 * to add new APIs. 548 * 549 * @param devId Indicates the ID of the display device. 550 * 551 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 552 * in {@link DispErrCode} otherwise. 553 * @since 1.0 554 * @version 1.0 555 */ 556 int32_t (*InvokeDisplayCmd)(uint32_t devId, ...); 557 558 /* * 559 * @brief Creates a virtual display device. 560 * 561 * @param width Indicates the pixel width of the display device. 562 * @param height Indicates the pixel height of the display device. 563 * @param format Indicates the pointer to the pixel format of the display device. 564 * For details, see {@link PixelFormat}. The <b>format</b> can be modified based on hardware requirements and 565 * returned to the graphics service. 566 * @param devId Indicates the pointer to the ID of the virtual display device created. 567 * 568 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 569 * in {@link DispErrCode} otherwise. 570 * @since 1.0 571 * @version 1.0 572 */ 573 int32_t (*CreateVirtualDisplay)(uint32_t width, uint32_t height, int32_t *format, uint32_t *devId); 574 575 /* * 576 * @brief Destroys a virtual display device. 577 * 578 * @param devId Indicates the ID of the display device. 579 * 580 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 581 * in {@link DispErrCode} otherwise. 582 * @since 1.0 583 * @version 1.0 584 */ 585 int32_t (*DestroyVirtualDisplay)(uint32_t devId); 586 587 /* * 588 * @brief Sets the output buffer for a virtual display device. 589 * 590 * This buffer stores the output of the virtual display device. The buffer can be used only after the sync fence 591 * is in the signaled state. 592 * 593 * @param devId Indicates the ID of the display device. 594 * @param buffer Indicates the pointer to the output buffer. 595 * @param fence Indicates the sync fence. 596 * 597 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 598 * in {@link DispErrCode} otherwise. 599 * @since 1.0 600 * @version 1.0 601 */ 602 int32_t (*SetVirtualDisplayBuffer)(uint32_t devId, BufferHandle *buffer, int32_t fence); 603 604 /* * 605 * @brief Obtains the writeback frame of a display device. 606 * 607 * This function is used to obtain data of the writeback endpoint specified by <b>devId</b>. The data is written 608 * to the specified buffer by this interface. 609 * 610 * @param devId Indicates the ID of the display device. 611 * @param buffer Indicates the pointer to the buffer of the writeback endpoint data. 612 * @param fence Indicates the pointer to the sync fence. When calling this interface, the graphics service needs 613 * to pass the <b>release fence</b> of the buffer to 614 * specify whether data can be written to the buffer. Then, <b>acquire fence</b> of the buffer needs to be written 615 * and sent to the graphics service to specify whether the writeback data has been written to the buffer. 616 * 617 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 618 * in {@link DispErrCode} otherwise. 619 * @since 1.0 620 * @version 1.0 621 */ 622 int32_t (*GetWriteBackFrame)(uint32_t devId, BufferHandle *buffer, int32_t *fence); 623 624 /* * 625 * @brief Creates a writeback endpoint for a display device. 626 * 627 * If the number of writeback endpoints exceeds the limit, a failure message will be returned. 628 * 629 * @param devId Indicates the pointer to the ID of the display device. After a writeback endpoint is created, the 630 * device ID of the writeback endpoint is written in this parameter and returned to the graphics service. 631 * @param width Indicates the writeback pixel width. 632 * @param height Indicates the writeback pixel height. 633 * @param format Indicates the pointer to the writeback point data format. For details, see {@link PixelFormat}. 634 * The <b>format</b> can be modified based on hardware requirements and returned to the graphics service. 635 * 636 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 637 * in {@link DispErrCode} otherwise. 638 * @since 1.0 639 * @version 1.0 640 */ 641 int32_t (*CreateWriteBack)(uint32_t *devId, uint32_t width, uint32_t height, int32_t *format); 642 643 /* * 644 * @brief Destroys the writeback endpoint of a display device. 645 * 646 * @param devId Indicates the ID of the display device. 647 * 648 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 649 * in {@link DispErrCode} otherwise. 650 * @since 1.0 651 * @version 1.0 652 */ 653 int32_t (*DestroyWriteBack)(uint32_t devId); 654 } DeviceFuncs; 655 656 /** 657 * @brief Initializes the control functions of a display device. You can apply for resources for 658 * using control functions and then operate the display device by using the control functions. 659 * 660 * @param funcs Indicates the double pointer to the control functions of the display device. The caller obtains 661 * the double pointer to operate the display device. The memory is allocated during initialization, and therefore 662 * the caller does not need to allocate the memory. 663 * 664 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 665 * in {@link DispErrCode} otherwise. 666 * 667 * @since 1.0 668 * @version 1.0 669 */ 670 int32_t DeviceInitialize(DeviceFuncs **funcs); 671 672 /** 673 * @brief Uninitializes control functions of the display device. The resources used by the control functions will be 674 * released. In other words, the memory allocated during initialization of the control functions will be released. 675 * 676 * @param funcs Indicates the double pointer to the control functions of the display device. 677 * 678 * @return Returns <b>0</b> if the operation is successful; returns an error code defined 679 * in {@link DispErrCode} otherwise. 680 * @since 1.0 681 * @version 1.0 682 */ 683 int32_t DeviceUninitialize(DeviceFuncs *funcs); 684 685 int32_t RegComposerDeathCallback(ComposerDeathCallback callback, void *data); 686 687 #ifdef __cplusplus 688 } 689 #endif 690 #endif 691 /* @} */ 692