From fee3399357d0e2ba203ced301f6bfdfae665f789 Mon Sep 17 00:00:00 2001 From: machangyu <16025333+machangyu1@user.noreply.gitee.com> Date: Wed, 20 Aug 2025 10:30:34 +0800 Subject: [PATCH 1/2] display composor add tunnel HDI interface Signed-off-by: liujiabinit --- .../include/display_vdi_adapter_interface.h | 17 +++- display/composer/v1_3/DisplayComposerType.idl | 22 +++++ display/composer/v1_3/IDisplayComposer.idl | 85 ++++++++++++++++++ .../v1_3/hdi_impl/display_composer_hdi_impl.h | 49 +++++++++++ .../include/idisplay_composer_interface.h | 86 +++++++++++++++++++ 5 files changed, 258 insertions(+), 1 deletion(-) diff --git a/display/composer/common/include/display_vdi_adapter_interface.h b/display/composer/common/include/display_vdi_adapter_interface.h index fc2465b7..727287e8 100644 --- a/display/composer/common/include/display_vdi_adapter_interface.h +++ b/display/composer/common/include/display_vdi_adapter_interface.h @@ -20,6 +20,8 @@ #include #include "base/buffer_handle.h" #include "v1_0/include/idisplay_composer_interface.h" +#include "v1_2/include/idisplay_composer_interface.h" +#include "v1_3/include/idisplay_composer_interface.h" #include "v1_0/display_composer_type.h" #include "v1_2/display_composer_type.h" #include "v1_3/display_composer_type.h" @@ -100,6 +102,13 @@ struct DisplayComposerVdiAdapter { int32_t (*ClearLayerBuffer)(uint32_t devId, uint32_t layerId); int32_t (*GetDisplayIdentificationData)(uint32_t devId, uint8_t& portId, std::vector& edidData); int32_t (*RegHwcEventCallback)(HwcEventCallback cb, void *data); + int32_t (*GetSupportLayerType)(uint32_t devId, std::vector& types); + int32_t (*SetTunnelLayerId)(uint32_t devId, uint32_t layerId, uint64_t tunnelId); + int32_t (*SetTunnelLayerProperty)(uint32_t devId, uint32_t layerId, uint32_t property); + int32_t (*SetTunnelLayerPosition)(uint32_t devId, uint64_t tunnelId, int32_t x, int32_t y); + int32_t (*SetTunnelLayerBuffer)(uint32_t devId, uint64_t tunnelId, + const BufferHandle* inHandle, const int32_t acquireFence); + int32_t (*CommitTunnelLayer)(uint32_t devId, uint64_t tunnelId, int32_t& releaseFence); }; using LoadVdiImplFunc = int32_t (*)(); @@ -169,7 +178,13 @@ using ClearDisplayClientBufferFunc = int32_t (*)(uint32_t devId); using ClearLayerBufferFunc = int32_t (*)(uint32_t devId, uint32_t layerId); using GetDisplayIdentificationDataFunc = int32_t (*)(uint32_t devId, uint8_t& portId, std::vector& edidData); using RegHwcEventCallbackFunc = int32_t (*)(HwcEventCallback cb, void *data); - +using GetSupportLayerTypeFunc = int32_t (*)(uint32_t devId, std::vector& types); +using SetTunnelLayerIdFunc = int32_t (*)(uint32_t devId, uint32_t layerId, uint64_t tunnelId); +using SetTunnelLayerPropertyFunc = int32_t (*)(uint32_t devId, uint32_t layerId, uint32_t property); +using SetTunnelLayerPositionFunc = int32_t (*)(uint32_t devId, uint64_t tunnelId, int32_t x, int32_t y); +using SetTunnelLayerBufferFunc = int32_t (*)(uint32_t devId, uint64_t tunnelId, + const BufferHandle* inHandle, const int32_t acquireFence); +using CommitTunnelLayerFunc = int32_t (*)(uint32_t devId, uint64_t tunnelId, int32_t& releaseFence); } // namespace Composer } // namespace Display diff --git a/display/composer/v1_3/DisplayComposerType.idl b/display/composer/v1_3/DisplayComposerType.idl index fc7c504c..c31e20c6 100644 --- a/display/composer/v1_3/DisplayComposerType.idl +++ b/display/composer/v1_3/DisplayComposerType.idl @@ -45,3 +45,25 @@ import ohos.hdi.display.composer.v1_0.DisplayComposerType; import ohos.hdi.display.composer.v1_1.DisplayComposerType; import ohos.hdi.display.composer.v1_2.DisplayComposerType; +/** + * @brief Enumerates the property id of tunnel layer. + * + * @since 6.0 + * @version 1.0 + */ +enum TunnelLayerProperty { + TUNNEL_PROP_INVALID = 0, /**< invalid tunnel layer property */ + TUNNEL_PROP_POSTION = (1 << 0), /**< update layer position by tunnel */ + TUNNEL_PROP_BUFFER_ADDR = (1 << 1), /**< update layer buffer address by tunnel */ + TUNNEL_PROP_CLIENT_COMMIT = (1 << 2), /**< tunnel layer update by client */ + TUNNEL_PROP_DEVICE_COMMIT = (1 << 3), /**< tunnel layer update by device */ + TUNNEL_PROP_SECURE_DEVICE_COMMIT = (1 << 4), /**< tunnel layer update by secure device */ +}; + +/** + * @brief Enumerates layer types. + * + */ +enum LayerType : ohos.hdi.display.composer.v1_0.LayerType { + LAYER_TYPE_TUNNEL, /**< Tunnel layer */ +}; diff --git a/display/composer/v1_3/IDisplayComposer.idl b/display/composer/v1_3/IDisplayComposer.idl index fa6dc0e6..3d87aa7c 100644 --- a/display/composer/v1_3/IDisplayComposer.idl +++ b/display/composer/v1_3/IDisplayComposer.idl @@ -34,4 +34,89 @@ interface IDisplayComposer extends ohos.hdi.display.composer.v1_2.IDisplayCompos * @version 1.0 */ RegHwcEventCallback([in] IHwcEventCallback cb); + + /** + * @brief returns the list of supported layer types + * + * @param devId Indicates the ID of the display device. + * @param types Indicates the supported layer types + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + GetSupportLayerType([in] unsigned int devId, [out] struct LayerType[] types); + + /** + * @brief Set TunnelId for the tunnel layer + * + * @param devId Indicates the ID of the display device. + * @param layerId Indicates the ID of the layer to be operated on. + * @param tunnelId Indicates the ID of the tunnel layer. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + SetTunnelLayerId([in] unsigned int devId, [in] unsigned int layerId, [in] unsigned long tunnelId); + + /** + * @brief Set Tunnel property for the tunnel layer + * + * @param devId Indicates the ID of the display device. + * @param layerId Indicates the ID of the layer to be operated on. + * @param property Indicates the property of the tunnel layer. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + SetTunnelLayerProperty([in] unsigned int devId, [in] unsigned int layerId, [in] unsigned int property); + + /** + * @brief Set position parameter for for the tunnel layer. + * + * @param devId Indicates the ID of the display device. + * @param tunnelId Indicates the ID of the tunnel layer. + * @param x Indicates coordinate. + * @param y Indicates coordinate. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + SetTunnelLayerPosition([in] unsigned int devId, [in] unsigned long tunnelId, [in] int x, [in] int y); + + /** + * @brief Set layer buffer address for the tunnel layer. + * + * @param devId Indicates the ID of the display device. + * @param tunnelId Indicates the ID of the tunnel layer. + * @param bufferAddr Indicates buffer address. + * @param acquireFence Indicates buffer fence. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + SetTunnelLayerBuffer([in] unsigned int devId, [in] unsigned long tunnelId, [in] NativeBuffer inHandle, [in] HdifdParcelable acquireFence); + + /** + * @brief slave tunnel commit tunnel layer + * + * @param devId Indicates the ID of the display device. + * @param tunnelId Indicates the ID of the layer to be operated on. + * @param releaseFence Indicates release buffer fence. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + CommitTunnelLayer([in] unsigned int devId, [in] unsigned long tunnelId, [out] HdifdParcelable releaseFence); } diff --git a/display/composer/v1_3/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_3/hdi_impl/display_composer_hdi_impl.h index ba4f2368..d0e182ff 100644 --- a/display/composer/v1_3/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_3/hdi_impl/display_composer_hdi_impl.h @@ -88,6 +88,55 @@ public: return ToDispErrCode(hdi_v1_3_->RegHwcEventCallback(this)); } + virtual int32_t GetSupportLayerType(uint32_t devId, std::vector& types) override + { + COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_3_); + return ToDispErrCode(hdi_v1_3_->GetSupportLayerType(devId, types)); + } + + virtual int32_t SetTunnelLayerId(uint32_t devId, uint32_t layerId, uint64_t tunnelId) override + { + COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_3_); + return ToDispErrCode(hdi_v1_3_->SetTunnelLayerId(devId, layerId, tunnelId)); + } + + virtual int32_t SetTunnelLayerProperty(uint32_t devId, uint32_t layerId, uint32_t property) override + { + COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_3_); + return ToDispErrCode(hdi_v1_3_->SetTunnelLayerProperty(devId, layerId, property)); + } + + virtual int32_t SetTunnelLayerPosition(uint32_t devId, uint64_t tunnelId, int32_t x, int32_t y) override + { + COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_3_); + return ToDispErrCode(hdi_v1_3_->SetTunnelLayerPosition(devId, tunnelId, x, y)); + } + + virtual int32_t SetTunnelLayerBuffer(uint32_t devId, uint64_t tunnelId, + const BufferHandle* inHandle, const int32_t acquireFence) override + { + COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_3_); + COMPOSER_CHECK_NULLPTR_RETURN(inHandle); + sptr hdiBuffer = new NativeBuffer(inHandle); + COMPOSER_CHECK_NULLPTR_RETURN(hdiBuffer); + sptr hdiFence(new HdifdParcelable); + COMPOSER_CHECK_NULLPTR_RETURN(hdiFence); + hdiFence->Init(acquireFence); + return ToDispErrCode(hdi_v1_3_->SetTunnelLayerBuffer(devId, tunnelId, hdiBuffer, hdiFence)); + } + + virtual int32_t CommitTunnelLayer(uint32_t devId, uint64_t tunnelId, int32_t& releaseFence) override + { + COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_3_); + sptr hdiFence; + int32_t ret = ToDispErrCode(hdi_v1_3_->CommitTunnelLayer(devId, tunnelId, hdiFence)); + if (ret != DISPLAY_SUCCESS) { + return ret; + } + COMPOSER_CHECK_NULLPTR_RETURN(hdiFence); + releaseFence = hdiFence->Move(); + return DISPLAY_SUCCESS; + } protected: using BaseType1_2 = V1_2::DisplayComposerHdiImpl; using BaseType1_2::WAIT_TIME_INTERVAL; diff --git a/display/composer/v1_3/include/idisplay_composer_interface.h b/display/composer/v1_3/include/idisplay_composer_interface.h index 71aa127f..dcd37a3b 100644 --- a/display/composer/v1_3/include/idisplay_composer_interface.h +++ b/display/composer/v1_3/include/idisplay_composer_interface.h @@ -49,6 +49,92 @@ public: * @version 1.0 */ virtual int32_t RegHwcEventCallback(HwcEventCallback cb, void *data) = 0; + + /** + * @brief returns the list of supported layer types + * + * @param devId Indicates the ID of the display device. + * @param types Indicates the supported layer types + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + virtual int32_t GetSupportLayerType(uint32_t devId, std::vector& types) = 0; + + /** + * @brief Set TunnelId for the tunnel layer + * + * @param devId Indicates the ID of the display device. + * @param layerId Indicates the ID of the layer to be operated on. + * @param tunnelId Indicates the ID of the tunnel layer. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + virtual int32_t SetTunnelLayerId(uint32_t devId, uint32_t layerId, uint64_t tunnelId) = 0; + + /** + * @brief Set Tunnel property for the tunnel layer + * + * @param devId Indicates the ID of the display device. + * @param layerId Indicates the ID of the layer to be operated on. + * @param property Indicates the property of the tunnel layer. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + virtual int32_t SetTunnelLayerProperty(uint32_t devId, uint32_t layerId, uint32_t property) = 0; + + /** + * @brief Set position parameter for for the tunnel layer. + * + * @param devId Indicates the ID of the display device. + * @param tunnelId Indicates the ID of the tunnel layer. + * @param x Indicates coordinate. + * @param y Indicates coordinate. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + virtual int32_t SetTunnelLayerPosition(uint32_t devId, uint64_t tunnelId, int32_t x, int32_t y) = 0; + + /** + * @brief Set layer buffer address for the tunnel layer. + * + * @param devId Indicates the ID of the display device. + * @param tunnelId Indicates the ID of the tunnel layer. + * @param bufferAddr Indicates buffer address. + * @param acquireFence Indicates buffer fence. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + virtual int32_t SetTunnelLayerBuffer(uint32_t devId, uint64_t tunnelId, + const BufferHandle* inHandle, const int32_t acquireFence) = 0; + + /** + * @brief slave tunnel commit tunnel layer + * + * @param devId Indicates the ID of the display device. + * @param tunnelId Indicates the ID of the layer to be operated on. + * @param releaseFence Indicates release buffer fence. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + virtual int32_t CommitTunnelLayer(uint32_t devId, uint64_t tunnelId, int32_t& releaseFence) = 0; }; } // V1_3 } // Composer -- Gitee From bcce7e9cd90f4f659ec90c24ede30fe10948e388 Mon Sep 17 00:00:00 2001 From: liujiabin Date: Tue, 26 Aug 2025 01:26:28 +0000 Subject: [PATCH 2/2] update display/composer/v1_3/IDisplayComposer.idl. Signed-off-by: liujiabin --- display/composer/v1_3/IDisplayComposer.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/composer/v1_3/IDisplayComposer.idl b/display/composer/v1_3/IDisplayComposer.idl index 3d87aa7c..9b66286b 100644 --- a/display/composer/v1_3/IDisplayComposer.idl +++ b/display/composer/v1_3/IDisplayComposer.idl @@ -96,7 +96,7 @@ interface IDisplayComposer extends ohos.hdi.display.composer.v1_2.IDisplayCompos * * @param devId Indicates the ID of the display device. * @param tunnelId Indicates the ID of the tunnel layer. - * @param bufferAddr Indicates buffer address. + * @param inHandle Indicates layer buffer. * @param acquireFence Indicates buffer fence. * * @return Returns 0 if the operation is successful; returns an error code defined -- Gitee