gralloc: header change for ION support

Change-Id: I64ecf3ef5ea6974b2c155013c686444501939b9e
This commit is contained in:
Naseer Ahmed 2011-10-30 15:46:56 -07:00
parent d850658b6e
commit 7aa97f87d1
3 changed files with 16 additions and 13 deletions

10
gpu.cpp
View File

@ -58,7 +58,7 @@ int gpu_context_t::gralloc_alloc_framebuffer_locked(size_t size, int usage,
private_module_t* m = reinterpret_cast<private_module_t*>(common.module);
// we don't support allocations with both the FB and PMEM_ADSP flags
if (usage & GRALLOC_USAGE_PRIVATE_PMEM_ADSP) {
if (usage & GRALLOC_USAGE_PRIVATE_ADSP_HEAP) {
return -EINVAL;
}
@ -190,7 +190,7 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage, buffer_handle_t*
flags |= private_handle_t::PRIV_FLAGS_USES_PMEM;
}
#else
if (usage & GRALLOC_USAGE_PRIVATE_PMEM){
if (usage & GRALLOC_USAGE_PRIVATE_EBI_HEAP){
flags |= private_handle_t::PRIV_FLAGS_USES_PMEM;
}
@ -201,7 +201,7 @@ 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) {
if (usage & GRALLOC_USAGE_PRIVATE_ADSP_HEAP) {
flags |= private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP;
flags &= ~private_handle_t::PRIV_FLAGS_USES_PMEM;
}
@ -237,8 +237,8 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage, buffer_handle_t*
// Allocate the buffer from pmem
err = pma->alloc_pmem_buffer(size, usage, &base, &offset, &fd);
if (err < 0) {
if (((usage & GRALLOC_USAGE_PRIVATE_PMEM) == 0) &&
((usage & GRALLOC_USAGE_PRIVATE_PMEM_ADSP) == 0) &&
if (((usage & GRALLOC_USAGE_PRIVATE_EBI_HEAP) == 0) &&
((usage & GRALLOC_USAGE_PRIVATE_ADSP_HEAP) == 0) &&
!isMDPComposition) {
// the caller didn't request PMEM, so we can try something else
flags &= ~private_handle_t::PRIV_FLAGS_USES_PMEM;

View File

@ -44,10 +44,12 @@ enum { BYPASS_OV_CHANNEL_OPEN,
#endif
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,
/* gralloc usage bit indicating the type
* of allocation that should be used */
GRALLOC_USAGE_PRIVATE_ADSP_HEAP = GRALLOC_USAGE_PRIVATE_0,
GRALLOC_USAGE_PRIVATE_EBI_HEAP = GRALLOC_USAGE_PRIVATE_1,
GRALLOC_USAGE_PRIVATE_SMI_HEAP = GRALLOC_USAGE_PRIVATE_2,
GRALLOC_USAGE_PRIVATE_SYSTEM_HEAP = GRALLOC_USAGE_PRIVATE_3,
};
/* numbers of max buffers for page flipping */
@ -325,9 +327,10 @@ struct private_handle_t {
PRIV_FLAGS_FRAMEBUFFER = 0x00000001,
PRIV_FLAGS_USES_PMEM = 0x00000002,
PRIV_FLAGS_USES_PMEM_ADSP = 0x00000004,
PRIV_FLAGS_NEEDS_FLUSH = 0x00000008,
PRIV_FLAGS_USES_ION = 0x00000008,
PRIV_FLAGS_USES_ASHMEM = 0x00000010,
PRIV_FLAGS_DO_NOT_FLUSH = 0x00000020,
PRIV_FLAGS_NEEDS_FLUSH = 0x00000020,
PRIV_FLAGS_DO_NOT_FLUSH = 0x00000040,
};
enum {

View File

@ -342,7 +342,7 @@ int gralloc_perform(struct gralloc_module_t const* module,
native_handle_t** handle = va_arg(args, native_handle_t**);
int memoryFlags = va_arg(args, int);
if (memoryFlags == GRALLOC_USAGE_PRIVATE_PMEM) {
if (memoryFlags == GRALLOC_USAGE_PRIVATE_EBI_HEAP) {
// validate that it's indeed a pmem buffer
pmem_region region;
if (ioctl(fd, PMEM_GET_SIZE, &region) < 0) {
@ -353,7 +353,7 @@ int gralloc_perform(struct gralloc_module_t const* module,
private_handle_t::sNumFds, private_handle_t::sNumInts);
hnd->magic = private_handle_t::sMagic;
hnd->fd = fd;
hnd->flags = (memoryFlags == GRALLOC_USAGE_PRIVATE_PMEM) ?
hnd->flags = (memoryFlags == GRALLOC_USAGE_PRIVATE_EBI_HEAP) ?
private_handle_t::PRIV_FLAGS_USES_PMEM |
private_handle_t::PRIV_FLAGS_DO_NOT_FLUSH:
private_handle_t::PRIV_FLAGS_USES_ASHMEM;