• 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 #ifndef GRAPHIC_COMPOSER_DISPLAY_TYPE_H
17 #define GRAPHIC_COMPOSER_DISPLAY_TYPE_H
18 #include "buffer_handle.h"
19 #include "surface_type.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #define PROPERTY_NAME_LEN  50
26 #define INVALID_BUFFER_CACHE_INDEX 0xFFFFFFFF
27 
28 /*
29  * @brief Defines property object which contains name, property id and value.
30  */
31 typedef struct {
32     std::string name;             /**< Name of the property */
33     uint32_t propId;              /**< Property id which was decided in the DRM internal */
34     uint64_t value;               /**< the value of property  */
35 } GraphicPropertyObject;
36 
37 /*
38  * @brief Enumerates interface types.
39  */
40 typedef enum {
41     GRAPHIC_DISP_INTF_HDMI = 0,       /**< HDMI interface */
42     GRAPHIC_DISP_INTF_LCD,            /**< LCD interface */
43     GRAPHIC_DISP_INTF_BT1120,         /**< BT1120 interface */
44     GRAPHIC_DISP_INTF_BT656,          /**< BT656 interface */
45     GRAPHIC_DISP_INTF_YPBPR,          /**< YPBPR interface */
46     GRAPHIC_DISP_INTF_RGB,            /**< RGB interface */
47     GRAPHIC_DISP_INTF_CVBS,           /**< CVBS interface */
48     GRAPHIC_DISP_INTF_SVIDEO,         /**< SVIDEO interface */
49     GRAPHIC_DISP_INTF_VGA,            /**< VGA interface */
50     GRAPHIC_DISP_INTF_MIPI,           /**< MIPI interface */
51     GRAPHIC_DISP_INTF_PANEL,          /**< PANEL interface */
52     GRAPHIC_DISP_INTF_BUTT,
53 } GraphicInterfaceType;
54 
55 /**
56  * @brief Defines the capability of the output.
57  */
58 typedef struct {
59     std::string name;                          /**< Name of the display device */
60     GraphicInterfaceType type;                 /**< Interface type of panel */
61     uint32_t phyWidth;                         /**< Physical width */
62     uint32_t phyHeight;                        /**< Physical height */
63     uint32_t supportLayers;                    /**< Number of supported layers */
64     uint32_t virtualDispCount;                 /**< Count of virtual displays supported */
65     bool supportWriteBack;                     /**< Whether writeback is supported */
66     uint32_t propertyCount;                    /**< Count of properties */
67     std::vector<GraphicPropertyObject> props;  /**< Vector of property objects */
68 } GraphicDisplayCapability;
69 
70 /*
71  * @brief Defines output mode info.
72  */
73 typedef struct {
74     int32_t width;      /**< Width in pixel */
75     int32_t height;     /**< Height in pixel */
76     uint32_t freshRate; /**< Fresh rate per second */
77     int32_t id;         /**< ID of the mode */
78 } GraphicDisplayModeInfo;
79 
80 typedef enum {
81     GRAPHIC_POWER_STATUS_ON,              /**< The power status is on. */
82     GRAPHIC_POWER_STATUS_STANDBY,         /**< The power status is standby. */
83     GRAPHIC_POWER_STATUS_SUSPEND,         /**< The power status is suspended. */
84     GRAPHIC_POWER_STATUS_OFF,             /**< The power status is off. */
85     GRAPHIC_POWER_STATUS_BUTT
86 } GraphicDispPowerStatus;
87 
88 /**
89  * @brief Enumerates the color gamut maps.
90  *
91  */
92 typedef enum {
93     GRAPHIC_GAMUT_MAP_CONSTANT = 0,
94     GRAPHIC_GAMUT_MAP_EXPANSION = 1,
95     GRAPHIC_GAMUT_MAP_HDR_CONSTANT = 2,
96     GRAPHIC_GAMUT_MAP_HDR_EXPANSION = 3,
97 } GraphicGamutMap;
98 
99 /*
100  * @brief Enumerates the HDR formats.
101  */
102 typedef enum {
103     GRAPHIC_NOT_SUPPORT_HDR = 0,
104     GRAPHIC_DOLBY_VISION = 1,
105     GRAPHIC_HDR10 = 2,
106     GRAPHIC_HLG = 3,
107     GRAPHIC_HDR10_PLUS = 4,
108     GRAPHIC_HDR_VIVID = 5,
109 } GraphicHDRFormat;
110 
111 /*
112  * @brief Defines the HDR capability.
113  */
114 typedef struct {
115     uint32_t formatCount;
116     std::vector<GraphicHDRFormat> formats;
117     float maxLum;
118     float maxAverageLum;
119     float minLum;
120 } GraphicHDRCapability;
121 
122 /*
123  * @brief Defines the layer buffer info.
124  */
125 typedef struct {
126     BufferHandle* handle;
127     uint32_t cacheIndex;
128     OHOS::sptr<OHOS::SyncFence> acquireFence;
129     std::vector<uint32_t> deletingList;
130 } GraphicLayerBuffer;
131 
132 /*
133  * @brief Called when a hot plug event occurs.
134  *
135  * This callback must be registered by calling <b>RegHotPlugCallback</b>.
136  *
137  * @param devId Indicates the ID of the display device.
138  * @param connected Indicates the connection status of the display device. The value <b>true</b> means that
139  *  the display device is connected, and <b>false</b> means the opposite.
140  * @param data Indicates the private data carried by the graphics service.
141  */
142 typedef void (*HotPlugCallback)(uint32_t devId, bool connected, void *data);
143 
144 /*
145  * @brief Called when a VBLANK event occurs.
146  *
147  * This callback must be registered by calling <b>RegDisplayVBlankCallback</b>.
148  *
149  * @param sequence Indicates the VBLANK sequence, which is an accumulated value.
150  * @param ns Indicates the timestamp (in ns) of the VBLANK event.
151  * @param data Indicates the pointer to the private data carried by the graphics service.
152  */
153 typedef void (*VBlankCallback)(unsigned int sequence, uint64_t ns, void *data);
154 
155 
156 /*
157  * @brief Called when composer host process died.
158  *
159  * This callback must be registered by calling <b>RegComposerDeathCallback</b>.
160  *
161  * @param data Indicates the pointer to the private data carried by the graphics service.
162  */
163 typedef void (*OnHwcDeadCallback)(void *data);
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 #endif // GRAPHIC_COMPOSER_DISPLAY_TYPE_H
169