From 76595c17bd528374a726ec55bdda59c9ad823598 Mon Sep 17 00:00:00 2001 From: Shubhraprakash Das Date: Tue, 18 Jan 2011 17:59:30 -0700 Subject: [PATCH] libgralloc-qsd8k: Port part of change Ice6a7c28 Port over part of change Ice6a7c28 that frees ashmem memory. Change-Id: I467617f3bc35a0e448fbf41207853e669aed657a --- libgralloc-qsd8k/gpu.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libgralloc-qsd8k/gpu.cpp b/libgralloc-qsd8k/gpu.cpp index 68177a5..a2c35b4 100755 --- a/libgralloc-qsd8k/gpu.cpp +++ b/libgralloc-qsd8k/gpu.cpp @@ -401,6 +401,16 @@ int gpu_context_t::free_impl(private_handle_t const* hnd) { pmem_allocator = &pmemAllocator; } else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP) { pmem_allocator = &pmemAdspAllocator; + } else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ASHMEM) { + // free ashmem + if (hnd->fd >= 0) { + if (hnd->base) { + int err = munmap((void*)hnd->base, hnd->size); + LOGE_IF(err<0, "ASHMEM_UNMAP failed (%s), " + "fd=%d, sub.offset=%d, sub.size=%d", + strerror(errno), hnd->fd, hnd->offset, hnd->size); + } + } } if (pmem_allocator) { pmem_allocator->free_pmem_buffer(hnd->size, (void*)hnd->base,