From 9cb3945dc3c1b5cd9c602036777d34b8ed31688c Mon Sep 17 00:00:00 2001 From: huyx Date: Thu, 4 Sep 2025 15:46:56 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- display/bundle.json | 9 ++ .../include/display_vdi_adapter_interface.h | 16 ++++ display/composer/v1_0/BUILD.gn | 28 ++++++ .../display_command/display_cmd_responser.h | 53 ++++++----- .../v1_0/display_command/display_cmd_utils.h | 2 +- .../v1_0/hdi_impl/display_composer_hdi_impl.h | 26 +++++- display/composer/v1_2/IDisplayComposer.idl | 12 +-- .../display_command/display_cmd_responser.h | 14 +-- .../v1_2/hdi_impl/display_composer_hdi_impl.h | 6 +- display/composer/v1_3/BUILD.gn | 1 - display/composer/v1_3/DisplayComposerType.idl | 22 +++++ display/composer/v1_3/IDisplayComposer.idl | 87 ++++++++++++++++++- .../v1_3/hdi_impl/display_composer_hdi_impl.h | 49 +++++++++++ .../include/idisplay_composer_interface.h | 86 ++++++++++++++++++ display/graphic/common/v2_1/CMColorSpace.idl | 37 ++++++++ .../common/v2_2/BufferHandleMetaKeyType.idl | 13 ++- 16 files changed, 404 insertions(+), 57 deletions(-) diff --git a/display/bundle.json b/display/bundle.json index 189c568f..3533bdf9 100644 --- a/display/bundle.json +++ b/display/bundle.json @@ -50,6 +50,7 @@ "//drivers/interface/display/buffer/v1_3:libdisplay_buffer_hdi_impl_v1_3", "//drivers/interface/display/composer/cache_manager:libcomposer_buffer_cache", "//drivers/interface/display/composer/v1_0:display_composer_idl_target", + "//drivers/interface/display/composer/v1_0:libdisplay_composer_hdi_impl", "//drivers/interface/display/composer/v1_1:display_composer_idl_target", "//drivers/interface/display/composer/v1_1:libdisplay_composer_hdi_impl_1.1", "//drivers/interface/display/composer/v1_2:display_composer_idl_target", @@ -239,6 +240,14 @@ "header_base": "//drivers/interface/display/composer" } }, + { + "name": "//drivers/interface/display/composer/v1_0:libdisplay_composer_hdi_impl", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/composer" + } + }, { "name": "//drivers/interface/display/composer/v1_1:libdisplay_composer_proxy_1.1", "header": { diff --git a/display/composer/common/include/display_vdi_adapter_interface.h b/display/composer/common/include/display_vdi_adapter_interface.h index fc2465b7..2242842d 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" @@ -99,6 +101,13 @@ struct DisplayComposerVdiAdapter { int32_t (*ClearDisplayClientBuffer)(uint32_t devId); int32_t (*ClearLayerBuffer)(uint32_t devId, uint32_t layerId); int32_t (*GetDisplayIdentificationData)(uint32_t devId, uint8_t& portId, std::vector& edidData); + 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); int32_t (*RegHwcEventCallback)(HwcEventCallback cb, void *data); }; @@ -168,6 +177,13 @@ using FastPresentFunc = int32_t (*)(uint32_t devId, const PresentParam& param, 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 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); using RegHwcEventCallbackFunc = int32_t (*)(HwcEventCallback cb, void *data); diff --git a/display/composer/v1_0/BUILD.gn b/display/composer/v1_0/BUILD.gn index d6f2c1e8..76c0528b 100644 --- a/display/composer/v1_0/BUILD.gn +++ b/display/composer/v1_0/BUILD.gn @@ -32,3 +32,31 @@ hdi("display_composer") { public_configs = [ "../hdifd_parcelable/" ] } + +config("libdisplay_composer_hdi_impl_config") { + include_dirs = [ + "../", + "../hdifd_parcelable", + ] +} + +ohos_shared_library("libdisplay_composer_hdi_impl) { + sources = [ "hdi_impl/display_composer_interface.cpp" ] + + public_configs = [ ":libdisplay_composer_hdi_impl_config" ] + + deps = [ + "c_utils:utils", + "graphic_surface:buffer_handle", + "hdf_core:libhdi", + "hdf_core:libpub_utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "init:libbegetutil", + "ipc:ipc_single", + ] + + install_images = [ "system" ] + subsystem_name = "hdf" + part_name = "drivers_interface_display" +} diff --git a/display/composer/v1_0/display_command/display_cmd_responser.h b/display/composer/v1_0/display_command/display_cmd_responser.h index 628d8b11..d24394b5 100755 --- a/display/composer/v1_0/display_command/display_cmd_responser.h +++ b/display/composer/v1_0/display_command/display_cmd_responser.h @@ -227,7 +227,7 @@ protected: return request_->Read(reinterpret_cast(requestData.get()), inEleCnt, CmdUtils::TRANSFER_WAIT_TIME); } - + int32_t CmdRequestDataWrite(uint32_t outEleCnt) { std::lock_guard lock(replyMutex_); @@ -393,25 +393,26 @@ EXIT: } int32_t ret = devCache->SetDisplayClientBuffer(data.buffer, data.seqNo, needFreeBuffer, - [&](const BufferHandle& handle)->int32_t { + [&data, &needMoveFd, &fd, this](const BufferHandle& handle)->int32_t { #ifdef DISPLAY_COMSPOER_DEBUG_DUMP DumpLayerBuffer(data.devId, data.seqNo, data.fence, handle, "client_"); #endif - std::string traceMsg = ""; - if (data.buffer == nullptr) { - traceMsg = "data.buffer is nullptr! seqNo:" + std::to_string(data.seqNo); - } else { - traceMsg = "HDI:DISP:HARDWARE " - "height:" + std::to_string(data.buffer->height) + - " width:" + std::to_string(data.buffer->width) + - " data.buffer->fd:" + std::to_string(data.buffer->fd) + - " seqNo:" + std::to_string(data.seqNo); - } - traceMsg += " fd:" + std::to_string(fd); + HITRACE_METER_FMT(HITRACE_TAG_HDF, + "SetDisplayClientBuffer:%s data.devId:%d, data.buffer->fd:%d, data.seqNo:%d, fd:%d", + data.buffer == nullptr ? "data.buffer is nullptr!" : "", + data.devId, + data.buffer == nullptr ? -1 : data.buffer->fd, + data.seqNo, + fd); if (data.fence > ERROR_FENCE_COUNT) { - HDF_LOGI("SetDisplayClientBuffer: %{public}s", traceMsg.c_str()); + HDF_LOGI("SetDisplayClientBuffer:%{public}s data.devId:%{public}d, data.buffer->fd:%{public}d, + data.seqNo:%{public}d, fd:%{public}d", + data.buffer == nullptr ? "data.buffer is nullptr!" : "", + data.devId, + data.buffer == nullptr ? -1 : data.buffer->fd, + data.seqNo, + fd); } - HdfTrace traceVdi("SetDisplayClientBuffer", traceMsg); needMoveFd = true; int rc = impl_->SetDisplayClientBuffer(data.devId, handle, fd); DISPLAY_CHK_RETURN(rc != HDF_SUCCESS, HDF_FAILURE, HDF_LOGE(" fail")); @@ -873,21 +874,18 @@ EXIT: DISPLAY_CHECK(layerCache == nullptr, return HDF_FAILURE); int32_t ret = layerCache->SetLayerBuffer(data.buffer, data.seqNo, needFreeBuffer, deletingList, - [&](const BufferHandle& handle)->int32_t { + [&data, &needMoveFd, &fd, this](const BufferHandle& handle)->int32_t { #ifdef DISPLAY_COMSPOER_DEBUG_DUMP DumpLayerBuffer(data.devId, data.layerId, data.fence, handle, "layer_"); #endif - std::string traceMsg = ""; - if (data.buffer == nullptr) { - traceMsg = "data.buffer is nullptr! seqNo:" + std::to_string(data.seqNo); - } else { - traceMsg = "HDI:DISP:HARDWARE" - "height:" + std::to_string(data.buffer->height) + - " width:" + std::to_string(data.buffer->width) + - " data.buffer->fd:" + std::to_string(data.buffer->fd) + - " seqNo:" + std::to_string(data.seqNo); - } - traceMsg += " fd:" + std::to_string(fd); + HITRACE_METER_FMT(HITRACE_TAG_HDF, + "SetDisplayClientBuffer:%s data.devId:%d, data.layerId:%d, buffer->fd:%d, data.seqNo:%d, fd:%d", + data.buffer == nullptr ? "data.buffer is nullptr!" : "", + data.devId, + data.layerId, + data.buffer == nullptr ? -1 : data.buffer->fd, + data.seqNo, + fd); if (data.fence > ERROR_FENCE_COUNT || fd > ERROR_FENCE_COUNT || handle.fd > ERROR_FENCE_COUNT) { HDF_LOGI("SetLayerBuffer: %{public}s data.devId: %{public}d data.layerId: %{public}d, " "data.buffer->fd:%{public}d, data.seqNo:%{public}d handle.fd:%{public}d, fd:%{public}d", @@ -895,7 +893,6 @@ EXIT: data.devId, data.layerId, data.buffer == nullptr ? -1 : data.buffer->fd, data.seqNo, handle.fd, fd); cacheMgr_->Dump(); } - HdfTrace traceVdi("SetLayerBuffer", traceMsg); needMoveFd = true; int rc = impl_->SetLayerBuffer(data.devId, data.layerId, handle, fd); DISPLAY_CHK_RETURN(rc != HDF_SUCCESS, HDF_FAILURE, HDF_LOGE(" fail")); diff --git a/display/composer/v1_0/display_command/display_cmd_utils.h b/display/composer/v1_0/display_command/display_cmd_utils.h index f9c1f763..a7f811f5 100644 --- a/display/composer/v1_0/display_command/display_cmd_utils.h +++ b/display/composer/v1_0/display_command/display_cmd_utils.h @@ -44,7 +44,7 @@ public: static constexpr uint32_t TRANSFER_WAIT_TIME = 100000000; // ms static constexpr uint32_t INIT_ELEMENT_COUNT = 32 * 1024; static constexpr uint32_t MAX_MEMORY = 10485760; // 10M - static constexpr uint32_t MAX_ELE_COUNT = 100000; + static constexpr uint32_t MAX_ELE_COUNT = 1000000; #define SWITCHCASE(x) case (x): {return #x;} static const char *CommandToString(int32_t cmdId) diff --git a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h index 8c5e9c17..34ee2ef8 100644 --- a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h @@ -30,7 +30,6 @@ #define LOG_TAG "DISP_HDI_COMP" #undef LOG_DOMAIN #define LOG_DOMAIN 0xD002515 -#define MAX_COUNT 10 namespace OHOS { namespace HDI { @@ -77,7 +76,9 @@ public: vBlankCb_(nullptr), hotPlugCbData_(nullptr), vBlankCbData_(nullptr), - recipient_(nullptr) {} + recipient_(nullptr) { + vsncEnableStatus_.clear(); + } virtual ~DisplayComposerHdiImpl() { @@ -216,7 +217,21 @@ public: virtual int32_t SetDisplayVsyncEnabled(uint32_t devId, bool enabled) override { COMPOSER_CHECK_NULLPTR_RETURN(hdi_); - return ToDispErrCode(hdi_->SetDisplayVsyncEnabled(devId, enabled)); + /* Already enabled, return success*/ + if (enabled && (vsuncEnableStatus_.find(devId) != vsuncEnableStatus_.end()) && vsuncEnableStatus_[devId]) { + HDF_LOGD("%{public}s: vsyncStatus[%{public}u] = %{public}d, skip", + __func__, devId, vsuncEnableStatus_[devId]); + return DISPLAY_SUCCESS; + } + + int32_t ret = ToDispErrCode(hdi_->SetDisplayVsyncEnabled(devId, enabled)); + if (ret != DISPLAY_SUCCESS) { + HDF_LOGD("%{public}s: vsyncStatus[%{public}u] = %{public}d, fail", __func__, devId, enabled); + return ret; + } + + vsyncEnableStatus_[devId] = enabled; + return ret; } virtual int32_t RegDisplayVBlankCallback(uint32_t devId, VBlankCallback cb, void *data) override @@ -470,7 +485,7 @@ public: virtual int32_t OnHotPlug(uint32_t outputId, bool connected) override { DISPLAY_TRACE; - + HDF_LOGI("OnHotPlug(%{public}u, %{public}u)", outputId, connected); int32_t ret = HDF_SUCCESS; if (hotPlugCb_ != nullptr) { @@ -480,6 +495,8 @@ public: ret = HDF_FAILURE; } + vsyncEnableStatus_[outputId] = false; + return ret; } @@ -560,6 +577,7 @@ protected: void *hotPlugCbData_; void *vBlankCbData_; sptr recipient_; + std::unordered_map vsyncEnableStatus; }; using HdiDisplayComposer = DisplayComposerHdiImpl; } // namespace V1_0 diff --git a/display/composer/v1_2/IDisplayComposer.idl b/display/composer/v1_2/IDisplayComposer.idl index 73b26198..c210f276 100644 --- a/display/composer/v1_2/IDisplayComposer.idl +++ b/display/composer/v1_2/IDisplayComposer.idl @@ -59,7 +59,7 @@ interface IDisplayComposer extends ohos.hdi.display.composer.v1_1.IDisplayCompos */ ClearLayerBuffer([in] unsigned int devId, [in] unsigned int layerId); - /** + /** * @brief Update Hardware Cursor Position and Style. * * @param devId Indicates which device, x and y Indicates the position of hardware cursor. @@ -70,9 +70,9 @@ interface IDisplayComposer extends ohos.hdi.display.composer.v1_1.IDisplayCompos * @since 5.0 * @version 1.0 */ - UpdateHardwareCursor([in] unsigned int devId, [in] int x, [in] int y, [in] NativeBuffer buffer); + UpdateHardwareCursor([in] unsigned int devId, [in] int x, [in] int y, [in] NativeBuffer buffer); - /** + /** * @brief Enable Hardware Cursor. * * @param devId Indicates which device, enable Indicates which stats of enabled hardware cursor. @@ -82,9 +82,9 @@ interface IDisplayComposer extends ohos.hdi.display.composer.v1_1.IDisplayCompos * @since 5.0 * @version 1.0 */ - EnableHardwareCursorStats([in] unsigned int devId, [in] boolean enable); + EnableHardwareCursorStats([in] unsigned int devId, [in] boolean enable); - /** + /** * @brief Get Hardware Cursor stats. * * @param devId Indicates which device, frameCount Indicates hardware cursor frame count, @@ -95,7 +95,7 @@ interface IDisplayComposer extends ohos.hdi.display.composer.v1_1.IDisplayCompos * @since 5.0 * @version 1.0 */ - GetHardwareCursorStats([in] unsigned int devId, [out] unsigned int frameCount, [out] unsigned int vsyncCount); + GetHardwareCursorStats([in] unsigned int devId, [out] unsigned int frameCount, [out] unsigned int vsyncCount); /** * @brief Set Display Active Region. diff --git a/display/composer/v1_2/display_command/display_cmd_responser.h b/display/composer/v1_2/display_command/display_cmd_responser.h index c4e36bb6..bb4f1739 100644 --- a/display/composer/v1_2/display_command/display_cmd_responser.h +++ b/display/composer/v1_2/display_command/display_cmd_responser.h @@ -49,7 +49,7 @@ public: DISPLAY_CHK_RETURN(impl == nullptr, nullptr, HDF_LOGE("%{public}s: error, VdiImpl is nullptr", __func__)); DISPLAY_CHK_RETURN(cacheMgr == nullptr, nullptr, - HDF_LOGE("%{public}s: error, cacheMgr is nullptr", __func__)); + HDF_LOGE("%{public}s: error, VdiImpl is nullptr", __func__)); return std::make_unique(impl, cacheMgr); } @@ -224,16 +224,11 @@ REPLY: ReplyCommitAndGetReleaseFence(outFds, devId, commitInfo); } - int32_t CmdRequest(uint32_t inEleCnt, const std::vector& inFds, - uint32_t& outEleCnt, std::vector& outFds) + int32_t CmdRequest(uint32_t inEleCnt, const std::vector& inFds, uint32_t& outEleCnt, + std::vector& outFds) { std::shared_ptr requestData(new char[inEleCnt * CmdUtils::ELEMENT_SIZE], std::default_delete()); - int32_t ret = HDF_SUCCESS; - { - std::lock_guard lock(requestMutex_); - ret = request_->Read(reinterpret_cast(requestData.get()), inEleCnt, - CmdUtils::TRANSFER_WAIT_TIME); - } + int32_t ret = CmdRequestDataRead(requestData, inEleCnt); CommandDataUnpacker unpacker; unpacker.Init(requestData.get(), inEleCnt << CmdUtils::MOVE_SIZE); #ifdef DEBUG_DISPLAY_CMD_RAW_DATA @@ -463,7 +458,6 @@ private: }; using HdiDisplayCmdResponser = DisplayCmdResponser, DisplayComposerVdiAdapter>; - } // namespace V1_2 } // namespace Composer } // namespace Display diff --git a/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h index 2b0042e4..23767b06 100644 --- a/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h @@ -116,13 +116,13 @@ public: } virtual int32_t ClearClientBuffer(uint32_t devId) override { - COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_2_); + COMPOSER_CHECK_NULLPTR_RETURN(req_v1_2_); return ToDispErrCode(hdi_v1_2_->ClearClientBuffer(devId)); } virtual int32_t ClearLayerBuffer(uint32_t devId, uint32_t layerId) override { - COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_2_); + COMPOSER_CHECK_NULLPTR_RETURN(req_v1_2_); return ToDispErrCode(hdi_v1_2_->ClearLayerBuffer(devId, layerId)); } @@ -192,7 +192,7 @@ public: COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_2_); return ToDispErrCode(hdi_v1_2_->GetDisplayIdentificationData(devId, portId, edidData)); } - + protected: using BaseType1_1 = V1_1::DisplayComposerHdiImpl; using BaseType1_1::WAIT_TIME_INTERVAL; diff --git a/display/composer/v1_3/BUILD.gn b/display/composer/v1_3/BUILD.gn index da7314b1..e6d3242c 100644 --- a/display/composer/v1_3/BUILD.gn +++ b/display/composer/v1_3/BUILD.gn @@ -58,7 +58,6 @@ ohos_shared_library("libdisplay_composer_hdi_impl_1.3") { external_deps = [ "c_utils:utils", "graphic_surface:buffer_handle", - "hdf_core:libhdf_ipc_adapter", "hdf_core:libhdi", "hdf_core:libpub_utils", "hilog:libhilog", diff --git a/display/composer/v1_3/DisplayComposerType.idl b/display/composer/v1_3/DisplayComposerType.idl index fc7c504c..f2df2b5d 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 */ +}; \ No newline at end of file diff --git a/display/composer/v1_3/IDisplayComposer.idl b/display/composer/v1_3/IDisplayComposer.idl index fa6dc0e6..e827f856 100644 --- a/display/composer/v1_3/IDisplayComposer.idl +++ b/display/composer/v1_3/IDisplayComposer.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -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 inHandle Indicates layer buffer. + * @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 diff --git a/display/graphic/common/v2_1/CMColorSpace.idl b/display/graphic/common/v2_1/CMColorSpace.idl index 7692c2ca..2e6aaed9 100644 --- a/display/graphic/common/v2_1/CMColorSpace.idl +++ b/display/graphic/common/v2_1/CMColorSpace.idl @@ -40,4 +40,41 @@ import ohos.hdi.display.graphic.common.v2_0.CMColorSpace; enum CM_HDR_Metadata_Type : ohos.hdi.display.graphic.common.v2_0.CM_HDR_Metadata_Type { /* Video AIHDR metadata type */ CM_VIDEO_AI_HDR = 60, // video AIHDR +}; + +/** + * @brief defines clolor gamut. + * + */ +enum CM_ColorPrimaries : ohos.hdi.display.graphic.common.v2_0.CM_ColorPrimaries { +}; + +/** + * @brief control the linear/non-linear color convert, nick named gamma function. + * + */ +enum CM_TransFunc : ohos.hdi.display.graphic.common.v2_0.CM_TransFunc { + Transfunc_priv_log = 9, +}; + +enum CM_Range : ohos.hdi.display.graphic.common.v2_0.CM_Range { +}; + +/** + * @brief control yuv<-->rgb conversion. + * + */ +enum CM_Matrix : ohos.hdi.display.graphic.common.v2_0.CM_Matrix { +}; + +struct CM_ColorSpaceInfo { + enum CM_ColorPrimaries primaries; + enum CM_TransFunc transfunc; + enum CM_Matrix matrix; + enum CM_Range range; +}; + +enum CM_ColorSpaceType : ohos.hdi.display.graphic.common.v2_0.CM_ColorSpaceType { + CM_BT2020_LOG_FULL = 4 | (9 << 8) | (4 << 16) | (1 << 21), // COLORPRIMARIES_BT2020 | (TRANSFUNC_PRIV_LOG << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) + CM_BT2020_LOG_LIMIT = 4 | (9 << 8) | (4 << 16) | (2 << 21), // COLORPRIMARIES_BT2020 | (TRANSFUNC_PRIV_LOG << 8) | (MATRIX_BT2020 << 16) | (RANGE_LIMITED << 21) }; \ No newline at end of file diff --git a/display/graphic/common/v2_2/BufferHandleMetaKeyType.idl b/display/graphic/common/v2_2/BufferHandleMetaKeyType.idl index b3d8175d..409a1a9a 100644 --- a/display/graphic/common/v2_2/BufferHandleMetaKeyType.idl +++ b/display/graphic/common/v2_2/BufferHandleMetaKeyType.idl @@ -23,10 +23,17 @@ package ohos.hdi.display.graphic.common.v2_2; import ohos.hdi.display.graphic.common.v2_1.BufferHandleMetaKeyType; +enum BufferHandleAttrKey : ohos.hdi.display.graphic.common.v2_1.BufferHandleAttrKey { + ATTRKEY_VIDEO_AI_HDR_LUT = 4099, // value: grid lut for video aihdr + ATTRKEY_EXTERNAL_LOWDELAY_INFO = 4100, // value: ExternalLowDelayInfo +}; + /** - * @ brief Enumerates buffer handle attribution keys. + * @brief ExternalLowDelayInfo of [value] in GetMetadata/SetMetaData, to trans metadata. * + * @since 6.0 + * @version 1.0 */ -enum BufferHandleAttrKey : ohos.hdi.display.graphic.common.v2_1.BufferHandleAttrKey { - ATTRKEY_VIDEO_AI_HDR_LUT = 4099, // value: grid lut for video aihdr +struct ExternalLowDelayInfo { + unsigned int enhanceLayerFlag; // enhance layer flag for lowdelay dual420 }; \ No newline at end of file -- Gitee From e76945cf477e666b9e8c0edf7d16d413eb3d191e Mon Sep 17 00:00:00 2001 From: huyx Date: Thu, 4 Sep 2025 20:07:04 +0800 Subject: [PATCH 2/6] format Signed-off-by: huyx --- display/composer/v1_0/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/composer/v1_0/BUILD.gn b/display/composer/v1_0/BUILD.gn index 76c0528b..f99529a0 100644 --- a/display/composer/v1_0/BUILD.gn +++ b/display/composer/v1_0/BUILD.gn @@ -40,7 +40,7 @@ config("libdisplay_composer_hdi_impl_config") { ] } -ohos_shared_library("libdisplay_composer_hdi_impl) { +ohos_shared_library("libdisplay_composer_hdi_impl") { sources = [ "hdi_impl/display_composer_interface.cpp" ] public_configs = [ ":libdisplay_composer_hdi_impl_config" ] -- Gitee From 635fb38a5c53478cdc3b122bc4069a38e526778d Mon Sep 17 00:00:00 2001 From: huyx Date: Fri, 5 Sep 2025 14:50:17 +0800 Subject: [PATCH 3/6] format Signed-off-by: huyx --- display/composer/v1_0/BUILD.gn | 5 +++++ display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/display/composer/v1_0/BUILD.gn b/display/composer/v1_0/BUILD.gn index f99529a0..f572b2e8 100644 --- a/display/composer/v1_0/BUILD.gn +++ b/display/composer/v1_0/BUILD.gn @@ -46,6 +46,11 @@ ohos_shared_library("libdisplay_composer_hdi_impl") { public_configs = [ ":libdisplay_composer_hdi_impl_config" ] deps = [ + "libdisplay_composer_proxy_1.0", + "../hdifd_parcelable:libhdifd_parcelable", + ] + + external_deps = [ "c_utils:utils", "graphic_surface:buffer_handle", "hdf_core:libhdi", diff --git a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h index 34ee2ef8..1a20b3fe 100644 --- a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h @@ -577,7 +577,7 @@ protected: void *hotPlugCbData_; void *vBlankCbData_; sptr recipient_; - std::unordered_map vsyncEnableStatus; + std::unordered_map vsyncEnableStatus_; }; using HdiDisplayComposer = DisplayComposerHdiImpl; } // namespace V1_0 -- Gitee From 089bd801a0f7f0a222bc2ab1c0c195361bff9073 Mon Sep 17 00:00:00 2001 From: huyx Date: Fri, 5 Sep 2025 16:15:06 +0800 Subject: [PATCH 4/6] format Signed-off-by: huyx --- display/composer/v1_0/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/composer/v1_0/BUILD.gn b/display/composer/v1_0/BUILD.gn index f572b2e8..f5fc56d1 100644 --- a/display/composer/v1_0/BUILD.gn +++ b/display/composer/v1_0/BUILD.gn @@ -46,7 +46,7 @@ ohos_shared_library("libdisplay_composer_hdi_impl") { public_configs = [ ":libdisplay_composer_hdi_impl_config" ] deps = [ - "libdisplay_composer_proxy_1.0", + ":libdisplay_composer_proxy_1.0", "../hdifd_parcelable:libhdifd_parcelable", ] -- Gitee From a43e34ad31f20c8bafbcb9d5a9fd4b17109f7562 Mon Sep 17 00:00:00 2001 From: huyx Date: Fri, 5 Sep 2025 17:06:13 +0800 Subject: [PATCH 5/6] format Signed-off-by: huyx --- display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h index 1a20b3fe..7b1d6f82 100644 --- a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h @@ -77,7 +77,7 @@ public: hotPlugCbData_(nullptr), vBlankCbData_(nullptr), recipient_(nullptr) { - vsncEnableStatus_.clear(); + vsyncEnableStatus_.clear(); } virtual ~DisplayComposerHdiImpl() @@ -218,9 +218,9 @@ public: { COMPOSER_CHECK_NULLPTR_RETURN(hdi_); /* Already enabled, return success*/ - if (enabled && (vsuncEnableStatus_.find(devId) != vsuncEnableStatus_.end()) && vsuncEnableStatus_[devId]) { + if (enabled && (vsyncEnableStatus_.find(devId) != vsyncEnableStatus_.end()) && vsyncEnableStatus_[devId]) { HDF_LOGD("%{public}s: vsyncStatus[%{public}u] = %{public}d, skip", - __func__, devId, vsuncEnableStatus_[devId]); + __func__, devId, vsyncEnableStatus_[devId]); return DISPLAY_SUCCESS; } -- Gitee From 2044c3127b8dbdb0550619013655d5382b4d95e3 Mon Sep 17 00:00:00 2001 From: huyx Date: Fri, 5 Sep 2025 17:40:03 +0800 Subject: [PATCH 6/6] format Signed-off-by: huyx --- display/composer/v1_0/display_command/display_cmd_responser.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/display/composer/v1_0/display_command/display_cmd_responser.h b/display/composer/v1_0/display_command/display_cmd_responser.h index d24394b5..76bd4493 100755 --- a/display/composer/v1_0/display_command/display_cmd_responser.h +++ b/display/composer/v1_0/display_command/display_cmd_responser.h @@ -405,8 +405,8 @@ EXIT: data.seqNo, fd); if (data.fence > ERROR_FENCE_COUNT) { - HDF_LOGI("SetDisplayClientBuffer:%{public}s data.devId:%{public}d, data.buffer->fd:%{public}d, - data.seqNo:%{public}d, fd:%{public}d", + HDF_LOGI("SetDisplayClientBuffer:%{public}s data.devId:%{public}d, data.buffer->fd:%{public}d, " + "data.seqNo:%{public}d, fd:%{public}d", data.buffer == nullptr ? "data.buffer is nullptr!" : "", data.devId, data.buffer == nullptr ? -1 : data.buffer->fd, -- Gitee