gralloc: Fix UBWC related issues
1. Fix the missed ALIGN in getUBwcMetaBufferSize api. 2. Fix de-reference of data address pointer in getRgbDataAddress api. Change-Id: I5dae2b6f449bb9a5b0dcc23110a2efce36060a42
This commit is contained in:
@@ -898,7 +898,7 @@ static unsigned int getUBwcMetaBufferSize(int width, int height, int bpp)
|
|||||||
meta_width = ALIGN(((width + block_width - 1) / block_width), 64);
|
meta_width = ALIGN(((width + block_width - 1) / block_width), 64);
|
||||||
|
|
||||||
// Align meta buffer size to 4K
|
// Align meta buffer size to 4K
|
||||||
size = ((meta_width * meta_height), 4096);
|
size = ALIGN((meta_width * meta_height), 4096);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -929,7 +929,7 @@ static unsigned int getUBwcSize(int width, int height, int format,
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getRgbDataAddress(private_handle_t* hnd, void* rgb_data)
|
int getRgbDataAddress(private_handle_t* hnd, void** rgb_data)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@@ -940,7 +940,7 @@ int getRgbDataAddress(private_handle_t* hnd, void* rgb_data)
|
|||||||
|
|
||||||
// linear buffer
|
// linear buffer
|
||||||
if (!(hnd->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED)) {
|
if (!(hnd->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED)) {
|
||||||
rgb_data = (void*)hnd->base;
|
*rgb_data = (void*)hnd->base;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -960,6 +960,6 @@ int getRgbDataAddress(private_handle_t* hnd, void* rgb_data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb_data = (void*)(hnd->base + meta_size);
|
*rgb_data = (void*)(hnd->base + meta_size);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ int decideBufferHandlingMechanism(int format, const char *compositionUsed,
|
|||||||
int alloc_buffer(private_handle_t **pHnd, int w, int h, int format, int usage);
|
int alloc_buffer(private_handle_t **pHnd, int w, int h, int format, int usage);
|
||||||
void free_buffer(private_handle_t *hnd);
|
void free_buffer(private_handle_t *hnd);
|
||||||
int getYUVPlaneInfo(private_handle_t* pHnd, struct android_ycbcr* ycbcr);
|
int getYUVPlaneInfo(private_handle_t* pHnd, struct android_ycbcr* ycbcr);
|
||||||
int getRgbDataAddress(private_handle_t* pHnd, void* rgb_data);
|
int getRgbDataAddress(private_handle_t* pHnd, void** rgb_data);
|
||||||
|
|
||||||
// To query if UBWC is enabled, based on format and usage flags
|
// To query if UBWC is enabled, based on format and usage flags
|
||||||
bool isUBwcEnabled(int format, int usage);
|
bool isUBwcEnabled(int format, int usage);
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ int gralloc_perform(struct gralloc_module_t const* module,
|
|||||||
case GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS:
|
case GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS:
|
||||||
{
|
{
|
||||||
private_handle_t* hnd = va_arg(args, private_handle_t*);
|
private_handle_t* hnd = va_arg(args, private_handle_t*);
|
||||||
void* rgb_data = va_arg(args, void*);
|
void** rgb_data = va_arg(args, void**);
|
||||||
if (!private_handle_t::validate(hnd)) {
|
if (!private_handle_t::validate(hnd)) {
|
||||||
res = getRgbDataAddress(hnd, rgb_data);
|
res = getRgbDataAddress(hnd, rgb_data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user