1c5e268c6Sopenharmony_ci/*
2c5e268c6Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
3c5e268c6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4c5e268c6Sopenharmony_ci * you may not use this file except in compliance with the License.
5c5e268c6Sopenharmony_ci * You may obtain a copy of the License at
6c5e268c6Sopenharmony_ci *
7c5e268c6Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8c5e268c6Sopenharmony_ci *
9c5e268c6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10c5e268c6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11c5e268c6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12c5e268c6Sopenharmony_ci * See the License for the specific language governing permissions and
13c5e268c6Sopenharmony_ci * limitations under the License.
14c5e268c6Sopenharmony_ci */
15c5e268c6Sopenharmony_ci
16c5e268c6Sopenharmony_ci#ifndef OHOS_HDI_DISPLAY_V1_1_IDISPLAY_COMPOSER_INTERFACE_H
17c5e268c6Sopenharmony_ci#define OHOS_HDI_DISPLAY_V1_1_IDISPLAY_COMPOSER_INTERFACE_H
18c5e268c6Sopenharmony_ci
19c5e268c6Sopenharmony_ci#include "v1_0/include/idisplay_composer_interface.h"
20c5e268c6Sopenharmony_ci#include "v1_1/display_composer_type.h"
21c5e268c6Sopenharmony_ci
22c5e268c6Sopenharmony_cinamespace OHOS {
23c5e268c6Sopenharmony_cinamespace HDI {
24c5e268c6Sopenharmony_cinamespace Display {
25c5e268c6Sopenharmony_cinamespace Composer {
26c5e268c6Sopenharmony_cinamespace V1_1 {
27c5e268c6Sopenharmony_ci
28c5e268c6Sopenharmony_ciclass IDisplayComposerInterface : public V1_0::IDisplayComposerInterface {
29c5e268c6Sopenharmony_cipublic:
30c5e268c6Sopenharmony_ci    /**
31c5e268c6Sopenharmony_ci     * @brief Obtains all interfaces of IDisplayComposerInterface.
32c5e268c6Sopenharmony_ci     *
33c5e268c6Sopenharmony_ci     * @return Returns <b>IDisplayComposerInterface*</b> if the operation is successful;
34c5e268c6Sopenharmony_ci     * returns an null point otherwise.
35c5e268c6Sopenharmony_ci     * @since 4.0
36c5e268c6Sopenharmony_ci     * @version 1.1
37c5e268c6Sopenharmony_ci     */
38c5e268c6Sopenharmony_ci    static IDisplayComposerInterface* Get(bool needSMQ = true);
39c5e268c6Sopenharmony_ci
40c5e268c6Sopenharmony_ci    /**
41c5e268c6Sopenharmony_ci     * @brief Registers the callback to be invoked when it's ready to change framerate.
42c5e268c6Sopenharmony_ci     *
43c5e268c6Sopenharmony_ci     * @param cb Indicates the callback
44c5e268c6Sopenharmony_ci     * @param data Data used by cb
45c5e268c6Sopenharmony_ci     *
46c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
47c5e268c6Sopenharmony_ci     * in {@link DispErrCode} otherwise.
48c5e268c6Sopenharmony_ci     * @since 4.1
49c5e268c6Sopenharmony_ci     * @version 1.1
50c5e268c6Sopenharmony_ci     */
51c5e268c6Sopenharmony_ci    virtual int32_t RegSeamlessChangeCallback(SeamlessChangeCallback cb, void* data) = 0;
52c5e268c6Sopenharmony_ci
53c5e268c6Sopenharmony_ci    /**
54c5e268c6Sopenharmony_ci     * @brief Obtains the display modes supported by a display device.
55c5e268c6Sopenharmony_ci     *
56c5e268c6Sopenharmony_ci     * @param devId Indicates the ID of the display device.
57c5e268c6Sopenharmony_ci     * @param modes Indicates the vector of the information about all modes supported by the display device,
58c5e268c6Sopenharmony_ci     * including all supported resolutions, refresh rates and groupId. Each mode has an ID, which will be used when
59c5e268c6Sopenharmony_ci     * the mode is set or obtained. For details, see {@link DisplayModeInfoExt}.
60c5e268c6Sopenharmony_ci     *
61c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
62c5e268c6Sopenharmony_ci     * in {@link DispErrCode} otherwise.
63c5e268c6Sopenharmony_ci     * @since 4.1
64c5e268c6Sopenharmony_ci     * @version 1.1
65c5e268c6Sopenharmony_ci     */
66c5e268c6Sopenharmony_ci    virtual int32_t GetDisplaySupportedModesExt(unsigned int devId, std::vector<DisplayModeInfoExt>& modes) = 0;
67c5e268c6Sopenharmony_ci
68c5e268c6Sopenharmony_ci    /**
69c5e268c6Sopenharmony_ci     * @brief Sets the display mode of a display device.
70c5e268c6Sopenharmony_ci     *
71c5e268c6Sopenharmony_ci     * @param devId Indicates the ID of the display device.
72c5e268c6Sopenharmony_ci     * @param modeId Indicates the ID of the display mode. The device is switched to the display mode specified by
73c5e268c6Sopenharmony_ci     * this parameter in this interface.
74c5e268c6Sopenharmony_ci     * @param cb Indicates the callback to be invoked when mode is change.
75c5e268c6Sopenharmony_ci     *
76c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
77c5e268c6Sopenharmony_ci     * in {@link DispErrCode} otherwise.
78c5e268c6Sopenharmony_ci     * @since 4.1
79c5e268c6Sopenharmony_ci     * @version 1.1
80c5e268c6Sopenharmony_ci     */
81c5e268c6Sopenharmony_ci    virtual int32_t SetDisplayModeAsync(uint32_t devId, uint32_t modeId, ModeCallback cb) = 0;
82c5e268c6Sopenharmony_ci
83c5e268c6Sopenharmony_ci    /**
84c5e268c6Sopenharmony_ci     * @brief Get the current vblank period.
85c5e268c6Sopenharmony_ci     * @param devId Indicates the ID of the display device.
86c5e268c6Sopenharmony_ci     * @param period Indicates the vblank period(ns).
87c5e268c6Sopenharmony_ci     *
88c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
89c5e268c6Sopenharmony_ci     * in {@link DispErrCode} otherwise.
90c5e268c6Sopenharmony_ci     * @since 4.1
91c5e268c6Sopenharmony_ci     * @version 1.1
92c5e268c6Sopenharmony_ci     */
93c5e268c6Sopenharmony_ci    virtual int32_t GetDisplayVBlankPeriod(uint32_t devId, uint64_t &period) = 0;
94c5e268c6Sopenharmony_ci
95c5e268c6Sopenharmony_ci    /* *
96c5e268c6Sopenharmony_ci     * @brief Set the layer per frame keys supported by a display device.
97c5e268c6Sopenharmony_ci     *
98c5e268c6Sopenharmony_ci     * @param devId Indicates the ID of the display device.
99c5e268c6Sopenharmony_ci     * @param layerId Indicates the layer ID, which uniquely identifies a layer. You can perform operations on the layer
100c5e268c6Sopenharmony_ci     * with the specified layer ID.
101c5e268c6Sopenharmony_ci     * @param key Indicates the metadata key.
102c5e268c6Sopenharmony_ci     * @param value Indicates the property to get.
103c5e268c6Sopenharmony_ci     *
104c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
105c5e268c6Sopenharmony_ci     * in {@link DispErrCode} otherwise.
106c5e268c6Sopenharmony_ci     * @since 4.1
107c5e268c6Sopenharmony_ci     * @version 1.1
108c5e268c6Sopenharmony_ci     */
109c5e268c6Sopenharmony_ci    virtual int32_t SetLayerPerFrameParameter(uint32_t devId, uint32_t layerId, const std::string& key,
110c5e268c6Sopenharmony_ci        const std::vector<int8_t>& value) = 0;
111c5e268c6Sopenharmony_ci
112c5e268c6Sopenharmony_ci    /* *
113c5e268c6Sopenharmony_ci     * @brief Obtains the layer per frame keys supported by a display device.
114c5e268c6Sopenharmony_ci     *
115c5e268c6Sopenharmony_ci     * @param keys Indicates the vector of the information about all HDR metadata keys supported by the display device.
116c5e268c6Sopenharmony_ci     *
117c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
118c5e268c6Sopenharmony_ci     * in {@link DispErrCode} otherwise.
119c5e268c6Sopenharmony_ci     * @since 4.1
120c5e268c6Sopenharmony_ci     * @version 1.1
121c5e268c6Sopenharmony_ci     */
122c5e268c6Sopenharmony_ci    virtual int32_t GetSupportedLayerPerFrameParameterKey(std::vector<std::string>& keys) = 0;
123c5e268c6Sopenharmony_ci
124c5e268c6Sopenharmony_ci    /* *
125c5e268c6Sopenharmony_ci     * @brief Set display width and height of a display device.
126c5e268c6Sopenharmony_ci     *
127c5e268c6Sopenharmony_ci     * @param devId Indicates the ID of the display device.
128c5e268c6Sopenharmony_ci     * @param width Indicates the pixel width of the display device.
129c5e268c6Sopenharmony_ci     * @param height Indicates the pixel height of the display device.
130c5e268c6Sopenharmony_ci     *
131c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
132c5e268c6Sopenharmony_ci     * in {@link DispErrCode} otherwise.
133c5e268c6Sopenharmony_ci     * @since 4.1
134c5e268c6Sopenharmony_ci     * @version 1.1
135c5e268c6Sopenharmony_ci     */
136c5e268c6Sopenharmony_ci    virtual int32_t SetDisplayOverlayResolution(uint32_t devId, uint32_t width, uint32_t height) = 0;
137c5e268c6Sopenharmony_ci
138c5e268c6Sopenharmony_ci    /**
139c5e268c6Sopenharmony_ci     * @brief Registers the callback to be invoked when a refresh event occurs.
140c5e268c6Sopenharmony_ci     *
141c5e268c6Sopenharmony_ci     * @param cb Indicates the instance used to notify the graphics service of a refresh event occurred.
142c5e268c6Sopenharmony_ci     * @param data Indicates the pointer to the private data returned to the graphics service in the
143c5e268c6Sopenharmony_ci     * <b>RefreshCallback</b> callback.
144c5e268c6Sopenharmony_ci     *
145c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
146c5e268c6Sopenharmony_ci     * in {@link DispErrCode} otherwise.
147c5e268c6Sopenharmony_ci     * @since 4.1
148c5e268c6Sopenharmony_ci     * @version 1.1
149c5e268c6Sopenharmony_ci     */
150c5e268c6Sopenharmony_ci    virtual int32_t RegRefreshCallback(RefreshCallback cb, void *data) = 0;
151c5e268c6Sopenharmony_ci
152c5e268c6Sopenharmony_ci    /* *
153c5e268c6Sopenharmony_ci     * @brief Obtains the capabilities of a display device.
154c5e268c6Sopenharmony_ci     *
155c5e268c6Sopenharmony_ci     * @param devId Indicates the ID of the display device.
156c5e268c6Sopenharmony_ci     * @param gamuts Indicates the vector of the information about all color gamuts supported by the display device.
157c5e268c6Sopenharmony_ci     *
158c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
159c5e268c6Sopenharmony_ci     * in {@link DispErrCode} otherwise.
160c5e268c6Sopenharmony_ci     * @since 4.1
161c5e268c6Sopenharmony_ci     * @version 1.1
162c5e268c6Sopenharmony_ci     */
163c5e268c6Sopenharmony_ci    virtual int32_t GetDisplaySupportedColorGamuts(uint32_t devId, std::vector<ColorGamut>& gamuts) = 0;
164c5e268c6Sopenharmony_ci
165c5e268c6Sopenharmony_ci    /* *
166c5e268c6Sopenharmony_ci     * @brief Obtains the capabilities of a display device.
167c5e268c6Sopenharmony_ci     *
168c5e268c6Sopenharmony_ci     * @param devId Indicates the ID of the display device.
169c5e268c6Sopenharmony_ci     * @param info Indicates the pointer to the capabilities supported by the hdr device.
170c5e268c6Sopenharmony_ci     *
171c5e268c6Sopenharmony_ci     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
172c5e268c6Sopenharmony_ci     * in {@link DispErrCode} otherwise.
173c5e268c6Sopenharmony_ci     * @since 4.1
174c5e268c6Sopenharmony_ci     * @version 1.1
175c5e268c6Sopenharmony_ci     */
176c5e268c6Sopenharmony_ci    virtual int32_t GetHDRCapabilityInfos(uint32_t devId, HDRCapability& info) = 0;
177c5e268c6Sopenharmony_ci};
178c5e268c6Sopenharmony_ci} // V1_1
179c5e268c6Sopenharmony_ci} // Composer
180c5e268c6Sopenharmony_ci} // Display
181c5e268c6Sopenharmony_ci} // HDI
182c5e268c6Sopenharmony_ci} // OHOS
183c5e268c6Sopenharmony_ci#endif // OHOS_HDI_DISPLAY_V1_1_IDISPLAY_COMPOSER_INTERFACE_H
184