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>
tirimbino
Espen Fjellvær Olsen 12 years ago committed by codeworkx
parent 4b20a95b20
commit d288deb284
  1. 5
      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; 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); 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); err = gralloc_alloc_framebuffer(dev, size, usage, pHandle, w, h, format, 32);
else else
err = gralloc_alloc_buffer(dev, size, usage, pHandle, w, h, format, 0, (int)stride_raw, (int)stride); err = gralloc_alloc_buffer(dev, size, usage, pHandle, w, h, format, 0, (int)stride_raw, (int)stride);

Loading…
Cancel
Save