gralloc1: Check linear format

--add check for LINEAR_FORMAT.
--use getMetaData API to access value(s).

CRs-Fixed: 2079563

Change-Id: I4e9375ab0778b97ca305ba3acd134391bdced266
This commit is contained in:
Ramakant Singh
2017-07-26 15:36:33 +05:30
parent 49d00a3b40
commit c7d077937e
2 changed files with 18 additions and 8 deletions

View File

@@ -357,29 +357,33 @@ int GetYUVPlaneInfo(const private_handle_t *hnd, struct android_ycbcr *ycbcr) {
bool interlaced = false;
memset(ycbcr->reserved, 0, sizeof(ycbcr->reserved));
MetaData_t *metadata = reinterpret_cast<MetaData_t *>(hnd->base_metadata);
// Check if UBWC buffer has been rendered in linear format.
if (metadata && (metadata->operation & LINEAR_FORMAT)) {
format = INT(metadata->linearFormat);
int linear_format = 0;
if (getMetaData(const_cast<private_handle_t *>(hnd),
GET_LINEAR_FORMAT, &linear_format) == 0) {
format = INT(linear_format);
}
// Check metadata if the geometry has been updated.
if (metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
BufferDim_t buffer_dim;
if (getMetaData(const_cast<private_handle_t *>(hnd),
GET_BUFFER_GEOMETRY, &buffer_dim) == 0) {
int usage = 0;
if (hnd->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED) {
usage = GRALLOC1_PRODUCER_USAGE_PRIVATE_ALLOC_UBWC;
}
BufferInfo info(metadata->bufferDim.sliceWidth, metadata->bufferDim.sliceHeight, format,
BufferInfo info(buffer_dim.sliceWidth, buffer_dim.sliceHeight, format,
prod_usage, cons_usage);
GetAlignedWidthAndHeight(info, &width, &height);
}
// Check metadata for interlaced content.
if (metadata && (metadata->operation & PP_PARAM_INTERLACED)) {
interlaced = metadata->interlaced ? true : false;
int interlace_flag = 0;
if (getMetaData(const_cast<private_handle_t *>(hnd),
GET_PP_PARAM_INTERLACED, &interlace_flag) != 0) {
interlaced = interlace_flag;
}
// Get the chroma offsets from the handle width/height. We take advantage