Merge tag 'LA.QSSI.14.0.r1-13400-qssi.0' into staging/lineage-21.0_merge-LA.QSSI.14.0.r1-13400-qssi.0

"LA.QSSI.14.0.r1-13400-qssi.0"

# By Govind R Sekhar (2) and Tharaga Balachandran (1)
# Via Linux Build Service Account (2) and others
* tag 'LA.QSSI.14.0.r1-13400-qssi.0':
  gralloc: Define UBWC_NV124R format usage
  gralloc: Define UBWC_NV124R format usage
  gralloc: Add plane layout component type blob

Change-Id: Ibbbbe74ceb85ddc258f82c9a4a0f6216e701a570
diff --git a/.gitupstream b/.gitupstream
new file mode 100644
index 0000000..911f20b
--- /dev/null
+++ b/.gitupstream
@@ -0,0 +1 @@
+https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/display-commonsys-intf
diff --git a/Android.bp b/Android.bp
index 408e904..6bd3fb3 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,6 +1,14 @@
+soong_namespace {
+}
+
 cc_library_headers {
     name: "display_intf_headers",
     vendor_available: true,
+    defaults: [
+        "gralloc_handle_has_custom_content_md_reserved_size_defaults",
+        "gralloc_handle_has_reserved_size_defaults",
+        "gralloc_handle_has_ubwcp_format_defaults",
+    ],
     export_include_dirs: [
         "gralloc",
         "include",
diff --git a/gralloc/QtiGrallocPriv.h b/gralloc/QtiGrallocPriv.h
index b20be66..5fc2db1 100644
--- a/gralloc/QtiGrallocPriv.h
+++ b/gralloc/QtiGrallocPriv.h
@@ -149,12 +149,18 @@
   uint64_t base;
   uint64_t base_metadata;
   uint64_t gpuaddr;
+#ifdef GRALLOC_HANDLE_HAS_RESERVED_SIZE
   unsigned int reserved_size;
+#endif
+#ifdef GRALLOC_HANDLE_HAS_CUSTOM_CONTENT_MD_RESERVED_SIZE
   unsigned int custom_content_md_reserved_size;
+#endif
   static const int kNumFds = 2;
   static const int kMagic = 'gmsm';
+#ifdef GRALLOC_HANDLE_HAS_UBWCP_FORMAT
   unsigned int linear_size;
   int ubwcp_format;
+#endif
 
   static inline int NumInts() {
     return ((sizeof(private_handle_t) - sizeof(native_handle_t)) / sizeof(int)) - kNumFds;
@@ -180,11 +186,18 @@
         offset_metadata(0),
         base(0),
         base_metadata(0),
-        gpuaddr(0),
-        reserved_size(0),
-        linear_size(0),
-        ubwcp_format(format),
-        custom_content_md_reserved_size(0) {
+        gpuaddr(0)
+#ifdef GRALLOC_HANDLE_HAS_RESERVED_SIZE
+        ,reserved_size(0)
+#endif
+#ifdef GRALLOC_HANDLE_HAS_UBWCP_FORMAT
+        ,linear_size(0)
+        ,ubwcp_format(format)
+#endif
+#ifdef GRALLOC_HANDLE_HAS_CUSTOM_CONTENT_MD_RESERVED_SIZE
+        ,custom_content_md_reserved_size(0)
+#endif
+  {
     version = static_cast<int>(sizeof(native_handle));
     numInts = NumInts();
     numFds = kNumFds;
@@ -218,11 +231,9 @@
   static void Dump(const private_handle_t *hnd) {
     ALOGD("handle id:%" PRIu64
           " wxh:%dx%d uwxuh:%dx%d size: %d fd:%d fd_meta:%d flags:0x%x "
-          "usage:0x%" PRIx64 "  format:0x%x layer_count: %d reserved_size = %d "
-          "custom_content_md_reserved_size = %u",
+          "usage:0x%" PRIx64 "  format:0x%x layer_count: %d",
           hnd->id, hnd->width, hnd->height, hnd->unaligned_width, hnd->unaligned_height, hnd->size,
-          hnd->fd, hnd->fd_metadata, hnd->flags, hnd->usage, hnd->format, hnd->layer_count,
-          hnd->reserved_size, hnd->custom_content_md_reserved_size);
+          hnd->fd, hnd->fd_metadata, hnd->flags, hnd->usage, hnd->format, hnd->layer_count);
   }
 };
 #pragma pack(pop)
diff --git a/gralloc/gr_priv_handle.h b/gralloc/gr_priv_handle.h
index be1441b..1042e29 100644
--- a/gralloc/gr_priv_handle.h
+++ b/gralloc/gr_priv_handle.h
@@ -98,13 +98,19 @@
   uint64_t base;
   uint64_t base_metadata;
   uint64_t gpuaddr;
+#ifdef GRALLOC_HANDLE_HAS_RESERVED_SIZE
   unsigned int reserved_size;
+#endif
+#ifdef GRALLOC_HANDLE_HAS_CUSTOM_CONTENT_MD_RESERVED_SIZE
   unsigned int custom_content_md_reserved_size;
+#endif
 #ifdef __cplusplus
   static const int kNumFds = 2;
   static const int kMagic = 'gmsm';
+#ifdef GRALLOC_HANDLE_HAS_UBWCP_FORMAT
   unsigned int linear_size;
   int ubwcp_format;
+#endif
 
   static inline int NumInts() {
     return ((sizeof(private_handle_t) - sizeof(native_handle_t)) / sizeof(int)) - kNumFds;
@@ -130,11 +136,18 @@
         offset_metadata(0),
         base(0),
         base_metadata(0),
-        gpuaddr(0),
-        reserved_size(0),
-        linear_size(0),
-        ubwcp_format(format),
-        custom_content_md_reserved_size(0) {
+        gpuaddr(0)
+#ifdef GRALLOC_HANDLE_HAS_RESERVED_SIZE
+        ,reserved_size(0)
+#endif
+#ifdef GRALLOC_HANDLE_HAS_UBWCP_FORMAT
+        ,linear_size(0)
+        ,ubwcp_format(format)
+#endif
+#ifdef GRALLOC_HANDLE_HAS_CUSTOM_CONTENT_MD_RESERVED_SIZE
+        ,custom_content_md_reserved_size(0)
+#endif
+  {
     version = static_cast<int>(sizeof(native_handle));
     numInts = NumInts();
     numFds = kNumFds;
@@ -175,11 +188,9 @@
   static void Dump(const private_handle_t *hnd) {
     ALOGD("handle id:%" PRIu64
           " wxh:%dx%d uwxuh:%dx%d size: %d fd:%d fd_meta:%d flags:0x%x "
-          "usage:0x%" PRIx64 "  format:0x%x layer_count: %d reserved_size = %d "
-          "custom_content_md_reserved_size = %u",
+          "usage:0x%" PRIx64 "  format:0x%x layer_count: %d",
           hnd->id, hnd->width, hnd->height, hnd->unaligned_width, hnd->unaligned_height, hnd->size,
-          hnd->fd, hnd->fd_metadata, hnd->flags, hnd->usage, hnd->format, hnd->layer_count,
-          hnd->reserved_size, hnd->custom_content_md_reserved_size);
+          hnd->fd, hnd->fd_metadata, hnd->flags, hnd->usage, hnd->format, hnd->layer_count);
   }
 
   int GetUnalignedWidth() const { return unaligned_width; }