libgralloc: Add support for custom buffer size.
Init allocSize hook function with alloc_size function
Change-Id: I514d47928f10b6c41404aa19d8b704f64327211b
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index f79841c..92e7193 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -43,6 +43,7 @@
common.module = const_cast<hw_module_t*>(&module->base.common);
common.close = gralloc_close;
alloc = gralloc_alloc;
+ allocSize = gralloc_alloc_size;
free = gralloc_free;
}
@@ -219,7 +220,7 @@
if ((ssize_t)size <= 0)
return -EINVAL;
- size = (bufferSize >= size)? bufferSize : size;
+ size = (bufferSize != 0)? bufferSize : size;
// All buffers marked as protected or for external
// display need to go to overlay