summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEspen Fjellvær Olsen <espen@mrfjo.org>2012-12-02 21:05:31 +0100
committercodeworkx <codeworkx@cyanogenmod.org>2012-12-03 17:45:45 +0100
commitd288deb284f205c6b0eae04b27377c902afaf24e (patch)
treed0c46019a367d826a40e759583a8edafb0d8a095
parent4b20a95b20a00abbfe5ac456725257650d6f9b7d (diff)
downloadhardware_samsung-d288deb284f205c6b0eae04b27377c902afaf24e.zip
hardware_samsung-d288deb284f205c6b0eae04b27377c902afaf24e.tar.gz
hardware_samsung-d288deb284f205c6b0eae04b27377c902afaf24e.tar.bz2
gralloc: Send first 2 FB buffers to carveout and next to UMP
Taken from QCOM gralloc: commit d80a52cbf961d737f6f3beef47b868a581b98591 Author: Saurabh Shah <saurshah@codeaurora.org> 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 <malchev@google.com>
-rw-r--r--exynos4/hal/libgralloc_ump/alloc_device.cpp5
1 files changed, 4 insertions, 1 deletions
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<private_module_t*>(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);