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
16package ohos.hdi.display.composer.v1_1;
17
18import ohos.hdi.display.composer.v1_0.IDisplayComposer;
19import ohos.hdi.display.composer.v1_0.DisplayComposerType;
20import ohos.hdi.display.composer.v1_1.DisplayComposerType;
21import ohos.hdi.display.composer.v1_1.IModeCallback;
22import ohos.hdi.display.composer.v1_1.ISeamlessChangeCallback;
23import ohos.hdi.display.composer.v1_0.IRefreshCallback;
24
25interface IDisplayComposer extends ohos.hdi.display.composer.v1_0.IDisplayComposer {
26    /**
27     * @brief Registers the callback to be invoked when it's ready to change framerate.
28     *
29     * @param cb Indicates the instance used to notify graphics service that it's ready to change framerate.
30     *
31     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
32     * in {@link DispErrCode} otherwise.
33     * @since 4.1
34     * @version 1.1
35     */
36    RegSeamlessChangeCallback([in] ISeamlessChangeCallback cb);
37
38    /**
39     * @brief Obtains the display modes supported by a display device.
40     *
41     * @param devId Indicates the ID of the display device.
42     * @param modes Indicates the vector of the information about all modes supported by the display device,
43     * including all supported resolutions, refresh rates and groupId. Each mode has an ID, which will be used when
44     * the mode is set or obtained. For details, see {@link DisplayModeInfoExt}.
45     *
46     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
47     * in {@link DispErrCode} otherwise.
48     * @since 4.1
49     * @version 1.1
50     */
51    GetDisplaySupportedModesExt([in] unsigned int devId, [out] struct DisplayModeInfoExt[] modes);
52
53    /**
54     * @brief Sets the display mode of a display device.
55     *
56     * @param devId Indicates the ID of the display device.
57     * @param modeId Indicates the ID of the display mode. The device is switched to the display mode specified by
58     * this parameter in this interface.
59     * @param cb Indicates the callback to be invoked when mode is change.
60     *
61     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
62     * in {@link DispErrCode} otherwise.
63     * @since 4.1
64     * @version 1.1
65     */
66    SetDisplayModeAsync([in] unsigned int devId, [in] unsigned int modeId, [in] IModeCallback cb);
67
68    /**
69     * @brief Get the current vblank period.
70     * @param devId Indicates the ID of the display device.
71     * @param period Indicates the vblank period(ns).
72     *
73     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
74     * in {@link DispErrCode} otherwise.
75     * @since 4.1
76     * @version 1.1
77     */
78    GetDisplayVBlankPeriod([in] unsigned int devId, [out] unsigned long period);
79
80    /**
81     * @brief Sets parameter for the given layer, the parameter change must have fully taken effect after this call.
82     *
83     * @param devId Indicates the ID of the display device.
84     * @param layerId Indicates the ID of the layer to be operated on.
85     * @param key Indicates a particular key.
86     * @param value Indicates the value corresponding to the key.
87     *
88     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
89     * in {@link DispErrCode} otherwise.
90     * @since 4.1
91     * @version 1.1
92     */
93    SetLayerPerFrameParameter([in] unsigned int devId, [in] unsigned int layerId, [in] String key, [in] byte[] value);
94
95    /**
96     * @brief returns the list of supported parameter keys
97     *
98     * @param keys Indicates the supported parameter keys.
99     *
100     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
101     * in {@link DispErrCode} otherwise.
102     * @since 4.1
103     * @version 1.1
104     */
105    GetSupportedLayerPerFrameParameterKey([out] String[] keys);
106
107    /**
108     * @brief Sets parameter for the given layer, the parameter change must have fully taken effect after this call.
109     *
110     * @param devId Indicates the ID of the display device.
111     * @param width Indicates the pixel width of the display device
112     * @param height Indicates the pixel height of the display device
113     *
114     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
115     * in {@link DispErrCode} otherwise.
116     * @since 4.1
117     * @version 1.1
118     */
119    SetDisplayOverlayResolution([in] unsigned int devId, [in] unsigned int width, [in] unsigned int height);
120
121    /**
122     * @brief Registers the callback to be invoked when a refresh event occurs.
123     *
124     * @param cb Indicates the instance used to notify the graphics service of a refresh event occurred.
125     *
126     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
127     * in {@link DispErrCode} otherwise.
128     * @since 4.1
129     * @version 1.1
130    */
131    RegRefreshCallback([in] IRefreshCallback cb);
132
133    /**
134     * @brief Obtains the color gamuts of a display device.
135     *
136     * @param devId Indicates the ID of the display device.
137     * @param gamuts Indicates the vector of the information about all color gamuts supported by the display device.
138     *
139     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
140     * in {@link DispErrCode} otherwise.
141     * @since 4.1
142     * @version 1.1
143     */
144    GetDisplaySupportedColorGamuts([in] unsigned int devId, [out] struct ColorGamut[] gamuts);
145
146    /**
147     * @brief Obtains the capabilities of a display device.
148     *
149     * @param devId Indicates the ID of the display device.
150     * @param info Indicates the pointer to the capabilities supported by the hdr device.
151     *
152     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
153     * in {@link DispErrCode} otherwise.
154     * @since 4.1
155     * @version 1.1
156     */
157    GetHDRCapabilityInfos([in] unsigned int devId, [out] struct HDRCapability info);
158}
159