Merge "gralloc: App support for new secure system heap and flags"
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
6fc33505bd
@@ -49,6 +49,17 @@
|
||||
|
||||
#define ASTC_BLOCK_SIZE 16
|
||||
|
||||
#ifdef ION_FLAG_CP_PIXEL
|
||||
#define CP_HEAP_ID ION_SECURE_HEAP_ID
|
||||
#else
|
||||
#define ION_FLAG_CP_PIXEL 0
|
||||
#define CP_HEAP_ID ION_CP_MM_HEAP_ID
|
||||
#endif
|
||||
|
||||
#ifndef ION_FLAG_ALLOW_NON_CONTIG
|
||||
#define ION_FLAG_ALLOW_NON_CONTIG 0
|
||||
#endif
|
||||
|
||||
using namespace gralloc;
|
||||
using namespace qdutils;
|
||||
|
||||
@@ -334,13 +345,22 @@ int IonController::allocate(alloc_data& data, int usage)
|
||||
|
||||
if(usage & GRALLOC_USAGE_PROTECTED) {
|
||||
if (usage & GRALLOC_USAGE_PRIVATE_MM_HEAP) {
|
||||
ionHeapId |= ION_HEAP(ION_CP_MM_HEAP_ID);
|
||||
ionHeapId = ION_HEAP(CP_HEAP_ID);
|
||||
ionFlags |= ION_SECURE;
|
||||
#ifdef ION_FLAG_ALLOW_NON_CONTIG
|
||||
if (usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY) {
|
||||
/*
|
||||
* There is currently no flag in ION for Secure Display
|
||||
* VM. Please add it here once available.
|
||||
*
|
||||
ionFlags |= <Ion flag for Secure Display>;
|
||||
*/
|
||||
} else {
|
||||
ionFlags |= ION_FLAG_CP_PIXEL;
|
||||
}
|
||||
|
||||
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 system heap.
|
||||
|
||||
@@ -26,10 +26,19 @@
|
||||
#include "memalloc.h"
|
||||
#include "alloc_controller.h"
|
||||
#include <qdMetaData.h>
|
||||
#include <linux/msm_ion.h>
|
||||
|
||||
using namespace gralloc;
|
||||
|
||||
#define SZ_2M 0x200000
|
||||
#define SZ_1M 0x100000
|
||||
#define SZ_4K 0x1000
|
||||
|
||||
#ifdef ION_FLAG_CP_PIXEL
|
||||
#define SECURE_ALIGN SZ_4K
|
||||
#else
|
||||
#define SECURE_ALIGN SZ_1M
|
||||
#endif
|
||||
|
||||
gpu_context_t::gpu_context_t(const private_module_t* module,
|
||||
IAllocController* alloc_ctrl ) :
|
||||
@@ -64,10 +73,14 @@ int gpu_context_t::gralloc_alloc_buffer(unsigned int size, int usage,
|
||||
else
|
||||
data.align = getpagesize();
|
||||
|
||||
/* force 1MB alignment selectively for secure buffers, MDP5 onwards */
|
||||
if ((usage & GRALLOC_USAGE_PROTECTED) &&
|
||||
(usage & GRALLOC_USAGE_PRIVATE_MM_HEAP)) {
|
||||
data.align = ALIGN((int) data.align, SZ_1M);
|
||||
if (usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY) {
|
||||
/* The alignment here reflects qsee mmu V7L/V8L requirement */
|
||||
data.align = SZ_2M;
|
||||
} else {
|
||||
data.align = SECURE_ALIGN;
|
||||
}
|
||||
size = ALIGN(size, data.align);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user