From cd8f8d8e84aa80dac27f64aef61cdb4fe7ea4bf0 Mon Sep 17 00:00:00 2001 From: Naomi Luis Date: Wed, 9 Mar 2011 15:40:32 -0800 Subject: [PATCH] libhwcomposer: Close the overlay channel after video/camera playback. Change-Id: I321acdb5ff00d7d70399d044473ef9b5ad9f547e --- libhwcomposer/hwcomposer.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index 036a6ca..621f292 100755 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -61,7 +61,7 @@ struct hwc_context_t { /* our private state goes below here */ overlay::Overlay* mOverlayLibObject; bool hdmiConnected; - bool videoHDMIStarted; + bool videoStarted; }; static int hwc_device_open(const struct hw_module_t* module, const char* name, @@ -164,25 +164,26 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list) { list->hwLayers[i].compositionType = HWC_FRAMEBUFFER; } } - } - // Inform the gralloc to close the UI mirroring channel if HDMI is connected - // and we have a video buffer - framebuffer_device_t *fbDev = hwcModule->fbDevice; - if ((yuvBufferCount == 1) && ctx->hdmiConnected && !ctx->videoHDMIStarted) { - if (fbDev) { - fbDev->videoOverlayStarted(fbDev, true); + // Inform the gralloc to close the UI mirroring channel if HDMI is connected + // and we have a video buffer + framebuffer_device_t *fbDev = hwcModule->fbDevice; + if ((yuvBufferCount == 1) && !ctx->videoStarted) { + if (ctx->hdmiConnected && fbDev) { + fbDev->videoOverlayStarted(fbDev, true); + } + ctx->videoStarted = true; } - ctx->videoHDMIStarted = true; - } - if (ctx->videoHDMIStarted && yuvBufferCount != 1) { - if(ovLibObject) - ovLibObject->closeChannel(); - if (fbDev) { - fbDev->videoOverlayStarted(fbDev, false); + if (ctx->videoStarted && yuvBufferCount != 1) { + if(ovLibObject) + ovLibObject->closeChannel(); + + if (ctx->hdmiConnected && fbDev) { + fbDev->videoOverlayStarted(fbDev, false); + } + ctx->videoStarted = false; } - ctx->videoHDMIStarted = false; } return 0; @@ -486,7 +487,7 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name, dev->mOverlayLibObject = NULL; dev->hdmiConnected = false; - dev->videoHDMIStarted = false; + dev->videoStarted = false; /* initialize the procs */ dev->device.common.tag = HARDWARE_DEVICE_TAG;