diff --git a/display/bundle.json b/display/bundle.json index 7643e8326e8a80a61ae71b4b4c3d8bd3fa5e4416..f34ca7a5903576c37929356eb34b2f09cdcdff39 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 bf8e32c2940460d36813417bcdee784e738c2022..2f079f62b7f484e204c20a1dfe344eec0743550b 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 d34b5812362ab82303263dd8bbcec6ca9ed5337f..fc2465b733969d3783d2e9d9f4a4609a5b84c868 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" @@ -32,6 +33,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)(); @@ -97,6 +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)(HwcEventCallback cb, void *data); }; using LoadVdiImplFunc = int32_t (*)(); @@ -165,6 +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 (*)(HwcEventCallback cb, void *data); } // namespace Composer 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 8a328edffeab10fe13e75dcd66591f374781444a..c4e36bb600700179466c0af9137c94da7c4c8691 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); } diff --git a/display/composer/v1_3/BUILD.gn b/display/composer/v1_3/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e6d3242c813f01f0742f4ed1d8acab6d6965d154 --- /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 0000000000000000000000000000000000000000..fc7c504cf32815295a4b3e8c5a7c888596071bd0 --- /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 0000000000000000000000000000000000000000..fa6dc0e6115163bf7dc9d2015f412b5a71e4ac09 --- /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 0000000000000000000000000000000000000000..af1f9b3c1b736c41b29ed59d793b008ca0d5320f --- /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 0000000000000000000000000000000000000000..cf9e00710696126b91b484300e0b620e4b9eae28 --- /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 0000000000000000000000000000000000000000..addf47d4aada168f35b0c36a28c7df852859b009 --- /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, cacheMgr 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 0000000000000000000000000000000000000000..b34b2323d164d36f73e5b8184e2f6b3217578f5b --- /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 0000000000000000000000000000000000000000..ba4f23686a81a7b830a983741bc12e464056be52 --- /dev/null +++ b/display/composer/v1_3/hdi_impl/display_composer_hdi_impl.h @@ -0,0 +1,106 @@ +/* + * 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 + +#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), + 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; + 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 0000000000000000000000000000000000000000..864ca5bf49adcd0284f9f95b959dd0048413f801 --- /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 0000000000000000000000000000000000000000..71aa127fda324a8561c1a87c3f4d19b6832c68d0 --- /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