We now have a real list of displays.
displays can be dynamically added or removed, and the
list is part of the SF's transaction.
Change-Id: I4186ea39f1317c0e7c044f869004017738968fab
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index b09b77c..a33b94b 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -97,33 +97,55 @@
*
*/
+DisplayDevice::DisplayDevice()
+ : mId(0),
+ mDisplay(EGL_NO_DISPLAY),
+ mSurface(EGL_NO_SURFACE),
+ mContext(EGL_NO_CONTEXT)
+{
+}
+
DisplayDevice::DisplayDevice(
const sp<SurfaceFlinger>& flinger,
int display,
const sp<SurfaceTextureClient>& surface,
EGLConfig config)
- : mFlinger(flinger),
- mDisplayId(display),
- mNativeWindow(surface),
- mDisplay(EGL_NO_DISPLAY),
- mSurface(EGL_NO_SURFACE),
- mContext(EGL_NO_CONTEXT),
- mDpiX(), mDpiY(),
- mRefreshRate(),
- mDensity(),
- mDisplayWidth(), mDisplayHeight(), mFormat(),
- mFlags(),
- mPageFlipCount(),
- mRefreshPeriod(),
- mSecureLayerVisible(false),
- mScreenAcquired(false),
- mOrientation(),
- mLayerStack(0)
+ : mFlinger(flinger),
+ mId(display),
+ mNativeWindow(surface),
+ mDisplay(EGL_NO_DISPLAY),
+ mSurface(EGL_NO_SURFACE),
+ mContext(EGL_NO_CONTEXT),
+ mDpiX(), mDpiY(),
+ mRefreshRate(),
+ mDensity(),
+ mDisplayWidth(), mDisplayHeight(), mFormat(),
+ mFlags(),
+ mPageFlipCount(),
+ mRefreshPeriod(),
+ mSecureLayerVisible(false),
+ mScreenAcquired(false),
+ mOrientation(),
+ mLayerStack(0)
{
init(config);
}
DisplayDevice::~DisplayDevice() {
+ // DO NOT call terminate() from here, because we create
+ // temporaries of this class (on the stack typically), and we don't
+ // want to destroy the EGLSurface in that case
+}
+
+void DisplayDevice::terminate() {
+ if (mSurface != EGL_NO_SURFACE) {
+ eglDestroySurface(mDisplay, mSurface);
+ mSurface = EGL_NO_SURFACE;
+ }
+}
+
+bool DisplayDevice::isValid() const {
+ return mFlinger != NULL;
}
float DisplayDevice::getDpiX() const {
@@ -389,5 +411,6 @@
h = tmp;
}
mOrientation = orientation;
+ dirtyRegion.set(bounds());
return NO_ERROR;
}