diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2014-01-02 15:50:59 +0000 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2014-01-02 16:01:26 +0000 |
commit | 0ae0edd95acb33725ea0607af21874f387dac578 (patch) | |
tree | 5cad5e56caf81e5d365a11452805a29d427208e3 | |
parent | 73ef2c14bf7c34070e041923c0d18c75e3453105 (diff) | |
download | android_hardware_samsung-0ae0edd95acb33725ea0607af21874f387dac578.tar.gz android_hardware_samsung-0ae0edd95acb33725ea0607af21874f387dac578.tar.bz2 android_hardware_samsung-0ae0edd95acb33725ea0607af21874f387dac578.zip |
gralloc: Attribute buffer ownership to last caller
Switch buffer management from creator to latest registrant
Change-Id: If6b1ab1a553f701e4a1038c089f2b2ecb02c2e8b
-rw-r--r-- | exynos4/hal/libgralloc_ump/gralloc_module.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/exynos4/hal/libgralloc_ump/gralloc_module.cpp b/exynos4/hal/libgralloc_ump/gralloc_module.cpp index 3bbb831..b4ed133 100644 --- a/exynos4/hal/libgralloc_ump/gralloc_module.cpp +++ b/exynos4/hal/libgralloc_ump/gralloc_module.cpp @@ -239,6 +239,8 @@ static int gralloc_register_buffer(gralloc_module_t const* module, buffer_handle s_ump_is_open = 1; } + hnd->pid = getpid(); + if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP) { hnd->ump_mem_handle = (int)ump_handle_create_from_secure_id(hnd->ump_id); if (UMP_INVALID_MEMORY_HANDLE != (ump_handle)hnd->ump_mem_handle) { @@ -318,8 +320,8 @@ static int gralloc_unregister_buffer(gralloc_module_t const* module, buffer_hand ALOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK, "[unregister] handle %p still locked (state=%08x)", hnd, hnd->lockState); - /* never unmap buffers that were created in this process */ - if (hnd->pid != getpid()) { + /* never unmap buffers that were not registered in this process */ + if (hnd->pid == getpid()) { pthread_mutex_lock(&s_map_lock); if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP) { ump_mapped_pointer_release((ump_handle)hnd->ump_mem_handle); |