diff options
author | Mathias Agopian <mathias@google.com> | 2012-04-10 22:09:54 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-04-10 22:18:43 -0700 |
commit | b60314a12f3336b27d73920805ab07cbc498d857 (patch) | |
tree | a921016f2448da9f274ff3c4abe59bac7b89746a /services/surfaceflinger/DisplayHardware | |
parent | e2c4f4ec23b735dd2a03f4ea8b08b288a1bb04e8 (diff) | |
download | frameworks_native-b60314a12f3336b27d73920805ab07cbc498d857.zip frameworks_native-b60314a12f3336b27d73920805ab07cbc498d857.tar.gz frameworks_native-b60314a12f3336b27d73920805ab07cbc498d857.tar.bz2 |
rework screen on/off code
Change-Id: I13f71e850592a588bbd4805b1830c503bd4decb4
Diffstat (limited to 'services/surfaceflinger/DisplayHardware')
-rw-r--r-- | services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp | 19 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h | 4 |
2 files changed, 5 insertions, 18 deletions
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp index 69f1aca..d3a8bde 100644 --- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp +++ b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp @@ -54,15 +54,12 @@ bool DisplayHardwareBase::DisplayEventThread::threadLoop() { sp<SurfaceFlinger> flinger = mFlinger.promote(); ALOGD("About to give-up screen, flinger = %p", flinger.get()); if (flinger != 0) { - mBarrier.close(); - flinger->screenReleased(0); - mBarrier.wait(); + flinger->screenReleased(); } if (waitForFbWake() == NO_ERROR) { - sp<SurfaceFlinger> flinger = mFlinger.promote(); ALOGD("Screen about to return, flinger = %p", flinger.get()); if (flinger != 0) { - flinger->screenAcquired(0); + flinger->screenAcquired(); } return true; } @@ -98,17 +95,12 @@ status_t DisplayHardwareBase::DisplayEventThread::waitForFbWake() { return err < 0 ? -errno : int(NO_ERROR); } -status_t DisplayHardwareBase::DisplayEventThread::releaseScreen() const { - mBarrier.open(); - return NO_ERROR; -} - // ---------------------------------------------------------------------------- DisplayHardwareBase::DisplayHardwareBase(const sp<SurfaceFlinger>& flinger, uint32_t displayIndex) - : mScreenAcquired(true) { + mScreenAcquired = true; mDisplayEventThread = new DisplayEventThread(flinger); } @@ -130,10 +122,7 @@ bool DisplayHardwareBase::canDraw() const { } void DisplayHardwareBase::releaseScreen() const { - status_t err = mDisplayEventThread->releaseScreen(); - if (err >= 0) { - mScreenAcquired = false; - } + mScreenAcquired = false; } void DisplayHardwareBase::acquireScreen() const { diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h index fba211b..6857481 100644 --- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h +++ b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h @@ -19,8 +19,8 @@ #include <stdint.h> #include <utils/RefBase.h> +#include <utils/StrongPointer.h> #include <utils/threads.h> -#include "Barrier.h" namespace android { @@ -48,14 +48,12 @@ public: private: class DisplayEventThread : public Thread { wp<SurfaceFlinger> mFlinger; - mutable Barrier mBarrier; status_t waitForFbSleep(); status_t waitForFbWake(); public: DisplayEventThread(const sp<SurfaceFlinger>& flinger); virtual ~DisplayEventThread(); virtual bool threadLoop(); - status_t releaseScreen() const; status_t initCheck() const; }; |