From 7c85d820308a9ce37bf736aacc064cd56e5ef8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Wed, 25 Jun 2025 16:40:24 +0800 Subject: [PATCH 01/12] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- display/bundle.json | 28 ++++- .../composer/common/include/display_common.h | 1 + .../include/display_vdi_adapter_interface.h | 1 + .../display_vdi_adapter_interface.h.rej | 27 +++++ display/composer/v1_3/BUILD.gn | 72 ++++++++++++ display/composer/v1_3/DisplayComposerType.idl | 47 ++++++++ display/composer/v1_3/IDisplayComposer.idl | 37 ++++++ display/composer/v1_3/IHwcEventCallback.idl | 34 ++++++ .../display_command/display_cmd_requester.h | 61 ++++++++++ .../display_command/display_cmd_responser.h | 60 ++++++++++ .../v1_3/display_command/display_cmd_utils.h | 40 +++++++ .../v1_3/hdi_impl/display_composer_hdi_impl.h | 109 ++++++++++++++++++ .../hdi_impl/display_composer_interface.cpp | 32 +++++ .../include/idisplay_composer_interface.h | 58 ++++++++++ 14 files changed, 606 insertions(+), 1 deletion(-) create mode 100644 display/composer/common/include/display_vdi_adapter_interface.h.rej create mode 100644 display/composer/v1_3/BUILD.gn create mode 100644 display/composer/v1_3/DisplayComposerType.idl create mode 100644 display/composer/v1_3/IDisplayComposer.idl create mode 100644 display/composer/v1_3/IHwcEventCallback.idl create mode 100644 display/composer/v1_3/display_command/display_cmd_requester.h create mode 100644 display/composer/v1_3/display_command/display_cmd_responser.h create mode 100644 display/composer/v1_3/display_command/display_cmd_utils.h create mode 100644 display/composer/v1_3/hdi_impl/display_composer_hdi_impl.h create mode 100644 display/composer/v1_3/hdi_impl/display_composer_interface.cpp create mode 100644 display/composer/v1_3/include/idisplay_composer_interface.h diff --git a/display/bundle.json b/display/bundle.json index 7643e832..f34ca7a5 100644 --- a/display/bundle.json +++ b/display/bundle.json @@ -52,6 +52,8 @@ "//drivers/interface/display/composer/v1_1:libdisplay_composer_hdi_impl_1.1", "//drivers/interface/display/composer/v1_2:display_composer_idl_target", "//drivers/interface/display/composer/v1_2:libdisplay_composer_hdi_impl_1.2", + "//drivers/interface/display/composer/v1_3:display_composer_idl_target", + "//drivers/interface/display/composer/v1_3:libdisplay_composer_hdi_impl_1.3", "//drivers/interface/display/graphic/common/v1_0:display_commontype_idl_target", "//drivers/interface/display/graphic/common/v1_1:display_commontype_idl_target", "//drivers/interface/display/graphic/common/v2_0:display_commontype_idl_target", @@ -268,7 +270,31 @@ } }, { - "name": "//drivers/interface/display/composer/hdifd_parcelable:libhdifd_parcelable", + "name": "//drivers/interface/display/composer/v1_3:libdisplay_composer_proxy_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/composer" + } + }, + { + "name": "//drivers/interface/display/composer/v1_3:libdisplay_composer_stub_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/composer" + } + }, + { + "name": "//drivers/interface/display/composer/v1_3:display_composer_idl_headers_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/composer" + } + }, + { + "name": "//drivers/interface/display/composer/v1_3:libdisplay_composer_hdi_impl_1.3", "header": { "header_files": [ ], diff --git a/display/composer/common/include/display_common.h b/display/composer/common/include/display_common.h index bf8e32c2..2f079f62 100644 --- a/display/composer/common/include/display_common.h +++ b/display/composer/common/include/display_common.h @@ -28,6 +28,7 @@ typedef void (*RefreshCallback)(uint32_t devId, void* data); typedef void (*ModeCallback)(uint32_t modeId, uint64_t vBlankPeriod, void* data); typedef void (*SeamlessChangeCallback)(uint32_t devId, void* data); typedef void (*VBlankIdleCallback)(uint32_t devId, uint64_t ns, void* data); +typedef void (*HwcEventCallback)(uint32_t devId, uint32_t eventId, const std::vector& eventData, void* data); } // namespace Display } // namespace HDI } // namespace OHOS diff --git a/display/composer/common/include/display_vdi_adapter_interface.h b/display/composer/common/include/display_vdi_adapter_interface.h index d34b5812..281c4e74 100644 --- a/display/composer/common/include/display_vdi_adapter_interface.h +++ b/display/composer/common/include/display_vdi_adapter_interface.h @@ -32,6 +32,7 @@ namespace Composer { using namespace OHOS::HDI::Display::Composer::V1_0; using namespace OHOS::HDI::Display::Composer::V1_1; using namespace OHOS::HDI::Display::Composer::V1_2; +using namespace OHOS::HDI::Display::Composer::V1_3; struct DisplayComposerVdiAdapter { int32_t (*LoadVdiImpl)(); int32_t (*DestroyVdiImpl)(); diff --git a/display/composer/common/include/display_vdi_adapter_interface.h.rej b/display/composer/common/include/display_vdi_adapter_interface.h.rej new file mode 100644 index 00000000..dcdaf4c7 --- /dev/null +++ b/display/composer/common/include/display_vdi_adapter_interface.h.rej @@ -0,0 +1,27 @@ +diff a/display/composer/common/include/display_vdi_adapter_interface.h b/display/composer/common/include/display_vdi_adapter_interface.h (rejected hunks) +@@ -23,6 +23,7 @@ + #include "v1_2/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" + #include "v1_1/imode_callback.h" + #include "v1_1/iseamless_change_callback.h" + +@@ -105,6 +107,7 @@ struct DisplayComposerVdiAdapter { + 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); + }; + + using LoadVdiImplFunc = int32_t (*)(); +@@ -180,6 +183,9 @@ using SetTunnelLayerPositionFunc = int32_t (*)(uint32_t devId, uint64_t tunnelId + 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); ++ ++ + } // namespace Composer + } // namespace Display + } // namespace HDI diff --git a/display/composer/v1_3/BUILD.gn b/display/composer/v1_3/BUILD.gn new file mode 100644 index 00000000..e6d3242c --- /dev/null +++ b/display/composer/v1_3/BUILD.gn @@ -0,0 +1,72 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/config/components/hdi/hdi.gni") + +hdi("display_composer") { + module_name = "display_composer" + + sources = [ + "DisplayComposerType.idl", + "IDisplayComposer.idl", + "IHwcEventCallback.idl", + ] + + proxy_deps = [ "../v1_0:libdisplay_composer_proxy_1.0", + "../v1_1:libdisplay_composer_proxy_1.1", + "../v1_2:libdisplay_composer_proxy_1.2", + "../hdifd_parcelable:libhdifd_parcelable" ] + + stub_deps = [ "../v1_0:libdisplay_composer_stub_1.0", + "../v1_1:libdisplay_composer_stub_1.1", + "../v1_2:libdisplay_composer_stub_1.2", + "../hdifd_parcelable:libhdifd_parcelable" ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_display" +} + +config("libdisplay_composer_hdi_impl_config") { + include_dirs = [ + "../", + "../hdifd_parcelable", + ] +} + +ohos_shared_library("libdisplay_composer_hdi_impl_1.3") { + sources = [ "./hdi_impl/display_composer_interface.cpp" ] + + public_configs = [ ":libdisplay_composer_hdi_impl_config" ] + + deps = [ + ":libdisplay_composer_proxy_1.3", + "../hdifd_parcelable:libhdifd_parcelable", + "../v1_2:libdisplay_composer_proxy_1.2", + ] + + 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_3/DisplayComposerType.idl b/display/composer/v1_3/DisplayComposerType.idl new file mode 100644 index 00000000..fc7c504c --- /dev/null +++ b/display/composer/v1_3/DisplayComposerType.idl @@ -0,0 +1,47 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Display + * + * @brief Defines driver interfaces of the display module. + * + * This module provides driver interfaces for upper-layer graphics services, including layer management, device control, and display buffer management. + * + * @since 6.0 + * @version 1.0 + */ + +/** + * @file DisplayComposerType.idl + * + * @brief Declares the data types used by the interfaces related to display composer operations. + * + * @since 6.0 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the display module interfaces. + * + * @since 6.0 + * @version 1.0 + */ +package ohos.hdi.display.composer.v1_3; +sequenceable OHOS.HDI.Display.HdifdParcelable; +import ohos.hdi.display.composer.v1_0.DisplayComposerType; +import ohos.hdi.display.composer.v1_1.DisplayComposerType; +import ohos.hdi.display.composer.v1_2.DisplayComposerType; + diff --git a/display/composer/v1_3/IDisplayComposer.idl b/display/composer/v1_3/IDisplayComposer.idl new file mode 100644 index 00000000..fa6dc0e6 --- /dev/null +++ b/display/composer/v1_3/IDisplayComposer.idl @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ohos.hdi.display.composer.v1_3; + +import ohos.hdi.display.composer.v1_1.IDisplayComposer; +import ohos.hdi.display.composer.v1_2.IDisplayComposer; +import ohos.hdi.display.composer.v1_0.DisplayComposerType; +import ohos.hdi.display.composer.v1_3.DisplayComposerType; +import ohos.hdi.display.composer.v1_3.IHwcEventCallback; +sequenceable OHOS.HDI.Display.HdifdParcelable; + +interface IDisplayComposer extends ohos.hdi.display.composer.v1_2.IDisplayComposer { + /** + * @brief Registers the callback to be invoked when the environment changes. + * + * @param cb Indicates the instance used to notify the graphics service of an environment change event occurred. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + RegHwcEventCallback([in] IHwcEventCallback cb); +} diff --git a/display/composer/v1_3/IHwcEventCallback.idl b/display/composer/v1_3/IHwcEventCallback.idl new file mode 100644 index 00000000..af1f9b3c --- /dev/null +++ b/display/composer/v1_3/IHwcEventCallback.idl @@ -0,0 +1,34 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ohos.hdi.display.composer.v1_3; + +import ohos.hdi.display.composer.v1_3.DisplayComposerType; + +[callback] interface IHwcEventCallback { + /** + * @brief the callback to be invoked when the environment changes + * + * @param devId Indicates the ID of the display device. + * @param eventId Indicates the ID of the environment. + * @param eventData Indicates the value of the case. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 6.0 + * @version 1.0 + */ + OnHwcEvent([in] unsigned int devId, [in] unsigned int eventId, [in] int[] eventData); +} \ No newline at end of file diff --git a/display/composer/v1_3/display_command/display_cmd_requester.h b/display/composer/v1_3/display_command/display_cmd_requester.h new file mode 100644 index 00000000..cf9e0071 --- /dev/null +++ b/display/composer/v1_3/display_command/display_cmd_requester.h @@ -0,0 +1,61 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_3_DISPLAY_CMD_REQUESTER_H +#define OHOS_HDI_DISPLAY_V1_3_DISPLAY_CMD_REQUESTER_H + +#include "v1_2/display_command/display_cmd_requester.h" +#include "v1_3/display_command/display_cmd_utils.h" +#include "v1_3/display_composer_type.h" +#include "v1_3/idisplay_composer.h" + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_3 { +using namespace OHOS::HDI::Base; + +template +class DisplayCmdRequester : public V1_2::DisplayCmdRequester { +public: + DisplayCmdRequester(sptr hdi) : BaseType1_2(hdi), hdi_1_3_(hdi) {} + + static std::unique_ptr Create(sptr hdi) + { + DISPLAY_CHK_RETURN(hdi == nullptr, nullptr, HDF_LOGE("%{public}s: hdi is nullptr", __func__)); + auto requester = std::make_unique(hdi); + DISPLAY_CHK_RETURN(requester == nullptr, nullptr, + HDF_LOGE("%{public}s: CmdRequester is nullptr", __func__)); + auto ret = requester->Init(CmdUtils::INIT_ELEMENT_COUNT); + if (ret != HDF_SUCCESS) { + HDF_LOGE("DisplayCmdRequester init failed"); + return nullptr; + } + return requester; + } + +protected: + sptr hdi_1_3_; +private: + using BaseType1_2 = V1_2::DisplayCmdRequester; +}; +using HdiDisplayCmdRequester = V1_3::DisplayCmdRequester, V1_3::IDisplayComposer>; +} // namespace V1_3 +} // namespace Composer +} // namespace Display +} // namespace HDI +} // namespace OHOS +#endif // OHOS_HDI_DISPLAY_V1_3_DISPLAY_CMD_REQUESTER_H diff --git a/display/composer/v1_3/display_command/display_cmd_responser.h b/display/composer/v1_3/display_command/display_cmd_responser.h new file mode 100644 index 00000000..e268773d --- /dev/null +++ b/display/composer/v1_3/display_command/display_cmd_responser.h @@ -0,0 +1,60 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_3_DISPLAY_CMD_REQUESTER_H +#define OHOS_HDI_DISPLAY_V1_3_DISPLAY_CMD_REQUESTER_H + +#include "v1_0/display_command/display_cmd_responser.h" +#include "v1_1/display_command/display_cmd_responser.h" +#include "v1_2/display_command/display_cmd_responser.h" +#include "v1_3/display_composer_type.h" +#include "v1_3/display_command/display_cmd_utils.h" + +#define DISPLAY_TRACE HdfTrace trace(__func__, "HDI:DISP:") + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_3 { +using namespace OHOS::HDI::Base; + +template +class DisplayCmdResponser : public V1_2::DisplayCmdResponser { +public: + static std::unique_ptr Create(VdiImpl* impl, std::shared_ptr cacheMgr) + { + 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, VdiImpl is nullptr", __func__)); + return std::make_unique(impl, cacheMgr); + } + + DisplayCmdResponser(VdiImpl* impl, std::shared_ptr cacheMgr) : BaseType1_2(impl, cacheMgr) {} + + virtual ~DisplayCmdResponser() {} + +private: + using BaseType1_2 = V1_2::DisplayCmdResponser; +}; + +using HdiDisplayCmdResponser = DisplayCmdResponser, DisplayComposerVdiAdapter>; +} // namespace V1_3 +} // namespace Composer +} // namespace Display +} // namespace HDI +} // namespace OHOS +#endif // OHOS_HDI_DISPLAY_V1_3_DISPLAY_CMD_REQUESTER_H \ No newline at end of file diff --git a/display/composer/v1_3/display_command/display_cmd_utils.h b/display/composer/v1_3/display_command/display_cmd_utils.h new file mode 100644 index 00000000..b34b2323 --- /dev/null +++ b/display/composer/v1_3/display_command/display_cmd_utils.h @@ -0,0 +1,40 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_3_DISPLAY_CMD_UTILS_H +#define OHOS_HDI_DISPLAY_V1_3_DISPLAY_CMD_UTILS_H + +#include "v1_2/display_command/display_cmd_utils.h" +#include "v1_3/display_composer_type.h" + +#undef LOG_TAG +#define LOG_TAG "DISP_CMD" +#undef LOG_DOMAIN +#define LOG_DOMAIN 0xD002515 + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_3 { + +class DisplayCmdUtils : public V1_2::DisplayCmdUtils {}; +using CmdUtils = DisplayCmdUtils; +} // namespace V1_3 +} // namespace Composer +} // namespace Display +} // namespace HDI +} // namespace OHOS +#endif // OHOS_HDI_DISPLAY_V1_3_DISPLAY_CMD_UTILS_H \ No newline at end of file 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 new file mode 100644 index 00000000..bb82f734 --- /dev/null +++ b/display/composer/v1_3/hdi_impl/display_composer_hdi_impl.h @@ -0,0 +1,109 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_3_DISPLAY_COMPOSER_HDI_IMPL_H +#define OHOS_HDI_DISPLAY_V1_3_DISPLAY_COMPOSER_HDI_IMPL_H + +#include "v1_2/hdi_impl/display_composer_hdi_impl.h" +#include "v1_3/display_command/display_cmd_requester.h" +#include "v1_3/display_composer_type.h" +#include "v1_3/idisplay_composer.h" +#include "v1_3/include/idisplay_composer_interface.h" +#include "hdf_trace.h" +#include + +#undef LOG_TAG +#define LOG_TAG "DISP_HDI_COMP" +#undef LOG_DOMAIN +#define LOG_DOMAIN 0xD002515 + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_3 { + +template +class DisplayComposerHdiImpl : public V1_2::DisplayComposerHdiImpl, + public IHwcEventCallback { +public: + static IDisplayComposerInterface* Create(bool needSMQ) + { + sptr hdi; + std::shared_ptr req = nullptr; + HDF_LOGI("%{public}s: hdi v1_3 start", __func__); + while ((hdi = CompHdi::Get()) == nullptr) { + // Waiting for display composer service ready + usleep(WAIT_TIME_INTERVAL); + } + HDF_LOGI("%{public}s: hdi v1_3 end", __func__); + if (needSMQ) { + req = CmdReq::Create(hdi); + if (req == nullptr) { + HDF_LOGE("%{public}s: Create DisplayCmdRequester failed %{public}d", __func__, __LINE__); + return nullptr; + } + } + return new DisplayComposerHdiImpl(hdi, req); + } + + DisplayComposerHdiImpl(sptr hdi, std::shared_ptr req) + : BaseType1_2(hdi, req), + req_v1_3_(req), + hdi_v1_3_(hdi), + hwcEventCb_(nullptr), + hwcEventCbData_(nullptr) {} + + virtual ~DisplayComposerHdiImpl() {} + + virtual int32_t OnHwcEvent(uint32_t devId, uint32_t eventId, const std::vector& eventData) override + { + DISPLAY_TRACE; + + int32_t ret = HDF_SUCCESS; + if (hwcEventCb_) { + hwcEventCb_(devId, eventId, eventData, hwcEventCbData_); + } else { + HDF_LOGE("HwcEvent callback is nullptr"); + ret = HDF_FAILURE; + } + return ret; + } + + virtual int32_t RegHwcEventCallback(HwcEventCallback cb, void *data) override + { + hwcEventCb_ = cb; + hwcEventCbData_ = data; + COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_3_); + return ToDispErrCode(hdi_v1_3_->RegHwcEventCallback(this)); + } + +protected: + using BaseType1_2 = V1_2::DisplayComposerHdiImpl; + using BaseType1_2::WAIT_TIME_INTERVAL; + using BaseType1_2::ToDispErrCode; + std::shared_ptr req_v1_3_; + sptr hdi_v1_3_; +private: + HwcEventCallback hwcEventCb_; + void *hwcEventCbData_; +}; +using HdiDisplayComposer = DisplayComposerHdiImpl; +} // namespace V1_3 +} // namespace Composer +} // namespace Display +} // namespace HDI +} // namespace OHOS +#endif // OHOS_HDI_DISPLAY_V1_3_DISPLAY_COMPOSER_HDI_IMPL_H diff --git a/display/composer/v1_3/hdi_impl/display_composer_interface.cpp b/display/composer/v1_3/hdi_impl/display_composer_interface.cpp new file mode 100644 index 00000000..864ca5bf --- /dev/null +++ b/display/composer/v1_3/hdi_impl/display_composer_interface.cpp @@ -0,0 +1,32 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "v1_3/hdi_impl/display_composer_hdi_impl.h" +#include "hilog/log.h" + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_3 { +IDisplayComposerInterface* IDisplayComposerInterface::Get(bool needSMQ) +{ + return HdiDisplayComposer::Create(needSMQ); +} +} // namespace V1_3 +} // namespace Composer +} // namespace Display +} // namespace HDI +} // namespace OHOS diff --git a/display/composer/v1_3/include/idisplay_composer_interface.h b/display/composer/v1_3/include/idisplay_composer_interface.h new file mode 100644 index 00000000..71aa127f --- /dev/null +++ b/display/composer/v1_3/include/idisplay_composer_interface.h @@ -0,0 +1,58 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_3_IDISPLAY_COMPOSER_INTERFACE_H +#define OHOS_HDI_DISPLAY_V1_3_IDISPLAY_COMPOSER_INTERFACE_H + +#include "v1_2/include/idisplay_composer_interface.h" +#include "v1_3/display_composer_type.h" + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_3 { + +class IDisplayComposerInterface : public V1_2::IDisplayComposerInterface { +public: + /** + * @brief Obtains all interfaces of IDisplayComposerInterface. + * + * @return Returns IDisplayComposerInterface* if the operation is successful; + * returns an null point otherwise. + * @since 6.0 + * @version 1.0 + */ + static IDisplayComposerInterface* Get(bool needSMQ = true); + + /** + * @brief Registers the callback to be invoked when the environment changes. + * + * @param cb Indicates the instance used to notify the graphics service of an environment change event occurred. + * @param data Data used by cb + * + * @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 RegHwcEventCallback(HwcEventCallback cb, void *data) = 0; +}; +} // V1_3 +} // Composer +} // Display +} // HDI +} // OHOS +#endif // OHOS_HDI_DISPLAY_V1_3_IDISPLAY_COMPOSER_INTERFACE_H -- Gitee From af470ed7bb16ed2558bb99b858dc23ebc209e9fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 8 Jul 2025 10:27:39 +0800 Subject: [PATCH 02/12] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- .../display_vdi_adapter_interface.h.rej | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 display/composer/common/include/display_vdi_adapter_interface.h.rej diff --git a/display/composer/common/include/display_vdi_adapter_interface.h.rej b/display/composer/common/include/display_vdi_adapter_interface.h.rej deleted file mode 100644 index dcdaf4c7..00000000 --- a/display/composer/common/include/display_vdi_adapter_interface.h.rej +++ /dev/null @@ -1,27 +0,0 @@ -diff a/display/composer/common/include/display_vdi_adapter_interface.h b/display/composer/common/include/display_vdi_adapter_interface.h (rejected hunks) -@@ -23,6 +23,7 @@ - #include "v1_2/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" - #include "v1_1/imode_callback.h" - #include "v1_1/iseamless_change_callback.h" - -@@ -105,6 +107,7 @@ struct DisplayComposerVdiAdapter { - 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); - }; - - using LoadVdiImplFunc = int32_t (*)(); -@@ -180,6 +183,9 @@ using SetTunnelLayerPositionFunc = int32_t (*)(uint32_t devId, uint64_t tunnelId - 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); -+ -+ - } // namespace Composer - } // namespace Display - } // namespace HDI -- Gitee From 60bef4d20e3067d77aebf10481b43f3e819d3335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 8 Jul 2025 10:29:17 +0800 Subject: [PATCH 03/12] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- display/composer/v1_2/display_command/display_cmd_responser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8a328edf..c4e36bb6 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, VdiImpl is nullptr", __func__)); + HDF_LOGE("%{public}s: error, cacheMgr is nullptr", __func__)); return std::make_unique(impl, cacheMgr); } -- Gitee From cbc4c9fa6b4e034f1ebdac3cec4da597ee4db10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 8 Jul 2025 10:31:18 +0800 Subject: [PATCH 04/12] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- display/composer/v1_3/hdi_impl/display_composer_hdi_impl.h | 1 - 1 file changed, 1 deletion(-) 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 bb82f734..fddb6ac9 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 @@ -21,7 +21,6 @@ #include "v1_3/display_composer_type.h" #include "v1_3/idisplay_composer.h" #include "v1_3/include/idisplay_composer_interface.h" -#include "hdf_trace.h" #include #undef LOG_TAG -- Gitee From 319a7363e09128f6a6e5b59b53430d3dfcb10b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 8 Jul 2025 10:32:49 +0800 Subject: [PATCH 05/12] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- display/composer/v1_3/hdi_impl/display_composer_hdi_impl.h | 2 -- 1 file changed, 2 deletions(-) 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 fddb6ac9..ba4f2368 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 @@ -60,7 +60,6 @@ public: DisplayComposerHdiImpl(sptr hdi, std::shared_ptr req) : BaseType1_2(hdi, req), - req_v1_3_(req), hdi_v1_3_(hdi), hwcEventCb_(nullptr), hwcEventCbData_(nullptr) {} @@ -93,7 +92,6 @@ protected: using BaseType1_2 = V1_2::DisplayComposerHdiImpl; using BaseType1_2::WAIT_TIME_INTERVAL; using BaseType1_2::ToDispErrCode; - std::shared_ptr req_v1_3_; sptr hdi_v1_3_; private: HwcEventCallback hwcEventCb_; -- Gitee From 5789866ecc387d34bf13cb54760ccc2ab5302902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 8 Jul 2025 11:31:37 +0800 Subject: [PATCH 06/12] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- display/composer/common/include/display_vdi_adapter_interface.h | 2 ++ display/composer/v1_3/display_command/display_cmd_responser.h | 2 +- 2 files changed, 3 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 281c4e74..a45c1f4c 100644 --- a/display/composer/common/include/display_vdi_adapter_interface.h +++ b/display/composer/common/include/display_vdi_adapter_interface.h @@ -98,6 +98,7 @@ 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 (*RegHwcEventCallbackFunc)(const sptr& cb); }; using LoadVdiImplFunc = int32_t (*)(); @@ -166,6 +167,7 @@ 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 RegHwcEventCallbackFunc = int32_t (*)(const sptr& cb); } // namespace Composer diff --git a/display/composer/v1_3/display_command/display_cmd_responser.h b/display/composer/v1_3/display_command/display_cmd_responser.h index e268773d..addf47d4 100644 --- a/display/composer/v1_3/display_command/display_cmd_responser.h +++ b/display/composer/v1_3/display_command/display_cmd_responser.h @@ -39,7 +39,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, VdiImpl is nullptr", __func__)); + HDF_LOGE("%{public}s: error, cacheMgr is nullptr", __func__)); return std::make_unique(impl, cacheMgr); } -- Gitee From 2cce4e8b3a9eb9418ef39275a67a89c96e0d7fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 8 Jul 2025 11:36:10 +0800 Subject: [PATCH 07/12] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- display/composer/common/include/display_vdi_adapter_interface.h | 1 + 1 file changed, 1 insertion(+) diff --git a/display/composer/common/include/display_vdi_adapter_interface.h b/display/composer/common/include/display_vdi_adapter_interface.h index a45c1f4c..548383a6 100644 --- a/display/composer/common/include/display_vdi_adapter_interface.h +++ b/display/composer/common/include/display_vdi_adapter_interface.h @@ -22,6 +22,7 @@ #include "v1_0/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" #include "v1_1/imode_callback.h" #include "v1_1/iseamless_change_callback.h" -- Gitee From 5b150675fa40da8378ee6a4e9cd529c6e8700fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 8 Jul 2025 11:42:07 +0800 Subject: [PATCH 08/12] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- .../composer/common/include/display_vdi_adapter_interface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/display/composer/common/include/display_vdi_adapter_interface.h b/display/composer/common/include/display_vdi_adapter_interface.h index 548383a6..6c323d66 100644 --- a/display/composer/common/include/display_vdi_adapter_interface.h +++ b/display/composer/common/include/display_vdi_adapter_interface.h @@ -99,7 +99,7 @@ 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 (*RegHwcEventCallbackFunc)(const sptr& cb); + int32_t (*RegHwcEventCallback)(const sptr& cb, void *data); }; using LoadVdiImplFunc = int32_t (*)(); @@ -168,7 +168,7 @@ 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 RegHwcEventCallbackFunc = int32_t (*)(const sptr& cb); +using RegHwcEventCallbackFunc = int32_t (*)(const sptr& cb, void *data); } // namespace Composer -- Gitee From 570d7830e77249950f94b6c92ffa150b40949cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 8 Jul 2025 11:42:55 +0800 Subject: [PATCH 09/12] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- .../composer/common/include/display_vdi_adapter_interface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/display/composer/common/include/display_vdi_adapter_interface.h b/display/composer/common/include/display_vdi_adapter_interface.h index 6c323d66..47db42dd 100644 --- a/display/composer/common/include/display_vdi_adapter_interface.h +++ b/display/composer/common/include/display_vdi_adapter_interface.h @@ -99,7 +99,7 @@ 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 (*RegHwcEventCallback)(const sptr& cb, void *data); + int32_t (*RegHwcEventCallback)(HwcEventCallback cb, void *data); }; using LoadVdiImplFunc = int32_t (*)(); @@ -168,7 +168,7 @@ 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 RegHwcEventCallbackFunc = int32_t (*)(const sptr& cb, void *data); +using RegHwcEventCallbackFunc = int32_t (*)(IHwcEventCallback cb, void *data); } // namespace Composer -- Gitee From 4812937f569ff2acba66b4af5b19216777a15a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 8 Jul 2025 11:43:20 +0800 Subject: [PATCH 10/12] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- display/composer/common/include/display_vdi_adapter_interface.h | 2 +- 1 file changed, 1 insertion(+), 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 47db42dd..fc2465b7 100644 --- a/display/composer/common/include/display_vdi_adapter_interface.h +++ b/display/composer/common/include/display_vdi_adapter_interface.h @@ -168,7 +168,7 @@ 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 RegHwcEventCallbackFunc = int32_t (*)(IHwcEventCallback cb, void *data); +using RegHwcEventCallbackFunc = int32_t (*)(HwcEventCallback cb, void *data); } // namespace Composer -- Gitee From 0490ca42a7b276799b303a50ef6c502faba55c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Fri, 25 Jul 2025 16:07:49 +0800 Subject: [PATCH 11/12] 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- display/composer/v1_3/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/display/composer/v1_3/BUILD.gn b/display/composer/v1_3/BUILD.gn index e6d3242c..da7314b1 100644 --- a/display/composer/v1_3/BUILD.gn +++ b/display/composer/v1_3/BUILD.gn @@ -58,6 +58,7 @@ 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", -- Gitee From 86f65de18dc185bbe4432be974fa58717d726591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Fri, 25 Jul 2025 16:08:24 +0800 Subject: [PATCH 12/12] 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- display/buffer/v1_3/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/display/buffer/v1_3/BUILD.gn b/display/buffer/v1_3/BUILD.gn index 5d69e281..d1a9514b 100644 --- a/display/buffer/v1_3/BUILD.gn +++ b/display/buffer/v1_3/BUILD.gn @@ -66,6 +66,7 @@ ohos_shared_library("libdisplay_buffer_hdi_impl_v1_3") { external_deps = [ "c_utils:utils", "graphic_surface:buffer_handle", + "hdf_core:libhdf_ipc_adapter", "hdf_core:libhdi", "hdf_core:libpub_utils", "hilog:libhilog", -- Gitee