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 16 #ifndef OHOS_HDI_DISPLAY_V1_0_IDISPLAY_COMPOSER_VDI_H 17 #define OHOS_HDI_DISPLAY_V1_0_IDISPLAY_COMPOSER_VDI_H 18 19 #include <vector> 20 #include <string> 21 #include "buffer_handle.h" 22 #include "v1_0/include/idisplay_composer_interface.h" 23 #include "v1_0/display_composer_type.h" 24 25 namespace OHOS { 26 namespace HDI { 27 namespace Display { 28 namespace Composer { 29 namespace V1_0 { 30 using namespace OHOS::HDI::Display::Composer::V1_0; 31 32 #ifdef COMPOSER_VDI_DEFAULT_LIBRARY_ENABLE 33 #define DISPLAY_COMPOSER_VDI_DEFAULT_LIBRARY "libdisplay_composer_vdi_impl_default.z.so" 34 #endif // COMPOSER_VDI_DEFAULT_LIBRARY_ENABLE 35 #define DISPLAY_COMPOSER_VDI_LIBRARY "libdisplay_composer_vdi_impl.z.so" 36 class IDisplayComposerVdi { 37 public: 38 virtual ~IDisplayComposerVdi() = default; 39 /** device func */ 40 virtual int32_t RegHotPlugCallback(HotPlugCallback cb, void* data) = 0; 41 virtual int32_t GetDisplayCapability(uint32_t devId, DisplayCapability& info) = 0; 42 virtual int32_t GetDisplaySupportedModes(uint32_t devId, std::vector<DisplayModeInfo>& modes) = 0; 43 virtual int32_t GetDisplayMode(uint32_t devId, uint32_t& modeId) = 0; 44 virtual int32_t SetDisplayMode(uint32_t devId, uint32_t modeId) = 0; 45 virtual int32_t GetDisplayPowerStatus(uint32_t devId, DispPowerStatus& status) = 0; 46 virtual int32_t SetDisplayPowerStatus(uint32_t devId, DispPowerStatus status) = 0; 47 virtual int32_t GetDisplayBacklight(uint32_t devId, uint32_t& level) = 0; 48 virtual int32_t SetDisplayBacklight(uint32_t devId, uint32_t level) = 0; 49 virtual int32_t GetDisplayProperty(uint32_t devId, uint32_t id, uint64_t& value) = 0; 50 virtual int32_t GetDisplayCompChange( 51 uint32_t devId, std::vector<uint32_t>& layers, std::vector<int32_t>& types) = 0; 52 virtual int32_t SetDisplayClientCrop(uint32_t devId, const IRect& rect) = 0; 53 virtual int32_t SetDisplayClientBuffer(uint32_t devId, const BufferHandle& buffer, int32_t fence) = 0; 54 virtual int32_t SetDisplayClientDamage(uint32_t devId, std::vector<IRect>& rects) = 0; 55 virtual int32_t SetDisplayVsyncEnabled(uint32_t devId, bool enabled) = 0; 56 virtual int32_t RegDisplayVBlankCallback(uint32_t devId, VBlankCallback cb, void* data) = 0; 57 virtual int32_t GetDisplayReleaseFence( 58 uint32_t devId, std::vector<uint32_t>& layers, std::vector<int32_t>& fences) = 0; 59 virtual int32_t CreateVirtualDisplay(uint32_t width, uint32_t height, int32_t& format, uint32_t& devId) = 0; 60 virtual int32_t DestroyVirtualDisplay(uint32_t devId) = 0; 61 virtual int32_t SetVirtualDisplayBuffer(uint32_t devId, const BufferHandle& buffer, const int32_t fence) = 0; 62 virtual int32_t SetDisplayProperty(uint32_t devId, uint32_t id, uint64_t value) = 0; 63 virtual int32_t Commit(uint32_t devId, int32_t& fence) = 0; 64 /* layer func */ 65 virtual int32_t CreateLayer(uint32_t devId, const LayerInfo& layerInfo, uint32_t& layerId) = 0; 66 virtual int32_t DestroyLayer(uint32_t devId, uint32_t layerId) = 0; 67 virtual int32_t PrepareDisplayLayers(uint32_t devId, bool& needFlushFb) = 0; 68 virtual int32_t SetLayerAlpha(uint32_t devId, uint32_t layerId, const LayerAlpha& alpha) = 0; 69 virtual int32_t SetLayerRegion(uint32_t devId, uint32_t layerId, const IRect& rect) = 0; 70 virtual int32_t SetLayerCrop(uint32_t devId, uint32_t layerId, const IRect& rect) = 0; 71 virtual int32_t SetLayerZorder(uint32_t devId, uint32_t layerId, uint32_t zorder) = 0; 72 virtual int32_t SetLayerPreMulti(uint32_t devId, uint32_t layerId, bool preMul) = 0; 73 virtual int32_t SetLayerTransformMode(uint32_t devId, uint32_t layerId, TransformType type) = 0; 74 virtual int32_t SetLayerDirtyRegion(uint32_t devId, uint32_t layerId, const std::vector<IRect>& rects) = 0; 75 virtual int32_t SetLayerVisibleRegion(uint32_t devId, uint32_t layerId, std::vector<IRect>& rects) = 0; 76 virtual int32_t SetLayerBuffer(uint32_t devId, uint32_t layerId, const BufferHandle& buffer, int32_t fence) = 0; 77 virtual int32_t SetLayerCompositionType(uint32_t devId, uint32_t layerId, CompositionType type) = 0; 78 virtual int32_t SetLayerBlendType(uint32_t devId, uint32_t layerId, BlendType type) = 0; 79 virtual int32_t SetLayerMaskInfo(uint32_t devId, uint32_t layerId, const MaskInfo maskInfo) = 0; 80 virtual int32_t SetLayerColor(uint32_t devId, uint32_t layerId, const LayerColor& layerColor) = 0; 81 }; 82 83 using CreateComposerVdiFunc = IDisplayComposerVdi* (*)(); 84 using DestroyComposerVdiFunc = void (*)(IDisplayComposerVdi* vdi); 85 extern "C" IDisplayComposerVdi* CreateComposerVdi(); 86 extern "C" void DestroyComposerVdi(IDisplayComposerVdi* vdi); 87 } // namespace V1_0 88 } // namespace Composer 89 } // namespace Display 90 } // namespace HDI 91 } // namespace OHOS 92 #endif // OHOS_HDI_DISPLAY_V1_0_IDISPLAY_COMPOSER_VDI_H 93