cleanups in preparation of bigger changes
- fix typo drawForSreenshot misspelled
- get rid of DisplayDeviceBase
- removed unused or unneeded code
- always pass a DisplayDevice to Layer methods that are called
on a per-display basis (to make it clear that this could be
called more than once per composition).
Change-Id: Id948b7e09fe5c06db0e42d40d6ed75dd095c7f44
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 7caf099..3775734 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -475,7 +475,7 @@
if (display != NULL) {
stc = new SurfaceTextureClient(display);
- result = eglCreateWindowSurface(hw.getEGLDisplay(),
+ result = eglCreateWindowSurface(mEGLDisplay,
mEGLConfig, (EGLNativeWindowType)stc.get(), NULL);
ALOGE_IF(result == EGL_NO_SURFACE,
"eglCreateWindowSurface failed (ISurfaceTexture=%p)",
@@ -493,7 +493,7 @@
if (old_surface != EGL_NO_SURFACE) {
// Note: EGL allows to destroy an object while its current
// it will fail to become current next time though.
- eglDestroySurface(hw.getEGLDisplay(), old_surface);
+ eglDestroySurface(mEGLDisplay, old_surface);
}
}
@@ -540,8 +540,6 @@
}
void SurfaceFlinger::onVSyncReceived(int dpy, nsecs_t timestamp) {
- DisplayDevice& hw(const_cast<DisplayDevice&>(getDisplayDevice(dpy)));
- hw.onVSyncReceived(timestamp);
mEventThread->onVSyncReceived(dpy, timestamp);
}
@@ -640,7 +638,7 @@
* update the per-frame h/w composer data for each layer
* and build the transparent region of the FB
*/
- layer->setPerFrameData(*cur);
+ layer->setPerFrameData(hw, *cur);
}
}
status_t err = hwc.prepare();
@@ -700,7 +698,7 @@
const size_t count = layers.size();
for (size_t i=0 ; i<count ; ++i) {
const sp<LayerBase>& layer(layers[i]);
- layer->drawForSreenShot(hw);
+ layer->drawForScreenShot(hw);
}
success = eglSwapBuffers(eglGetCurrentDisplay(), externalDisplaySurface);
@@ -736,7 +734,7 @@
const HWComposer::LayerListIterator end = hwc.end();
for (size_t i=0 ; cur!=end && i<count ; ++i, ++cur) {
const sp<LayerBase>& layer(currentLayers[i]);
- layer->setAcquireFence(*cur);
+ layer->setAcquireFence(hw, *cur);
}
}
hw.flip(hw.swapRegion);
@@ -756,12 +754,12 @@
HWComposer::LayerListIterator cur = hwc.begin();
const HWComposer::LayerListIterator end = hwc.end();
for (size_t i = 0; cur != end && i < count; ++i, ++cur) {
- currentLayers[i]->onLayerDisplayed(&*cur);
+ currentLayers[i]->onLayerDisplayed(hw, &*cur);
}
} else {
eglSwapBuffers(mEGLDisplay, hw.getEGLSurface());
for (size_t i = 0; i < count; i++) {
- currentLayers[i]->onLayerDisplayed(NULL);
+ currentLayers[i]->onLayerDisplayed(hw, NULL);
}
}
@@ -1096,6 +1094,12 @@
composeSurfaces(hw, dirtyRegion);
+ const LayerVector& currentLayers(mDrawingState.layersSortedByZ);
+ const size_t count = currentLayers.size();
+ for (size_t i=0 ; i<count ; i++) {
+ currentLayers[i]->onPostComposition();
+ }
+
// update the swap region and clear the dirty region
hw.swapRegion.orSelf(dirtyRegion);
}
@@ -1791,8 +1795,7 @@
result.append(buffer);
snprintf(buffer, SIZE, "EGL : %s\n",
- eglQueryString(hw.getEGLDisplay(),
- EGL_VERSION_HW_ANDROID));
+ eglQueryString(mEGLDisplay, EGL_VERSION_HW_ANDROID));
result.append(buffer);
snprintf(buffer, SIZE, "EXTS: %s\n", extensions.getExtension());
@@ -2023,7 +2026,7 @@
const size_t count = layers.size();
for (size_t i=0 ; i<count ; ++i) {
const sp<LayerBase>& layer(layers[i]);
- layer->drawForSreenShot(hw);
+ layer->drawForScreenShot(hw);
}
hw.compositionComplete();
@@ -2583,7 +2586,7 @@
if (!(flags & ISurfaceComposer::eLayerHidden)) {
const uint32_t z = layer->drawingState().z;
if (z >= minLayerZ && z <= maxLayerZ) {
- layer->drawForSreenShot(hw);
+ layer->drawForScreenShot(hw);
}
}
}