gralloc: Allow non-contiguous allocations for secure buffers

Pass a flag to ion to allow non-contiguous allocations with a sg
(scatter gather) list of 1MB chunks for all secure buffers except
secure display.

Change-Id: Ife2709e94571ab7603b29da17805a857ba73fd72
This commit is contained in:
Shalaj Jain
2014-12-02 16:20:54 -08:00
committed by Gerrit - the friendly Code Review server
parent c18558644f
commit 13cdf813ab
2 changed files with 12 additions and 1 deletions

View File

@@ -292,6 +292,11 @@ int IonController::allocate(alloc_data& data, int usage)
if (usage & GRALLOC_USAGE_PRIVATE_MM_HEAP) {
ionFlags |= ION_HEAP(ION_CP_MM_HEAP_ID);
ionFlags |= ION_SECURE;
#ifdef ION_FLAG_ALLOW_NON_CONTIG
if (!(usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY)) {
ionFlags |= ION_FLAG_ALLOW_NON_CONTIG;
}
#endif
} else {
// for targets/OEMs which do not need HW level protection
// do not set ion secure flag & MM heap. Fallback to IOMMU heap.

View File

@@ -77,12 +77,18 @@ int IonAlloc::alloc_buffer(alloc_data& data)
ionAllocData.len = data.size;
ionAllocData.align = data.align;
ionAllocData.heap_id_mask = data.flags & ~ION_SECURE;
#ifdef ION_FLAG_ALLOW_NON_CONTIG
ionAllocData.heap_id_mask &= (data.flags & ~ION_FLAG_ALLOW_NON_CONTIG);
#endif
ionAllocData.flags = data.uncached ? 0 : ION_FLAG_CACHED;
// ToDo: replace usage of alloc data structure with
// ionallocdata structure.
if (data.flags & ION_SECURE)
ionAllocData.flags |= ION_SECURE;
#ifdef ION_FLAG_ALLOW_NON_CONTIG
if (data.flags & ION_FLAG_ALLOW_NON_CONTIG)
ionAllocData.flags |= ION_FLAG_ALLOW_NON_CONTIG;
#endif
err = open_device();
if (err)
return err;