1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ci#ifndef OHOS_HDI_DISPLAY_V1_0_IDISPLAY_COMPOSER_VDI_H 17094332d3Sopenharmony_ci#define OHOS_HDI_DISPLAY_V1_0_IDISPLAY_COMPOSER_VDI_H 18094332d3Sopenharmony_ci 19094332d3Sopenharmony_ci#include <vector> 20094332d3Sopenharmony_ci#include <string> 21094332d3Sopenharmony_ci#include "buffer_handle.h" 22094332d3Sopenharmony_ci#include "v1_2/include/idisplay_composer_interface.h" 23094332d3Sopenharmony_ci#include "v1_0/display_composer_type.h" 24094332d3Sopenharmony_ci 25094332d3Sopenharmony_cinamespace OHOS { 26094332d3Sopenharmony_cinamespace HDI { 27094332d3Sopenharmony_cinamespace Display { 28094332d3Sopenharmony_cinamespace Composer { 29094332d3Sopenharmony_cinamespace V1_0 { 30094332d3Sopenharmony_ciusing namespace OHOS::HDI::Display::Composer::V1_0; 31094332d3Sopenharmony_ci 32094332d3Sopenharmony_ci#ifdef COMPOSER_VDI_DEFAULT_LIBRARY_ENABLE 33094332d3Sopenharmony_ci#define DISPLAY_COMPOSER_VDI_DEFAULT_LIBRARY "libdisplay_composer_vdi_impl_default.z.so" 34094332d3Sopenharmony_ci#endif // COMPOSER_VDI_DEFAULT_LIBRARY_ENABLE 35094332d3Sopenharmony_ci#define DISPLAY_COMPOSER_VDI_LIBRARY "libdisplay_composer_vdi_impl.z.so" 36094332d3Sopenharmony_ciclass IDisplayComposerVdi { 37094332d3Sopenharmony_cipublic: 38094332d3Sopenharmony_ci virtual ~IDisplayComposerVdi() = default; 39094332d3Sopenharmony_ci /** device func */ 40094332d3Sopenharmony_ci virtual int32_t RegHotPlugCallback(HotPlugCallback cb, void* data) = 0; 41094332d3Sopenharmony_ci virtual int32_t GetDisplayCapability(uint32_t devId, DisplayCapability& info) = 0; 42094332d3Sopenharmony_ci virtual int32_t GetDisplaySupportedModes(uint32_t devId, std::vector<DisplayModeInfo>& modes) = 0; 43094332d3Sopenharmony_ci virtual int32_t GetDisplayMode(uint32_t devId, uint32_t& modeId) = 0; 44094332d3Sopenharmony_ci virtual int32_t SetDisplayMode(uint32_t devId, uint32_t modeId) = 0; 45094332d3Sopenharmony_ci virtual int32_t GetDisplayPowerStatus(uint32_t devId, DispPowerStatus& status) = 0; 46094332d3Sopenharmony_ci virtual int32_t SetDisplayPowerStatus(uint32_t devId, DispPowerStatus status) = 0; 47094332d3Sopenharmony_ci virtual int32_t GetDisplayBacklight(uint32_t devId, uint32_t& level) = 0; 48094332d3Sopenharmony_ci virtual int32_t SetDisplayBacklight(uint32_t devId, uint32_t level) = 0; 49094332d3Sopenharmony_ci virtual int32_t GetDisplayProperty(uint32_t devId, uint32_t id, uint64_t& value) = 0; 50094332d3Sopenharmony_ci virtual int32_t GetDisplayCompChange( 51094332d3Sopenharmony_ci uint32_t devId, std::vector<uint32_t>& layers, std::vector<int32_t>& types) = 0; 52094332d3Sopenharmony_ci virtual int32_t SetDisplayClientCrop(uint32_t devId, const IRect& rect) = 0; 53094332d3Sopenharmony_ci virtual int32_t SetDisplayClientBuffer(uint32_t devId, const BufferHandle& buffer, int32_t fence) = 0; 54094332d3Sopenharmony_ci virtual int32_t SetDisplayClientDamage(uint32_t devId, std::vector<IRect>& rects) = 0; 55094332d3Sopenharmony_ci virtual int32_t SetDisplayVsyncEnabled(uint32_t devId, bool enabled) = 0; 56094332d3Sopenharmony_ci virtual int32_t RegDisplayVBlankCallback(uint32_t devId, VBlankCallback cb, void* data) = 0; 57094332d3Sopenharmony_ci virtual int32_t GetDisplayReleaseFence( 58094332d3Sopenharmony_ci uint32_t devId, std::vector<uint32_t>& layers, std::vector<int32_t>& fences) = 0; 59094332d3Sopenharmony_ci virtual int32_t CreateVirtualDisplay(uint32_t width, uint32_t height, int32_t& format, uint32_t& devId) = 0; 60094332d3Sopenharmony_ci virtual int32_t DestroyVirtualDisplay(uint32_t devId) = 0; 61094332d3Sopenharmony_ci virtual int32_t SetVirtualDisplayBuffer(uint32_t devId, const BufferHandle& buffer, const int32_t fence) = 0; 62094332d3Sopenharmony_ci virtual int32_t SetDisplayProperty(uint32_t devId, uint32_t id, uint64_t value) = 0; 63094332d3Sopenharmony_ci virtual int32_t Commit(uint32_t devId, int32_t& fence) = 0; 64094332d3Sopenharmony_ci /* layer func */ 65094332d3Sopenharmony_ci virtual int32_t CreateLayer(uint32_t devId, const LayerInfo& layerInfo, uint32_t& layerId) = 0; 66094332d3Sopenharmony_ci virtual int32_t DestroyLayer(uint32_t devId, uint32_t layerId) = 0; 67094332d3Sopenharmony_ci virtual int32_t PrepareDisplayLayers(uint32_t devId, bool& needFlushFb) = 0; 68094332d3Sopenharmony_ci virtual int32_t SetLayerAlpha(uint32_t devId, uint32_t layerId, const LayerAlpha& alpha) = 0; 69094332d3Sopenharmony_ci virtual int32_t SetLayerRegion(uint32_t devId, uint32_t layerId, const IRect& rect) = 0; 70094332d3Sopenharmony_ci virtual int32_t SetLayerCrop(uint32_t devId, uint32_t layerId, const IRect& rect) = 0; 71094332d3Sopenharmony_ci virtual int32_t SetLayerZorder(uint32_t devId, uint32_t layerId, uint32_t zorder) = 0; 72094332d3Sopenharmony_ci virtual int32_t SetLayerPreMulti(uint32_t devId, uint32_t layerId, bool preMul) = 0; 73094332d3Sopenharmony_ci virtual int32_t SetLayerTransformMode(uint32_t devId, uint32_t layerId, TransformType type) = 0; 74094332d3Sopenharmony_ci virtual int32_t SetLayerDirtyRegion(uint32_t devId, uint32_t layerId, const std::vector<IRect>& rects) = 0; 75094332d3Sopenharmony_ci virtual int32_t SetLayerVisibleRegion(uint32_t devId, uint32_t layerId, std::vector<IRect>& rects) = 0; 76094332d3Sopenharmony_ci virtual int32_t SetLayerBuffer(uint32_t devId, uint32_t layerId, const BufferHandle& buffer, int32_t fence) = 0; 77094332d3Sopenharmony_ci virtual int32_t SetLayerCompositionType(uint32_t devId, uint32_t layerId, CompositionType type) = 0; 78094332d3Sopenharmony_ci virtual int32_t SetLayerBlendType(uint32_t devId, uint32_t layerId, BlendType type) = 0; 79094332d3Sopenharmony_ci virtual int32_t SetLayerMaskInfo(uint32_t devId, uint32_t layerId, const MaskInfo maskInfo) = 0; 80094332d3Sopenharmony_ci virtual int32_t SetLayerColor(uint32_t devId, uint32_t layerId, const LayerColor& layerColor) = 0; 81094332d3Sopenharmony_ci}; 82094332d3Sopenharmony_ci 83094332d3Sopenharmony_ciusing CreateComposerVdiFunc = IDisplayComposerVdi* (*)(); 84094332d3Sopenharmony_ciusing DestroyComposerVdiFunc = void (*)(IDisplayComposerVdi* vdi); 85094332d3Sopenharmony_ciextern "C" IDisplayComposerVdi* CreateComposerVdi(); 86094332d3Sopenharmony_ciextern "C" void DestroyComposerVdi(IDisplayComposerVdi* vdi); 87094332d3Sopenharmony_ci} // namespace V1_0 88094332d3Sopenharmony_ci} // namespace Composer 89094332d3Sopenharmony_ci} // namespace Display 90094332d3Sopenharmony_ci} // namespace HDI 91094332d3Sopenharmony_ci} // namespace OHOS 92094332d3Sopenharmony_ci#endif // OHOS_HDI_DISPLAY_V1_0_IDISPLAY_COMPOSER_VDI_H 93