diff --git a/exynos4/hal/libgralloc_ump/alloc_device.cpp b/exynos4/hal/libgralloc_ump/alloc_device.cpp index 42a14e76..c2df282a 100644 --- a/exynos4/hal/libgralloc_ump/alloc_device.cpp +++ b/exynos4/hal/libgralloc_ump/alloc_device.cpp @@ -416,8 +416,11 @@ static int alloc_device_alloc(alloc_device_t* dev, int w, int h, int format, } int err; + private_module_t* m = reinterpret_cast(dev->common.module); + const uint32_t bufferMask = m->bufferMask; + const uint32_t numBuffers = m->numBuffers; pthread_mutex_lock(&l_surface); - if (usage & GRALLOC_USAGE_HW_FB) + if (usage & GRALLOC_USAGE_HW_FB && (bufferMask < ((1LU << numBuffers) - 1))) err = gralloc_alloc_framebuffer(dev, size, usage, pHandle, w, h, format, 32); else err = gralloc_alloc_buffer(dev, size, usage, pHandle, w, h, format, 0, (int)stride_raw, (int)stride);