diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp index 18f810f..a05ae4a 100755 --- a/libgralloc/gpu.cpp +++ b/libgralloc/gpu.cpp @@ -264,12 +264,12 @@ int gpu_context_t::free_impl(private_handle_t const* hnd) { int index = (hnd->base - m->framebuffer->base) / bufferSize; m->bufferMask &= ~(1<base, const_cast(hnd)); sp memalloc = mAllocCtrl->getAllocator(hnd->flags); int err = memalloc->free_buffer((void*)hnd->base, (size_t) hnd->size, hnd->offset, hnd->fd); if(err) return err; - terminateBuffer(&m->base, const_cast(hnd)); } // Release the genlock diff --git a/libgralloc/ionalloc.cpp b/libgralloc/ionalloc.cpp index 94a27e3..a04a6b7 100644 --- a/libgralloc/ionalloc.cpp +++ b/libgralloc/ionalloc.cpp @@ -64,6 +64,7 @@ void IonAlloc::close_device() int IonAlloc::alloc_buffer(alloc_data& data) { + Locker::Autolock _l(mLock); int err = 0; int ionSyncFd = FD_INIT; int iFd = FD_INIT; @@ -151,6 +152,7 @@ int IonAlloc::alloc_buffer(alloc_data& data) int IonAlloc::free_buffer(void* base, size_t size, int offset, int fd) { + Locker::Autolock _l(mLock); LOGD("ion: Freeing buffer base:%p size:%d fd:%d", base, size, fd); int err = 0; diff --git a/libgralloc/ionalloc.h b/libgralloc/ionalloc.h index 91a1d65..27e5e01 100644 --- a/libgralloc/ionalloc.h +++ b/libgralloc/ionalloc.h @@ -31,6 +31,7 @@ #define GRALLOC_IONALLOC_H #include "memalloc.h" +#include "gr.h" #include namespace gralloc { @@ -63,6 +64,8 @@ namespace gralloc { void close_device(); + mutable Locker mLock; + }; }