gralloc: Add support to enable UBWC aligned framebuffer
Gralloc checks the system property "debug.gralloc.enable_fb_ubwc" to enable UBWC aligned allocation for framebuffer. The allocation will be linear by default. Change-Id: I7fdb5878eec620f264ba3a6425a9810b28b54604
This commit is contained in:
@@ -308,6 +308,25 @@ int gpu_context_t::alloc_impl(int w, int h, int format, int usage,
|
|||||||
grallocFormat = HAL_PIXEL_FORMAT_RGBA_8888;
|
grallocFormat = HAL_PIXEL_FORMAT_RGBA_8888;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool useFbMem = false;
|
||||||
|
char property[PROPERTY_VALUE_MAX];
|
||||||
|
char isUBWC[PROPERTY_VALUE_MAX];
|
||||||
|
if (usage & GRALLOC_USAGE_HW_FB) {
|
||||||
|
if ((property_get("debug.gralloc.map_fb_memory", property, NULL) > 0) &&
|
||||||
|
(!strncmp(property, "1", PROPERTY_VALUE_MAX ) ||
|
||||||
|
(!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) {
|
||||||
|
useFbMem = true;
|
||||||
|
} else {
|
||||||
|
if (property_get("debug.gralloc.enable_fb_ubwc", isUBWC, NULL) > 0){
|
||||||
|
if ((!strncmp(isUBWC, "1", PROPERTY_VALUE_MAX)) ||
|
||||||
|
(!strncasecmp(isUBWC, "true", PROPERTY_VALUE_MAX))) {
|
||||||
|
// Allocate UBWC aligned framebuffer
|
||||||
|
usage |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getGrallocInformationFromFormat(grallocFormat, &bufferType);
|
getGrallocInformationFromFormat(grallocFormat, &bufferType);
|
||||||
size = getBufferSizeAndDimensions(w, h, grallocFormat, usage, alignedw,
|
size = getBufferSizeAndDimensions(w, h, grallocFormat, usage, alignedw,
|
||||||
alignedh);
|
alignedh);
|
||||||
@@ -316,15 +335,6 @@ int gpu_context_t::alloc_impl(int w, int h, int format, int usage,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
size = (bufferSize >= size)? bufferSize : size;
|
size = (bufferSize >= size)? bufferSize : size;
|
||||||
|
|
||||||
bool useFbMem = false;
|
|
||||||
char property[PROPERTY_VALUE_MAX];
|
|
||||||
if((usage & GRALLOC_USAGE_HW_FB) &&
|
|
||||||
(property_get("debug.gralloc.map_fb_memory", property, NULL) > 0) &&
|
|
||||||
(!strncmp(property, "1", PROPERTY_VALUE_MAX ) ||
|
|
||||||
(!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) {
|
|
||||||
useFbMem = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int err = 0;
|
int err = 0;
|
||||||
if(useFbMem) {
|
if(useFbMem) {
|
||||||
err = gralloc_alloc_framebuffer(usage, pHandle);
|
err = gralloc_alloc_framebuffer(usage, pHandle);
|
||||||
|
|||||||
Reference in New Issue
Block a user