From 1b69283a7fdc76a29935ba1cbd5919dac0364fe7 Mon Sep 17 00:00:00 2001 From: Amara Venkata Mastan Manoj Kumar Date: Mon, 27 Aug 2012 12:33:42 -0700 Subject: [PATCH] hwcomposer: keep secure content in an overlay when below skip layer Secure content can not be displayed unless in an overlay. Since getLayerStats marks all layers under the skip layer for framebuffer composition, when there is a skip layer on top of protected content, the protected content disappears since surfaceflinger doesn't draw protected layers. Change-Id: I59dd5dffad08dbf578baa459f5f4c726b6674c83 --- libhwcomposer/hwc_utils.cpp | 13 ++++++++++--- libhwcomposer/hwc_utils.h | 4 ++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp index 55b900b..4c1acce 100644 --- a/libhwcomposer/hwc_utils.cpp +++ b/libhwcomposer/hwc_utils.cpp @@ -130,6 +130,7 @@ void getLayerStats(hwc_context_t *ctx, const hwc_layer_list_t *list) int extLayerIndex = -1; //ext-only or block except closed caption int extCount = 0; //ext-only except closed caption bool isExtBlockPresent = false; //is BLOCK layer present + bool yuvSecure = false; for (size_t i = 0; i < list->numHwLayers; i++) { private_handle_t *hnd = @@ -147,8 +148,11 @@ void getLayerStats(hwc_context_t *ctx, const hwc_layer_list_t *list) //second video pipLayerIndex = i; } + yuvLayerIndex = i; + yuvSecure = isSecureBuffer(hnd); //Animating - if (isSkipLayer(&list->hwLayers[i])) { + //Do not mark as SKIP if it is secure buffer + if (isSkipLayer(&list->hwLayers[i]) && !yuvSecure) { isYuvLayerSkip = true; } } else if(UNLIKELY(isExtCC(hnd))) { @@ -164,9 +168,12 @@ void getLayerStats(hwc_context_t *ctx, const hwc_layer_list_t *list) } else if (isSkipLayer(&list->hwLayers[i])) { //Popups //If video layer is below a skip layer if(yuvLayerIndex != -1 && yuvLayerIndex < (ssize_t)i) { - isYuvLayerSkip = true; + //Do not mark as SKIP if it is secure buffer + if (!yuvSecure) { + isYuvLayerSkip = true; + skipCount++; + } } - skipCount++; } } diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h index 6ed830d..51c9491 100644 --- a/libhwcomposer/hwc_utils.h +++ b/libhwcomposer/hwc_utils.h @@ -95,6 +95,10 @@ static inline bool isYuvBuffer(const private_handle_t* hnd) { return (hnd && (hnd->bufferType == BUFFER_TYPE_VIDEO)); } +// Returns true if the buffer is secure +static inline bool isSecureBuffer(const private_handle_t* hnd) { + return (hnd && (private_handle_t::PRIV_FLAGS_SECURE_BUFFER & hnd->flags)); +} //Return true if buffer is marked locked static inline bool isBufferLocked(const private_handle_t* hnd) { return (hnd && (private_handle_t::PRIV_FLAGS_HWC_LOCK & hnd->flags));