diff options
author | Jesse Hall <jessehall@google.com> | 2013-03-28 21:24:55 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-03-28 21:24:56 +0000 |
commit | 86b03c2f6578bfd78580dc02fb1a167b21dbceaf (patch) | |
tree | 74ab0b13394355d51b15012434ba8e5b5a83ee4d | |
parent | fb40d5de36fc93a1a3cab9c2cd73988ac52043a2 (diff) | |
parent | c71b6caece3fb1b85327f05acdd1becae4eda137 (diff) | |
download | libhardware-86b03c2f6578bfd78580dc02fb1a167b21dbceaf.tar.gz |
Merge "Remove pid check in register/unregister" into jb-mr2-dev
-rw-r--r-- | modules/gralloc/gralloc_priv.h | 8 | ||||
-rw-r--r-- | modules/gralloc/mapper.cpp | 23 |
2 files changed, 10 insertions, 21 deletions
diff --git a/modules/gralloc/gralloc_priv.h b/modules/gralloc/gralloc_priv.h index e1c502a6..9d14fe0e 100644 --- a/modules/gralloc/gralloc_priv.h +++ b/modules/gralloc/gralloc_priv.h @@ -74,18 +74,16 @@ struct private_handle_t { int size; int offset; - // FIXME: the attributes below should be out-of-line + // FIXME: this should be out-of-line int base; - int pid; #ifdef __cplusplus - static const int sNumInts = 6; + static const int sNumInts = 5; static const int sNumFds = 1; static const int sMagic = 0x3141592; private_handle_t(int fd, int size, int flags) : - fd(fd), magic(sMagic), flags(flags), size(size), offset(0), - base(0), pid(getpid()) + fd(fd), magic(sMagic), flags(flags), size(size), offset(0), base(0) { version = sizeof(native_handle); numInts = sNumInts; diff --git a/modules/gralloc/mapper.cpp b/modules/gralloc/mapper.cpp index c4096aeb..8aadb4a2 100644 --- a/modules/gralloc/mapper.cpp +++ b/modules/gralloc/mapper.cpp @@ -82,7 +82,7 @@ static int gralloc_unmap(gralloc_module_t const* module, /*****************************************************************************/ -static pthread_mutex_t sMapLock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t sMapLock = PTHREAD_MUTEX_INITIALIZER; /*****************************************************************************/ @@ -92,14 +92,8 @@ int gralloc_register_buffer(gralloc_module_t const* module, if (private_handle_t::validate(handle) < 0) return -EINVAL; - // if this handle was created in this process, then we keep it as is. - int err = 0; - private_handle_t* hnd = (private_handle_t*)handle; - if (hnd->pid != getpid()) { - void *vaddr; - err = gralloc_map(module, handle, &vaddr); - } - return err; + void *vaddr; + return gralloc_map(module, handle, &vaddr); } int gralloc_unregister_buffer(gralloc_module_t const* module, @@ -108,13 +102,10 @@ int gralloc_unregister_buffer(gralloc_module_t const* module, if (private_handle_t::validate(handle) < 0) return -EINVAL; - // never unmap buffers that were created in this process private_handle_t* hnd = (private_handle_t*)handle; - if (hnd->pid != getpid()) { - if (hnd->base) { - gralloc_unmap(module, handle); - } - } + if (hnd->base) + gralloc_unmap(module, handle); + return 0; } @@ -157,7 +148,7 @@ int gralloc_lock(gralloc_module_t const* module, return 0; } -int gralloc_unlock(gralloc_module_t const* module, +int gralloc_unlock(gralloc_module_t const* module, buffer_handle_t handle) { // we're done with a software buffer. nothing to do in this |