• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_0;
17
18import ohos.hdi.display.composer.v1_0.DisplayComposerType;
19import ohos.hdi.display.composer.v1_0.IHotPlugCallback;
20import ohos.hdi.display.composer.v1_0.IVBlankCallback;
21import ohos.hdi.display.composer.v1_0.IRefreshCallback;
22
23sequenceable OHOS.HDI.Display.HdifdParcelable;
24
25interface IDisplayComposer {
26    /* *
27     * @brief Registers the callback to be invoked when a hot plug event occurs.
28     *
29     * @param cb Indicates the instance used to notify the graphics service of a hot plug event occurred.
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.0
34     * @version 1.0
35     */
36    RegHotPlugCallback([in] IHotPlugCallback cb);
37
38    /**
39     * @brief Sets the client buffer cache count of a display device.
40     *
41     * @param devId Indicates the ID of the display device.
42     * @param count client buffer cache count.
43     *
44     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
45     * in {@link DispErrCode} otherwise.
46     * @since 4.0
47     * @version 1.0
48     */
49    SetClientBufferCacheCount([in] unsigned int devId, [in] unsigned int count);
50
51    /* *
52     * @brief Registers the callback to be invoked when a VBLANK event occurs.
53     *
54     * @param devId Indicates the ID of the display device.
55     * @param cb Indicates the instance used to notify the graphics service of the VBLANK event occurred when
56     * <b>DisplayVsync</b> is enabled.
57     *
58     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
59     * in {@link DispErrCode} otherwise.
60     * @since 4.0
61     * @version 1.0
62     */
63    RegDisplayVBlankCallback([in] unsigned int devId, [in] IVBlankCallback cb);
64
65    /* *
66     * @brief Obtains the capabilities of a display device.
67     *
68     * @param devId Indicates the ID of the display device.
69     * @param info Indicates the pointer to the capabilities supported by the display device. For details,
70     * see {@link DisplayCapability}.
71     *
72     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
73     * in {@link DispErrCode} otherwise.
74     * @since 4.0
75     * @version 1.0
76     */
77    GetDisplayCapability([in] unsigned int devId, [out] struct DisplayCapability info);
78
79    /* *
80     * @brief Obtains the display modes supported by a display device.
81     *
82     * @param devId Indicates the ID of the display device.
83     * @param modes Indicates the vector of the information about all modes supported by the display device,
84     * including all supported resolutions and refresh rates. Each mode has an ID, which will be used when
85     * the mode is set or obtained. For details, see {@link DisplayModeInfo}.
86     *
87     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
88     * in {@link DispErrCode} otherwise.
89     * @since 4.0
90     * @version 1.0
91     */
92    GetDisplaySupportedModes([in] unsigned int devId, [out] struct DisplayModeInfo[] modes);
93
94    /* *
95     * @brief Obtains the current display mode of a display device.
96     *
97     * @param devId Indicates the ID of the display device.
98     * @param modeId indicates the pointer to the ID of the current display mode of the device. The display mode ID
99     * is written by this API.
100     *
101     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
102     * in {@link DispErrCode} otherwise.
103     * @since 4.0
104     * @version 1.0
105     */
106    GetDisplayMode([in] unsigned int devId, [out] unsigned int modeId);
107
108    /* *
109     * @brief Sets the display mode of a display device.
110     *
111     * @param devId Indicates the ID of the display device.
112     * @param modeId Indicates the ID of the display mode. The device is switched to the display mode specified by
113     * this parameter in this interface.
114     *
115     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
116     * in {@link DispErrCode} otherwise.
117     * @since 4.0
118     * @version 1.0
119     */
120    SetDisplayMode([in] unsigned int devId, [in] unsigned int modeId);
121
122    /* *
123     * @brief Obtains the power status of a display device.
124     *
125     * @param devId Indicates the ID of the display device.
126     * @param status Indicates the pointer to the power status of the device. The status is written by this interface.
127     *
128     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
129     * in {@link DispErrCode} otherwise.
130     * @since 4.0
131     * @version 1.0
132     */
133    GetDisplayPowerStatus([in] unsigned int devId, [out] enum DispPowerStatus status);
134
135    /* *
136     * @brief Sets the power status of a display device.
137     *
138     * @param devId Indicates the ID of the display device.
139     * @param status Indicates the power status to set.
140     *
141     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
142     * in {@link DispErrCode} otherwise.
143     * @since 4.0
144     * @version 1.0
145     */
146    SetDisplayPowerStatus([in] unsigned int devId, [in] enum DispPowerStatus status);
147
148    /* *
149     * @brief Obtains the backlight value of a display device.
150     *
151     * @param devId Indicates the ID of the display device.
152     * @param level Indicates the pointer to the backlight value of the device. The backlight value is written
153     * by this interface.
154     *
155     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
156     * in {@link DispErrCode} otherwise.
157     * @since 4.0
158     * @version 1.0
159     */
160    GetDisplayBacklight([in] unsigned int devId, [out] unsigned int level);
161
162    /* *
163     * @brief Sets the backlight value for a display device.
164     *
165     * @param devId Indicates the ID of the display device.
166     * @param level Indicates the backlight value to set.
167     *
168     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
169     * in {@link DispErrCode} otherwise.
170     * @since 4.0
171     * @version 1.0
172     */
173    SetDisplayBacklight([in] unsigned int devId, [in] unsigned int level);
174
175    /* *
176     * @brief Enables or disables the vertical sync signal.
177     *
178     * When the vertical sync signal is generated, the <b>VBlankCallback</b> callback registered
179     * by <b>RegDisplayVBlankCallback</b> will be invoked. The vertical sync signal must be enabled when the graphics
180     * service needs to refresh the display, and disabled when display refresh is not required. The display does not
181     * need to refresh when <b>VBlankCallback</b> is invoked and the graphics service composes layers and sends the
182     * composition result to the device for display.
183     *
184     * @param devId Indicates the ID of the display device.
185     * @param enabled Specifies whether to enable the vertical sync signal. The value <b>true</b> means to enable the
186     * vertical sync signal, and <b>false</b> means to disable it.
187     *
188     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
189     * in {@link DispErrCode}otherwise.
190     * @since 4.0
191     * @version 1.0
192     */
193    SetDisplayVsyncEnabled([in] unsigned int devId, [in] boolean enabled);
194
195    /**
196     * @brief Opens a layer on a specified display device.
197     *
198     * Before using a layer on the GUI, you must open the layer based on the layer information. After the layer is
199     * opened, you can obtain the layer ID and then use other functions based on the layer ID.
200     *
201     * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
202     * display device, and 4 indicates the last display device.
203     * @param layerInfo Indicates the pointer to the layer information passed to open a layer, including the layer
204     * type, layer size, and pixel format.
205     * @param cacheCount Indicates the count of buffer cache.
206     * @param layerId Indicates the pointer to the layer ID, which uniquely identifies a layer. The layer ID is returned
207     * to the GUI after the layer is successfully opened.
208     *
209     * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
210     * otherwise.
211     * @see DestroyLayer
212     * @since 4.0
213     * @version 1.0
214     */
215    CreateLayer([in] unsigned int devId, [in] struct LayerInfo layerInfo, [in] unsigned int cacheCount,
216        [out] unsigned int layerId);
217
218    /**
219     * @brief Opens a layer on a specified display device.
220     *
221     * Before using a layer on the GUI, you must open the layer based on the layer information. After the layer is
222     * opened, you can obtain the layer ID and then use other functions based on the layer ID.
223     *
224     * @param devId Indicates the ID of the display device. The value ranges from 0 to 4, where 0 indicates the first
225     * display device, and 4 indicates the last display device.
226     * @param layerInfo Indicates the pointer to the layer information passed to open a layer, including the layer
227     * type, layer size, and pixel format.
228     * @param cacheCount Indicates the count of buffer cache.
229     * @param layerId Indicates the pointer to the layer ID, which uniquely identifies a layer. The layer ID is returned
230     * to the GUI after the layer is successfully opened.
231     *
232     * @return Returns <b>0</b> if the operation is successful; returns an error code defined in {@link DispErrCode}
233     * otherwise.
234     * @see DestroyLayer
235     * @since 4.0
236     * @version 1.0
237     */
238    DestroyLayer([in] unsigned int devId, [in] unsigned int layerId);
239
240     /* *
241     * @brief Sets the cropped region for a display device.
242     *
243     * You can use this interface to set the cropped region of the client buffer of the display device.
244     * The cropped region cannot exceed the size of the client buffer.
245     *
246     * @param devId Indicates the ID of the display device.
247     * @param rect Indicates the pointer to the cropped region of the client buffer.
248     *
249     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
250     * in {@link DispErrCode} otherwise.
251     * @since 4.0
252     * @version 1.0
253     */
254    SetDisplayClientCrop([in] unsigned int devId, [in] struct IRect rect);
255
256    /* *
257     * @brief Obtains the fences of the display layers after the commit operation.
258     *
259     * @param devId Indicates the ID of the display device.
260     * @param layers Indicates the vector of the start address of the layer array.
261     * @param fences Indicates the vector of the start address of the fence array.
262     *
263     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
264     * in {@link DispErrCode} otherwise.
265     * @since 4.0
266     * @version 1.0
267     */
268    GetDisplayReleaseFence([in] unsigned int devId, [out] unsigned int[] layers, [out] HdifdParcelable[] fences);
269
270     /* *
271     * @brief Creates a virtual display device.
272     *
273     * @param width Indicates the pixel width of the display device.
274     * @param height Indicates the pixel height of the display device.
275     * @param format Indicates the pointer to the pixel format of the display device.
276     * @param devId Indicates the ID of the display device.
277     * For details, see {@link PixelFormat}. The <b>format</b> can be modified based on hardware requirements and
278     * returned to the graphics service.
279     * @param devId Indicates the pointer to the ID of the virtual display device created.
280     *
281     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
282     * in {@link DispErrCode} otherwise.
283     * @since 4.0
284     * @version 1.0
285     */
286    CreateVirtualDisplay([in] unsigned int width, [in] unsigned int height, [out] int format, [out] unsigned int devId);
287
288    /* *
289     * @brief Destroys a virtual display device.
290     *
291     * @param devId Indicates the ID of the display device.
292     *
293     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
294     * in {@link DispErrCode} otherwise.
295     * @since 4.0
296     * @version 1.0
297     */
298    DestroyVirtualDisplay([in] unsigned int devId);
299
300    /* *
301     * @brief Sets the output buffer for a virtual display device.
302     *
303     * This buffer stores the output of the virtual display device. The buffer can be used only after the sync fence
304     * is in the signaled state.
305     *
306     * @param devId Indicates the ID of the display device.
307     * @param buffer Indicates the pointer to the output buffer.
308     * @param fence Indicates the sync fence.
309     *
310     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
311     * in {@link DispErrCode} otherwise.
312     * @since 4.0
313     * @version 1.0
314     */
315    SetVirtualDisplayBuffer([in] unsigned int devId, [in] NativeBuffer buffer, [in] HdifdParcelable fence);
316
317    /* *
318     * @brief Sets the property for a display device.
319     *
320     * @param devId Indicates the ID of the display device.
321     * @param id Indicates the property ID returned by <b>GetDisplayCapability</b>.
322     * @param value Indicates the property to set.
323     *
324     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
325     * in {@link DispErrCode} otherwise.
326     * @since 4.0
327     * @version 1.0
328     */
329    SetDisplayProperty([in] unsigned int devId, [in] unsigned int id, [in] unsigned long value);
330
331    /* *
332     * @brief Obtains the property for a display device.
333     *
334     * @param devId Indicates the ID of the display device.
335     * @param id Indicates the property ID returned by <b>GetDisplayCapability</b>.
336     * @param value Indicates the property to get.
337     *
338     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
339     * in {@link DispErrCode} otherwise.
340     * @since 4.0
341     * @version 1.0
342     */
343    GetDisplayProperty([in] unsigned int devId, [in] unsigned int id, [out] unsigned long value);
344
345    /* func for smq transfer */
346    /* *
347     * @brief Initializes a command request object.
348     *
349     * @param request Indicates the SharedMemQueue to Initializes.
350     *
351     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
352     * in {@link DispErrCode} otherwise.
353     * @since 4.0
354     * @version 1.0
355     */
356    InitCmdRequest([in] SharedMemQueue<int> request);
357
358    /* *
359     * @brief Send a command request.
360     *
361     * @param inEleCnt Indicates the number of element.
362     * @param inFds Indicates the ID of HdifdParcelable.
363     * @param outEleCnt outEleCnt inEleCnt Indicates the number of element to get.
364     * @param outFds outEleCnt Indicates the ID of HdifdParcelable to get.
365     *
366     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
367     * in {@link DispErrCode} otherwise.
368     * @since 4.0
369     * @version 1.0
370     */
371    CmdRequest([in] unsigned int inEleCnt, [in] struct HdifdInfo[] inFds, [out] unsigned int outEleCnt,
372        [out] struct HdifdInfo[] outFds);
373
374    /* *
375     * @brief Gets the return result of a command request.
376     *
377     * @param reply Indicates the the return result.
378     *
379     * @return Returns <b>0</b> if the operation is successful; returns an error code defined
380     * in {@link DispErrCode} otherwise.
381     * @since 4.0
382     * @version 1.0
383     */
384    GetCmdReply([out] SharedMemQueue<int> reply);
385}
386