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:
committed by
Gerrit - the friendly Code Review server
parent
c18558644f
commit
13cdf813ab
@@ -292,6 +292,11 @@ int IonController::allocate(alloc_data& data, int usage)
|
|||||||
if (usage & GRALLOC_USAGE_PRIVATE_MM_HEAP) {
|
if (usage & GRALLOC_USAGE_PRIVATE_MM_HEAP) {
|
||||||
ionFlags |= ION_HEAP(ION_CP_MM_HEAP_ID);
|
ionFlags |= ION_HEAP(ION_CP_MM_HEAP_ID);
|
||||||
ionFlags |= ION_SECURE;
|
ionFlags |= ION_SECURE;
|
||||||
|
#ifdef ION_FLAG_ALLOW_NON_CONTIG
|
||||||
|
if (!(usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY)) {
|
||||||
|
ionFlags |= ION_FLAG_ALLOW_NON_CONTIG;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// for targets/OEMs which do not need HW level protection
|
// for targets/OEMs which do not need HW level protection
|
||||||
// do not set ion secure flag & MM heap. Fallback to IOMMU heap.
|
// do not set ion secure flag & MM heap. Fallback to IOMMU heap.
|
||||||
|
|||||||
@@ -77,12 +77,18 @@ int IonAlloc::alloc_buffer(alloc_data& data)
|
|||||||
ionAllocData.len = data.size;
|
ionAllocData.len = data.size;
|
||||||
ionAllocData.align = data.align;
|
ionAllocData.align = data.align;
|
||||||
ionAllocData.heap_id_mask = data.flags & ~ION_SECURE;
|
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;
|
ionAllocData.flags = data.uncached ? 0 : ION_FLAG_CACHED;
|
||||||
// ToDo: replace usage of alloc data structure with
|
// ToDo: replace usage of alloc data structure with
|
||||||
// ionallocdata structure.
|
// ionallocdata structure.
|
||||||
if (data.flags & ION_SECURE)
|
if (data.flags & ION_SECURE)
|
||||||
ionAllocData.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();
|
err = open_device();
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
Reference in New Issue
Block a user