sdm: gralloc: Add support for Secure Camera use-case

1. Add support for Secure Camera use-case in SDM and gralloc.
2. Set the appropriate ION Heap ID, secure camera/preview ION flags
   and the alignment requirement for Secure Camera use-case.

CRs-Fixed: 1065934
Change-Id: I9e80f3093d598eec7bf717ddd0e3adbbc3382d5e
This commit is contained in:
Sushil Chauhan
2016-09-12 15:48:29 -07:00
committed by Gerrit - the friendly Code Review server
parent 2197ae270b
commit dfe55a2036
12 changed files with 63 additions and 7 deletions

View File

@@ -59,16 +59,24 @@
#define ION_FLAG_ALLOW_NON_CONTIG 0
#endif
#ifndef ION_FLAG_CP_CAMERA_PREVIEW
#define ION_FLAG_CP_CAMERA_PREVIEW 0
#endif
#ifdef MASTER_SIDE_CP
#define CP_HEAP_ID ION_SECURE_HEAP_ID
#define SD_HEAP_ID ION_SECURE_DISPLAY_HEAP_ID
#define ION_CP_FLAGS (ION_SECURE | ION_FLAG_CP_PIXEL)
#define ION_SD_FLAGS (ION_SECURE | ION_FLAG_CP_SEC_DISPLAY)
#define ION_SC_FLAGS (ION_SECURE | ION_FLAG_CP_CAMERA)
#define ION_SC_PREVIEW_FLAGS (ION_SECURE | ION_FLAG_CP_CAMERA_PREVIEW)
#else // SLAVE_SIDE_CP
#define CP_HEAP_ID ION_CP_MM_HEAP_ID
#define SD_HEAP_ID CP_HEAP_ID
#define ION_CP_FLAGS (ION_SECURE | ION_FLAG_ALLOW_NON_CONTIG)
#define ION_SD_FLAGS ION_SECURE
#define ION_SC_FLAGS ION_SECURE
#define ION_SC_PREVIEW_FLAGS ION_SECURE
#endif
using namespace gralloc;
@@ -473,6 +481,9 @@ int IonController::allocate(alloc_data& data, int usage)
* VM. Please add it to the define once available.
*/
ionFlags |= ION_SD_FLAGS;
} else if (usage & GRALLOC_USAGE_HW_CAMERA_MASK) {
ionHeapId = ION_HEAP(SD_HEAP_ID);
ionFlags |= (usage & GRALLOC_USAGE_HW_COMPOSER) ? ION_SC_PREVIEW_FLAGS : ION_SC_FLAGS;
} else {
ionHeapId = ION_HEAP(CP_HEAP_ID);
ionFlags |= ION_CP_FLAGS;