Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c60ca767 authored by Jeff Tinker's avatar Jeff Tinker Committed by android-build-merger
Browse files

Merge "Unmap shared memory when no longer used" into pi-dev

am: e70022cf

Change-Id: Ib30bab78226f747e62364f1734c41d84a49643fd
parents 81857dcb e70022cf
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -262,6 +262,17 @@ int32_t CryptoHal::setHeapBase(const sp<IMemoryHeap>& heap) {
void CryptoHal::clearHeapBase(int32_t seqNum) {
    Mutex::Autolock autoLock(mLock);

    /*
     * Clear the remote shared memory mapping by setting the shared
     * buffer base to a null hidl_memory.
     *
     * TODO: Add a releaseSharedBuffer method in a future DRM HAL
     * API version to make this explicit.
     */
    uint32_t bufferId = mHeapBases.valueFor(seqNum).getBufferId();
    Return<void> hResult = mPlugin->setSharedBufferBase(hidl_memory(), bufferId);
    ALOGE_IF(!hResult.isOk(), "setSharedBufferBase(): remote call failed");

    mHeapBases.removeItem(seqNum);
}