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 uint32_t width; /**< Width in pixel */ 75 uint32_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_OFF_FAKE, /**< Dss is off but screen is still on. */ 86 GRAPHIC_POWER_STATUS_ON_ADVANCED, /**< Power-on the screen in advance. */ 87 GRAPHIC_POWER_STATUS_OFF_ADVANCED, /**< Power-off the screen in advance. */ 88 GRAPHIC_POWER_STATUS_BUTT 89 } GraphicDispPowerStatus; 90 91 /** 92 * @brief Enumerates the color gamut maps. 93 * 94 */ 95 typedef enum { 96 GRAPHIC_GAMUT_MAP_CONSTANT = 0, 97 GRAPHIC_GAMUT_MAP_EXPANSION = 1, 98 GRAPHIC_GAMUT_MAP_HDR_CONSTANT = 2, 99 GRAPHIC_GAMUT_MAP_HDR_EXPANSION = 3, 100 } GraphicGamutMap; 101 102 /* 103 * @brief Enumerates the HDR formats. 104 */ 105 typedef enum { 106 GRAPHIC_NOT_SUPPORT_HDR = 0, 107 GRAPHIC_DOLBY_VISION = 1, 108 GRAPHIC_HDR10 = 2, 109 GRAPHIC_HLG = 3, 110 GRAPHIC_HDR10_PLUS = 4, 111 GRAPHIC_HDR_VIVID = 5, 112 } GraphicHDRFormat; 113 114 /* 115 * @brief Defines the HDR capability. 116 */ 117 typedef struct { 118 uint32_t formatCount; 119 std::vector<GraphicHDRFormat> formats; 120 float maxLum; 121 float maxAverageLum; 122 float minLum; 123 } GraphicHDRCapability; 124 125 /* 126 * @brief Defines the layer buffer info. 127 */ 128 typedef struct { 129 BufferHandle* handle; 130 uint32_t cacheIndex; 131 OHOS::sptr<OHOS::SyncFence> acquireFence; 132 std::vector<uint32_t> deletingList; 133 } GraphicLayerBuffer; 134 135 typedef struct { 136 uint8_t r; 137 uint8_t g; 138 uint8_t b; 139 uint8_t a; 140 } GraphicLayerColor; 141 142 /* 143 * @brief Called when a hot plug event occurs. 144 * 145 * This callback must be registered by calling <b>RegHotPlugCallback</b>. 146 * 147 * @param devId Indicates the ID of the display device. 148 * @param connected Indicates the connection status of the display device. The value <b>true</b> means that 149 * the display device is connected, and <b>false</b> means the opposite. 150 * @param data Indicates the private data carried by the graphics service. 151 */ 152 typedef void (*HotPlugCallback)(uint32_t devId, bool connected, void *data); 153 154 /* 155 * @brief Called when a refresh event occurs. 156 * 157 * This callback must be registered by calling <b>RegRefreshCallback</b>. 158 * 159 * @param devId Indicates the ID of the display device. 160 * @param data Indicates the private data carried by the graphics service. 161 */ 162 typedef void (*RefreshCallback)(uint32_t devId, void *data); 163 164 /* 165 * @brief Called when a VBLANK event occurs. 166 * 167 * This callback must be registered by calling <b>RegDisplayVBlankCallback</b>. 168 * 169 * @param sequence Indicates the VBLANK sequence, which is an accumulated value. 170 * @param ns Indicates the timestamp (in ns) of the VBLANK event. 171 * @param data Indicates the pointer to the private data carried by the graphics service. 172 */ 173 typedef void (*VBlankCallback)(unsigned int sequence, uint64_t ns, void *data); 174 175 176 /* 177 * @brief Called when composer host process died. 178 * 179 * This callback must be registered by calling <b>RegComposerDeathCallback</b>. 180 * 181 * @param data Indicates the pointer to the private data carried by the graphics service. 182 */ 183 typedef void (*OnHwcDeadCallback)(void *data); 184 185 /* 186 * @brief Called when a VBlank idle event occurs. 187 * 188 * This callback must be registered by calling <b>RegDisplayVBlankIdleCallback</b>. 189 * 190 * @param devId Indicates the ID of the display device. 191 * @param ns Indicates the timestamp when a VBlank idle event occurs. 192 * @param data Indicates the pointer to the private data carried by the graphics service. 193 */ 194 typedef void (*OnVBlankIdleCallback)(uint32_t devId, uint64_t ns, void *data); 195 196 #ifdef __cplusplus 197 } 198 #endif 199 #endif // GRAPHIC_COMPOSER_DISPLAY_TYPE_H 200