display: Update metadata
This change adds libgralloc.qti to support Gralloc4 and the transition to
standardized metadata.
CRs-Fixed: 2619182
Change-Id: Ia43de9b1dc9da52affc508783c046b82cde1775e
diff --git a/libqdmetadata/Android.bp b/libqdmetadata/Android.bp
index 5552f3e..449d46a 100644
--- a/libqdmetadata/Android.bp
+++ b/libqdmetadata/Android.bp
@@ -5,11 +5,14 @@
cflags: [
"-Wno-sign-conversion",
"-DLOG_TAG=\"qdmetadata\"",
+ "-D__QTI_DISPLAY_GRALLOC__",
],
shared_libs: [
"liblog",
"libcutils",
"libutils",
+ "libhidlbase",
+ "libgralloc.qti",
],
header_libs: ["libhardware_headers", "display_intf_headers"],
srcs: ["qdMetaData.cpp", "qd_utils.cpp"],
diff --git a/libqdmetadata/qdMetaData.cpp b/libqdmetadata/qdMetaData.cpp
index fb32095..1810101 100644
--- a/libqdmetadata/qdMetaData.cpp
+++ b/libqdmetadata/qdMetaData.cpp
@@ -27,13 +27,16 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "qdMetaData.h"
+
+#include <QtiGrallocPriv.h>
#include <errno.h>
+#include <gralloc_priv.h>
+#include <log/log.h>
#include <string.h>
#include <sys/mman.h>
-#include <log/log.h>
+
#include <cinttypes>
-#include <gralloc_priv.h>
-#include "qdMetaData.h"
static int colorMetaDataToColorSpace(ColorMetaData in, ColorSpace_t *out) {
if (in.colorPrimaries == ColorPrimaries_BT601_6_525 ||
@@ -151,9 +154,11 @@
case PP_PARAM_INTERLACED:
data->interlaced = *((int32_t *)param);
break;
- case UPDATE_BUFFER_GEOMETRY:
- data->bufferDim = *((BufferDim_t *)param);
- break;
+ case UPDATE_BUFFER_GEOMETRY: {
+ BufferDim_t in = *((BufferDim_t *)param);
+ data->crop = {0, 0, in.sliceWidth, in.sliceHeight};
+ break;
+ }
case UPDATE_REFRESH_RATE:
data->refreshrate = *((float *)param);
break;
@@ -301,8 +306,8 @@
break;
case GET_BUFFER_GEOMETRY:
if (data->operation & UPDATE_BUFFER_GEOMETRY) {
- *((BufferDim_t *)param) = data->bufferDim;
- ret = 0;
+ *((BufferDim_t *)param) = {data->crop.right, data->crop.bottom};
+ ret = 0;
}
break;
case GET_REFRESH_RATE:
diff --git a/libqdmetadata/qdMetaData.h b/libqdmetadata/qdMetaData.h
index fe396f2..a36d6e7 100644
--- a/libqdmetadata/qdMetaData.h
+++ b/libqdmetadata/qdMetaData.h
@@ -30,146 +30,38 @@
#ifndef _QDMETADATA_H
#define _QDMETADATA_H
+#include <QtiGrallocMetadata.h>
#include <color_metadata.h>
+/* TODO: This conditional include is to prevent breaking video and camera test cases using
+ * MetaData_t - camxchinodedewarp.cpp, vtest_EncoderFileSource.cpp
+ */
+
+#ifdef __cplusplus
+#include <QtiGrallocPriv.h>
+#endif
+
+#ifndef __QTI_DISPLAY_GRALLOC__
+#pragma message "qdMetaData.h is being deprecated"
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
-#define MAX_UBWC_STATS_LENGTH 32
-#define GRAPHICS_METADATA_SIZE 4096
-#define CVP_METADATA_SIZE 1024
+struct MetaData_t;
-enum ColorSpace_t{
- ITU_R_601,
- ITU_R_601_FR,
- ITU_R_709,
- ITU_R_2020,
- ITU_R_2020_FR,
+enum ColorSpace_t {
+ ITU_R_601,
+ ITU_R_601_FR,
+ ITU_R_709,
+ ITU_R_2020,
+ ITU_R_2020_FR,
};
struct BufferDim_t {
- int32_t sliceWidth;
- int32_t sliceHeight;
-};
-
-enum UBWC_Version {
- UBWC_UNUSED = 0,
- UBWC_1_0 = 0x1,
- UBWC_2_0 = 0x2,
- UBWC_3_0 = 0x3,
- UBWC_4_0 = 0x4,
- UBWC_MAX_VERSION = 0xFF,
-};
-
-struct UBWC_2_0_Stats {
- uint32_t nCRStatsTile32; /**< UBWC Stats info for 32 Byte Tile */
- uint32_t nCRStatsTile64; /**< UBWC Stats info for 64 Byte Tile */
- uint32_t nCRStatsTile96; /**< UBWC Stats info for 96 Byte Tile */
- uint32_t nCRStatsTile128; /**< UBWC Stats info for 128 Byte Tile */
- uint32_t nCRStatsTile160; /**< UBWC Stats info for 160 Byte Tile */
- uint32_t nCRStatsTile192; /**< UBWC Stats info for 192 Byte Tile */
- uint32_t nCRStatsTile256; /**< UBWC Stats info for 256 Byte Tile */
-};
-
-struct UBWCStats {
- enum UBWC_Version version; /* Union depends on this version. */
- uint8_t bDataValid; /* If [non-zero], CR Stats data is valid.
- * Consumers may use stats data.
- * If [zero], CR Stats data is invalid.
- * Consumers *Shall* not use stats data */
- union {
- struct UBWC_2_0_Stats ubwc_stats;
- uint32_t reserved[MAX_UBWC_STATS_LENGTH]; /* This is for future */
- };
-};
-
-typedef struct GraphicsMetadata {
- uint32_t size;
- uint32_t data[GRAPHICS_METADATA_SIZE];
-} GraphicsMetadata;
-
-#define VIDEO_HISTOGRAM_STATS_SIZE (4 * 1024)
-/* Frame type bit mask */
-#define QD_SYNC_FRAME (0x1 << 0)
-struct VideoHistogramMetadata {
- uint32_t stats_info[1024]; /* video stats payload */
- uint32_t stat_len; /* Payload size in bytes */
- uint32_t frame_type; /* bit mask to indicate frame type */
- uint32_t display_width;
- uint32_t display_height;
- uint32_t decode_width;
- uint32_t decode_height;
- uint32_t reserved[12];
-};
-
-enum CVPMetadataFlags {
- /* bit wise flags */
- CVP_METADATA_FLAG_NONE = 0x00000000,
- CVP_METADATA_FLAG_REPEAT = 0x00000001,
-};
-
-typedef struct CVPMetadata {
- uint32_t size; /* payload size in bytes */
- uint8_t payload[CVP_METADATA_SIZE];
- uint32_t capture_frame_rate;
- /* Frame rate in Q16 format.
- Eg: fps = 7.5, then
- capture_frame_rate = 7 << 16 --> Upper 16 bits to represent 7
- capture_frame_rate |= 5 -------> Lower 16 bits to represent 5
-
- If size > 0, framerate is valid
- If size = 0, invalid data, so ignore all parameters */
- uint32_t cvp_frame_rate;
- enum CVPMetadataFlags flags;
- uint32_t reserved[8];
-} CVPMetadata;
-
-struct MetaData_t {
- int32_t operation;
- int32_t interlaced;
- struct BufferDim_t bufferDim;
- float refreshrate;
- /* Gralloc sets PRIV_SECURE_BUFFER flag to inform that the buffers are from
- * ION_SECURE. which should not be mapped. However, for GPU post proc
- * feature, GFX needs to map this buffer, in the client context and in SF
- * context, it should not. Hence to differentiate, add this metadata field
- * for clients to set, and GPU will to read and know when to map the
- * SECURE_BUFFER(ION) */
- int32_t mapSecureBuffer;
- /* The supported formats are defined in gralloc_priv.h to
- * support legacy code*/
- uint32_t s3dFormat;
- /* VENUS output buffer is linear for UBWC Interlaced video */
- uint32_t linearFormat;
- /* Set by graphics to indicate that this buffer will be written to but not
- * swapped out */
- uint32_t isSingleBufferMode;
- /* Set by camera to program the VT Timestamp */
- uint64_t vtTimeStamp;
- /* Color Aspects + HDR info */
- ColorMetaData color;
- /* Consumer should read this data as follows based on
- * Gralloc flag "interlaced" listed above.
- * [0] : If it is progressive.
- * [0] : Top field, if it is interlaced.
- * [1] : Do not read, if it is progressive.
- * [1] : Bottom field, if it is interlaced.
- */
- struct UBWCStats ubwcCRStats[2];
- /* Set by camera to indicate that this buffer will be used for a High
- * Performance Video Usecase */
- uint32_t isVideoPerfMode;
- /* Populated and used by adreno during buffer size calculation.
- * Set only for RGB formats. */
- GraphicsMetadata graphics_metadata;
- /* Video hisogram stats populated by video decoder */
- struct VideoHistogramMetadata video_histogram_stats;
- /*
- * Producer (camera) will set cvp metadata and consumer (video) will
- * use it. The format of metadata is known to producer and consumer.
- */
- CVPMetadata cvpMetadata;
+ int32_t sliceWidth;
+ int32_t sliceHeight;
};
enum DispParamType {
@@ -214,6 +106,9 @@
GET_VIDEO_HISTOGRAM_STATS = 0x00020000
};
+/* Frame type bit mask */
+#define QD_SYNC_FRAME (0x1 << 0)
+
struct private_handle_t;
int setMetaData(struct private_handle_t *handle, enum DispParamType paramType,
void *param);