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
This commit is contained in:
Amara Venkata Mastan Manoj Kumar 2012-08-27 12:33:42 -07:00 committed by Andrew Sutherland
parent 0d7fad0878
commit 1b69283a7f
2 changed files with 14 additions and 3 deletions

View File

@ -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++;
}
}

View File

@ -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));