diff options
Diffstat (limited to 'libgralloc/alloc_controller.cpp')
-rw-r--r-- | libgralloc/alloc_controller.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp index cd6d5658..fd81c708 100644 --- a/libgralloc/alloc_controller.cpp +++ b/libgralloc/alloc_controller.cpp @@ -76,6 +76,21 @@ static bool canFallback(int usage, bool triedSystem) return true; } +/* The default policy is to return cached buffers unless the client explicity + * sets the PRIVATE_UNCACHED flag or indicates that the buffer will be rarely + * read or written in software. Any combination with a _RARELY_ flag will be + * treated as uncached. */ +static bool useUncached(const int& usage) { + if((usage & GRALLOC_USAGE_PRIVATE_UNCACHED) or + ((usage & GRALLOC_USAGE_SW_WRITE_MASK) == + GRALLOC_USAGE_SW_WRITE_RARELY) or + ((usage & GRALLOC_USAGE_SW_READ_MASK) == + GRALLOC_USAGE_SW_READ_RARELY)) + return true; + + return false; +} + //-------------- AdrenoMemInfo-----------------------// AdrenoMemInfo::AdrenoMemInfo() { @@ -664,14 +679,3 @@ void free_buffer(private_handle_t *hnd) delete hnd; } - -bool useUncached(const int& usage) { - if(usage & GRALLOC_USAGE_PRIVATE_UNCACHED) - return true; - - if(not (usage & (GRALLOC_USAGE_SW_WRITE_OFTEN | - GRALLOC_USAGE_SW_READ_OFTEN))) - return true; - - return false; -} |