From d120c0dfac62a02ed1e8b1d76a6c1ea88ef825da Mon Sep 17 00:00:00 2001 From: Mathew Karimpanal Date: Sat, 10 Dec 2011 22:13:05 -0800 Subject: [PATCH] libhwcomposer: Mark layers below skip-layers for GPU composition If module composition type is MDP or C2D and we have a skipped layer (usually layers without backing buffers, layers with "invalid" orientations or debug layers), mark every HWC layer below this layer for GPU composition. This logic is needed because ICS SF composes a bunch of z-ordered HWC_FRAMEBUFFER (GPU) layers first and then the remaining bunch of z-ordered HWC_OVERLAY layers last which breaks the overall z-ordered layer rendering requirement. This logic also holds valid for 2-layer bypass in ICS. Change-Id: I5082affac8affd6b19d78be827d149901945a163 --- libhwcomposer/hwcomposer.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index e713807..517ae82 100755 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -863,6 +863,28 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list) { // need to still mark the layer for S3D composition if (isS3DCompositionNeeded) markUILayerForS3DComposition(list->hwLayers[i], s3dVideoFormat); + + if (hwcModule->compositionType + & (COMPOSITION_TYPE_C2D | COMPOSITION_TYPE_MDP)) { + // Ensure that HWC_OVERLAY layers below skip layers do not + // overwrite GPU composed skip layers. + ssize_t layer_countdown = ((ssize_t)i) - 1; + while (layer_countdown >= 0) + { + // Mark every non-mdp overlay layer below the + // skip-layer for GPU composition. + switch(list->hwLayers[layer_countdown].compositionType) { + case HWC_FRAMEBUFFER: + case HWC_USE_OVERLAY: + break; + case HWC_USE_COPYBIT: + default: + list->hwLayers[layer_countdown].compositionType = HWC_FRAMEBUFFER; + break; + } + layer_countdown--; + } + } continue; } if (hnd && (hnd->bufferType == BUFFER_TYPE_VIDEO) && (yuvBufferCount == 1)) {