1/*
2 * Copyright (c) 2023 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 OHOS_HDI_DISPLAY_COMPOSER_V1_1_DISPLAYCOMPOSERTYPE_H
17#define OHOS_HDI_DISPLAY_COMPOSER_V1_1_DISPLAYCOMPOSERTYPE_H
18
19#include <cstdbool>
20#include <cstdint>
21#include "display/composer/v1_0/display_composer_type.h"
22#include "hdifd_parcelable.h"
23
24#ifndef HDI_BUFF_MAX_SIZE
25#define HDI_BUFF_MAX_SIZE (1024 * 200)
26#endif
27
28#ifndef HDI_CHECK_VALUE_RETURN
29#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \
30    if ((lv) compare (rv)) { \
31        return ret; \
32    } \
33} while (false)
34#endif
35
36#ifndef HDI_CHECK_VALUE_RET_GOTO
37#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \
38    if ((lv) compare (rv)) { \
39        ret = value; \
40        goto table; \
41    } \
42} while (false)
43#endif
44
45namespace OHOS {
46class MessageParcel;
47}
48
49namespace OHOS {
50namespace HDI {
51namespace Display {
52namespace Composer {
53namespace V1_1 {
54
55using namespace OHOS;
56using namespace OHOS::HDI::Display;
57using namespace OHOS::HDI::Display::Composer::V1_0;
58
59enum PixelFormat : int32_t {
60    PIXEL_FMT_CLUT8 = 0,
61    PIXEL_FMT_CLUT1,
62    PIXEL_FMT_CLUT4,
63    PIXEL_FMT_RGB_565,
64    PIXEL_FMT_RGBA_5658,
65    PIXEL_FMT_RGBX_4444,
66    PIXEL_FMT_RGBA_4444,
67    PIXEL_FMT_RGB_444,
68    PIXEL_FMT_RGBX_5551,
69    PIXEL_FMT_RGBA_5551,
70    PIXEL_FMT_RGB_555,
71    PIXEL_FMT_RGBX_8888,
72    PIXEL_FMT_RGBA_8888,
73    PIXEL_FMT_RGB_888,
74    PIXEL_FMT_BGR_565,
75    PIXEL_FMT_BGRX_4444,
76    PIXEL_FMT_BGRA_4444,
77    PIXEL_FMT_BGRX_5551,
78    PIXEL_FMT_BGRA_5551,
79    PIXEL_FMT_BGRX_8888,
80    PIXEL_FMT_BGRA_8888,
81    PIXEL_FMT_YUV_422_I,
82    PIXEL_FMT_YCBCR_422_SP,
83    PIXEL_FMT_YCRCB_422_SP,
84    PIXEL_FMT_YCBCR_420_SP,
85    PIXEL_FMT_YCRCB_420_SP,
86    PIXEL_FMT_YCBCR_422_P,
87    PIXEL_FMT_YCRCB_422_P,
88    PIXEL_FMT_YCBCR_420_P,
89    PIXEL_FMT_YCRCB_420_P,
90    PIXEL_FMT_YUYV_422_PKG,
91    PIXEL_FMT_UYVY_422_PKG,
92    PIXEL_FMT_YVYU_422_PKG,
93    PIXEL_FMT_VYUY_422_PKG,
94    PIXEL_FMT_RGBA_1010102,
95    PIXEL_FMT_VENDER_MASK = 0X7FFF0000,
96    PIXEL_FMT_BUTT = 0X7FFFFFFF,
97    PIXEL_FMT_YCBCR_P010 = 35,
98    PIXEL_FMT_YCRCB_P010,
99    PIXEL_FMT_RAW10,
100    PIXEL_FMT_BLOB,
101};
102
103enum DispPowerStatus : int32_t {
104    POWER_STATUS_ON = 0,
105    POWER_STATUS_STANDBY = 1,
106    POWER_STATUS_SUSPEND = 2,
107    POWER_STATUS_OFF = 3,
108    POWER_STATUS_BUTT,
109    POWER_STATUS_OFF_FAKE = 4,
110    POWER_STATUS_BUTT_V1_1,
111};
112
113enum CompositionType : int32_t {
114    COMPOSITION_CLIENT,
115    COMPOSITION_DEVICE,
116    COMPOSITION_CURSOR,
117    COMPOSITION_VIDEO,
118    COMPOSITION_DEVICE_CLEAR,
119    COMPOSITION_CLIENT_CLEAR,
120    COMPOSITION_TUNNEL,
121    COMPOSITION_BUTT,
122    COMPOSITION_SOLID_COLOR = 7,
123    COMPOSITION_BUTT_V1_1,
124};
125
126struct DisplayModeInfoExt {
127    OHOS::HDI::Display::Composer::V1_0::DisplayModeInfo v1_0;
128    uint32_t groupId;
129} __attribute__ ((aligned(8)));
130
131bool DisplayModeInfoExtBlockMarshalling(OHOS::MessageParcel &data, const OHOS::HDI::Display::Composer::V1_1::DisplayModeInfoExt& dataBlock);
132
133bool DisplayModeInfoExtBlockUnmarshalling(OHOS::MessageParcel &data, OHOS::HDI::Display::Composer::V1_1::DisplayModeInfoExt& dataBlock);
134
135} // V1_1
136} // Composer
137} // Display
138} // HDI
139} // OHOS
140
141#endif // OHOS_HDI_DISPLAY_COMPOSER_V1_1_DISPLAYCOMPOSERTYPE_H
142
143