From 0856a1cf2f285109e8bc618dcfc18a101b987512 Mon Sep 17 00:00:00 2001 From: Naseer Ahmed Date: Wed, 2 Nov 2011 18:29:14 -0700 Subject: [PATCH] gralloc: header change for ION support Change-Id: Ibbb81034c1c4cbc6ddc79719c7d47ded97bd816e --- libgralloc-qsd8k/gpu.cpp | 10 +++++----- libgralloc-qsd8k/gralloc_priv.h | 18 ++++++++++++------ libgralloc-qsd8k/mapper.cpp | 1 - libgralloc-qsd8k/pmemalloc.cpp | 4 ++-- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/libgralloc-qsd8k/gpu.cpp b/libgralloc-qsd8k/gpu.cpp index af36fee..cabcda9 100755 --- a/libgralloc-qsd8k/gpu.cpp +++ b/libgralloc-qsd8k/gpu.cpp @@ -80,7 +80,7 @@ int gpu_context_t::gralloc_alloc_framebuffer_locked(size_t size, int usage, private_module_t* m = reinterpret_cast(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; } @@ -221,11 +221,11 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage, buffer_handle_t* flags |= private_handle_t::PRIV_FLAGS_USES_PMEM; } - if (usage & GRALLOC_USAGE_PRIVATE_PMEM) { + if (usage & GRALLOC_USAGE_PRIVATE_EBI_HEAP) { 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_ADSP_HEAP) || (usage & GRALLOC_USAGE_PRIVATE_SMI_HEAP) || (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; @@ -267,8 +267,8 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage, buffer_handle_t* // c. The client has not explicitly requested a PMEM buffer if ((get_composition_type() != MDP_COMPOSITION) && (bufferType != BUFFER_TYPE_VIDEO) && - ((usage & GRALLOC_USAGE_PRIVATE_PMEM) == 0) && - ((usage & GRALLOC_USAGE_PRIVATE_PMEM_ADSP) == 0)) { + ((usage & GRALLOC_USAGE_PRIVATE_EBI_HEAP) == 0) && + ((usage & GRALLOC_USAGE_PRIVATE_ADSP_HEAP) == 0)) { // the caller didn't request PMEM, so we can try something else flags &= ~private_handle_t::PRIV_FLAGS_USES_PMEM; err = 0; diff --git a/libgralloc-qsd8k/gralloc_priv.h b/libgralloc-qsd8k/gralloc_priv.h index c6780ef..8037812 100755 --- a/libgralloc-qsd8k/gralloc_priv.h +++ b/libgralloc-qsd8k/gralloc_priv.h @@ -36,10 +36,15 @@ using namespace overlay; #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_SMIPOOL = GRALLOC_USAGE_PRIVATE_1, - GRALLOC_USAGE_PRIVATE_PMEM = GRALLOC_USAGE_PRIVATE_2, + /* gralloc usage bits 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, + /* Set this for allocating uncached memory (using O_DSYNC) + * cannot be used with the system heap */ + GRALLOC_USAGE_PRIVATE_UNCACHED = 0x00010000, }; enum { @@ -262,9 +267,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_FORMAT_CHANGED = 0x00000020, + PRIV_FLAGS_NEEDS_FLUSH = 0x00000020, + PRIV_FLAGS_DO_NOT_FLUSH = 0x00000040, }; enum { diff --git a/libgralloc-qsd8k/mapper.cpp b/libgralloc-qsd8k/mapper.cpp index cdd9bbc..0e495be 100755 --- a/libgralloc-qsd8k/mapper.cpp +++ b/libgralloc-qsd8k/mapper.cpp @@ -374,7 +374,6 @@ int gralloc_perform(struct gralloc_module_t const* module, hnd->height = h; if (hnd->format != f) { hnd->format = f; - hnd->flags |= private_handle_t::PRIV_FLAGS_FORMAT_CHANGED; } break; } diff --git a/libgralloc-qsd8k/pmemalloc.cpp b/libgralloc-qsd8k/pmemalloc.cpp index e9c5247..fce2d87 100755 --- a/libgralloc-qsd8k/pmemalloc.cpp +++ b/libgralloc-qsd8k/pmemalloc.cpp @@ -278,9 +278,9 @@ int PmemKernelAllocator::alloc_pmem_buffer(size_t size, int usage, int openFlags = get_open_flags(usage); const char *device; - if (usage & GRALLOC_USAGE_PRIVATE_PMEM_ADSP) { + if (usage & GRALLOC_USAGE_PRIVATE_ADSP_HEAP) { device = DEVICE_PMEM_ADSP; - } else if (usage & GRALLOC_USAGE_PRIVATE_PMEM_SMIPOOL) { + } else if (usage & GRALLOC_USAGE_PRIVATE_SMI_HEAP) { device = DEVICE_PMEM_SMIPOOL; } else if ((usage & GRALLOC_USAGE_EXTERNAL_DISP) || (usage & GRALLOC_USAGE_PROTECTED)) {