From f4080b43069036ad896a66aea8a98ece0545e80c Mon Sep 17 00:00:00 2001 From: Naseer Ahmed Date: Tue, 5 Mar 2013 17:48:38 -0500 Subject: ui: Allocate the custom buffer size in the failure case also The custom buffer size was not being honored if memory allocation failed in the first pass. Also - removing an unnecessary check. Change-Id: Ie501b2dda3843454405fec05fc898fec5912bd06 --- libs/ui/GraphicBufferAllocator.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp index 9ad314a..470f58a 100644 --- a/libs/ui/GraphicBufferAllocator.cpp +++ b/libs/ui/GraphicBufferAllocator.cpp @@ -228,17 +228,21 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, BufferLiberatorThread::maybeWaitForLiberation(); #ifdef QCOM_BSP - if (bufferSize) - err = mAllocDev->allocSize(mAllocDev, w, h, + err = mAllocDev->allocSize(mAllocDev, w, h, format, usage, handle, stride, bufferSize); - else +#else + err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride); #endif - err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride); if (err != NO_ERROR) { ALOGW("WOW! gralloc alloc failed, waiting for pending frees!"); BufferLiberatorThread::waitForLiberation(); +#ifdef QCOM_BSP + err = mAllocDev->allocSize(mAllocDev, w, h, + format, usage, handle, stride, bufferSize); +#else err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride); +#endif } #ifdef QCOM_BSP -- cgit v1.1