diff --git a/display/bundle.json b/display/bundle.json index 189c568f915353ba7c3b4e89c022c23206070185..3533bdf99e01b12827a904bd310e1f1a0a60e8a5 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 fc2465b733969d3783d2e9d9f4a4609a5b84c868..2242842d17bec7f5342fdf18fd26cab297facafb 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 d6f2c1e8f9eda22b90a7f5a0ad7dc28d12685880..f5fc56d1adb679c469268deffa68c6cc38f2921b 100644 --- a/display/composer/v1_0/BUILD.gn +++ b/display/composer/v1_0/BUILD.gn @@ -32,3 +32,36 @@ 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 = [ + ":libdisplay_composer_proxy_1.0", + "../hdifd_parcelable:libhdifd_parcelable", + ] + + external_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 628d8b11ca864fe6337cb356108a8623786cbde8..76bd449366a1160baef6a580d97bebcc61ea1716 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 f9c1f76362396c4114edbfce4539cd17447f6d4a..a7f811f527e92e1e00624017c4fab8e159d76af6 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 8c5e9c177626b8046cd6274801925df49254c783..7b1d6f82b6c7980381a0bd12c60b7cba77945b6a 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) { + vsyncEnableStatus_.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 && (vsyncEnableStatus_.find(devId) != vsyncEnableStatus_.end()) && vsyncEnableStatus_[devId]) { + HDF_LOGD("%{public}s: vsyncStatus[%{public}u] = %{public}d, skip", + __func__, devId, vsyncEnableStatus_[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 73b2619856ea3924050be47ab1fe151ea5002a5a..c210f276615ccc95faee42afbfeece5bb4977f04 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 c4e36bb600700179466c0af9137c94da7c4c8691..bb4f173955505ec429ed1be27a0988477f283ecb 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 2b0042e48312e0f423c2dc2cf9cae47dd33a512d..23767b063ba4b135951dc60c739e6ad19713b1a5 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 da7314b13feb642cab7ee5bf406d1f40035f7281..e6d3242c813f01f0742f4ed1d8acab6d6965d154 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 fc7c504cf32815295a4b3e8c5a7c888596071bd0..f2df2b5d48847713584a68e2dbb03bc5efe3046a 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 fa6dc0e6115163bf7dc9d2015f412b5a71e4ac09..e827f856796ef51141055abb06e6b3a7b9f978fc 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 ba4f23686a81a7b830a983741bc12e464056be52..d0e182ffbe411f4168d342158e02e8d9512ac049 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 71aa127fda324a8561c1a87c3f4d19b6832c68d0..dcd37a3b5bf47a3fe485ebf95c1413f06ac9a625 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 7692c2ca181a20427cb19691176d622afab64ba1..2e6aaed900b7eabde59cea621d984a3cb62ff7a9 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 b3d8175dca229559198906bdf8e25ff911730633..409a1a9a50d44b0b2f6ee8d63eca532a59174bfd 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