From b313c97d358c868735854edbd27f944a4c613091 Mon Sep 17 00:00:00 2001 From: huyx Date: Fri, 4 Jul 2025 11:49:34 +0800 Subject: [PATCH 1/4] =?UTF-8?q?ReAllocMem=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- display/buffer/hdi_service/BUILD.gn | 36 +++ .../include/allocator_service_1_3.h | 52 +++++ .../hdi_service/include/idisplay_buffer_vdi.h | 6 + .../hdi_service/src/allocator_driver.cpp | 9 +- .../hdi_service/src/allocator_service_1_3.cpp | 217 ++++++++++++++++++ display/buffer/test/unittest/BUILD.gn | 2 +- .../test/unittest/display_buffer_ut.cpp | 44 ++++ .../buffer/test/unittest/display_buffer_ut.h | 5 +- 8 files changed, 364 insertions(+), 7 deletions(-) create mode 100644 display/buffer/hdi_service/include/allocator_service_1_3.h create mode 100644 display/buffer/hdi_service/src/allocator_service_1_3.cpp diff --git a/display/buffer/hdi_service/BUILD.gn b/display/buffer/hdi_service/BUILD.gn index 1b4a2c3435..8be91cd988 100644 --- a/display/buffer/hdi_service/BUILD.gn +++ b/display/buffer/hdi_service/BUILD.gn @@ -18,6 +18,7 @@ group("hdf_display_buffer_service") { deps = [ ":liballocator_driver_1.0", ":liballocator_service_1.0", + ":liballocator_service_1.3", ":libmapper_driver_1.0", ":libmapper_service_1.0", ":libmapper_service_1.2", @@ -61,12 +62,47 @@ ohos_shared_library("liballocator_service_1.0") { part_name = "drivers_peripheral_display" } +ohos_shared_library("liballocator_service_1.3") { + defines = [] + defines += display_defines + include_dirs = [ + "dfx", + "include", + "../../utils/include", + ] + sources = [ + "dfx/display_buffer_dfx.cpp", + "src/allocator_service_1_3.cpp", + ] + + external_deps = [ + "c_utils:utils", + "drivers_interface_display:libdisplay_buffer_stub_1.3", + "graphic_surface:buffer_handle", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + "hdf_core:libhdi", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_single", + ] + + if (drivers_peripheral_display_hicollie_enable) { + external_deps += [ "hicollie:libhicollie" ] + } + + install_images = [ chipset_base_dir ] + subsystem_name = "hdf" + part_name = "drivers_peripheral_display" +} + ohos_shared_library("liballocator_driver_1.0") { sources = [ "src/allocator_driver.cpp" ] external_deps = [ "c_utils:utils", "drivers_interface_display:libdisplay_buffer_stub_1.0", + "drivers_interface_display:libdisplay_buffer_stub_1.3", "hdf_core:libhdf_host", "hdf_core:libhdf_ipc_adapter", "hdf_core:libhdf_utils", diff --git a/display/buffer/hdi_service/include/allocator_service_1_3.h b/display/buffer/hdi_service/include/allocator_service_1_3.h new file mode 100644 index 0000000000..ef4b6a739e --- /dev/null +++ b/display/buffer/hdi_service/include/allocator_service_1_3.h @@ -0,0 +1,52 @@ +/* + * 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_BUFFER_V1_3_ALLOCATOR_SERVICE_H +#define OHOS_HDI_DISPLAY_BUFFER_V1_3_ALLOCATOR_SERVICE_H + +#include "idisplay_buffer_vdi.h" +#include "v1_0/display_buffer_type.h" +#include "v1_3/iallocator.h" +#include + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Buffer { +namespace V1_3 { +class AllocatorService : public V1_3::IAllocator { +public: + AllocatorService(); + virtual ~AllocatorService(); + int32_t AllocMem(const AllocInfo& info, sptr& handle) override; + int32_t ReAllocMem(const OHOS::HDI::Display::Buffer::V1_0::AllocInfo& info, + const sptr& inHandle, sptr& outHandle) override; + +private: + int32_t LoadVdi(); + void FreeMemVdi(BufferHandle* handle); + void WriteAllocPidToDma(int32_t fd, pid_t remotePid); + std::mutex mutex_; + void *libHandle_; + IDisplayBufferVdi *vdiImpl_; + CreateDisplayBufferVdiFunc createVdi_; + DestroyDisplayBufferVdiFunc destroyVdi_; +}; +} // namespace V1_3 +} // namespace Buffer +} // namespace Display +} // namespace HDI +} // namespace OHOS +#endif // OHOS_HDI_DISPLAY_BUFFER_V1_3_ALLOCATOR_SERVICE_H diff --git a/display/buffer/hdi_service/include/idisplay_buffer_vdi.h b/display/buffer/hdi_service/include/idisplay_buffer_vdi.h index 9940e6ad37..e1bbfe1434 100644 --- a/display/buffer/hdi_service/include/idisplay_buffer_vdi.h +++ b/display/buffer/hdi_service/include/idisplay_buffer_vdi.h @@ -149,6 +149,12 @@ public: { return 0; } + + virtual int32_t ReAllocMem(const OHOS::HDI::Display::Buffer::V1_0::AllocInfo& info, + const NativeBuffer& inHandle, NativeBuffer*& outHandle) const + { + return 0; + } }; using CreateDisplayBufferVdiFunc = IDisplayBufferVdi* (*)(); diff --git a/display/buffer/hdi_service/src/allocator_driver.cpp b/display/buffer/hdi_service/src/allocator_driver.cpp index 2290502e89..c35261bc77 100644 --- a/display/buffer/hdi_service/src/allocator_driver.cpp +++ b/display/buffer/hdi_service/src/allocator_driver.cpp @@ -17,14 +17,14 @@ #include #include #include -#include "v1_0/allocator_stub.h" +#include "v1_3/allocator_stub.h" #undef LOG_TAG #define LOG_TAG "ALLOC_DRV" #undef LOG_DOMAIN #define LOG_DOMAIN 0xD002515 -using namespace OHOS::HDI::Display::Buffer::V1_0; +using namespace OHOS::HDI::Display::Buffer::V1_3; struct HdfAllocatorHost { struct IDeviceIoService ioService; @@ -77,7 +77,7 @@ static int HdfAllocatorDriverBind(struct HdfDeviceObject* deviceObject) hdfAllocatorHost->ioService.Release = NULL; - auto serviceImpl = IAllocator::Get(true); + auto serviceImpl = OHOS::HDI::Display::Buffer::V1_3::IAllocator::Get(true); if (serviceImpl == nullptr) { HDF_LOGE("%{public}s: failed to get the implement of service", __func__); delete hdfAllocatorHost; @@ -85,7 +85,8 @@ static int HdfAllocatorDriverBind(struct HdfDeviceObject* deviceObject) } hdfAllocatorHost->stub = - OHOS::HDI::ObjectCollector::GetInstance().GetOrNewObject(serviceImpl, IAllocator::GetDescriptor()); + OHOS::HDI::ObjectCollector::GetInstance().GetOrNewObject(serviceImpl, + OHOS::HDI::Display::Buffer::V1_3::IAllocator::GetDescriptor()); if (hdfAllocatorHost->stub == nullptr) { HDF_LOGE("%{public}s: failed to get stub object", __func__); delete hdfAllocatorHost; diff --git a/display/buffer/hdi_service/src/allocator_service_1_3.cpp b/display/buffer/hdi_service/src/allocator_service_1_3.cpp new file mode 100644 index 0000000000..5daf50b771 --- /dev/null +++ b/display/buffer/hdi_service/src/allocator_service_1_3.cpp @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2023 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 "allocator_service_1_3.h" + +#include +#include +#include +#include +#include +#include +#include +#include "display_log.h" +#include "hdf_trace.h" +#include "hdf_remote_service.h" +#include "display_buffer_dfx.h" + +#undef LOG_TAG +#define LOG_TAG "ALLOC_SRV" +#undef LOG_DOMAIN +#define LOG_DOMAIN 0xD002515 +#define BUFF_SIZE 16 + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Buffer { +namespace V1_3 { +extern "C" IAllocator* AllocatorImplGetInstance(void) +{ + return new (std::nothrow) AllocatorService(); +} + +AllocatorService::AllocatorService() + : libHandle_(nullptr), + vdiImpl_(nullptr), + createVdi_(nullptr), + destroyVdi_(nullptr) +{ + int32_t ret = LoadVdi(); + if (ret == HDF_SUCCESS) { + vdiImpl_ = createVdi_(); + CHECK_NULLPOINTER_RETURN(vdiImpl_); + } else { + HDF_LOGE("%{public}s: Load buffer VDI failed", __func__); + } +} + +AllocatorService::~AllocatorService() +{ + std::lock_guard lck(mutex_); + if (destroyVdi_ != nullptr && vdiImpl_ != nullptr) { + destroyVdi_(vdiImpl_); + vdiImpl_ = nullptr; + destroyVdi_ = nullptr; + } + if (libHandle_ != nullptr) { + dlclose(libHandle_); + libHandle_ = nullptr; + } +} + +int32_t AllocatorService::LoadVdi() +{ + const char* errStr = dlerror(); + if (errStr != nullptr) { + HDF_LOGD("%{public}s: allocator load vdi, clear earlier dlerror: %{public}s", __func__, errStr); + } +#ifdef BUFFER_VDI_DEFAULT_LIBRARY_ENABLE + libHandle_ = dlopen(DISPLAY_BUFFER_VDI_DEFAULT_LIBRARY, RTLD_LAZY); + if (libHandle_ == nullptr) { + DISPLAY_LOGE("display buffer load vendor vdi default library failed: %{public}s", DISPLAY_BUFFER_VDI_LIBRARY); +#endif // BUFFER_VDI_DEFAULT_LIBRARY_ENABLE + libHandle_ = dlopen(DISPLAY_BUFFER_VDI_LIBRARY, RTLD_LAZY); + DISPLAY_LOGD("display buffer load vendor vdi library: %{public}s", DISPLAY_BUFFER_VDI_LIBRARY); +#ifdef BUFFER_VDI_DEFAULT_LIBRARY_ENABLE + } else { + DISPLAY_LOGD("display buffer load vendor vdi default library: %{public}s", DISPLAY_BUFFER_VDI_LIBRARY); + } +#endif // BUFFER_VDI_DEFAULT_LIBRARY_ENABLE + CHECK_NULLPOINTER_RETURN_VALUE(libHandle_, HDF_FAILURE); + + createVdi_ = reinterpret_cast(dlsym(libHandle_, "CreateDisplayBufferVdi")); + if (createVdi_ == nullptr) { + errStr = dlerror(); + if (errStr != nullptr) { + HDF_LOGE("%{public}s: allocator CreateDisplayBufferVdi dlsym error: %{public}s", __func__, errStr); + } + dlclose(libHandle_); + return HDF_FAILURE; + } + + destroyVdi_ = reinterpret_cast(dlsym(libHandle_, "DestroyDisplayBufferVdi")); + if (destroyVdi_ == nullptr) { + errStr = dlerror(); + if (errStr != nullptr) { + HDF_LOGE("%{public}s: allocator DestroyDisplayBufferVdi dlsym error: %{public}s", __func__, errStr); + } + dlclose(libHandle_); + return HDF_FAILURE; + } + return HDF_SUCCESS; +} + +void AllocatorService::WriteAllocPidToDma(int32_t fd, pid_t remotePid) +{ + char pidStr[BUFF_SIZE] = { 0 }; + if (sprintf_s(pidStr, BUFF_SIZE, "%d", remotePid) >= 0) { + ioctl(fd, DMA_BUF_SET_NAME_A, pidStr); + } +} + +void AllocatorService::FreeMemVdi(BufferHandle* handle) +{ + DisplayBufferDfx dfxIns("HDI:Display:FreeMemVdi:FreeMem"); + dfxIns.SetTimer(); + dfxIns.StartTimeStamp(); + HdfTrace traceTwo("FreeMem", "HDI:VDI:"); + vdiImpl_->FreeMem(*handle); +} + +int32_t AllocatorService::AllocMem(const AllocInfo& info, sptr& handle) +{ + pid_t remotePid = HdfRemoteGetCallingPid(); + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: remotePid %d", __func__, remotePid); + + BufferHandle* buffer = nullptr; + CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); + { + DisplayBufferDfx dfxIns("HDI:Display:AllocatorService:remotePid:" + std::to_string(remotePid)); + dfxIns.SetTimer(); + dfxIns.StartTimeStamp(); + HdfTrace traceOne("AllocMem-VDI", "HDI:VDI:"); + int32_t ec = vdiImpl_->AllocMem(info, buffer); + if (ec != HDF_SUCCESS) { + HDF_LOGE("%{public}s: AllocMem failed, ec = %{public}d", __func__, ec); + return ec; + } + } + + CHECK_NULLPOINTER_RETURN_VALUE(buffer, HDF_DEV_ERR_NO_MEMORY); + WriteAllocPidToDma(buffer->fd, remotePid); + + handle = new NativeBuffer(); + if (handle == nullptr) { + HDF_LOGE("%{public}s: new NativeBuffer failed", __func__); + FreeMemVdi(buffer); + return HDF_FAILURE; + } + + handle->SetBufferHandle(buffer, true, [this](BufferHandle* freeBuffer) { + FreeMemVdi(freeBuffer); + }); + return HDF_SUCCESS; +} + +int32_t AllocatorService::ReAllocMem(const OHOS::HDI::Display::Buffer::V1_0::AllocInfo& info, + const sptr& inBuffer, sptr& outBuffer) +{ + pid_t remotePid = HdfRemoteGetCallingPid(); + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: remotePid %d", __func__, remotePid); + + CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); + BufferHandle* inHandle = inBuffer->Move(); + BufferHandle* outHandle = nullptr; + { + DisplayBufferDfx dfxIns("HDI:Display:AllocatorService:remotePid:" + std::to_string(remotePid)); + dfxIns.SetTimer(); + dfxIns.StartTimeStamp(); + HdfTrace traceOne("AllocMem-VDI", "HDI:VDI:"); + int32_t ret = vdiImpl_->RegisterBuffer(*inHandle); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%{public}s: RegisterBuffer failed, ret = %{public}d", __func__, ret); + return ret; + } + + int32_t ec = vdiImpl_->ReAllocMem(info, *inHandle, outHandle); + if (ec != HDF_SUCCESS) { + HDF_LOGE("%{public}s: ReAllocMem failed, ec = %{public}d", __func__, ec); + return ec; + } + } + + CHECK_NULLPOINTER_RETURN_VALUE(outHandle, HDF_DEV_ERR_NO_MEMORY); + WriteAllocPidToDma(outHandle->fd, remotePid); + + FreeMemVdi(inHandle); + + outBuffer = new NativeBuffer(); + if (outBuffer == nullptr) { + HDF_LOGE("%{public}s: new NativeBuffer failed", __func__); + FreeMemVdi(outHandle); + return HDF_FAILURE; + } + + outBuffer->SetBufferHandle(outHandle, true, [this](BufferHandle* freeBuffer) { + FreeMemVdi(freeBuffer); + }); + return HDF_SUCCESS; +} +} // namespace V1_3 +} // namespace Buffer +} // namespace Display +} // namespace HDI +} // namespace OHOS diff --git a/display/buffer/test/unittest/BUILD.gn b/display/buffer/test/unittest/BUILD.gn index 35e8c4d614..72a59d7834 100644 --- a/display/buffer/test/unittest/BUILD.gn +++ b/display/buffer/test/unittest/BUILD.gn @@ -24,7 +24,7 @@ ohos_unittest("hdf_disp_buffer_unittest") { external_deps = [ "c_utils:utils", - "drivers_interface_display:libdisplay_buffer_hdi_impl_v1_1", + "drivers_interface_display:libdisplay_buffer_hdi_impl_v1_3", "drivers_interface_display:libdisplay_buffer_proxy_1.0", "drivers_interface_display:libdisplay_buffer_proxy_1.1", "drivers_interface_display:libdisplay_composer_hdi_impl_1.2", diff --git a/display/buffer/test/unittest/display_buffer_ut.cpp b/display/buffer/test/unittest/display_buffer_ut.cpp index 9878a0740a..1799ede78a 100644 --- a/display/buffer/test/unittest/display_buffer_ut.cpp +++ b/display/buffer/test/unittest/display_buffer_ut.cpp @@ -486,6 +486,50 @@ TEST_P(DisplayBufferUt, DisplayBufferUt) } INSTANTIATE_TEST_SUITE_P(AllocTest, DisplayBufferUt, ::testing::ValuesIn(DISPLAY_BUFFER_TEST_SETS)); + +int32_t DisplayBufferUt::ReallocMemTest(AllocInfo& info) +{ + int ret; + BufferHandle* inBuffer = nullptr; + ret = displayBuffer_->AllocMem(info, inBuffer); + EXPECT_TRUE(ret == DISPLAY_SUCCESS); + EXPECT_NE(inBuffer, nullptr); + + /*ReAllocMem*/ + BufferHandle* outBuffer = nullptr; + AllocInfo newInfo = { + .width = 1920, + .height = 1080, + .usage = Composer::V1_0::HBM_USE_MEM_DMA | Composer::V1_0::HBM_USE_VIDEO_DECODER | + Composer::V1_0::HBM_USE_HW_COMPOSER | Composer::V1_0::HBM_USE_CPU_READ, + .format = Composer::V1_1::PIXEL_FMT_YCBCR_420_P + }; // HFBC in bbk + ret = displayBuffer->ReAllocMem(newInfo, *inBuffer, outBuffer); + EXPECT_TRUE(ret == DISPLAY_SUCCESS); + EXPECT_NE(inBuffer, nullptr); + EXPECT_NE(outBuffer, nullptr); + + EXPECT_EQ(outBuffer->size, inBuffer->size); + EXPECT_NE(outBuffer->fd, inBuffer->fd); + + displayBuffer_->FreeMem(*inBuffer); + displayBuffer_->FreeMem(*outBuffer); + + return DISPLAY_SUCCESS; +} + +HWTEST_F(DisplayBuuferUt, test_ReAllocMemTest, TestSize.Level1) +{ + AllocInfo info = { + .width = 1920, + .height = 1080, + .usage = Composer::V1_0::HBM_USE_MEM_DMA | Composer::V1_0::HBM_USE_VIDEO_DECODER | + Composer::V1_0::HBM_USE_HW_COMPOSER, + .format = Composer::V1_1::PIXEL_FMT_YCBCR_420_P + }; + int ret = ReaalocMemTest(info); + ASSERT_TRUE(ret == DISPLAY_SUCCESS); +} } // OHOS } // HDI } // DISPLAY diff --git a/display/buffer/test/unittest/display_buffer_ut.h b/display/buffer/test/unittest/display_buffer_ut.h index bdd81445d4..7426ebde81 100644 --- a/display/buffer/test/unittest/display_buffer_ut.h +++ b/display/buffer/test/unittest/display_buffer_ut.h @@ -20,7 +20,7 @@ #include "v1_0/imapper.h" #include "v1_1/imetadata.h" #include "v1_0/display_buffer_type.h" -#include "v1_1/include/idisplay_buffer.h" +#include "v1_3/include/idisplay_buffer.h" namespace OHOS { namespace HDI { @@ -30,7 +30,7 @@ using OHOS::HDI::Display::Buffer::V1_0::IAllocator; using OHOS::HDI::Display::Buffer::V1_0::IMapper; using OHOS::HDI::Display::Buffer::V1_0::AllocInfo; using OHOS::HDI::Display::Buffer::V1_1::IMetadata; -using OHOS::HDI::Display::Buffer::V1_1::IDisplayBuffer; +using OHOS::HDI::Display::Buffer::V1_3::IDisplayBuffer; class DisplayBufferUt : public ::testing::TestWithParam { protected: @@ -39,6 +39,7 @@ protected: public: IDisplayBuffer* displayBuffer_{ nullptr }; int32_t AllocMemTest(AllocInfo& info); + int32_t ReAllocMemTest(AllocInfo& info); void MetadataTest(BufferHandle& handle); }; } // OHOS -- Gitee From 85c38f44b47bf40696bdb91df0438ca7b7a95dec Mon Sep 17 00:00:00 2001 From: huyx Date: Fri, 4 Jul 2025 13:39:16 +0800 Subject: [PATCH 2/4] =?UTF-8?q?ReAllocMem=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- display/buffer/hdi_service/src/allocator_service_1_3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/buffer/hdi_service/src/allocator_service_1_3.cpp b/display/buffer/hdi_service/src/allocator_service_1_3.cpp index 5daf50b771..f7d346cd7a 100644 --- a/display/buffer/hdi_service/src/allocator_service_1_3.cpp +++ b/display/buffer/hdi_service/src/allocator_service_1_3.cpp @@ -167,7 +167,7 @@ int32_t AllocatorService::AllocMem(const AllocInfo& info, sptr& ha } int32_t AllocatorService::ReAllocMem(const OHOS::HDI::Display::Buffer::V1_0::AllocInfo& info, - const sptr& inBuffer, sptr& outBuffer) + const sptr& inBuffer, sptr& outBuffer) { pid_t remotePid = HdfRemoteGetCallingPid(); HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: remotePid %d", __func__, remotePid); -- Gitee From 447ad767b0c1147e9a3d4d32e5eade68189b1993 Mon Sep 17 00:00:00 2001 From: huyx Date: Fri, 4 Jul 2025 13:41:06 +0800 Subject: [PATCH 3/4] =?UTF-8?q?ReAllocMem=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- display/buffer/hdi_service/include/idisplay_buffer_vdi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/buffer/hdi_service/include/idisplay_buffer_vdi.h b/display/buffer/hdi_service/include/idisplay_buffer_vdi.h index e1bbfe1434..c97625e74a 100644 --- a/display/buffer/hdi_service/include/idisplay_buffer_vdi.h +++ b/display/buffer/hdi_service/include/idisplay_buffer_vdi.h @@ -151,7 +151,7 @@ public: } virtual int32_t ReAllocMem(const OHOS::HDI::Display::Buffer::V1_0::AllocInfo& info, - const NativeBuffer& inHandle, NativeBuffer*& outHandle) const + const BufferHandle& inHandle, BufferHandle*& outHandle) const { return 0; } -- Gitee From 6fbf506e68cbe7f8ac8fc6ff3867a4c45db3692f Mon Sep 17 00:00:00 2001 From: huyx Date: Fri, 4 Jul 2025 20:51:28 +0800 Subject: [PATCH 4/4] =?UTF-8?q?ReallocMem=E9=87=8D=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- display/buffer/test/unittest/display_buffer_ut.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/display/buffer/test/unittest/display_buffer_ut.cpp b/display/buffer/test/unittest/display_buffer_ut.cpp index 1799ede78a..0b004042ab 100644 --- a/display/buffer/test/unittest/display_buffer_ut.cpp +++ b/display/buffer/test/unittest/display_buffer_ut.cpp @@ -487,7 +487,7 @@ TEST_P(DisplayBufferUt, DisplayBufferUt) INSTANTIATE_TEST_SUITE_P(AllocTest, DisplayBufferUt, ::testing::ValuesIn(DISPLAY_BUFFER_TEST_SETS)); -int32_t DisplayBufferUt::ReallocMemTest(AllocInfo& info) +int32_t DisplayBufferUt::ReAllocMemTest(AllocInfo& info) { int ret; BufferHandle* inBuffer = nullptr; @@ -504,7 +504,7 @@ int32_t DisplayBufferUt::ReallocMemTest(AllocInfo& info) Composer::V1_0::HBM_USE_HW_COMPOSER | Composer::V1_0::HBM_USE_CPU_READ, .format = Composer::V1_1::PIXEL_FMT_YCBCR_420_P }; // HFBC in bbk - ret = displayBuffer->ReAllocMem(newInfo, *inBuffer, outBuffer); + ret = displayBuffer_->ReAllocMem(newInfo, *inBuffer, outBuffer); EXPECT_TRUE(ret == DISPLAY_SUCCESS); EXPECT_NE(inBuffer, nullptr); EXPECT_NE(outBuffer, nullptr); @@ -518,7 +518,7 @@ int32_t DisplayBufferUt::ReallocMemTest(AllocInfo& info) return DISPLAY_SUCCESS; } -HWTEST_F(DisplayBuuferUt, test_ReAllocMemTest, TestSize.Level1) +HWTEST_F(DisplayBufferUt, test_ReAllocMemTest, TestSize.Level1) { AllocInfo info = { .width = 1920, @@ -527,7 +527,7 @@ HWTEST_F(DisplayBuuferUt, test_ReAllocMemTest, TestSize.Level1) Composer::V1_0::HBM_USE_HW_COMPOSER, .format = Composer::V1_1::PIXEL_FMT_YCBCR_420_P }; - int ret = ReaalocMemTest(info); + int ret = ReAllocMemTest(info); ASSERT_TRUE(ret == DISPLAY_SUCCESS); } } // OHOS -- Gitee