Add OMX_COLOR_FormatYUV420Planar to GoldfishMapper::isSupportedImpl

Allocator and Mapper must agree on supported formats.

Bug: 152554068
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Merged-In: I157b79835b4bf0b74e8f08451a2a39f1eb595e83
Change-Id: Ic515d07d8ad1411a33b560b59636b65b0519a5df
diff --git a/system/hals/allocator3.cpp b/system/hals/allocator3.cpp
index 698c9f3..2e5c23e 100644
--- a/system/hals/allocator3.cpp
+++ b/system/hals/allocator3.cpp
@@ -24,7 +24,7 @@
 #include "types.h"
 #include "debug.h"
 
-#define OMX_COLOR_FormatYUV420Planar 19
+const int kOMX_COLOR_FormatYUV420Planar = 19;
 
 using ::android::hardware::hidl_handle;
 using ::android::hardware::hidl_vec;
@@ -294,7 +294,7 @@
                 }
             }
             RETURN_ERROR(Error3::UNSUPPORTED);
-        } else if ((int)frameworkFormat == OMX_COLOR_FormatYUV420Planar &&
+        } else if (static_cast<int>(frameworkFormat) == kOMX_COLOR_FormatYUV420Planar &&
                (usage & BufferUsage::GPU_DATA_BUFFER)) {
             ALOGW("gralloc_alloc: Requested OMX_COLOR_FormatYUV420Planar, given "
               "YCbCr_420_888, taking experimental path. "
diff --git a/system/hals/mapper3.cpp b/system/hals/mapper3.cpp
index cbfff9a..3221350 100644
--- a/system/hals/mapper3.cpp
+++ b/system/hals/mapper3.cpp
@@ -23,6 +23,8 @@
 #include "FormatConversions.h"
 #include "debug.h"
 
+const int kOMX_COLOR_FormatYUV420Planar = 19;
+
 using ::android::hardware::hidl_handle;
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
@@ -577,6 +579,10 @@
             RETURN(usageSwRead);
 
         default:
+            if (static_cast<int>(descriptor.format) == kOMX_COLOR_FormatYUV420Planar) {
+                return (usage & BufferUsage::GPU_DATA_BUFFER) != 0;
+            }
+
             RETURN(false);
         }
     }