From 7c3d92ed0be26bf4955536cb5bf947c05df4932b Mon Sep 17 00:00:00 2001 From: Naomi Luis Date: Thu, 19 May 2011 13:53:49 -0700 Subject: [PATCH] libhwcomposer: Handle HDMI disconnect event - Inform the gralloc of the HDMI status. - If the HDMI is disconnected, close the overlay and also inform the gralloc that video mirroring has stopped. Change-Id: Ie89ffe860c0f9c9142d6c7f5d7a6c555884561ce CRs-fixed: 286954 --- libhwcomposer/hwcomposer.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index 78c15a6..afea6d4 100755 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -124,9 +124,25 @@ static void dump_layer(hwc_layer_t const* l) { static void hwc_enableHDMIOutput(hwc_composer_device_t *dev, bool enable) { hwc_context_t* ctx = (hwc_context_t*)(dev); + private_hwc_module_t* hwcModule = reinterpret_cast( + dev->common.module); + framebuffer_device_t *fbDev = hwcModule->fbDevice; + if (fbDev) { + fbDev->enableHDMIOutput(fbDev, enable); + } + if(ctx && ctx->mOverlayLibObject) { overlay::Overlay *ovLibObject = ctx->mOverlayLibObject; ovLibObject->setHDMIStatus(enable); + + if (!enable) { + // Close the overlay channels if HDMI is disconnected + ovLibObject->closeChannel(); + // Inform the gralloc that video mirroring is stopped + framebuffer_device_t *fbDev = hwcModule->fbDevice; + if (fbDev) + fbDev->videoOverlayStarted(fbDev, false); + } } }