gralloc: In lock use writer info from allocation time
lock() can be called from a CpuConsumer with only the READ_OFTEN flag
so relying only on that makes gralloc assume there are no non cpu
writers.
Store the writer information during allocation in private flags of
handle and refer to those during lock()
Change-Id: Ifbf25ebc74dbf4e422a2fdec52ec000cd75e549b
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 943e64f..3053d47 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -238,11 +238,11 @@
}
if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION and
not useUncached(usage)) {
- bool nonCPUWriters = usage & (
- GRALLOC_USAGE_HW_RENDER |
- GRALLOC_USAGE_HW_FB |
- GRALLOC_USAGE_HW_VIDEO_ENCODER |
- GRALLOC_USAGE_HW_CAMERA_WRITE);
+ bool nonCPUWriters = hnd->flags & (
+ private_handle_t::PRIV_FLAGS_HW_RENDER |
+ private_handle_t::PRIV_FLAGS_HW_FB |
+ private_handle_t::PRIV_FLAGS_VIDEO_ENCODER |
+ private_handle_t::PRIV_FLAGS_CAMERA_WRITE);
//Invalidate if CPU reads in software and there are non-CPU
//writers. No need to do this for the metadata buffer as it is