From babba1868773eba5edf8a8e335b8e109a32292e0 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Wed, 12 Sep 2012 13:14:51 -0700 Subject: [PATCH] Fix emulator Emulator has no HWC. Change-Id: I7810b27034f6772823142e5bf877681db1c8ee49 --- services/surfaceflinger/DisplayHardware/HWComposer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 75b8ad836..992d06785 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -111,9 +111,10 @@ HWComposer::HWComposer( loadFbHalModule(); loadHwcModule(); - if (!hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1) && !mFbDev) { + // If we have no HWC, or a pre-1.1 HWC, an FB dev is mandatory. + if ((!mHwc || !hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) + && !mFbDev) { ALOGE("ERROR: failed to open framebuffer, aborting"); - // FB mandatory on <= 1.0, give up abort(); } @@ -186,7 +187,9 @@ HWComposer::HWComposer( } HWComposer::~HWComposer() { - mHwc->eventControl(mHwc, 0, EVENT_VSYNC, 0); + if (mHwc) { + mHwc->eventControl(mHwc, 0, EVENT_VSYNC, 0); + } if (mVSyncThread != NULL) { mVSyncThread->requestExitAndWait(); }