From 10fbdb6059755f009e02f0ccc2b9d289beb6b086 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 12 Jul 2012 17:56:34 -0700 Subject: [PATCH] surfaceflinger: call into hardware composer to blank screen Call into the new HWC blank operation to blank or unblank the screen. Legacy systems may have already blanked the screen via early suspend, and can choose to not implement the blank operation in their hardware composer implementation. Change-Id: Ib403c8c0e36367a2cfef3e1d124872fcfeb9e7cb --- services/surfaceflinger/DisplayHardware.cpp | 3 +++ .../DisplayHardware/HWComposer.cpp | 22 +++++++++++++++++++ .../DisplayHardware/HWComposer.h | 5 ++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/services/surfaceflinger/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware.cpp index eac9e04ac..eb64c9f8f 100644 --- a/services/surfaceflinger/DisplayHardware.cpp +++ b/services/surfaceflinger/DisplayHardware.cpp @@ -434,6 +434,9 @@ void DisplayHardware::releaseScreen() const void DisplayHardware::acquireScreen() const { + if (mHwc->initCheck() == NO_ERROR) { + mHwc->acquire(); + } DisplayHardwareBase::acquireScreen(); } diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 4ed692fc4..122be5ed0 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -286,11 +286,33 @@ status_t HWComposer::release() const { mHwc->methods->eventControl(mHwc, HWC_EVENT_VSYNC, 0); } int err = mHwc->set(mHwc, NULL, NULL, NULL); + if (err < 0) { + return (status_t)err; + } + + if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_1_0)) { + if (mHwc->methods && mHwc->methods->blank) { + err = mHwc->methods->blank(mHwc, 1); + } + } return (status_t)err; } return NO_ERROR; } +status_t HWComposer::acquire() const { + if (mHwc) { + if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_1_0)) { + if (mHwc->methods && mHwc->methods->blank) { + int err = mHwc->methods->blank(mHwc, 0); + return (status_t)err; + } + } + } + + return NO_ERROR; +} + status_t HWComposer::disable() { if (mHwc) { free(mList); diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h index a662b25f4..5cde7fbcf 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.h +++ b/services/surfaceflinger/DisplayHardware/HWComposer.h @@ -71,9 +71,12 @@ public: // commits the list status_t commit() const; - // release hardware resources + // release hardware resources and blank screen status_t release() const; + // acquire hardware resources and unblank screen + status_t acquire() const; + // create a work list for numLayers layer. sets HWC_GEOMETRY_CHANGED. status_t createWorkList(size_t numLayers);