Partially revert gralloc struct changes
Gralloc handle struct changes break blobs that use the previous struct
Default
GRALLOC_HANDLE_HAS_CUSTOM_CONTENT_MD_RESERVED_SIZE
GRALLOC_HANDLE_HAS_RESERVED_SIZE
GRALLOC_HANDLE_HAS_UBWCP_FORMAT
to be unset.
This partially reverts the following commits:
34fef9c4f6e22d97c52ff60ccd93fc404ea6a4cb
13de7b77a3aae8c29623a867db910e8d3930e558
bcf82a2c1b293d4d68dd0ddee5bd6dae2a1b982a
4cb9a3fa65469bbf411cead425c001f8c99e2087
Co-authored-by: Bruno Martins <bgcngm@gmail.com>
Co-authored-by: Chirayu Desai <chirayudesai1@gmail.com>
Co-authored-by: Michael Bestas <mkbestas@lineageos.org>
Change-Id: I7cfaea81a2c7c3ae121f4f02ac61374c5a00e9a9
diff --git a/Android.bp b/Android.bp
index 22955cc..6bd3fb3 100644
--- a/Android.bp
+++ b/Android.bp
@@ -4,6 +4,11 @@
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 41862e4..e1d63cb 100644
--- a/gralloc/QtiGrallocPriv.h
+++ b/gralloc/QtiGrallocPriv.h
@@ -177,12 +177,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;
@@ -208,11 +214,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;
@@ -246,11 +259,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; }