Gralloc: Add API to get custom format and private handle flags

Add IMapper API to get custom format and private handle flags
for a given combination of input format and usage flags.

Change-Id: I22a7c89c9516ae646b6e4dc666852b469cb36120
CRs-Fixed: 2255171
diff --git a/gralloc/QtiMapper.cpp b/gralloc/QtiMapper.cpp
index 490cf94..4ad6836 100644
--- a/gralloc/QtiMapper.cpp
+++ b/gralloc/QtiMapper.cpp
@@ -334,6 +334,13 @@
   return Void();
 }
 
+Return<void> QtiMapper::getCustomFormatFlags(int32_t format, uint64_t usage,
+                                             getCustomFormatFlags_cb hidl_cb) {
+  uint64_t priv_flags = 0;
+  hidl_cb(Error::NONE, format, priv_flags);
+  return Void();
+}
+
 Return<void> QtiMapper::getColorSpace(void *buffer, getColorSpace_cb hidl_cb) {
   auto err = Error::BAD_BUFFER;
   auto hnd = static_cast<private_handle_t *>(buffer);
diff --git a/gralloc/QtiMapper.h b/gralloc/QtiMapper.h
index e39ce8b..a7d0c5c 100644
--- a/gralloc/QtiMapper.h
+++ b/gralloc/QtiMapper.h
@@ -94,6 +94,8 @@
   Return<void> calculateBufferAttributes(int32_t width, int32_t height, int32_t format,
                                          uint64_t usage,
                                          calculateBufferAttributes_cb _hidl_cb) override;
+  Return<void> getCustomFormatFlags(int32_t format, uint64_t usage,
+                                    getCustomFormatFlags_cb _hidl_cb) override;
   Return<void> getColorSpace(void *buffer, getColorSpace_cb _hidl_cb) override;
   Return<void> getYuvPlaneInfo(void *buffer, getYuvPlaneInfo_cb _hidl_cb) override;
   Return<Error> setSingleBufferMode(void *buffer, bool enable) override;
diff --git a/gralloc/gr_priv_handle.h b/gralloc/gr_priv_handle.h
index 1eb03b8..964bed0 100644
--- a/gralloc/gr_priv_handle.h
+++ b/gralloc/gr_priv_handle.h
@@ -58,6 +58,7 @@
     PRIV_FLAGS_UBWC_ALIGNED = 0x08000000,
     PRIV_FLAGS_DISP_CONSUMER = 0x10000000,
     PRIV_FLAGS_CLIENT_ALLOCATED = 0x20000000,  // Ion buffer allocated outside of gralloc
+    PRIV_FLAGS_UBWC_ALIGNED_PI = 0x40000000,  // PI format
   };
 
   // file-descriptors dup'd over IPC
diff --git a/gralloc/gralloc_priv.h b/gralloc/gralloc_priv.h
index f184787..8f8c0c4 100644
--- a/gralloc/gralloc_priv.h
+++ b/gralloc/gralloc_priv.h
@@ -69,6 +69,8 @@
 /* This flag is used to indicate 10-bit tight pack format (e.g. TP10) */
 #define GRALLOC_USAGE_PRIVATE_10BIT_TP (UINT32_C(1) << 27)
 
+/* This flag indicates PI format is being used */
+#define GRALLOC_USAGE_PRIVATE_ALLOC_UBWC_PI 1ULL << 49
 /* Legacy gralloc1 definitions */
 /* Some clients may still be using the old flags */
 #define GRALLOC1_PRODUCER_USAGE_PRIVATE_ADSP_HEAP GRALLOC_USAGE_PRIVATE_ADSP_HEAP