1 /*
2  * Copyright (c) 2024 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_V1_2_IDISPLAY_COMPOSER_INTERFACE_H
17 #define OHOS_HDI_DISPLAY_V1_2_IDISPLAY_COMPOSER_INTERFACE_H
18 
19 #include "v1_1/include/idisplay_composer_interface.h"
20 #include "v1_2/display_composer_type.h"
21 
22 namespace OHOS {
23 namespace HDI {
24 namespace Display {
25 namespace Composer {
26 namespace V1_2 {
27 
28 class IDisplayComposerInterface : public V1_1::IDisplayComposerInterface {
29 public:
30     /**
31      * @brief Obtains all interfaces of IDisplayComposerInterface.
32      *
33      * @return Returns <b>IDisplayComposerInterface*</b> if the operation is successful;
34      * returns an null point otherwise.
35      * @since 5.0
36      * @version 1.2
37      */
38     static IDisplayComposerInterface* Get(bool needSMQ = true);
39 
40     /**
41      * @brief Commits the request for composition and display.
42      *        Obtains the fences of the display layers after the commit operation.
43      * If there is a hardware composition layer, the composition is performed and the composition result is sent to
44      * the hardware for display.
45      *
46      * @param devId Indicates the ID of the display device.
47      * @param fence Indicates the pointer to the start address of the fence.
48      * @param skipState Indicates the state of the skip validate feature.
49      * @param needFlush Indicates the pointer that specifies whether the graphics service needs to reset the display
50      * framebuffer by using <b>SetDisplayClientBuffer</b> before the commit operation.
51      * The value <b>true</b> means that the framebuffer needs to be reset, and <b>false</b> means the opposite.
52      *
53      * @return Returns <b>0</b> if the operation is successful; returns an error code defined
54      * in {@link DispErrCode} otherwise.
55      * @since 5.0
56      * @version 1.2
57      */
58     virtual int32_t CommitAndGetReleaseFence(uint32_t devId, int32_t& fence, int32_t& skipState,
59         bool& needFlush, std::vector<uint32_t>& layers, std::vector<int32_t>& fences, bool isValidated) = 0;
60 
61     virtual int32_t RegDisplayVBlankIdleCallback(VBlankIdleCallback cb, void* data) = 0;
62 
63     virtual int32_t SetDisplayConstraint(uint32_t devId, uint64_t frameID, uint64_t ns, uint32_t type) = 0;
64 
65     virtual int32_t ClearClientBuffer(uint32_t devId) = 0;
66 
67     virtual int32_t ClearLayerBuffer(uint32_t devId, uint32_t layerId) = 0;
68 
69     virtual int32_t SetHardwareCursorPosition(uint32_t devId, int32_t x, int32_t y) = 0;
70 
71     virtual int32_t EnableHardwareCursorStats(uint32_t devId, bool enable) = 0;
72 
73     virtual int32_t GetHardwareCursorStats(uint32_t devId, uint32_t& frameCount, uint32_t& vsyncCount) = 0;
74 };
75 } // V1_2
76 } // Composer
77 } // Display
78 } // HDI
79 } // OHOS
80 #endif // OHOS_HDI_DISPLAY_V1_2_IDISPLAY_COMPOSER_INTERFACE_H
81