From 6dd7f17b59007e00b7e44c52cd3013bfc9e807ac Mon Sep 17 00:00:00 2001 From: Naomi Luis Date: Thu, 26 Jan 2012 10:20:38 -0800 Subject: [PATCH] libhwcomposer: Disable FB fetch if there is only one video layer. If we have a single layer for composition which goes via the overlay, we can disable disable the framebuffer fetch thereby saving power. CRs-Fixed: 338777 (cherry picked from commit c40d887d714d14182e867e5eb7942160b3feb197) Change-Id: I361f5d8a60fb478a675b47163b7524c79e66624a --- libhwcomposer/hwcomposer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index d5fb9e3..fb1fe62 100644 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -587,7 +587,7 @@ static int hwc_closeOverlayChannels(hwc_context_t* ctx) { /* * Configures mdp pipes */ -static int prepareOverlay(hwc_context_t *ctx, hwc_layer_t *layer, const bool waitForVsync) { +static int prepareOverlay(hwc_context_t *ctx, hwc_layer_t *layer, const int flags) { int ret = 0; #ifdef COMPOSITION_BYPASS @@ -623,7 +623,7 @@ static int prepareOverlay(hwc_context_t *ctx, hwc_layer_t *layer, const bool wai hdmiConnected = (int)ctx->mHDMIEnabled; #endif ret = ovLibObject->setSource(info, layer->transform, - hdmiConnected, waitForVsync); + hdmiConnected, flags); if (!ret) { LOGE("prepareOverlay setSource failed"); return -1; @@ -1021,11 +1021,12 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list) { continue; } if (hnd && (hnd->bufferType == BUFFER_TYPE_VIDEO) && (yuvBufferCount == 1)) { - bool waitForVsync = true; + int flags = WAIT_FOR_VSYNC; + flags |= (1 == list->numHwLayers) ? DISABLE_FRAMEBUFFER_FETCH : 0; if (!isValidDestination(hwcModule->fbDevice, list->hwLayers[i].displayFrame)) { list->hwLayers[i].compositionType = HWC_FRAMEBUFFER; #ifdef USE_OVERLAY - } else if(prepareOverlay(ctx, &(list->hwLayers[i]), waitForVsync) == 0) { + } else if(prepareOverlay(ctx, &(list->hwLayers[i]), flags) == 0) { list->hwLayers[i].compositionType = HWC_USE_OVERLAY; list->hwLayers[i].hints |= HWC_HINT_CLEAR_FB; // We've opened the channel. Set the state to open.