gralloc: Do not map framebuffer memory unless needed

The SurfaceFlinger opens the framebuffer module even when it
isn't necessary. It does this for some legacy hals.
Due to this we unnecessarily mmap the fb memory in gralloc.
Do not map this unless the property to use the framebuffer
memory is set.

Change-Id: Ib4ebfdf9a63af0dabb53170342181bac0360baeb
This commit is contained in:
Naseer Ahmed
2013-07-04 15:24:31 -04:00
parent 6e8a57ef3a
commit 499ab3dfdf

View File

@@ -336,9 +336,15 @@ int mapFrameBufferLocked(struct private_module_t* module)
static int mapFrameBuffer(struct private_module_t* module)
{
pthread_mutex_lock(&module->lock);
int err = mapFrameBufferLocked(module);
pthread_mutex_unlock(&module->lock);
int err = 0;
char property[PROPERTY_VALUE_MAX];
if((property_get("debug.gralloc.map_fb_memory", property, NULL) > 0) &&
(!strncmp(property, "1", PROPERTY_VALUE_MAX ) ||
(!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) {
pthread_mutex_lock(&module->lock);
err = mapFrameBufferLocked(module);
pthread_mutex_unlock(&module->lock);
}
return err;
}