gralloc: header change for ION support

Change-Id: Ibbb81034c1c4cbc6ddc79719c7d47ded97bd816e
This commit is contained in:
Naseer Ahmed 2011-11-02 18:29:14 -07:00
parent 6eb041de80
commit 0856a1cf2f
4 changed files with 19 additions and 14 deletions

View File

@ -80,7 +80,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;
}
@ -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;

View File

@ -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 {

View File

@ -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;
}

View File

@ -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)) {