qdMetadata: Remove unused metadata types
This change removes metadata types which are not set. The color space is also set through ColorMetadata, with helpers to convert to/from the legacy type ColorSpace_t. CRs-Fixed: 2606686 Change-Id: I2dd67c0082a31ca6900fe845c13d0519a2289060
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
d5010db9e1
commit
a6480a48d4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@@ -35,6 +35,61 @@
|
|||||||
#include <gralloc_priv.h>
|
#include <gralloc_priv.h>
|
||||||
#include "qdMetaData.h"
|
#include "qdMetaData.h"
|
||||||
|
|
||||||
|
static int colorMetaDataToColorSpace(ColorMetaData in, ColorSpace_t *out) {
|
||||||
|
if (in.colorPrimaries == ColorPrimaries_BT601_6_525 ||
|
||||||
|
in.colorPrimaries == ColorPrimaries_BT601_6_625) {
|
||||||
|
if (in.range == Range_Full) {
|
||||||
|
*out = ITU_R_601_FR;
|
||||||
|
} else {
|
||||||
|
*out = ITU_R_601;
|
||||||
|
}
|
||||||
|
} else if (in.colorPrimaries == ColorPrimaries_BT2020) {
|
||||||
|
if (in.range == Range_Full) {
|
||||||
|
*out = ITU_R_2020_FR;
|
||||||
|
} else {
|
||||||
|
*out = ITU_R_2020;
|
||||||
|
}
|
||||||
|
} else if (in.colorPrimaries == ColorPrimaries_BT709_5) {
|
||||||
|
*out = ITU_R_709;
|
||||||
|
} else {
|
||||||
|
ALOGE("Cannot convert ColorMetaData to ColorSpace_t");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int colorSpaceToColorMetadata(ColorSpace_t in, ColorMetaData *out) {
|
||||||
|
out->transfer = Transfer_sRGB;
|
||||||
|
switch (in) {
|
||||||
|
case ITU_R_601:
|
||||||
|
out->colorPrimaries = ColorPrimaries_BT601_6_525;
|
||||||
|
out->range = Range_Limited;
|
||||||
|
break;
|
||||||
|
case ITU_R_601_FR:
|
||||||
|
out->colorPrimaries = ColorPrimaries_BT601_6_525;
|
||||||
|
out->range = Range_Full;
|
||||||
|
break;
|
||||||
|
case ITU_R_709:
|
||||||
|
out->colorPrimaries = ColorPrimaries_BT709_5;
|
||||||
|
out->range = Range_Limited;
|
||||||
|
break;
|
||||||
|
case ITU_R_2020:
|
||||||
|
out->colorPrimaries = ColorPrimaries_BT2020;
|
||||||
|
out->range = Range_Limited;
|
||||||
|
break;
|
||||||
|
case ITU_R_2020_FR:
|
||||||
|
out->colorPrimaries = ColorPrimaries_BT2020;
|
||||||
|
out->range = Range_Full;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ALOGE("Cannot convert ColorSpace_t to ColorMetaData");
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
unsigned long getMetaDataSize() {
|
unsigned long getMetaDataSize() {
|
||||||
return static_cast<unsigned long>(ROUND_UP_PAGESIZE(sizeof(MetaData_t)));
|
return static_cast<unsigned long>(ROUND_UP_PAGESIZE(sizeof(MetaData_t)));
|
||||||
}
|
}
|
||||||
@@ -102,9 +157,13 @@ int setMetaDataVa(MetaData_t *data, DispParamType paramType,
|
|||||||
case UPDATE_REFRESH_RATE:
|
case UPDATE_REFRESH_RATE:
|
||||||
data->refreshrate = *((float *)param);
|
data->refreshrate = *((float *)param);
|
||||||
break;
|
break;
|
||||||
case UPDATE_COLOR_SPACE:
|
case UPDATE_COLOR_SPACE: {
|
||||||
data->colorSpace = *((ColorSpace_t *)param);
|
ColorMetaData color;
|
||||||
break;
|
if (!colorSpaceToColorMetadata(*((ColorSpace_t *)param), &color)) {
|
||||||
|
data->color = color;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case MAP_SECURE_BUFFER:
|
case MAP_SECURE_BUFFER:
|
||||||
data->mapSecureBuffer = *((int32_t *)param);
|
data->mapSecureBuffer = *((int32_t *)param);
|
||||||
break;
|
break;
|
||||||
@@ -114,15 +173,9 @@ int setMetaDataVa(MetaData_t *data, DispParamType paramType,
|
|||||||
case LINEAR_FORMAT:
|
case LINEAR_FORMAT:
|
||||||
data->linearFormat = *((uint32_t *)param);
|
data->linearFormat = *((uint32_t *)param);
|
||||||
break;
|
break;
|
||||||
case SET_IGC:
|
|
||||||
data->igc = *((IGC_t *)param);
|
|
||||||
break;
|
|
||||||
case SET_SINGLE_BUFFER_MODE:
|
case SET_SINGLE_BUFFER_MODE:
|
||||||
data->isSingleBufferMode = *((uint32_t *)param);
|
data->isSingleBufferMode = *((uint32_t *)param);
|
||||||
break;
|
break;
|
||||||
case SET_S3D_COMP:
|
|
||||||
data->s3dComp = *((S3DGpuComp_t *)param);
|
|
||||||
break;
|
|
||||||
case SET_VT_TIMESTAMP:
|
case SET_VT_TIMESTAMP:
|
||||||
data->vtTimeStamp = *((uint64_t *)param);
|
data->vtTimeStamp = *((uint64_t *)param);
|
||||||
break;
|
break;
|
||||||
@@ -205,10 +258,6 @@ int clearMetaDataVa(MetaData_t *data, DispParamType paramType) {
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
data->operation &= ~paramType;
|
data->operation &= ~paramType;
|
||||||
switch (paramType) {
|
switch (paramType) {
|
||||||
case SET_S3D_COMP:
|
|
||||||
data->s3dComp.displayId = -1;
|
|
||||||
data->s3dComp.s3dMode = 0;
|
|
||||||
break;
|
|
||||||
case SET_VIDEO_PERF_MODE:
|
case SET_VIDEO_PERF_MODE:
|
||||||
data->isVideoPerfMode = 0;
|
data->isVideoPerfMode = 0;
|
||||||
break;
|
break;
|
||||||
@@ -264,7 +313,10 @@ int getMetaDataVa(MetaData_t *data, DispFetchParamType paramType,
|
|||||||
break;
|
break;
|
||||||
case GET_COLOR_SPACE:
|
case GET_COLOR_SPACE:
|
||||||
if (data->operation & UPDATE_COLOR_SPACE) {
|
if (data->operation & UPDATE_COLOR_SPACE) {
|
||||||
*((ColorSpace_t *)param) = data->colorSpace;
|
ColorSpace_t color_space;
|
||||||
|
if (!colorMetaDataToColorSpace(data->color, &color_space)) {
|
||||||
|
*((ColorSpace_t *)param) = color_space;
|
||||||
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -286,24 +338,12 @@ int getMetaDataVa(MetaData_t *data, DispFetchParamType paramType,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GET_IGC:
|
|
||||||
if (data->operation & SET_IGC) {
|
|
||||||
*((IGC_t *)param) = data->igc;
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GET_SINGLE_BUFFER_MODE:
|
case GET_SINGLE_BUFFER_MODE:
|
||||||
if (data->operation & SET_SINGLE_BUFFER_MODE) {
|
if (data->operation & SET_SINGLE_BUFFER_MODE) {
|
||||||
*((uint32_t *)param) = data->isSingleBufferMode;
|
*((uint32_t *)param) = data->isSingleBufferMode;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GET_S3D_COMP:
|
|
||||||
if (data->operation & SET_S3D_COMP) {
|
|
||||||
*((S3DGpuComp_t *)param) = data->s3dComp;
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GET_VT_TIMESTAMP:
|
case GET_VT_TIMESTAMP:
|
||||||
if (data->operation & SET_VT_TIMESTAMP) {
|
if (data->operation & SET_VT_TIMESTAMP) {
|
||||||
*((uint64_t *)param) = data->vtTimeStamp;
|
*((uint64_t *)param) = data->vtTimeStamp;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@@ -48,18 +48,6 @@ enum ColorSpace_t{
|
|||||||
ITU_R_2020_FR,
|
ITU_R_2020_FR,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum IGC_t {
|
|
||||||
IGC_NotSpecified,
|
|
||||||
IGC_sRGB,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct HSICData_t {
|
|
||||||
int32_t hue;
|
|
||||||
float saturation;
|
|
||||||
int32_t intensity;
|
|
||||||
float contrast;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BufferDim_t {
|
struct BufferDim_t {
|
||||||
int32_t sliceWidth;
|
int32_t sliceWidth;
|
||||||
int32_t sliceHeight;
|
int32_t sliceHeight;
|
||||||
@@ -96,11 +84,6 @@ struct UBWCStats {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct S3DGpuComp_t {
|
|
||||||
int32_t displayId; /* on which display S3D is composed by client */
|
|
||||||
uint32_t s3dMode; /* the S3D format of this layer to be accessed by client */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct GraphicsMetadata {
|
typedef struct GraphicsMetadata {
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
uint32_t data[GRAPHICS_METADATA_SIZE];
|
uint32_t data[GRAPHICS_METADATA_SIZE];
|
||||||
@@ -147,8 +130,6 @@ struct MetaData_t {
|
|||||||
int32_t interlaced;
|
int32_t interlaced;
|
||||||
struct BufferDim_t bufferDim;
|
struct BufferDim_t bufferDim;
|
||||||
float refreshrate;
|
float refreshrate;
|
||||||
enum ColorSpace_t colorSpace;
|
|
||||||
enum IGC_t igc;
|
|
||||||
/* Gralloc sets PRIV_SECURE_BUFFER flag to inform that the buffers are from
|
/* 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
|
* 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
|
* feature, GFX needs to map this buffer, in the client context and in SF
|
||||||
@@ -164,9 +145,6 @@ struct MetaData_t {
|
|||||||
/* Set by graphics to indicate that this buffer will be written to but not
|
/* Set by graphics to indicate that this buffer will be written to but not
|
||||||
* swapped out */
|
* swapped out */
|
||||||
uint32_t isSingleBufferMode;
|
uint32_t isSingleBufferMode;
|
||||||
/* Indicate GPU to draw S3D layer on dedicate display device */
|
|
||||||
struct S3DGpuComp_t s3dComp;
|
|
||||||
|
|
||||||
/* Set by camera to program the VT Timestamp */
|
/* Set by camera to program the VT Timestamp */
|
||||||
uint64_t vtTimeStamp;
|
uint64_t vtTimeStamp;
|
||||||
/* Color Aspects + HDR info */
|
/* Color Aspects + HDR info */
|
||||||
|
|||||||
Reference in New Issue
Block a user