display: Use a new flag for content protection

The GRALLOC_USAGE_PROTECTED flag that was used
earlier for content protection is also used for
some other use cases such as disabling of
screen captures. Define this new flag that
is explicitly used for allocating secured
buffers for DRM.

Change-Id: Ia33f79fa0dea7f2f16dd320f267203e6173af48e
CRs-fixed: 348454
(cherry picked from commit 440a996f13be732895524412762793f109681c11)
This commit is contained in:
Naseer Ahmed 2012-04-12 18:49:31 -04:00 committed by Andrew Sutherland
parent b904eeeec8
commit 0371a6cfa9
4 changed files with 14 additions and 4 deletions

View File

@ -67,7 +67,8 @@ static bool canFallback(int compositionType, int usage, bool triedSystem)
return false;
if(triedSystem)
return false;
if(usage & (GRALLOC_HEAP_MASK | GRALLOC_USAGE_PROTECTED))
if(usage & (GRALLOC_HEAP_MASK | GRALLOC_USAGE_PROTECTED |
GRALLOC_USAGE_PRIVATE_CP_BUFFER))
return false;
if(usage & (GRALLOC_HEAP_MASK | GRALLOC_USAGE_EXTERNAL_ONLY))
return false;
@ -140,7 +141,7 @@ int IonController::allocate(alloc_data& data, int usage,
if(usage & GRALLOC_USAGE_PRIVATE_CAMERA_HEAP)
ionFlags |= ION_HEAP(ION_CAMERA_HEAP_ID);
if(usage & GRALLOC_USAGE_PROTECTED)
if(usage & GRALLOC_USAGE_PRIVATE_CP_BUFFER)
ionFlags |= ION_SECURE;
if(usage & GRALLOC_USAGE_PRIVATE_DO_NOT_MAP)

View File

@ -234,7 +234,8 @@ int gpu_context_t::alloc_impl(int w, int h, int format, int usage,
// All buffers marked as protected or for external
// display need to go to overlay
if ((usage & GRALLOC_USAGE_EXTERNAL_DISP) ||
(usage & GRALLOC_USAGE_PROTECTED)) {
(usage & GRALLOC_USAGE_PROTECTED) ||
(usage & GRALLOC_USAGE_PRIVATE_CP_BUFFER)) {
bufferType = BUFFER_TYPE_VIDEO;
}
int err;

View File

@ -85,6 +85,14 @@ enum {
* other EXTERNAL_ONLY buffers are available. Used during suspend.
*/
GRALLOC_USAGE_EXTERNAL_BLOCK = 0x00020000,
/* Use this flag to request content protected buffers. Please note
* that this flag is different from the GRALLOC_USAGE_PROTECTED flag
* which can be used for buffers that are not secured for DRM
* but still need to be protected from screen captures
* 0x00040000 is reserved and these values are subject to change.
*/
GRALLOC_USAGE_PRIVATE_CP_BUFFER = 0x00080000,
};
enum {

View File

@ -1821,7 +1821,7 @@ bool OverlayDataChannel::mapRotatorMemory(int num_buffers, bool uiChannel, int r
GRALLOC_USAGE_PRIVATE_DO_NOT_MAP;
if(mSecure) {
allocFlags |= GRALLOC_USAGE_PROTECTED;
allocFlags |= GRALLOC_USAGE_PRIVATE_CP_BUFFER;
} else {
allocFlags |= GRALLOC_USAGE_PRIVATE_ADSP_HEAP |
GRALLOC_USAGE_PRIVATE_IOMMU_HEAP;