libgralloc: Add support for custom buffer size.

Init allocSize hook function with alloc_size function

Change-Id: I514d47928f10b6c41404aa19d8b704f64327211b
This commit is contained in:
Ramkumar Radhakrishnan
2012-12-10 15:42:54 -08:00
parent 62f0399f53
commit 3d4c0ac4f2

View File

@@ -43,6 +43,7 @@ gpu_context_t::gpu_context_t(const private_module_t* module,
common.module = const_cast<hw_module_t*>(&module->base.common); common.module = const_cast<hw_module_t*>(&module->base.common);
common.close = gralloc_close; common.close = gralloc_close;
alloc = gralloc_alloc; alloc = gralloc_alloc;
allocSize = gralloc_alloc_size;
free = gralloc_free; free = gralloc_free;
} }
@@ -219,7 +220,7 @@ int gpu_context_t::alloc_impl(int w, int h, int format, int usage,
if ((ssize_t)size <= 0) if ((ssize_t)size <= 0)
return -EINVAL; return -EINVAL;
size = (bufferSize >= size)? bufferSize : size; size = (bufferSize != 0)? bufferSize : size;
// All buffers marked as protected or for external // All buffers marked as protected or for external
// display need to go to overlay // display need to go to overlay