• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 
17 #ifndef HDI_DISPLAY_HOST_PROXY_BASE_H
18 #define HDI_DISPLAY_HOST_PROXY_BASE_H
19 
20 #include <iremote_proxy.h>
21 #include "display_device_common.h"
22 #include "ihdi_display_register_callback_framework.h"
23 
24 #undef HDF_LOG_TAG
25 #define HDF_LOG_TAG DisplayHostProxyBase
26 
27 using ComposerServerTmp = struct {
28     DisplayDeviceCommandId cmdId;
29     int32_t returnVal;
30     int32_t arrayNum;
31 };
32 
33 namespace OHOS {
34 namespace Display {
35 namespace Device {
36 using OHOS::MessageOption;
37 using OHOS::MessageParcel;
38 using OHOS::sptr;
39 class IDisplayDevice : public IRemoteBroker {
40 public:
41     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DISPLAY.Device.Client.IDisplayDevice.V1_0");
42     virtual ~IDisplayDevice() = default;
43     static void Initialize(void);
44     /* device proxy */
45     virtual int32_t RegHotPlugCallback(HotPlugCallback callback, void *data) = 0;
46     virtual int32_t GetDisplayCapability(uint32_t devId, DisplayCapability &info) = 0;
47     virtual int32_t GetDisplaySupportedModes(uint32_t devId, uint32_t &num, DisplayModeInfo *modes) = 0;
48     virtual int32_t GetDisplayMode(uint32_t devId, uint32_t &modeId) = 0;
49     virtual int32_t SetDisplayMode(uint32_t devId, uint32_t modeId) = 0;
50     virtual int32_t GetDisplayPowerStatus(uint32_t devId, DispPowerStatus &status) = 0;
51     virtual int32_t SetDisplayPowerStatus(uint32_t devId, DispPowerStatus status) = 0;
52     virtual int32_t GetDisplayBacklight(uint32_t devId, uint32_t &level) = 0;
53     virtual int32_t SetDisplayBacklight(uint32_t devId, uint32_t level) = 0;
54     virtual int32_t GetDisplayProperty(uint32_t devId, uint32_t id, uint64_t &value) = 0;
55     virtual int32_t SetDisplayProperty(uint32_t devId, uint32_t id, uint64_t value) = 0;
56     virtual int32_t PrepareDisplayLayers(uint32_t devId, bool &needFlushFb) = 0;
57     virtual int32_t GetDisplayCompChange(uint32_t devId, uint32_t &num, uint32_t *layers, int32_t *type) = 0;
58     virtual int32_t SetDisplayClientCrop(uint32_t devId, const IRect *rect) = 0;
59     virtual int32_t SetDisplayClientDestRect(uint32_t devId, const IRect &rect) = 0;
60     virtual int32_t SetDisplayClientBuffer(uint32_t devId, const BufferHandle &buffer, int32_t fence) = 0;
61     virtual int32_t SetDisplayClientDamage(uint32_t devId, uint32_t num, const IRect &rect) = 0;
62     virtual int32_t SetDisplayVsyncEnabled(uint32_t devId, bool enabled) = 0;
63     virtual int32_t RegDisplayVBlankCallback(uint32_t devId, VBlankCallback callback, void *data) = 0;
64     virtual int32_t GetDisplayReleaseFence(uint32_t devId, uint32_t *num, uint32_t *layers, int32_t *fences) = 0;
65     virtual int32_t Commit(uint32_t devId, int32_t &fence) = 0;
66     virtual int32_t InvokeDisplayCmd(uint32_t devId, ...) = 0;
67     virtual int32_t CreateVirtualDisplay(uint32_t width, uint32_t height, int32_t &format, uint32_t &devId) = 0;
68     virtual int32_t DestroyVirtualDisplay(uint32_t devId) = 0;
69     virtual int32_t SetVirtualDisplayBuffer(uint32_t devId, const BufferHandle *buffer, int32_t fence) = 0;
70     virtual int32_t RegDisplayRefreshCallback(uint32_t devId, RefreshCallback callback, void *data) = 0;
71     virtual int32_t GetWriteBackFrame(uint32_t devId, BufferHandle &buffer, int32_t &fence) = 0;
72     virtual int32_t CreateWriteBack(uint32_t &devId, uint32_t width, uint32_t height, int32_t &format) = 0;
73     virtual int32_t DestroyWriteBack(uint32_t devId) = 0;
74     virtual int32_t SetProxyRemoteCallback(const OHOS::sptr<DisplayRegisterCallbackBase> &callback) = 0;
75     /* layer proxy */
76     virtual int32_t CreateLayer(uint32_t devId, const LayerInfo &layerInfo, uint32_t &layerId) = 0;
77     virtual int32_t SetLayerVisible(uint32_t devId, uint32_t layerId, bool visible) = 0;
78     virtual int32_t GetLayerVisibleState(uint32_t devId, uint32_t layerId, bool &visible) = 0;
79     virtual int32_t SetLayerCrop(uint32_t devId, uint32_t layerId, const IRect *rect) = 0;
80     virtual int32_t SetLayerZorder(uint32_t devId, uint32_t layerId, uint32_t zorder) = 0;
81     virtual int32_t GetLayerZorder(uint32_t devId, uint32_t layerId, uint32_t &zorder) = 0;
82     virtual int32_t SetLayerPreMulti(uint32_t devId, uint32_t layerId, bool preMul) = 0;
83     virtual int32_t GetLayerPreMulti(uint32_t devId, uint32_t layerId, bool &preMul) = 0;
84     virtual int32_t SetLayerAlpha(uint32_t devId, uint32_t layerId, const LayerAlpha &alpha) = 0;
85     virtual int32_t GetLayerAlpha(uint32_t devId, uint32_t layerId, LayerAlpha &alpha) = 0;
86     virtual int32_t SetLayerColorKey(uint32_t devId, uint32_t layerId, bool enable, uint32_t key) = 0;
87     virtual int32_t GetLayerColorKey(uint32_t devId, uint32_t layerId, bool *enable, uint32_t *key) = 0;
88     virtual int32_t SetLayerPalette(uint32_t devId, uint32_t layerId, const uint32_t *palette, uint32_t len) = 0;
89     virtual int32_t GetLayerPalette(uint32_t devId, uint32_t layerId, uint32_t &palette, uint32_t len) = 0;
90     virtual int32_t SetLayerCompression(uint32_t devId, uint32_t layerId, int32_t compType) = 0;
91     virtual int32_t GetLayerCompression(uint32_t devId, uint32_t layerId, int32_t &compType) = 0;
92     virtual int32_t Flush(uint32_t devId, uint32_t layerId, LayerBuffer &buffer) = 0;
93     virtual int32_t SetLayerDirtyRegion(uint32_t devId, uint32_t layerId, uint32_t num, const IRect &region) = 0;
94     virtual int32_t GetLayerBuffer(uint32_t devId, uint32_t layerId, LayerBuffer *buffer) = 0;
95     virtual int32_t SetTransformMode(uint32_t devId, uint32_t layerId, TransformType type) = 0;
96     virtual int32_t CloseLayer(uint32_t devId, uint32_t layerId) = 0;
97     virtual int32_t SetLayerSize(uint32_t devId, uint32_t layerId, const IRect *rect) = 0;
98     virtual int32_t GetLayerSize(uint32_t devId, uint32_t layerId, IRect &rect) = 0;
99     virtual int32_t WaitForVBlank(uint32_t devId, uint32_t layerId, int32_t timeOut) = 0;
100     virtual int32_t InitDisplay(uint32_t devId) = 0;
101     virtual int32_t DeinitDisplay(uint32_t devId) = 0;
102     virtual int32_t GetDisplayInfo(uint32_t devId, DisplayInfo &dispInfo) = 0;
103     virtual int32_t SnapShot(uint32_t devId, LayerBuffer &buffer) = 0;
104     virtual int32_t SetLayerVisibleRegion(uint32_t devId, uint32_t layerId, uint32_t num, const IRect &rect) = 0;
105     virtual int32_t SetLayerBuffer(uint32_t devId, uint32_t layerId, const BufferHandle &buffer, int32_t fence) = 0;
106     virtual int32_t InvokeLayerCmd(uint32_t devId, uint32_t layerId, uint32_t cmd, ...) = 0;
107     virtual int32_t SetLayerCompositionType(uint32_t devId, uint32_t layerId, CompositionType type) = 0;
108     virtual int32_t SetLayerBlendType(uint32_t devId, uint32_t layerId, BlendType type) = 0;
109     sptr<DisplayRegisterCallbackFramework> m_hotPlugObject_;
110 };
111 } // namespace Device
112 } // namespace Display
113 } // namespace OHOS
114 
115 #endif // HDI_DISPLAY_HOST_PROXY_BASE_H
116