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:
@@ -710,6 +710,12 @@ gralloc1_error_t BufferManager::Perform(int operation, va_list args) {
|
|||||||
return GRALLOC1_ERROR_BAD_HANDLE;
|
return GRALLOC1_ERROR_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
*flag = hnd->flags &private_handle_t::PRIV_FLAGS_UBWC_ALIGNED;
|
*flag = hnd->flags &private_handle_t::PRIV_FLAGS_UBWC_ALIGNED;
|
||||||
|
int linear_format = 0;
|
||||||
|
if (getMetaData(hnd, GET_LINEAR_FORMAT, &linear_format) == 0) {
|
||||||
|
if (!linear_format) {
|
||||||
|
*flag = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS: {
|
case GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS: {
|
||||||
|
|||||||
@@ -357,29 +357,33 @@ int GetYUVPlaneInfo(const private_handle_t *hnd, struct android_ycbcr *ycbcr) {
|
|||||||
bool interlaced = false;
|
bool interlaced = false;
|
||||||
|
|
||||||
memset(ycbcr->reserved, 0, sizeof(ycbcr->reserved));
|
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.
|
// Check if UBWC buffer has been rendered in linear format.
|
||||||
if (metadata && (metadata->operation & LINEAR_FORMAT)) {
|
int linear_format = 0;
|
||||||
format = INT(metadata->linearFormat);
|
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.
|
// 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;
|
int usage = 0;
|
||||||
|
|
||||||
if (hnd->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED) {
|
if (hnd->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED) {
|
||||||
usage = GRALLOC1_PRODUCER_USAGE_PRIVATE_ALLOC_UBWC;
|
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);
|
prod_usage, cons_usage);
|
||||||
GetAlignedWidthAndHeight(info, &width, &height);
|
GetAlignedWidthAndHeight(info, &width, &height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check metadata for interlaced content.
|
// Check metadata for interlaced content.
|
||||||
if (metadata && (metadata->operation & PP_PARAM_INTERLACED)) {
|
int interlace_flag = 0;
|
||||||
interlaced = metadata->interlaced ? true : false;
|
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
|
// Get the chroma offsets from the handle width/height. We take advantage
|
||||||
|
|||||||
Reference in New Issue
Block a user