split HWComposer out of DisplayHardware

we will only ever have a single instance of HWComposer, so
it's now an attribute of SurfaceFlinger, instead of being part
of DisplayHardware.

DisplayHardware now just represents a "display" (it should be renamed).

Change-Id: Iec191e57686868e1df6daa8b880a286c9fefde56
diff --git a/services/surfaceflinger/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware.cpp
index f982794..067a54f 100644
--- a/services/surfaceflinger/DisplayHardware.cpp
+++ b/services/surfaceflinger/DisplayHardware.cpp
@@ -106,7 +106,6 @@
     : DisplayHardwareBase(display),
       mFlinger(flinger),
       mDisplayId(display),
-      mHwc(0),
       mNativeWindow(surface),
       mFlags(0),
       mSecureLayerVisible(false)
@@ -227,12 +226,6 @@
     mFormat  = format;
     mPageFlipCount = 0;
 
-    // initialize the H/W composer
-    mHwc = new HWComposer(mFlinger, *this, mRefreshPeriod);
-    if (mHwc->initCheck() == NO_ERROR) {
-        mHwc->setFrameBuffer(mDisplay, mSurface);
-    }
-
     // initialize the shared control block
     surface_flinger_cblk_t* const scblk = mFlinger->getControlBlock();
     scblk->connected |= 1 << mDisplayId;
@@ -248,53 +241,6 @@
     DisplayHardware::setOrientation(ISurfaceComposer::eOrientationDefault);
 }
 
-void DisplayHardware::setVSyncHandler(const sp<VSyncHandler>& handler) {
-    Mutex::Autolock _l(mLock);
-    mVSyncHandler = handler;
-}
-
-void DisplayHardware::eventControl(int event, int enabled) {
-    if (event == EVENT_VSYNC) {
-        mPowerHAL.vsyncHint(enabled);
-    }
-    mHwc->eventControl(event, enabled);
-}
-
-void DisplayHardware::onVSyncReceived(int dpy, nsecs_t timestamp) {
-    sp<VSyncHandler> handler;
-    { // scope for the lock
-        Mutex::Autolock _l(mLock);
-        mLastHwVSync = timestamp;
-        if (mVSyncHandler != NULL) {
-            handler = mVSyncHandler.promote();
-        }
-    }
-
-    if (handler != NULL) {
-        handler->onVSyncReceived(dpy, timestamp);
-    }
-}
-
-HWComposer& DisplayHardware::getHwComposer() const {
-    return *mHwc;
-}
-
-void DisplayHardware::releaseScreen() const
-{
-    DisplayHardwareBase::releaseScreen();
-    if (mHwc->initCheck() == NO_ERROR) {
-        mHwc->release();
-    }
-}
-
-void DisplayHardware::acquireScreen() const
-{
-    if (mHwc->initCheck() == NO_ERROR) {
-        mHwc->acquire();
-    }
-    DisplayHardwareBase::acquireScreen();
-}
-
 uint32_t DisplayHardware::getPageFlipCount() const {
     return mPageFlipCount;
 }
@@ -319,6 +265,11 @@
     return mFramebufferSurface->compositionComplete();
 }
 
+void DisplayHardware::onVSyncReceived(nsecs_t timestamp) {
+    Mutex::Autolock _l(mLock);
+    mLastHwVSync = timestamp;
+}
+
 void DisplayHardware::flip(const Region& dirty) const
 {
     checkGLErrors();
@@ -342,13 +293,6 @@
     }
     
     mPageFlipCount++;
-
-    if (mHwc->initCheck() == NO_ERROR) {
-        mHwc->commit();
-    } else {
-        eglSwapBuffers(dpy, surface);
-    }
-    checkEGLErrors("eglSwapBuffers");
 }
 
 uint32_t DisplayHardware::getFlags() const