gralloc: Introduce custom content metadata region

Introduce a new dynamic memory region to store custom content
metadata that has sizing requirements that exceeds the base
1KB region allocated. This region is dynamic to ensure a layer's
memory requirements are only increased when absolutely needed.

Change-Id: I774197ed0c4ec7a18cc09b24262b6548dc293e72
This commit is contained in:
Christopher Braga
2022-05-09 16:42:44 -04:00
committed by Gerrit - the friendly Code Review server
parent 356602355d
commit 34fef9c4f6
3 changed files with 11 additions and 3 deletions

View File

@@ -131,6 +131,8 @@ static const MetadataType MetadataType_BufferPermission = {VENDOR_QTI, QTI_BUFFE
static const MetadataType MetadataType_MemHandle = {VENDOR_QTI, QTI_MEM_HANDLE};
static const MetadataType MetadataType_TimedRendering = {VENDOR_QTI, QTI_TIMED_RENDERING};
static const MetadataType MetadataType_CustomContentMetadata = {VENDOR_QTI,
QTI_CUSTOM_CONTENT_METADATA};
// 0 is also used as invalid value in standard metadata
static const MetadataType MetadataType_Invalid = {VENDOR_QTI, 0};
@@ -165,6 +167,8 @@ Error decodeYUVPlaneInfoMetadata(hidl_vec<uint8_t> &in, qti_ycbcr *out);
Error encodeYUVPlaneInfoMetadata(qti_ycbcr *in, hidl_vec<uint8_t> *out);
Error decodeBufferPermission(hidl_vec<uint8_t> &in, BufferPermission *out);
Error encodeBufferPermission(BufferPermission *in, hidl_vec<uint8_t> *out);
Error decodeCustomContentMetadata(hidl_vec<uint8_t> &in, void *out);
Error encodeCustomContentMetadata(const void *in, hidl_vec<uint8_t> *out);
} // namespace qtigralloc
#endif //__QTIGRALLOC_H__

View File

@@ -70,6 +70,7 @@
#define QTI_BUFFER_PERMISSION 10026
#define QTI_MEM_HANDLE 10027
#define QTI_TIMED_RENDERING 10028
#define QTI_CUSTOM_CONTENT_METADATA 10029
// Used to indicate to framework that internal definitions are used instead
#define COMPRESSION_QTI_UBWC 20001

View File

@@ -174,6 +174,7 @@ struct private_handle_t : public native_handle_t {
uint64_t base_metadata;
uint64_t gpuaddr;
unsigned int reserved_size;
unsigned int custom_content_md_reserved_size;
static const int kNumFds = 2;
static const int kMagic = 'gmsm';
@@ -202,7 +203,8 @@ struct private_handle_t : public native_handle_t {
base(0),
base_metadata(0),
gpuaddr(0),
reserved_size(0) {
reserved_size(0),
custom_content_md_reserved_size(0) {
version = static_cast<int>(sizeof(native_handle));
numInts = NumInts();
numFds = kNumFds;
@@ -236,10 +238,11 @@ struct private_handle_t : public native_handle_t {
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",
"usage:0x%" PRIx64 " format:0x%x layer_count: %d reserved_size = %d "
"custom_content_md_reserved_size = %u",
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->reserved_size, hnd->custom_content_md_reserved_size);
}
};
#pragma pack(pop)