refactor things a bit

- decouple GL and main display initialization
- ensure that each "supported" display has its own FramebufferSurface
- onScreenAcquired/Released now takes a display

Change-Id: If34a05f3dea40f6c79db77f4dde283a2580daac4
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index ffe68c6..a648621 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -166,6 +166,7 @@
         DisplayDeviceState(DisplayDevice::DisplayType type);
         bool isValid() const { return type >= 0; }
         bool isMainDisplay() const { return type == DisplayDevice::DISPLAY_PRIMARY; }
+        bool isVirtualDisplay() const { return type >= DisplayDevice::DISPLAY_VIRTUAL; }
         DisplayDevice::DisplayType type;
         sp<ISurfaceTexture> surface;
         uint32_t layerStack;
@@ -238,9 +239,9 @@
     // called on the main thread in response to initializeDisplays()
     void onInitializeDisplays();
     // called on the main thread in response to blank()
-    void onScreenReleased();
+    void onScreenReleased(const sp<const DisplayDevice>& hw);
     // called on the main thread in response to unblank()
-    void onScreenAcquired();
+    void onScreenAcquired(const sp<const DisplayDevice>& hw);
 
     void handleMessageTransaction();
     void handleMessageInvalidate();
@@ -320,7 +321,7 @@
         EGLint const* attrs, PixelFormat format, EGLConfig* outConfig);
     static EGLConfig selectEGLConfig(EGLDisplay disp, EGLint visualId);
     static EGLContext createGLContext(EGLDisplay disp, EGLConfig config);
-    void initializeGL(EGLDisplay display, const sp<DisplayDevice>& hw);
+    void initializeGL(EGLDisplay display);
     uint32_t getMaxTextureSize() const;
     uint32_t getMaxViewportDims() const;