From f75b90721f488a89f23f61e510e57bd688e630ed Mon Sep 17 00:00:00 2001 From: Naomi Luis Date: Mon, 1 Aug 2011 12:09:22 -0700 Subject: [PATCH] libgralloc-qsd8k: Check PMEM_ADSP flag Check the PMEM_ADSP flag during the terminateBuffer and gralloc_unmap operations. CRs-fixed: 296807, 298849, 296817 Change-Id: Ia97aca71935ca3c921f53fc88f5b4f918d7434c0 --- libgralloc-qsd8k/mapper.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libgralloc-qsd8k/mapper.cpp b/libgralloc-qsd8k/mapper.cpp index d32fc28..883c10b 100755 --- a/libgralloc-qsd8k/mapper.cpp +++ b/libgralloc-qsd8k/mapper.cpp @@ -179,8 +179,9 @@ int terminateBuffer(gralloc_module_t const* module, if (hnd->lockState & private_handle_t::LOCK_STATE_MAPPED) { // this buffer was mapped, unmap it now - if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_PMEM || - hnd->flags & private_handle_t::PRIV_FLAGS_USES_ASHMEM) { + if (hnd->flags & (private_handle_t::PRIV_FLAGS_USES_PMEM | + private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP | + private_handle_t::PRIV_FLAGS_USES_ASHMEM)) { if (hnd->pid != getpid()) { // ... unless it's a "master" pmem buffer, that is a buffer // mapped in the process it's been allocated. @@ -188,6 +189,7 @@ int terminateBuffer(gralloc_module_t const* module, gralloc_unmap(module, hnd); } } else { + LOGE("terminateBuffer: unmapping a non pmem/ashmem buffer flags = 0x%x", hnd->flags); gralloc_unmap(module, hnd); } } @@ -283,7 +285,8 @@ int gralloc_unlock(gralloc_module_t const* module, if (hnd->flags & private_handle_t::PRIV_FLAGS_NEEDS_FLUSH) { int err; - if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_PMEM) { + if (hnd->flags & (private_handle_t::PRIV_FLAGS_USES_PMEM | + private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP)) { struct pmem_addr pmem_addr; pmem_addr.vaddr = hnd->base; pmem_addr.offset = hnd->offset;