From ed7ede134401f09ef2fef1b1edcf789f35fee730 Mon Sep 17 00:00:00 2001 From: Justin Yun Date: Tue, 17 Oct 2023 14:06:38 +0900 Subject: Update VNDK snapshot v33 to build 10954093. Taken from branch android13-gsi. Bug: 244713317 Bug: 305592995 Test: na Change-Id: I33cde3f888186f12657941b960757eb20b069d44 Merged-In: I33cde3f888186f12657941b960757eb20b069d44 (cherry picked from commit 523c09dea488a8eb68c2c26c3837f84b916261e1) --- .../vndk-core/libstagefright_bufferpool@2.0.so | Bin 134856 -> 136744 bytes .../system/libfmq/include/fmq/MessageQueueBase.h | 56 +++++++++++++++++---- .../vndk-core/libstagefright_bufferpool@2.0.so | Bin 134156 -> 135828 bytes .../vndk-core/libstagefright_bufferpool@2.0.so | Bin 182632 -> 186840 bytes .../system/libfmq/include/fmq/MessageQueueBase.h | 56 +++++++++++++++++---- .../vndk-core/libstagefright_bufferpool@2.0.so | Bin 177092 -> 180868 bytes .../system/libfmq/include/fmq/MessageQueueBase.h | 56 +++++++++++++++++---- .../vndk-core/libstagefright_bufferpool@2.0.so | Bin 175956 -> 179860 bytes .../vndk-core/libstagefright_bufferpool@2.0.so | Bin 187192 -> 190344 bytes .../system/libfmq/include/fmq/MessageQueueBase.h | 56 +++++++++++++++++---- 10 files changed, 180 insertions(+), 44 deletions(-) diff --git a/arm/arch-arm-armv7-a-neon/shared/vndk-core/libstagefright_bufferpool@2.0.so b/arm/arch-arm-armv7-a-neon/shared/vndk-core/libstagefright_bufferpool@2.0.so index 84ed419..9d38134 100755 Binary files a/arm/arch-arm-armv7-a-neon/shared/vndk-core/libstagefright_bufferpool@2.0.so and b/arm/arch-arm-armv7-a-neon/shared/vndk-core/libstagefright_bufferpool@2.0.so differ diff --git a/arm/include/system/libfmq/include/fmq/MessageQueueBase.h b/arm/include/system/libfmq/include/fmq/MessageQueueBase.h index c34a4ff..f4bf7e2 100644 --- a/arm/include/system/libfmq/include/fmq/MessageQueueBase.h +++ b/arm/include/system/libfmq/include/fmq/MessageQueueBase.h @@ -586,12 +586,6 @@ void MessageQueueBase::initMemory(bool resetPointer return; } - const auto& grantors = mDesc->grantors(); - for (const auto& grantor : grantors) { - hardware::details::check(hardware::details::isAlignedToWordBoundary(grantor.offset) == true, - "Grantor offsets need to be aligned"); - } - if (flavor == kSynchronizedReadWrite) { mReadPtr = reinterpret_cast*>( mapGrantorDescr(hardware::details::READPTRPOS)); @@ -602,11 +596,11 @@ void MessageQueueBase::initMemory(bool resetPointer */ mReadPtr = new (std::nothrow) std::atomic; } - hardware::details::check(mReadPtr != nullptr, "mReadPtr is null"); + if (mReadPtr == nullptr) goto error; mWritePtr = reinterpret_cast*>( mapGrantorDescr(hardware::details::WRITEPTRPOS)); - hardware::details::check(mWritePtr != nullptr, "mWritePtr is null"); + if (mWritePtr == nullptr) goto error; if (resetPointers) { mReadPtr->store(0, std::memory_order_release); @@ -617,14 +611,32 @@ void MessageQueueBase::initMemory(bool resetPointer } mRing = reinterpret_cast(mapGrantorDescr(hardware::details::DATAPTRPOS)); - hardware::details::check(mRing != nullptr, "mRing is null"); + if (mRing == nullptr) goto error; if (mDesc->countGrantors() > hardware::details::EVFLAGWORDPOS) { mEvFlagWord = static_cast*>( mapGrantorDescr(hardware::details::EVFLAGWORDPOS)); - hardware::details::check(mEvFlagWord != nullptr, "mEvFlagWord is null"); + if (mEvFlagWord == nullptr) goto error; android::hardware::EventFlag::createEventFlag(mEvFlagWord, &mEventFlag); } + return; +error: + if (mReadPtr) { + if (flavor == kSynchronizedReadWrite) { + unmapGrantorDescr(mReadPtr, hardware::details::READPTRPOS); + } else { + delete mReadPtr; + } + mReadPtr = nullptr; + } + if (mWritePtr) { + unmapGrantorDescr(mWritePtr, hardware::details::WRITEPTRPOS); + mWritePtr = nullptr; + } + if (mRing) { + unmapGrantorDescr(mRing, hardware::details::EVFLAGWORDPOS); + mRing = nullptr; + } } template