libgralloc-qsd8k: Support for additional gralloc usage flags.
Add support for the GRALLOC_USAGE_EXTERNAL_DISP and the GRALLOC_USAGE_PROTECTED usage bits. If any of the two usage bits are set, we need to send the buffers to the overlay. Since we send the buffers to the overlay, we need to allocate these buffers from the PMEM region. (cherry picked from commit 195345cd63f0e19cfee4cf055587d5fffe76d0ef) Change-Id: I64116b9be07c8ddadbd5a132ef21b19e5326737b
This commit is contained in:
parent
7e2db6e3d0
commit
3ae7f52726
@ -182,7 +182,8 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage, buffer_handle_t*
|
||||
flags |= private_handle_t::PRIV_FLAGS_USES_PMEM;
|
||||
}
|
||||
#endif
|
||||
if ((usage & GRALLOC_USAGE_PRIVATE_PMEM_ADSP) || (usage & GRALLOC_USAGE_PRIVATE_PMEM_SMIPOOL)) {
|
||||
if ((usage & GRALLOC_USAGE_PRIVATE_PMEM_ADSP) || (usage & GRALLOC_USAGE_PRIVATE_PMEM_SMIPOOL)
|
||||
|| (usage & GRALLOC_USAGE_EXTERNAL_DISP) || (usage & GRALLOC_USAGE_PROTECTED)) {
|
||||
flags |= private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP;
|
||||
flags &= ~private_handle_t::PRIV_FLAGS_USES_PMEM;
|
||||
}
|
||||
@ -341,6 +342,12 @@ int gpu_context_t::alloc_impl(int w, int h, int format, int usage,
|
||||
|
||||
size = (bufferSize >= size)? bufferSize : size;
|
||||
|
||||
// All buffers marked as protected or for external
|
||||
// display need to go to overlay
|
||||
if ((usage & GRALLOC_USAGE_EXTERNAL_DISP) ||
|
||||
(usage & GRALLOC_USAGE_PROTECTED)) {
|
||||
bufferType = BUFFER_TYPE_VIDEO;
|
||||
}
|
||||
int err;
|
||||
if (usage & GRALLOC_USAGE_HW_FB) {
|
||||
err = gralloc_alloc_framebuffer(size, usage, pHandle);
|
||||
|
@ -277,6 +277,15 @@ int PmemKernelAllocator::alloc_pmem_buffer(size_t size, int usage,
|
||||
device = DEVICE_PMEM_ADSP;
|
||||
} else if (usage & GRALLOC_USAGE_PRIVATE_PMEM_SMIPOOL) {
|
||||
device = DEVICE_PMEM_SMIPOOL;
|
||||
} else if ((usage & GRALLOC_USAGE_EXTERNAL_DISP) ||
|
||||
(usage & GRALLOC_USAGE_PROTECTED)) {
|
||||
int tempFd = deps.open(DEVICE_PMEM_SMIPOOL, openFlags, 0);
|
||||
if (tempFd < 0) {
|
||||
device = DEVICE_PMEM_ADSP;
|
||||
} else {
|
||||
close(tempFd);
|
||||
device = DEVICE_PMEM_SMIPOOL;
|
||||
}
|
||||
} else {
|
||||
LOGE("Invalid device");
|
||||
return -EINVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user