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