diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp index a8bb57e..a88f214 100644 --- a/libgralloc/alloc_controller.cpp +++ b/libgralloc/alloc_controller.cpp @@ -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) diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp index 7e3d9c2..7832121 100755 --- a/libgralloc/gpu.cpp +++ b/libgralloc/gpu.cpp @@ -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; diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h index 0d1be56..19b03e0 100644 --- a/libgralloc/gralloc_priv.h +++ b/libgralloc/gralloc_priv.h @@ -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 { diff --git a/liboverlay/overlayLib.cpp b/liboverlay/overlayLib.cpp index 2d972f2..29e3269 100755 --- a/liboverlay/overlayLib.cpp +++ b/liboverlay/overlayLib.cpp @@ -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;