• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  *
25  * @since 1.0
26  * @version 1.0
27  */
28 
29 /**
30  * @file display_layer.h
31  *
32  * @brief Declares the driver functions for implementing layer operations.
33  *
34  * @since 1.0
35  * @version 2.0
36  */
37 
38 #ifndef DISPLAY_LAYTER_H
39 #define DISPLAY_LAYTER_H
40 #include "display_type.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /**
47  * @brief Defines pointers to the layer driver functions.
48  */
49 typedef struct {
50     /**
51      * @brief Initializes a display device.
52      *
53      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
54      * display device, and 4 indicates the last display device.
55      *
56      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
57      * otherwise.
58      * @see DeinitDisplay
59      * @since 1.0
60      * @version 1.0
61      */
62     int32_t (*InitDisplay)(uint32_t devId);
63 
64     /**
65      * @brief Deinitializes a display device.
66      *
67      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
68      * display device, and 4 indicates the last display device.
69      *
70      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
71      * otherwise.
72      * @see InitDisplay
73      * @since 1.0
74      * @version 1.0
75      */
76     int32_t (*DeinitDisplay)(uint32_t devId);
77 
78     /**
79      * @brief Obtains information about a display device.
80      *
81      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
82      * display device, and 4 indicates the last display device.
83      * @param dispInfo Indicates the pointer to the display device information obtained.
84      *
85      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
86      * otherwise.
87      * @since 1.0
88      * @version 1.0
89      */
90     int32_t (*GetDisplayInfo)(uint32_t devId, DisplayInfo *dispInfo);
91 
92     /**
93      * @brief Opens a layer on a specified display device.
94      *
95      * Before using a layer on the GUI, you must open the layer based on the layer information. After the layer is
96      * opened, you can obtain the layer ID and then use other functions based on the layer ID.
97      *
98      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
99      * display device, and 4 indicates the last display device.
100      * @param layerInfo Indicates the pointer to the layer information passed to open a layer, including the layer
101      * type, layer size, and pixel format.
102      * @param layerId Indicates the pointer to the layer ID, which uniquely identifies a layer. The layer ID is returned
103      * to the GUI after the layer is successfully opened.
104      *
105      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
106      * otherwise.
107      * @see CloseLayer
108      * @since 1.0
109      * @version 1.0
110      */
111 
112     int32_t (*CreateLayer)(uint32_t devId, const LayerInfo *layerInfo, uint32_t *layerId);
113     /**
114      * @brief Closes a layer that is no longer required on a specified display device.
115      *
116      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
117      * display device, and 4 indicates the last display device.
118      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
119      * with the specified layer ID.
120      *
121      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
122      * otherwise.
123      * @see OpenLayer
124      * @since 1.0
125      * @version 1.0
126      */
127     int32_t (*CloseLayer)(uint32_t devId, uint32_t layerId);
128 
129     /**
130      * @brief Sets whether a layer is visible.
131      *
132      * A visible layer is displayed on the screen, whereas an invisible layer is not displayed on the screen.
133      *
134      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
135      * display device, and 4 indicates the last display device.
136      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
137      * with the specified layer ID.
138      * @param visible Indicates the visibility to set for the layer. The value <b>true</b> means to set the layer to be
139      * visible, and <b>false</b> means the opposite.
140      *
141      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
142      * otherwise.
143      * @see GetLayerVisibleState
144      * @since 1.0
145      * @version 1.0
146      */
147     int32_t (*SetLayerVisible)(uint32_t devId, uint32_t layerId, bool visible);
148 
149     /**
150      * @brief Checks whether a layer is visible.
151      *
152      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
153      * display device, and 4 indicates the last display device.
154      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
155      * with the specified layer ID.
156      * @param visible Indicates the pointer to the obtained layer visibility. The value <b>true</b> indicates that the
157      * layer is visible, and <b>false</b> indicates that the layer is invisible.
158      *
159      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
160      * otherwise.
161      * @see SetLayerVisible
162      * @since 1.0
163      * @version 1.0
164      */
165     int32_t (*GetLayerVisibleState)(uint32_t devId, uint32_t layerId, bool *visible);
166 
167     /**
168      * @brief Sets the size of a layer.
169      *
170      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
171      * display device, and 4 indicates the last display device.
172      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
173      * with the specified layer ID.
174      * @param rect Indicates the pointer to the layer size to set, in pixels.
175      *
176      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
177      * otherwise.
178      * @see GetLayerSize
179      * @since 1.0
180      * @version 1.0
181      */
182     int32_t (*SetLayerSize)(uint32_t devId, uint32_t layerId, IRect *rect);
183 
184     /**
185      * @brief Obtains the size of a layer.
186      *
187      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
188      * display device, and 4 indicates the last display device.
189      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
190      * with the specified layer ID.
191      * @param rect Indicates the pointer to the obtained layer size.
192      *
193      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
194      * otherwise.
195      * @see SetLayerSize
196      * @since 1.0
197      * @version 1.0
198      */
199     int32_t (*GetLayerSize)(uint32_t devId, uint32_t layerId, IRect *rect);
200 
201     /**
202      * @brief Sets the rectangular area to crop for a layer.
203      *
204      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
205      * display device, and 4 indicates the last display device.
206      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
207      * with the specified layer ID.
208      * @param rect Indicates the pointer to the rectangular area to crop.
209      *
210      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
211      * otherwise.
212      * @since 1.0
213      * @version 1.0
214      */
215     int32_t (*SetLayerCrop)(uint32_t devId, uint32_t layerId, IRect *rect);
216 
217     /**
218      * @brief Sets the z-order for a layer.
219      *
220      * A larger z-order value indicates a higher layer.
221      *
222      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
223      * display device, and 4 indicates the last display device.
224      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
225      * with the specified layer ID.
226      * @param zorder Indicates the z-order to set. The value is an integer ranging from 0 to 255.
227      *
228      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
229      * otherwise.
230      * @see GetLayerZorder
231      * @since 1.0
232      * @version 1.0
233      */
234     int32_t (*SetLayerZorder)(uint32_t devId, uint32_t layerId, uint32_t zorder);
235 
236     /**
237      * @brief Obtains the z-order of a layer.
238      *
239      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
240      * display device, and 4 indicates the last display device.
241      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
242      * with the specified layer ID.
243      * @param zorder Indicates the pointer to the obtained z-order. The value is an integer ranging from 0 to 255.
244      * A larger z-order value indicates a higher layer.
245      *
246      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
247      * otherwise.
248      * @see SetLayerZorder
249      * @since 1.0
250      * @version 1.0
251      */
252     int32_t (*GetLayerZorder)(uint32_t devId, uint32_t layerId, uint32_t *zorder);
253 
254     /**
255      * @brief Sets layer premultiplication.
256      *
257      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
258      * display device, and 4 indicates the last display device.
259      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
260      * with the specified layer ID.
261      * @param preMul Specifies whether to enable layer premultiplication. The value <b>1</b> means to enable layer
262      * premultiplication, and <b>0</b> means the opposite.
263      *
264      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
265      * otherwise.
266      * @see GetLayerPreMulti
267      * @since 1.0
268      * @version 1.0
269      */
270     int32_t (*SetLayerPreMulti)(uint32_t devId, uint32_t layerId, bool preMul);
271 
272     /**
273      * @brief Obtains the premultiplication flag of a layer.
274      *
275      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
276      * display device, and 4 indicates the last display device.
277      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
278      * with the specified layer ID.
279      * @param preMul Indicates the pointer to the obtained layer premultiplication flag.
280      *
281      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
282      * otherwise.
283      * @see SetLayerPreMulti
284      * @since 1.0
285      * @version 1.0
286      */
287     int32_t (*GetLayerPreMulti)(uint32_t devId, uint32_t layerId, bool *preMul);
288 
289     /**
290      * @brief Sets the alpha value for a layer.
291      *
292      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
293      * display device, and 4 indicates the last display device.
294      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
295      * with the specified layer ID.
296      * @param alpha Indicates the pointer to the alpha value to set.
297      *
298      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
299      * otherwise.
300      * @see GetLayerAlpha
301      * @since 1.0
302      * @version 1.0
303      */
304     int32_t (*SetLayerAlpha)(uint32_t devId, uint32_t layerId, LayerAlpha *alpha);
305 
306     /**
307      * @brief Obtains the alpha value of a layer.
308      *
309      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
310      * display device, and 4 indicates the last display device.
311      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
312      * with the specified layer ID.
313      * @param alpha Indicates the pointer to the obtained alpha value.
314      *
315      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
316      * otherwise.
317      * @see SetLayerAlpha
318      * @since 1.0
319      * @version 1.0
320      */
321     int32_t (*GetLayerAlpha)(uint32_t devId, uint32_t layerId, LayerAlpha *alpha);
322 
323     /**
324      * @brief Sets the color key for a layer. The color key is used during layer overlay.
325      *
326      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
327      * display device, and 4 indicates the last display device.
328      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
329      * with the specified layer ID.
330      * @param enable Specify whether to enable the color key.
331      * @param key Indicates the color key.
332      *
333      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
334      * otherwise.
335      * @see GetLayerColorKey
336      * @since 1.0
337      * @version 1.0
338      */
339     int32_t (*SetLayerColorKey)(uint32_t devId, uint32_t layerId, bool enable, uint32_t key);
340 
341     /**
342      * @brief Obtains the color key of a layer.
343      *
344      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
345      * display device, and 4 indicates the last display device.
346      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
347      * with the specified layer ID.
348      * @param enable Indicates the pointer to the color key enable bit.
349      * @param key Indicates the pointer to the color key.
350      *
351      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
352      * otherwise.
353      * @see SetLayerColorKey
354      * @since 1.0
355      * @version 1.0
356      */
357     int32_t (*GetLayerColorKey)(uint32_t devId, uint32_t layerId, bool *enable, uint32_t *key);
358 
359     /**
360      * @brief Sets the palette for a layer.
361      *
362      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
363      * display device, and 4 indicates the last display device.
364      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
365      * with the specified layer ID.
366      * @param palette Indicates the pointer to the palette to set.
367      * @param len Indicates the length of the palette.
368      *
369      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
370      * otherwise.
371      * @see GetLayerPalette
372      * @since 1.0
373      * @version 1.0
374      */
375     int32_t (*SetLayerPalette)(uint32_t devId, uint32_t layerId, uint32_t *palette, uint32_t len);
376 
377     /**
378      * @brief Obtains the palette of a layer.
379      *
380      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
381      * display device, and 4 indicates the last display device.
382      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
383      * with the specified layer ID.
384      * @param palette Indicates the pointer to the obtained palette.
385      * @param len Indicates the length of the palette.
386      *
387      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
388      * otherwise.
389      * @see SetLayerPalette
390      * @since 1.0
391      * @version 1.0
392      */
393     int32_t (*GetLayerPalette)(uint32_t devId, uint32_t layerId, uint32_t *palette, uint32_t len);
394 
395     /**
396      * @brief Sets the transform mode for rotating, scaling, or moving a layer.
397      *
398      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
399      * display device, and 4 indicates the last display device.
400      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
401      * with the specified layer ID.
402      * @param type Indicates the transformation mode to set.
403      *
404      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
405      * otherwise.
406      * @since 1.0
407      * @version 1.0
408      */
409     int32_t (*SetTransformMode)(uint32_t devId, uint32_t layerId, TransformType type);
410 
411     /**
412      * @brief Sets the compression feature for a layer.
413      *
414      * In specific scenarios, images need to be compressed. You can set whether to enable layer compression.
415      *
416      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
417      * display device, and 4 indicates the last display device.
418      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
419      * with the specified layer ID.
420      * @param compType Specifies whether to enable the compression feature. The value <b>true>/b> means to enable
421      * compression, and <b>false> means the opposite.
422      *
423      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
424      * otherwise.
425      * @see GetLayerCompression
426      * @since 1.0
427      * @version 1.0
428      */
429     int32_t (*SetLayerCompression)(uint32_t devId, uint32_t layerId, int32_t compType);
430 
431     /**
432      * @brief Checks whether the compression feature is enabled for a layer.
433      *
434      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
435      * display device, and 4 indicates the last display device.
436      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
437      * with the specified layer ID.
438      * @param compType Indicates the pointer to the variable specifying whether the compression feature is enabled.
439      *
440      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
441      * otherwise.
442      * @see SetLayerCompression
443      * @since 1.0
444      * @version 1.0
445      */
446     int32_t (*GetLayerCompression)(uint32_t devId, uint32_t layerId, int32_t *compType);
447 
448     /**
449      * @brief Sets the flushing area for a layer.
450      *
451      * After the GUI draws an image, you must set the layer flushing area before calling the {@link Flush} function to
452      * flush the screen.
453      *
454      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
455      * display device, and 4 indicates the last display device.
456      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
457      * with the specified layer ID.
458      * @param region Indicates the pointer to the flushing area to set.
459      *
460      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
461      * otherwise.
462      * @since 1.0
463      * @version 1.0
464      */
465     int32_t (*SetLayerDirtyRegion)(uint32_t devId, uint32_t layerId, IRect *region);
466 
467     /**
468      * @brief Obtains the buffer of a layer.
469      *
470      * After drawing a picture in the buffer, the application calls the {@link Flush} function to display the picture
471      * on the screen.
472      *
473      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
474      * display device, and 4 indicates the last display device.
475      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
476      * with the specified layer ID.
477      * @param buffer Indicates the pointer to the obtained buffer.
478      *
479      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
480      * otherwise.
481      * @see Flush
482      * @since 1.0
483      * @version 1.0
484      */
485     int32_t (*GetLayerBuffer)(uint32_t devId, uint32_t layerId, LayerBuffer *buffer);
486 
487     /**
488      * @brief Flushes a layer.
489      *
490      * Display data in the buffer is flushed to a specified layer so that the image data is displayed on the screen.
491      *
492      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
493      * display device, and 4 indicates the last display device.
494      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
495      * with the specified layer ID.
496      * @param buffer Indicates the pointer to the buffer in which the display data is to flush.
497      *
498      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
499      * otherwise.
500      * @since 1.0
501      * @version 1.0
502      */
503     int32_t (*Flush)(uint32_t devId, uint32_t layerId, LayerBuffer *buffer);
504 
505     /**
506      * @brief Waits for the arrival of vertical blanking.
507      *
508      * This function blocks the process until vertical blanking arrives, implementing the synchronization between
509      * software and hardware.
510      *
511      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
512      * display device, and 4 indicates the last display device.
513      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
514      * with the specified layer ID.
515      * @param timeOut Indicates the maximum duration that the process waits for the arrival of vertical blanking.
516      *
517      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
518      * otherwise.
519      * @since 1.0
520      * @version 1.0
521      */
522     int32_t (*WaitForVBlank)(uint32_t devId, uint32_t layerId, int32_t timeOut);
523 
524     /**
525      * @brief Implements the snapshot feature.
526      *
527      * This function saves the screenshot of image data on the display device to the buffer for debugging or as
528      * requested by applications.
529      *
530      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
531      * display device, and 4 indicates the last display device.
532      * @param buffer Indicates the pointer to the buffer for saving screenshots.
533      *
534      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
535      * otherwise.
536      * @since 1.0
537      * @version 1.0
538      */
539     int32_t (*SnapShot)(uint32_t devId, LayerBuffer *buffer);
540 
541     /**
542      * @brief Set the visible region for a layer
543      *
544      *
545      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
546      * display device, and 4 indicates the last display device.
547      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
548      * with the specified layer ID.
549      * @param num Indicates the count of rect. the region contains multiple IRect, the num means how much rects in the
550      * region.
551      * @param rect Indicates the pointer of the rectes.
552      *
553      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
554      * otherwise.
555      * @since 2.0
556      * @version 2.0
557      */
558     int32_t (*SetLayerVisibleRegion)(uint32_t devId, uint32_t layerId, uint32_t num, IRect *rect);
559 
560     /**
561      * @brief Set the buffer for a layer.
562      *
563      *
564      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
565      * display device, and 4 indicates the last display device.
566      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
567      * with the specified layer ID.
568      * @param buffer Indicates the pointer of the buffer handle. The buffer handle should contain all information of the
569      * buffer which will be used for composition.
570      * @param fence Indicates the fd of a sync file.
571      *
572      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
573      * otherwise.
574      * @since 2.0
575      * @version 2.0
576      */
577     int32_t (*SetLayerBuffer)(uint32_t devId, uint32_t layerId, const BufferHandle *buffer, int32_t fence);
578 
579     /**
580      * @brief Extension interface
581      *
582      *
583      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
584      * display device, and 4 indicates the last display device.
585      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
586      * with the specified layer ID.
587      * @param cmd Indicates extension cmd to be used to identify different intention.
588      *
589      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
590      * otherwise.
591      * @since 2.0
592      * @version 2.0
593      */
594     int32_t (*InvokeLayerCmd)(uint32_t devId, uint32_t layerId, uint32_t cmd, ...);
595 
596     /**
597      * @brief set the composition type which the client expect
598      *
599      *
600      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
601      * display device, and 4 indicates the last display device.
602      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
603      * with the specified layer ID.
604      * @param type Indicates the composition type which the client expect. It may vary with the implementation.
605      *
606      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
607      * otherwise.
608      * @since 2.0
609      * @version 2.0
610      */
611     int32_t (*SetLayerCompositionType)(uint32_t devId, uint32_t layerId, CompositionType type);
612 
613     /**
614      * @brief set the blend type
615      *
616      *
617      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
618      * display device, and 4 indicates the last display device.
619      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
620      * with the specified layer ID.
621      * @param type Indicates blend type
622      *
623      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
624      * otherwise.
625      * @since 2.0
626      * @version 2.0
627      */
628     int32_t (*SetLayerBlendType)(uint32_t devId, uint32_t layerId, BlendType type);
629 
630     /**
631      * @brief Sets a 4x4 color transformation matrix.
632      *
633      *
634      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
635      * display device, and 4 indicates the last display device.
636      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
637      * with the specified layer ID.
638      * @param matrix Indicates the 4x4 color transformation matrix.
639      *
640      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
641      * otherwise.
642      * @since 1.0
643      * @version 1.0
644      */
645     int32_t (*SetLayerColorTransform)(uint32_t devId, uint32_t layerId, const float *matrix);
646 
647     /**
648      * @brief Sets a color data space for a layer.
649      *
650      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
651      * display device, and 4 indicates the last display device.
652      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
653      * with the specified layer ID.
654      * @param colorSpace Indicates the color data space to set.
655      *
656      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
657      * otherwise.
658      * @since 1.0
659      * @version 1.0
660      */
661     int32_t (*SetLayerColorDataSpace)(uint32_t devId, uint32_t layerId, ColorDataSpace colorSpace);
662 
663     /**
664      * @brief Obtains the color data space of a layer.
665      *
666      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
667      * display device, and 4 indicates the last display device.
668      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
669      * with the specified layer ID.
670      * @param colorSpace Indicates the pointer to the color data space obtained.
671      *
672      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
673      * otherwise.
674      * @since 1.0
675      * @version 1.0
676      */
677     int32_t (*GetLayerColorDataSpace)(uint32_t devId, uint32_t layerId, ColorDataSpace *colorSpace);
678 
679     /**
680      * @brief Sets metadata for a layer.
681      *
682      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
683      * display device, and 4 indicates the last display device.
684      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
685      * with the specified layer ID.
686      * @param num Indicates the number of metadata records.
687      * @param metaData Indicates the pointer to the metadata to set.
688      *
689      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
690      * otherwise.
691      * @since 1.0
692      * @version 1.0
693      */
694     int32_t (*SetLayerMetaData)(uint32_t devId, uint32_t layerId, uint32_t num, const HDRMetaData *metaData);
695 
696     /**
697      * @brief Sets a metadata set for a layer.
698      *
699      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
700      * display device, and 4 indicates the last display device.
701      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
702      * with the specified layer ID.
703      * @param key Indicates the metadata key.
704      * @param num Indicates the number of metadata records.
705      * @param metaData Indicates the pointer to the metadata set of the uint8_t type to set.
706      *
707      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
708      * otherwise.
709      * @since 1.0
710      * @version 1.0
711      */
712     int32_t (*SetLayerMetaDataSet)(uint32_t devId, uint32_t layerId, HDRMetadataKey key, uint32_t num,
713                                    const uint8_t *metaData);
714 
715     /**
716      * @brief Obtains the hardware display present timestamp type supported by a layer.
717      *
718      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
719      * display device, and 4 indicates the last display device.
720      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
721      * with the specified layer ID.
722      * @param type Indicates the pointer to the present timestamp type obtained.
723      *
724      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
725      * otherwise.
726      * @since 1.0
727      * @version 1.0
728      */
729     int32_t (*GetSupportedPresentTimestamp)(uint32_t devId, uint32_t layerId, PresentTimestampType *type);
730 
731     /**
732      * @brief Obtains the hardware display present timestamp of a layer.
733      *
734      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
735      * display device, and 4 indicates the last display device.
736      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
737      * with the specified layer ID.
738      * @param pts Indicates the pointer to the present timestamp obtained.
739      *
740      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
741      * otherwise.
742      * @since 1.0
743      * @version 1.0
744      */
745     int32_t (*GetHwPresentTimestamp)(uint32_t devId, uint32_t layerId, PresentTimestamp *pts);
746     /**
747      * @brief Sets a tunnel handle for a layer.
748      *
749      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
750      * display device, and 4 indicates the last display device.
751      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
752      * with the specified layer ID.
753      * @param handle Indicates the handle of ExtDataHandle.
754      *
755      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
756      * otherwise.
757      * @since 3.2
758      * @version 1.0
759      */
760     int32_t (*SetLayerTunnelHandle)(uint32_t devId, uint32_t layerId, ExtDataHandle *handle);
761     /**
762      * @brief Obtains the release fence of a layer.
763      *
764      * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
765      * display device, and 4 indicates the last display device.
766      * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
767      * with the specified layer ID.
768      * @param fence Indicates the pointer to the release fence obtained.
769      *
770      * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
771      * otherwise.
772      * @since 3.2
773      * @version 1.0
774      */
775     int32_t (*GetLayerReleaseFence)(uint32_t devId, uint32_t layerId, int32_t *fence);
776 } LayerFuncs;
777 
778 /**
779  * @brief Initializes the layer to apply for resources used by the layer and obtain the pointer to functions for
780  * layer operations.
781  *
782  * @param funcs Indicates the double pointer to functions for layer operations. Memory is allocated automatically when
783  * you initiate the layer module, so you can simply use the pointer to gain access to the functions.
784  *
785  * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
786  * otherwise.
787  * @see LayerUninitialize
788  * @since 1.0
789  * @version 1.0
790  */
791 int32_t LayerInitialize(LayerFuncs **funcs);
792 
793 /**
794  * @brief Deinitializes the layer module to release the memory allocated to the pointer to functions for
795  * layer operations.
796  *
797  * @param funcs Indicates the pointer to functions for layer operations.
798  *
799  * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
800  * otherwise.
801  * @see LayerInitialize
802  * @since 1.0
803  * @version 1.0
804  */
805 int32_t LayerUninitialize(LayerFuncs *funcs);
806 
807 #ifdef __cplusplus
808 }
809 #endif
810 #endif
811 /** @} */
812