libgralloc-qsd8k: Modify perform to use memory region
Modify the GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER function to take into account the memory region that the buffer has been allocated from. Change-Id: Ifac7b117956b39e54911b1b7693c0f4b959c630b CRs-fixed: 284900
This commit is contained in:
parent
32a41ee5dc
commit
d314b7c703
@ -40,6 +40,7 @@ enum {
|
||||
/* gralloc usage bit indicating a pmem_adsp allocation should be used */
|
||||
GRALLOC_USAGE_PRIVATE_PMEM_ADSP = GRALLOC_USAGE_PRIVATE_0,
|
||||
GRALLOC_USAGE_PRIVATE_PMEM = GRALLOC_USAGE_PRIVATE_1,
|
||||
GRALLOC_USAGE_PRIVATE_ASHMEM = GRALLOC_USAGE_PRIVATE_2,
|
||||
};
|
||||
|
||||
/* numbers of max buffers for page flipping */
|
||||
|
18
mapper.cpp
18
mapper.cpp
@ -340,18 +340,22 @@ int gralloc_perform(struct gralloc_module_t const* module,
|
||||
size_t offset = va_arg(args, size_t);
|
||||
void* base = va_arg(args, void*);
|
||||
|
||||
// validate that it's indeed a pmem buffer
|
||||
pmem_region region;
|
||||
if (ioctl(fd, PMEM_GET_SIZE, ®ion) < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
native_handle_t** handle = va_arg(args, native_handle_t**);
|
||||
int memoryFlags = va_arg(args, int);
|
||||
if (memoryFlags == GRALLOC_USAGE_PRIVATE_PMEM) {
|
||||
// validate that it's indeed a pmem buffer
|
||||
pmem_region region;
|
||||
if (ioctl(fd, PMEM_GET_SIZE, ®ion) < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
private_handle_t* hnd = (private_handle_t*)native_handle_create(
|
||||
private_handle_t::sNumFds, private_handle_t::sNumInts);
|
||||
hnd->magic = private_handle_t::sMagic;
|
||||
hnd->fd = fd;
|
||||
hnd->flags = private_handle_t::PRIV_FLAGS_USES_PMEM;
|
||||
hnd->flags = (memoryFlags == GRALLOC_USAGE_PRIVATE_PMEM) ?
|
||||
private_handle_t::PRIV_FLAGS_USES_PMEM :
|
||||
private_handle_t::PRIV_FLAGS_USES_ASHMEM;
|
||||
hnd->size = size;
|
||||
hnd->offset = offset;
|
||||
hnd->base = intptr_t(base) + offset;
|
||||
|
Loading…
Reference in New Issue
Block a user