From d288deb284f205c6b0eae04b27377c902afaf24e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Espen=20Fjellv=C3=A6r=20Olsen?= Date: Sun, 2 Dec 2012 21:05:31 +0100 Subject: [PATCH] gralloc: Send first 2 FB buffers to carveout and next to UMP Taken from QCOM gralloc: commit d80a52cbf961d737f6f3beef47b868a581b98591 Author: Saurabh Shah Date: Tue Oct 2 14:32:40 2012 -0700 gralloc: Send first 2 FB buffers to carveout and next to IOMMU Gralloc uses the GRALLOC_USAGE_HW_FB flag to allocate memory from carveout. This is fine for primary framebuffer, but for external framebuffer we need IOMMU heap buffers, since the ioctls for external work with those. Ideally, the primary buffers also need to come from IOMMU heap, which is ongoing work. This patch allocates the first 2 FB buffer requests (assuming they are for primary) from carveout and allocates all subsequent buffers from IOMMU heap. Bug: 7124159 Change-Id: Ie53b2e1e7fcac136acd2d251f39cefe367fc7125 Signed-off-by: Iliyan Malchev --- exynos4/hal/libgralloc_ump/alloc_device.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exynos4/hal/libgralloc_ump/alloc_device.cpp b/exynos4/hal/libgralloc_ump/alloc_device.cpp index 42a14e7..c2df282 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); -- 2.20.1