Merge "c2-codecs: do not create host color buffer for cpu read write only usage" am: 980ea215e3

Original change: https://android-review.googlesource.com/c/device/generic/goldfish-opengl/+/1704150

Change-Id: I0ad0e9556a1706ca889ce0f6710a659a8d4b3349
diff --git a/system/hals/allocator3.cpp b/system/hals/allocator3.cpp
index c91bafd..5c103a5 100644
--- a/system/hals/allocator3.cpp
+++ b/system/hals/allocator3.cpp
@@ -323,6 +323,12 @@
             return false;
         }
 
+        // b/186585177
+        if ((usage & (BufferUsage::CPU_READ_MASK | BufferUsage::CPU_WRITE_MASK)) &&
+                (0 == (usage & ~(BufferUsage::CPU_READ_MASK | BufferUsage::CPU_WRITE_MASK)))) {
+            return false;
+        }
+
         return ((usage & BufferUsage::GPU_DATA_BUFFER)
                    || (format != PixelFormat::BLOB &&
                        format != PixelFormat::RAW16 &&