gralloc: Optimize ION cache clean and invalidate calls
-Clients not having WRITE_OFTEN or READ_OFTEN are uncached.
-Invalidate cache on lock only if CPU needs to read and there
are non-CPU writers in system (camera,gpu etc)
-Flush cache on unlock only if CPU writes. Since all buffers will be
read in HWC(MDP) there is no need to check if readers exist.
Change-Id: Icd114e60b7456bd71592b81016892e806c37cb22
diff --git a/libgralloc/gr.h b/libgralloc/gr.h
index 797d57e..37ee4e5 100644
--- a/libgralloc/gr.h
+++ b/libgralloc/gr.h
@@ -71,6 +71,10 @@
void free_buffer(private_handle_t *hnd);
int getYUVPlaneInfo(private_handle_t* pHnd, struct android_ycbcr* ycbcr);
+// Use uncached for all scenarios except when the CPU needs to read or write
+// often
+bool useUncached(const int& usage);
+
/*****************************************************************************/
class Locker {