• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  *
25  * @since 1.0
26  * @version 2.0
27  */
28 
29 /**
30  * @file display_type.h
31  *
32  * @brief Declares the data types used by the display driver functions.
33  *
34  * @since 1.0
35  * @version 2.0
36  */
37 
38 #ifndef DISPLAY_TYPE_H
39 #define DISPLAY_TYPE_H
40 #include <fcntl.h>
41 #include <stdbool.h>
42 #include <stddef.h>
43 #include <stdlib.h>
44 #include <sys/ioctl.h>
45 #include <sys/prctl.h>
46 #include <sys/types.h>
47 #include <unistd.h>
48 #include <stdint.h>
49 #include "buffer_handle.h"
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 /**
56  * @brief Enumerates return values of the functions.
57  *
58  */
59 typedef enum {
60     DISPLAY_SUCCESS = 0,           /**< Success */
61     DISPLAY_FAILURE = -1,          /**< Failure */
62     DISPLAY_FD_ERR = -2,           /**< File handle (FD) error */
63     DISPLAY_PARAM_ERR = -3,        /**< Parameter error */
64     DISPLAY_NULL_PTR = -4,         /**< Null pointer */
65     DISPLAY_NOT_SUPPORT = -5,      /**< Unsupported feature */
66     DISPLAY_NOMEM = -6,            /**< Insufficient memory */
67     DISPLAY_SYS_BUSY = -7,         /**< System busy */
68     DISPLAY_NOT_PERM = -8          /**< Forbidden operation */
69 } DispErrCode;
70 
71 /**
72  * @brief Enumerates layer types.
73  *
74  */
75 typedef enum {
76     LAYER_TYPE_GRAPHIC,         /**< Graphic layer */
77     LAYER_TYPE_OVERLAY,         /**< Overlay layer */
78     LAYER_TYPE_SIDEBAND,        /**< Sideband layer */
79     LAYER_TYPE_CURSOR,          /**< Cursor Layer */
80     LAYER_TYPE_BUTT             /**< Empty layer */
81 } LayerType;
82 
83 /* *
84  * @brief Defines the buffer usage.
85  *
86  */
87 typedef enum {
88     HBM_USE_CPU_READ = (1ULL << 0),        /**< CPU read buffer */
89     HBM_USE_CPU_WRITE = (1ULL << 1),       /**< CPU write memory */
90     HBM_USE_MEM_MMZ = (1ULL << 2),         /**< Media memory zone (MMZ) */
91     HBM_USE_MEM_DMA = (1ULL << 3),         /**< Direct memory access (DMA) buffer */
92     HBM_USE_MEM_SHARE = (1ULL << 4),       /**< Shared memory buffer*/
93     HBM_USE_MEM_MMZ_CACHE = (1ULL << 5),   /**< MMZ with cache*/
94     HBM_USE_MEM_FB = (1ULL << 6),          /**< Framebuffer */
95     HBM_USE_ASSIGN_SIZE = (1ULL << 7),     /**< Memory assigned */
96     HBM_USE_HW_RENDER = (1ULL << 8),       /**< For GPU write case */
97     HBM_USE_HW_TEXTURE = (1ULL << 9),      /**< For GPU read case */
98     HBM_USE_HW_COMPOSER = (1ULL << 10),    /**< For hardware composer */
99     HBM_USE_PROTECTED = (1ULL << 11),      /**< For safe buffer case, such as DRM */
100     HBM_USE_CAMERA_READ = (1ULL << 12),    /**< For camera read case */
101     HBM_USE_CAMERA_WRITE = (1ULL << 13),   /**< For camera write case */
102     HBM_USE_VIDEO_ENCODER = (1ULL << 14),  /**< For encode case */
103     HBM_USE_VIDEO_DECODER = (1ULL << 15),  /**< For decode case */
104     HBM_USE_VENDOR_PRI0 = (1ULL << 44),    /**< Reserverd for vendor */
105     HBM_USE_VENDOR_PRI1 = (1ULL << 45),    /**< Reserverd for vendor */
106     HBM_USE_VENDOR_PRI2 = (1ULL << 46),    /**< Reserverd for vendor */
107     HBM_USE_VENDOR_PRI3 = (1ULL << 47),    /**< Reserverd for vendor */
108     HBM_USE_VENDOR_PRI4 = (1ULL << 48),    /**< Reserverd for vendor */
109     HBM_USE_VENDOR_PRI5 = (1ULL << 49),    /**< Reserverd for vendor */
110     HBM_USE_VENDOR_PRI6 = (1ULL << 50),    /**< Reserverd for vendor */
111     HBM_USE_VENDOR_PRI7 = (1ULL << 51),    /**< Reserverd for vendor */
112     HBM_USE_VENDOR_PRI8 = (1ULL << 52),    /**< Reserverd for vendor */
113     HBM_USE_VENDOR_PRI9 = (1ULL << 53),    /**< Reserverd for vendor */
114     HBM_USE_VENDOR_PRI10 = (1ULL << 54),   /**< Reserverd for vendor */
115     HBM_USE_VENDOR_PRI11 = (1ULL << 55),   /**< Reserverd for vendor */
116     HBM_USE_VENDOR_PRI12 = (1ULL << 56),   /**< Reserverd for vendor */
117     HBM_USE_VENDOR_PRI13 = (1ULL << 57),   /**< Reserverd for vendor */
118     HBM_USE_VENDOR_PRI14 = (1ULL << 58),   /**< Reserverd for vendor */
119     HBM_USE_VENDOR_PRI15 = (1ULL << 59),   /**< Reserverd for vendor */
120     HBM_USE_VENDOR_PRI16 = (1ULL << 60),   /**< Reserverd for vendor */
121     HBM_USE_VENDOR_PRI17 = (1ULL << 61),   /**< Reserverd for vendor */
122     HBM_USE_VENDOR_PRI18 = (1ULL << 62),   /**< Reserverd for vendor */
123     HBM_USE_VENDOR_PRI19 = (1ULL << 63),   /**< Reserverd for vendor */
124 } DisplayBufferUsage;
125 
126 /**
127  * @brief Enumerates pixel formats.
128  *
129  */
130 typedef enum {
131     PIXEL_FMT_CLUT8 = 0,                 /**< CLUT8 format */
132     PIXEL_FMT_CLUT1,                     /**< CLUT1 format */
133     PIXEL_FMT_CLUT4,                     /**< CLUT4 format */
134     PIXEL_FMT_RGB_565,                   /**< RGB565 format */
135     PIXEL_FMT_RGBA_5658,                 /**< RGBA5658 format */
136     PIXEL_FMT_RGBX_4444,                 /**< RGBX4444 format */
137     PIXEL_FMT_RGBA_4444,                 /**< RGBA4444 format */
138     PIXEL_FMT_RGB_444,                   /**< RGB444 format */
139     PIXEL_FMT_RGBX_5551,                 /**< RGBX5551 format */
140     PIXEL_FMT_RGBA_5551,                 /**< RGBA5551 format */
141     PIXEL_FMT_RGB_555,                   /**< RGB555 format */
142     PIXEL_FMT_RGBX_8888,                 /**< RGBX8888 format */
143     PIXEL_FMT_RGBA_8888,                 /**< RGBA8888 format */
144     PIXEL_FMT_RGB_888,                   /**< RGB888 format */
145     PIXEL_FMT_BGR_565,                   /**< BGR565 format */
146     PIXEL_FMT_BGRX_4444,                 /**< BGRX4444 format */
147     PIXEL_FMT_BGRA_4444,                 /**< BGRA4444 format */
148     PIXEL_FMT_BGRX_5551,                 /**< BGRX5551 format */
149     PIXEL_FMT_BGRA_5551,                 /**< BGRA5551 format */
150     PIXEL_FMT_BGRX_8888,                 /**< BGRX8888 format */
151     PIXEL_FMT_BGRA_8888,                 /**< BGRA8888 format */
152     PIXEL_FMT_YUV_422_I,                 /**< YUV422 interleaved format */
153     PIXEL_FMT_YCBCR_422_SP,              /**< YCBCR422 semi-planar format */
154     PIXEL_FMT_YCRCB_422_SP,              /**< YCRCB422 semi-planar format */
155     PIXEL_FMT_YCBCR_420_SP,              /**< YCBCR420 semi-planar format */
156     PIXEL_FMT_YCRCB_420_SP,              /**< YCRCB420 semi-planar format */
157     PIXEL_FMT_YCBCR_422_P,               /**< YCBCR422 planar format */
158     PIXEL_FMT_YCRCB_422_P,               /**< YCRCB422 planar format */
159     PIXEL_FMT_YCBCR_420_P,               /**< YCBCR420 planar format */
160     PIXEL_FMT_YCRCB_420_P,               /**< YCRCB420 planar format */
161     PIXEL_FMT_YUYV_422_PKG,              /**< YUYV422 packed format */
162     PIXEL_FMT_UYVY_422_PKG,              /**< UYVY422 packed format */
163     PIXEL_FMT_YVYU_422_PKG,              /**< YVYU422 packed format */
164     PIXEL_FMT_VYUY_422_PKG,              /**< VYUY422 packed format */
165     PIXEL_FMT_VENDER_MASK = 0X7FFF0000,  /**< vendor mask format */
166     PIXEL_FMT_BUTT = 0X7FFFFFFF          /**< Invalid pixel format */
167 } PixelFormat;
168 
169 /**
170  * @brief Enumerates transform types of images.
171  *
172  */
173 typedef enum {
174     ROTATE_NONE = 0,        /**< No rotation */
175     ROTATE_90,              /**< Rotation by 90 degrees */
176     ROTATE_180,             /**< Rotation by 180 degrees */
177     ROTATE_270,             /**< Rotation by 270 degrees */
178     MIRROR_H,               /**< Mirror transform horizontally */
179     MIRROR_V,               /**< Mirror transform vertically */
180     MIRROR_H_ROTATE_90,     /**< Mirror transform horizontally, rotation by 90 degrees */
181     MIRROR_V_ROTATE_90,     /**< Mirror transform vertically, rotation by 90 degrees */
182     ROTATE_BUTT             /**< Invalid operation */
183 } TransformType;
184 
185 /**
186  * @brief Enumerates image blending types.
187  *
188  * The system combines images based on a specified blending type during hardware acceleration.
189  *
190  */
191 typedef enum {
192     BLEND_NONE = 0,         /**< No blending */
193     BLEND_CLEAR,            /**< CLEAR blending */
194     BLEND_SRC,              /**< SRC blending */
195     BLEND_SRCOVER,          /**< SRC_OVER blending */
196     BLEND_DSTOVER,          /**< DST_OVER blending */
197     BLEND_SRCIN,            /**< SRC_IN blending */
198     BLEND_DSTIN,            /**< DST_IN blending */
199     BLEND_SRCOUT,           /**< SRC_OUT blending */
200     BLEND_DSTOUT,           /**< DST_OUT blending */
201     BLEND_SRCATOP,          /**< SRC_ATOP blending */
202     BLEND_DSTATOP,          /**< DST_ATOP blending */
203     BLEND_ADD,              /**< ADD blending */
204     BLEND_XOR,              /**< XOR blending */
205     BLEND_DST,              /**< DST blending */
206     BLEND_AKS,              /**< AKS blending */
207     BLEND_AKD,              /**< AKD blending */
208     BLEND_BUTT              /**< Null operation */
209 } BlendType;
210 
211 /**
212  * @brief Enumerates ROP types supported by hardware acceleration.
213  *
214  * ROP performs bitwise Boolean operations (including bitwise AND and bitwise OR) on the RGB color and
215  * alpha values of the foreground bitmap with those of the background bitmap, and then outputs the result.
216  *
217  */
218 typedef enum {
219     ROP_BLACK = 0,          /**< Blackness */
220     ROP_NOTMERGEPEN,        /**< ~(S2+S1) */
221     ROP_MASKNOTPEN,         /**< ~S2&S1 */
222     ROP_NOTCOPYPEN,         /**< ~S2 */
223     ROP_MASKPENNOT,         /**< S2&~S1 */
224     ROP_NOT,                /**< ~S1 */
225     ROP_XORPEN,             /**< S2^S1 */
226     ROP_NOTMASKPEN,         /**< ~(S2&S1) */
227     ROP_MASKPEN,            /**< S2&S1 */
228     ROP_NOTXORPEN,          /**< ~(S2^S1) */
229     ROP_NOP,                /**< S1 */
230     ROP_MERGENOTPEN,        /**< ~S2+S1 */
231     ROP_COPYPE,             /**< S2 */
232     ROP_MERGEPENNOT,        /**< S2+~S1 */
233     ROP_MERGEPEN,           /**< S2+S1 */
234     ROP_WHITE,              /**< Whiteness */
235     ROP_BUTT                /**< Invalid ROP type */
236 } RopType;
237 
238 /**
239  * @brief Enumerates color key types supported by hardware acceleration.
240  *
241  */
242 typedef enum {
243     CKEY_NONE = 0,      /**< No color key */
244     CKEY_SRC,           /**< Source color key */
245     CKEY_DST,           /**< Destination color key */
246     CKEY_BUTT           /**< Null operation */
247 } ColorKey;
248 
249 /**
250  * @brief Enumerates mirror types supported by hardware acceleration.
251  *
252  */
253 typedef enum {
254     MIRROR_NONE = 0,      /**< No mirror */
255     MIRROR_LR,            /**< Left and right mirrors */
256     MIRROR_TB,            /**< Top and bottom mirrors */
257     MIRROR_BUTT           /**< Null operation */
258 } MirrorType;
259 
260 /**
261  * @brief Enumerates connection types of hot plugging.
262  *
263  */
264 typedef enum {
265     CON_INVALID = 0,            /**< Invalid connection */
266     CONNECTED,                  /**< Connected */
267     DISCONNECTED                /**< Disconnected */
268 } Connection;
269 
270 /**
271  * @brief Defines display information.
272  *
273  */
274 typedef struct {
275     uint32_t width;              /**< Display width */
276     uint32_t height;             /**< Display height */
277     int32_t rotAngle;            /**< Rotation angle of the display */
278 } DisplayInfo;
279 
280 /**
281  * @brief Defines layer information.
282  *
283  * <b>LayerInfo</b> must be passed to the {@link OpenLayer} function, which creates a layer based on the layer
284  * information.
285  *
286  */
287 typedef struct {
288     int32_t width;              /**< Layer width */
289     int32_t height;             /**< Layer height */
290     LayerType type;             /**< Layer type, which can be a graphic layer, overlay layer, or sideband layer */
291     int32_t bpp;                /**< Number of bits occupied by each pixel */
292     PixelFormat pixFormat;      /**< Pixel format of the layer */
293 } LayerInfo;
294 
295 /**
296  * @brief Defines alpha information about a layer.
297  *
298  */
299 typedef struct {
300     bool enGlobalAlpha;   /**< Global alpha enable bit */
301     bool enPixelAlpha;    /**< Pixel alpha enable bit */
302     uint8_t alpha0;       /**< Alpha0 value, ranging from 0 to 255 */
303     uint8_t alpha1;       /**< Alpha1 value, ranging from 0 to 255 */
304     uint8_t gAlpha;       /**< Global alpha value, ranging from 0 to 255 */
305 } LayerAlpha;
306 
307 
308 /**
309  * @brief Defines buffer data of a layer, including the virtual and physical memory addresses.
310  *
311  */
312 typedef struct {
313     uint64_t phyAddr;     /**< Physical memory address */
314     void *virAddr;        /**< Virtual memory address */
315 } BufferData;
316 
317 /**
318  * @brief Defines the buffer, which is used to store layer data.
319  *
320  */
321 typedef struct {
322     int32_t fenceId;          /**< Fence ID of the buffer */
323     int32_t width;            /**< Buffer width */
324     int32_t height;           /**< Buffer height */
325     int32_t pitch;            /**< Number of bytes from one row of pixels in memory to the next */
326     PixelFormat pixFormat;    /**< Pixel format of the buffer */
327     BufferData data;          /**< Layer buffer data */
328     BufferHandle* hdl;        /**< Layer buffer handle */
329 } LayerBuffer;
330 
331 /**
332  * @brief Defines the information about a rectangle.
333  *
334  */
335 typedef struct {
336     int32_t x;      /**< Start X coordinate of the rectangle */
337     int32_t y;      /**< Start Y coordinate of the rectangle */
338     int32_t w;      /**< Width of the rectangle */
339     int32_t h;      /**< Height of the rectangle */
340 } IRect;
341 
342 /**
343  * @brief Stores surface information for hardware acceleration, such as draw image and bit blit.
344  *
345  */
346 typedef struct {
347     uint64_t phyAddr;         /**< Start physical address of an image */
348     int32_t height;           /**< Image height */
349     int32_t width;            /**< Image width */
350     int32_t stride;           /**< Image stride */
351     PixelFormat enColorFmt;   /**< Image format */
352     bool bYCbCrClut;          /**< Whether the color lookup table (CLUT) is in the YCbCr space */
353     bool bAlphaMax255;        /**< Maximum alpha value of an image (255 or 128) */
354     bool bAlphaExt1555;       /**< ARGB1555 alpha extension enable bit */
355     uint8_t alpha0;           /**< Value of alpha0, ranging from 0 to 255 */
356     uint8_t alpha1;           /**< Value of alpha1, ranging from 0 to 255 */
357     uint64_t cbcrPhyAddr;     /**< CbCr physical address */
358     int32_t cbcrStride;       /**< CbCr stride */
359     uint64_t clutPhyAddr;     /**< Start physical address of the CLUT, used for color extension or correction */
360 } ISurface;
361 
362 /**
363  * @brief Describes a line to help draw lines in hardware acceleration.
364  *
365  */
366 typedef struct {
367     int32_t x0;                 /**< X coordinate of the start point of a line */
368     int32_t y0;                 /**< Y coordinate of the start point of a line */
369     int32_t x1;                 /**< X coordinate of the end point of a line */
370     int32_t y1;                 /**< Y coordinate of the end point of a line */
371     uint32_t color;             /**< Line color */
372 } ILine;
373 
374 /**
375  * @brief Describes a circle to help draw circles in hardware acceleration.
376  *
377  */
378 typedef struct {
379     int32_t x;                  /**< X coordinate of a circle center */
380     int32_t y;                  /**< Y coordinate of a circle center */
381     int32_t r;                  /**< Radius of a circle */
382     uint32_t color;             /**< Circle color */
383 } ICircle;
384 
385 /**
386  * @brief Describes a rectangle to help draw rectangles in hardware acceleration.
387  *
388  */
389 typedef struct {
390     IRect rect;                 /**< Bounds of a rectangle */
391     uint32_t color;             /**< Rectangle color */
392 } Rectangle;
393 
394 /**
395  * @brief Defines hardware acceleration options.
396  *
397  */
398 typedef struct {
399     bool enGlobalAlpha;         /**< Global alpha enable bit */
400     uint32_t globalAlpha;       /**< Global alpha value */
401     bool enPixelAlpha;          /**< Pixel alpha enable bit */
402     BlendType blendType;        /**< Blending type */
403     ColorKey colorKeyFrom;      /**< Color key mode */
404     bool enableRop;             /**< Raster operations pipeline (ROP) enable bit */
405     RopType colorRopType;       /**< Color ROP type */
406     RopType alphaRopType;       /**< Alpha ROP type */
407     bool enableScale;           /**< Scaling enable bit */
408     TransformType rotateType;   /**< Rotation type */
409     MirrorType mirrorType;      /**< Mirror type */
410 } GfxOpt;
411 
412 #define PROPERTY_NAME_LEN  50
413 
414 /**
415  * @brief Defines property object which contains name, property id and value.
416  *
417  */
418 typedef struct {
419     char name[PROPERTY_NAME_LEN]; /**< Name of the property */
420     uint32_t propId;     /**< Property id which was decided in the DRM internal */
421     uint64_t value;      /**< the value of property  */
422 } PropertyObject;
423 
424 /**
425  * @brief Enumerates interface types.
426  *
427  */
428 typedef enum {
429     DISP_INTF_HDMI = 0,       /**< HDMI interface */
430     DISP_INTF_LCD,            /**< LCD interface */
431     DISP_INTF_BT1120,         /**< BT1120 interface */
432     DISP_INTF_BT656,          /**< BT656 interface */
433     DISP_INTF_YPBPR,          /**< YPBPR interface */
434     DISP_INTF_RGB,            /**< RGB interface */
435     DISP_INTF_CVBS,           /**< CVBS interface */
436     DISP_INTF_SVIDEO,         /**< SVIDEO interface */
437     DISP_INTF_VGA,            /**< VGA interface */
438     DISP_INTF_MIPI,           /**< MIPI interface */
439     DISP_INTF_PANEL,          /**< PANEL interface */
440     DISP_INTF_BUTT,
441 } InterfaceType;
442 
443 /**
444  * @brief Defines the capability of the output.
445  */
446 typedef struct {
447     char name[PROPERTY_NAME_LEN];       /**< Name of the display device */
448     InterfaceType type;                 /**< Interface type of panel */
449     uint32_t phyWidth;                  /**< Physical width */
450     uint32_t phyHeight;                 /**< Physical height */
451     uint32_t supportLayers;             /**< Number of supported layers */
452     uint32_t virtualDispCount;          /**< Count of virtual displays supported */
453     bool supportWriteBack;              /**< Whether writeback is supported */
454     uint32_t propertyCount;             /**< Count of properties */
455     PropertyObject* props;              /**< Array of property objects */
456 } DisplayCapability;
457 
458 /**
459  * @brief Defines output mode info.
460  */
461 typedef struct {
462     int32_t width;      /**< Width in pixel */
463     int32_t height;     /**< Height in pixel */
464     uint32_t freshRate; /**< Fresh rate per second */
465     int32_t id;         /**< ID of the mode */
466 } DisplayModeInfo;
467 
468 /**
469  * @brief Defines information about the memory to allocate.
470  *
471  */
472 typedef struct {
473     uint32_t width;               /**< Width of the requested memory */
474     uint32_t height;              /**< Height of the requested memory */
475     uint64_t usage;               /**< Usage of the requested memory */
476     PixelFormat format;           /**< Format of the requested memory */
477     uint32_t expectedSize;        /**< Size assigned by memory requester */
478 } AllocInfo;
479 /**
480  * @brief Enumerates power status.
481  */
482 
483 typedef enum {
484     POWER_STATUS_ON,              /**< The power status is on. */
485     POWER_STATUS_STANDBY,         /**< The power status is standby. */
486     POWER_STATUS_SUSPEND,         /**< The power status is suspended. */
487     POWER_STATUS_OFF,             /**< The power status is off. */
488     POWER_STATUS_BUTT
489 } DispPowerStatus;
490 
491 /**
492  * @brief Enumerates the composition types of the special layer.
493  */
494 typedef enum {
495     COMPOSITION_CLIENT,       /**< Client composition type. The composer should be the CPU or GPU. */
496     COMPOSITION_DEVICE,       /**< Device composition type. The composer should be the hardware. */
497     COMPOSITION_CURSOR,       /**< Cursor composition type, used for cursor. */
498     COMPOSITION_VIDEO,        /**< Cursor composition type, used for video. */
499     COMPOSITION_DEVICE_CLEAR, /**< Device clear composition type, the device will clear the target region. */
500     COMPOSITION_CLIENT_CLEAR, /**< Client clear composition type, the service will clear the target region. */
501     COMPOSITION_TUNNEL,       /**< Tunnel composition type, used for tunnel. */
502     COMPOSITION_BUTT
503 } CompositionType;
504 
505 /**
506  * @brief Enumerates the color gamuts.
507  *
508  */
509 typedef enum {
510     COLOR_GAMUT_INVALID = -1,            /**< Invalid */
511     COLOR_GAMUT_NATIVE = 0,              /**< Native or default */
512     COLOR_GAMUT_STANDARD_BT601 = 1,      /**< Standard BT601 */
513     COLOR_GAMUT_STANDARD_BT709 = 2,      /**< Standard BT709 */
514     COLOR_GAMUT_DCI_P3 = 3,              /**< DCI P3 */
515     COLOR_GAMUT_SRGB = 4,                /**< SRGB */
516     COLOR_GAMUT_ADOBE_RGB = 5,           /**< Adobe RGB */
517     COLOR_GAMUT_DISPLAY_P3 = 6,          /**< display P3 */
518     COLOR_GAMUT_BT2020 = 7,              /**< BT2020 */
519     COLOR_GAMUT_BT2100_PQ = 8,           /**< BT2100 PQ */
520     COLOR_GAMUT_BT2100_HLG = 9,          /**< BT2100 HLG */
521     COLOR_GAMUT_DISPLAY_BT2020 = 10,     /**< Display BT2020 */
522 } ColorGamut;
523 
524 /**
525  * @brief Enumerates the color gamut maps.
526  *
527  */
528 typedef enum {
529     GAMUT_MAP_CONSTANT = 0,
530     GAMUT_MAP_EXPANSION = 1,
531     GAMUT_MAP_HDR_CONSTANT = 2,
532     GAMUT_MAP_HDR_EXPANSION = 3,
533 } GamutMap;
534 
535 /**
536  * @brief Enumerates the color data spaces.
537  *
538  */
539 
540 typedef enum {
541     COLOR_DATA_SPACE_UNKNOWN = 0,
542     GAMUT_BT601 = 0x00000001,
543     GAMUT_BT709 = 0x00000002,
544     GAMUT_DCI_P3 = 0x00000003,
545     GAMUT_SRGB = 0x00000004,
546     GAMUT_ADOBE_RGB = 0x00000005,
547     GAMUT_DISPLAY_P3 = 0x00000006,
548     GAMUT_BT2020 = 0x00000007,
549     GAMUT_BT2100_PQ = 0x00000008,
550     GAMUT_BT2100_HLG = 0x00000009,
551     GAMUT_DISPLAY_BT2020 = 0x0000000a,
552     TRANSFORM_FUNC_UNSPECIFIED = 0x00000100,
553     TRANSFORM_FUNC_LINEAR = 0x00000200,
554     TRANSFORM_FUNC_SRGB = 0x00000300,
555     TRANSFORM_FUNC_SMPTE_170M = 0x00000400,
556     TRANSFORM_FUNC_GM2_2 = 0x00000500,
557     TRANSFORM_FUNC_GM2_6 = 0x00000600,
558     TRANSFORM_FUNC_GM2_8 = 0x00000700,
559     TRANSFORM_FUNC_ST2084 = 0x00000800,
560     TRANSFORM_FUNC_HLG = 0x00000900,
561     PRECISION_UNSPECIFIED = 0x00010000,
562     PRECISION_FULL = 0x00020000,
563     PRESION_LIMITED = 0x00030000,
564     PRESION_EXTENDED = 0x00040000,
565     BT601_SMPTE170M_FULL = GAMUT_BT601 | TRANSFORM_FUNC_SMPTE_170M | PRECISION_FULL,
566     BT601_SMPTE170M_LIMITED = GAMUT_BT601 | TRANSFORM_FUNC_SMPTE_170M | PRESION_LIMITED,
567     BT709_LINEAR_FULL = GAMUT_BT709 | TRANSFORM_FUNC_LINEAR | PRECISION_FULL,
568     BT709_LINEAR_EXTENDED = GAMUT_BT709 | TRANSFORM_FUNC_LINEAR | PRESION_EXTENDED,
569     BT709_SRGB_FULL = GAMUT_BT709 | TRANSFORM_FUNC_SRGB | PRECISION_FULL,
570     BT709_SRGB_EXTENDED = GAMUT_BT709 | TRANSFORM_FUNC_SRGB | PRESION_EXTENDED,
571     BT709_SMPTE170M_LIMITED = GAMUT_BT709 | TRANSFORM_FUNC_SMPTE_170M | PRESION_LIMITED,
572     DCI_P3_LINEAR_FULL = GAMUT_DCI_P3 | TRANSFORM_FUNC_LINEAR | PRECISION_FULL,
573     DCI_P3_GAMMA26_FULL = GAMUT_DCI_P3 | TRANSFORM_FUNC_GM2_6 | PRECISION_FULL,
574     DISPLAY_P3_LINEAR_FULL = GAMUT_DISPLAY_P3 | TRANSFORM_FUNC_LINEAR | PRECISION_FULL,
575     DCI_P3_SRGB_FULL = GAMUT_DCI_P3 | TRANSFORM_FUNC_SRGB | PRECISION_FULL,
576     ADOBE_RGB_GAMMA22_FULL = GAMUT_ADOBE_RGB | TRANSFORM_FUNC_GM2_2 | PRECISION_FULL,
577     BT2020_LINEAR_FULL = GAMUT_BT2020 | TRANSFORM_FUNC_LINEAR | PRECISION_FULL,
578     BT2020_SRGB_FULL = GAMUT_BT2020 | TRANSFORM_FUNC_SRGB | PRECISION_FULL,
579     BT2020_SMPTE170M_FULL = GAMUT_BT2020 | TRANSFORM_FUNC_SMPTE_170M | PRECISION_FULL,
580     BT2020_ST2084_FULL = GAMUT_BT2020 | TRANSFORM_FUNC_ST2084 | PRECISION_FULL,
581     BT2020_HLG_FULL = GAMUT_BT2020 | TRANSFORM_FUNC_HLG | PRECISION_FULL,
582     BT2020_ST2084_LIMITED = GAMUT_BT2020 | TRANSFORM_FUNC_ST2084 | PRESION_LIMITED,
583 } ColorDataSpace;
584 
585 /**
586  * @brief Enumerates the HDR formats.
587  *
588  */
589 typedef enum {
590     NOT_SUPPORT_HDR = 0,
591     DOLBY_VISION = 1,
592     HDR10 = 2,
593     HLG = 3,
594     HDR10_PLUS = 4,
595     HDR_VIVID = 5,
596 } HDRFormat;
597 
598 /**
599  * @brief Defines the HDR capability.
600  *
601  */
602 typedef struct {
603     uint32_t formatCount;
604     HDRFormat* formats;
605     float maxLum;
606     float maxAverageLum;
607     float minLum;
608 } HDRCapability;
609 
610 /**
611  * @brief Enumerates the HDR metadata keys.
612  *
613  */
614 typedef enum {
615     MATAKEY_RED_PRIMARY_X = 0,
616     MATAKEY_RED_PRIMARY_Y = 1,
617     MATAKEY_GREEN_PRIMARY_X = 2,
618     MATAKEY_GREEN_PRIMARY_Y = 3,
619     MATAKEY_BLUE_PRIMARY_X = 4,
620     MATAKEY_BLUE_PRIMARY_Y = 5,
621     MATAKEY_WHITE_PRIMARY_X = 6,
622     MATAKEY_WHITE_PRIMARY_Y = 7,
623     MATAKEY_MAX_LUMINANCE = 8,
624     MATAKEY_MIN_LUMINANCE = 9,
625     MATAKEY_MAX_CONTENT_LIGHT_LEVEL = 10,
626     MATAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11,
627     MATAKEY_HDR10_PLUS = 12,
628     MATAKEY_HDR_VIVID = 13,
629 } HDRMetadataKey;
630 
631 /**
632  * @brief Defines the HDR metadata.
633  *
634  */
635 typedef struct {
636     HDRMetadataKey key;
637     float value;
638 } HDRMetaData;
639 
640 /**
641  * @brief Defines information for verifying the memory to allocate.
642  *
643  */
644 typedef struct {
645     uint32_t width;               /**< Width of the memory to allocate */
646     uint32_t height;              /**< Height of the memory to allocate */
647     uint64_t usage;               /**< Usage of the memory */
648     PixelFormat format;           /**< Format of the memory to allocate */
649 } VerifyAllocInfo;
650 
651 /**
652  * @brief Enumerates the present timestamp types.
653  *
654  */
655 typedef enum {
656     HARDWARE_DISPLAY_PTS_UNSUPPORTED = 0,        /**< Unsupported */
657     HARDWARE_DISPLAY_PTS_DELAY = 1 << 0,         /**< Delay */
658     HARDWARE_DISPLAY_PTS_TIMESTAMP = 1 << 1,     /**< Timestamp */
659 } PresentTimestampType;
660 
661 /**
662  * @brief Defines the present timestamp.
663  *
664  */
665 typedef struct {
666     PresentTimestampType type;            /**< Present timestamp type */
667     int64_t time;                         /**< Present timestamp value */
668 } PresentTimestamp;
669 
670 typedef struct {
671     int32_t fd;                  /**< Handle fd, -1 if not supported */
672     uint32_t reserveInts;        /**< the number of reserved integer value */
673     int32_t reserve[0];          /**< the reserved data */
674 } __attribute__((__packed__)) ExtDataHandle;
675 
676 typedef struct {
677     void *baseAddr;              /**< Base address of memory */
678     size_t yOffset;              /**< Offset of Y */
679     size_t uOffset;              /**< Offset of U */
680     size_t vOffset;              /**< Offset of V */
681     size_t yStride;              /**< Stride of Y */
682     size_t uvStride;             /**< Stride of UV */
683     size_t uvStep;               /**< Step of UV */
684 } __attribute__((__packed__)) YUVDescInfo;
685 #ifdef __cplusplus
686 }
687 #endif
688 #endif
689 /* @} */
690