display: Add metadata types for allocated width and height
The standard metadata types for width and height return the
values requested by the client, rather than the width and height
of the allocated buffer. This change adds internal metadata types
so clients can query the allocated values.
CRs-Fixed: 2638621
Change-Id: I7c69cff65512c30e27eb86ef33f67079c979eeb6
diff --git a/gralloc/QtiGralloc.cpp b/gralloc/QtiGralloc.cpp
index 47be7dd..19ff2ab 100644
--- a/gralloc/QtiGralloc.cpp
+++ b/gralloc/QtiGralloc.cpp
@@ -152,6 +152,10 @@
return MetadataType_FD;
case QTI_PRIVATE_FLAGS:
return MetadataType_PrivateFlags;
+ case QTI_ALIGNED_WIDTH_IN_PIXELS:
+ return MetadataType_AlignedWidthInPixels;
+ case QTI_ALIGNED_HEIGHT_IN_PIXELS:
+ return MetadataType_AlignedHeightInPixels;
default:
return MetadataType_Invalid;
}
@@ -229,6 +233,14 @@
err = static_cast<Error>(android::gralloc4::decodeInt32(qtigralloc::MetadataType_PrivateFlags,
bytestream, (int32_t *)param));
break;
+ case QTI_ALIGNED_WIDTH_IN_PIXELS:
+ err = static_cast<Error>(android::gralloc4::decodeUint32(
+ qtigralloc::MetadataType_AlignedWidthInPixels, bytestream, (uint32_t *)param));
+ break;
+ case QTI_ALIGNED_HEIGHT_IN_PIXELS:
+ err = static_cast<Error>(android::gralloc4::decodeUint32(
+ qtigralloc::MetadataType_AlignedHeightInPixels, bytestream, (uint32_t *)param));
+ break;
default:
param = nullptr;
return Error::UNSUPPORTED;
diff --git a/gralloc/QtiGralloc.h b/gralloc/QtiGralloc.h
index 2f5c6f5..37593e5 100644
--- a/gralloc/QtiGralloc.h
+++ b/gralloc/QtiGralloc.h
@@ -96,6 +96,12 @@
static const MetadataType MetadataType_PrivateFlags = {VENDOR_QTI, QTI_PRIVATE_FLAGS};
+static const MetadataType MetadataType_AlignedWidthInPixels = {VENDOR_QTI,
+ QTI_ALIGNED_WIDTH_IN_PIXELS};
+
+static const MetadataType MetadataType_AlignedHeightInPixels = {VENDOR_QTI,
+ QTI_ALIGNED_HEIGHT_IN_PIXELS};
+
// 0 is also used as invalid value in standard metadata
static const MetadataType MetadataType_Invalid = {VENDOR_QTI, 0};
diff --git a/gralloc/QtiGrallocMetadata.h b/gralloc/QtiGrallocMetadata.h
index 35d51dc..00b0503 100644
--- a/gralloc/QtiGrallocMetadata.h
+++ b/gralloc/QtiGrallocMetadata.h
@@ -31,6 +31,7 @@
#define __QTIGRALLOCMETADATA_H__
#include <color_metadata.h>
+
#define QTI_VT_TIMESTAMP 10000
#define QTI_COLOR_METADATA 10001
#define QTI_PP_PARAM_INTERLACED 10002
@@ -43,8 +44,14 @@
#define QTI_SINGLE_BUFFER_MODE 10009
#define QTI_CVP_METADATA 10010
#define QTI_VIDEO_HISTOGRAM_STATS 10011
+// File descriptor for allocated buffer
#define QTI_FD 10012
+// Flags from the private handle of the allocated buffer
#define QTI_PRIVATE_FLAGS 10013
+// Width of the allocated buffer in pixels
+#define QTI_ALIGNED_WIDTH_IN_PIXELS 10014
+// Height of the allocated buffer in pixels
+#define QTI_ALIGNED_HEIGHT_IN_PIXELS 10015
// Used to indicate to framework that internal definitions are used instead
#define COMPRESSION_QTI_UBWC 20001