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