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/Android.mk b/services/surfaceflinger/Android.mk
index eb45840..1f7affd 100644
--- a/services/surfaceflinger/Android.mk
+++ b/services/surfaceflinger/Android.mk
@@ -9,7 +9,6 @@
LayerBase.cpp \
LayerDim.cpp \
LayerScreenshot.cpp \
- DisplayHardware/DisplayDeviceBase.cpp \
DisplayHardware/FramebufferSurface.cpp \
DisplayHardware/HWComposer.cpp \
DisplayHardware/PowerHAL.cpp \
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 70ce2d9..b09b77c 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -34,7 +34,6 @@
#include <hardware/gralloc.h>
#include "DisplayHardware/FramebufferSurface.h"
-#include "DisplayHardware/DisplayDeviceBase.h"
#include "DisplayHardware/HWComposer.h"
#include "DisplayDevice.h"
@@ -103,13 +102,23 @@
int display,
const sp<SurfaceTextureClient>& surface,
EGLConfig config)
- : DisplayDeviceBase(display),
- mFlinger(flinger),
- mDisplayId(display),
- mNativeWindow(surface),
- mFlags(0),
- mSecureLayerVisible(false),
- mLayerStack(0)
+ : 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)
{
init(config);
}
@@ -248,15 +257,6 @@
return mPageFlipCount;
}
-nsecs_t DisplayDevice::getRefreshTimestamp() const {
- // this returns the last refresh timestamp.
- // if the last one is not available, we estimate it based on
- // the refresh period and whatever closest timestamp we have.
- Mutex::Autolock _l(mLock);
- nsecs_t now = systemTime(CLOCK_MONOTONIC);
- return now - ((now - mLastHwVSync) % mRefreshPeriod);
-}
-
nsecs_t DisplayDevice::getRefreshPeriod() const {
return mRefreshPeriod;
}
@@ -268,11 +268,6 @@
return mFramebufferSurface->compositionComplete();
}
-void DisplayDevice::onVSyncReceived(nsecs_t timestamp) {
- Mutex::Autolock _l(mLock);
- mLastHwVSync = timestamp;
-}
-
void DisplayDevice::flip(const Region& dirty) const
{
checkGLErrors();
@@ -340,6 +335,24 @@
// ----------------------------------------------------------------------------
+bool DisplayDevice::canDraw() const {
+ return mScreenAcquired;
+}
+
+void DisplayDevice::releaseScreen() const {
+ mScreenAcquired = false;
+}
+
+void DisplayDevice::acquireScreen() const {
+ mScreenAcquired = true;
+}
+
+bool DisplayDevice::isScreenAcquired() const {
+ return mScreenAcquired;
+}
+
+// ----------------------------------------------------------------------------
+
status_t DisplayDevice::orientationToTransfrom(
int orientation, int w, int h, Transform* tr)
{
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index c9caffb..e1c2d11 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -14,16 +14,14 @@
* limitations under the License.
*/
-#ifndef ANDROID_DISPLAY_HARDWARE_H
-#define ANDROID_DISPLAY_HARDWARE_H
+#ifndef ANDROID_DISPLAY_DEVICE_H
+#define ANDROID_DISPLAY_DEVICE_H
#include <stdlib.h>
#include <ui/PixelFormat.h>
#include <ui/Region.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -32,8 +30,6 @@
#include "Transform.h"
-#include "DisplayHardware/DisplayDeviceBase.h"
-
namespace android {
class DisplayInfo;
@@ -42,7 +38,7 @@
class SurfaceFlinger;
class SurfaceTextureClient;
-class DisplayDevice : public DisplayDeviceBase
+class DisplayDevice
{
public:
// region in layer-stack space
@@ -63,14 +59,12 @@
const sp<SurfaceTextureClient>& surface,
EGLConfig config);
- virtual ~DisplayDevice();
+ ~DisplayDevice();
// Flip the front and back buffers if the back buffer is "dirty". Might
// be instantaneous, might involve copying the frame buffer around.
void flip(const Region& dirty) const;
- void onVSyncReceived(nsecs_t timestamp);
-
float getDpiX() const;
float getDpiY() const;
float getRefreshRate() const;
@@ -80,7 +74,6 @@
PixelFormat getFormat() const;
uint32_t getFlags() const;
nsecs_t getRefreshPeriod() const;
- nsecs_t getRefreshTimestamp() const;
status_t getInfo(DisplayInfo* info) const;
EGLSurface getEGLSurface() const;
@@ -94,12 +87,6 @@
const Transform& getTransform() const { return mGlobalTransform; }
uint32_t getLayerStack() const { return mLayerStack; }
-
- uint32_t getPageFlipCount() const;
- EGLDisplay getEGLDisplay() const { return mDisplay; }
-
- void dump(String8& res) const;
-
status_t compositionComplete() const;
Rect getBounds() const {
@@ -109,6 +96,21 @@
static void makeCurrent(const DisplayDevice& hw, EGLContext ctx);
+ /* ------------------------------------------------------------------------
+ * blank / unplank management
+ */
+ void releaseScreen() const;
+ void acquireScreen() const;
+ bool isScreenAcquired() const;
+ bool canDraw() const;
+
+ /* ------------------------------------------------------------------------
+ * Debugging
+ */
+ uint32_t getPageFlipCount() const;
+ void dump(String8& res) const;
+
+
private:
void init(EGLConfig config);
@@ -117,12 +119,13 @@
*/
sp<SurfaceFlinger> mFlinger;
int mDisplayId;
+
// ANativeWindow this display is rendering into
sp<SurfaceTextureClient> mNativeWindow;
+
// set if mNativeWindow is a FramebufferSurface
sp<FramebufferSurface> mFramebufferSurface;
-
EGLDisplay mDisplay;
EGLSurface mSurface;
EGLContext mContext;
@@ -135,35 +138,33 @@
PixelFormat mFormat;
uint32_t mFlags;
mutable uint32_t mPageFlipCount;
-
nsecs_t mRefreshPeriod;
/*
* Can only accessed from the main thread, these members
* don't need synchronization.
*/
+
// list of visible layers on that display
Vector< sp<LayerBase> > mVisibleLayersSortedByZ;
+
// Whether we have a visible secure layer on this display
bool mSecureLayerVisible;
+ // Whether the screen is blanked;
+ mutable int mScreenAcquired;
- // this used to be in GraphicPlane
+
+ /*
+ * Transaction state
+ */
static status_t orientationToTransfrom(int orientation, int w, int h,
Transform* tr);
Transform mGlobalTransform;
int mOrientation;
-
uint32_t mLayerStack;
-
-
- /*
- * protected by mLock
- */
- mutable Mutex mLock;
- mutable nsecs_t mLastHwVSync;
};
}; // namespace android
-#endif // ANDROID_DISPLAY_HARDWARE_H
+#endif // ANDROID_DISPLAY_DEVICE_H
diff --git a/services/surfaceflinger/DisplayHardware/DisplayDeviceBase.cpp b/services/surfaceflinger/DisplayHardware/DisplayDeviceBase.cpp
deleted file mode 100644
index e0a4de6..0000000
--- a/services/surfaceflinger/DisplayHardware/DisplayDeviceBase.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include "DisplayHardware/DisplayDeviceBase.h"
-
-// ----------------------------------------------------------------------------
-namespace android {
-
-DisplayDeviceBase::DisplayDeviceBase(uint32_t displayIndex) {
- mScreenAcquired = true;
-}
-
-DisplayDeviceBase::~DisplayDeviceBase() {
-}
-
-bool DisplayDeviceBase::canDraw() const {
- return mScreenAcquired;
-}
-
-void DisplayDeviceBase::releaseScreen() const {
- mScreenAcquired = false;
-}
-
-void DisplayDeviceBase::acquireScreen() const {
- mScreenAcquired = true;
-}
-
-bool DisplayDeviceBase::isScreenAcquired() const {
- return mScreenAcquired;
-}
-
-}; // namespace android
diff --git a/services/surfaceflinger/DisplayHardware/DisplayDeviceBase.h b/services/surfaceflinger/DisplayHardware/DisplayDeviceBase.h
deleted file mode 100644
index 9432cf2..0000000
--- a/services/surfaceflinger/DisplayHardware/DisplayDeviceBase.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_DISPLAY_HARDWARE_BASE_H
-#define ANDROID_DISPLAY_HARDWARE_BASE_H
-
-#include <stdint.h>
-
-namespace android {
-
-class DisplayDeviceBase {
-public:
- DisplayDeviceBase(uint32_t displayIndex);
- ~DisplayDeviceBase();
-
- // console management
- void releaseScreen() const;
- void acquireScreen() const;
- bool isScreenAcquired() const;
-
- bool canDraw() const;
-
-private:
- mutable int mScreenAcquired;
-};
-
-}; // namespace android
-
-#endif // ANDROID_DISPLAY_HARDWARE_BASE_H
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index b8506ee..d337805 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -185,6 +185,17 @@
void HWComposer::vsync(int dpy, int64_t timestamp) {
ATRACE_INT("VSYNC", ++mVSyncCount&1);
mEventHandler.onVSyncReceived(dpy, timestamp);
+ Mutex::Autolock _l(mLock);
+ mLastHwVSync = timestamp;
+}
+
+nsecs_t HWComposer::getRefreshTimestamp() const {
+ // this returns the last refresh timestamp.
+ // if the last one is not available, we estimate it based on
+ // the refresh period and whatever closest timestamp we have.
+ Mutex::Autolock _l(mLock);
+ nsecs_t now = systemTime(CLOCK_MONOTONIC);
+ return now - ((now - mLastHwVSync) % mRefreshPeriod);
}
void HWComposer::eventControl(int event, int enabled) {
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index ca41bd3..872ab98 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -189,6 +189,8 @@
void eventControl(int event, int enabled);
+ nsecs_t getRefreshTimestamp() const;
+
// this class is only used to fake the VSync event on systems that don't
// have it.
class VSyncThread : public Thread {
@@ -235,6 +237,10 @@
size_t mVSyncCount;
sp<VSyncThread> mVSyncThread;
bool mDebugForceFakeVSync;
+
+ // protected by mLock
+ mutable Mutex mLock;
+ mutable nsecs_t mLastHwVSync;
};
// ---------------------------------------------------------------------------
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 97f3cd4..7da0c9b 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -60,7 +60,6 @@
mCurrentOpacity(true),
mRefreshPending(false),
mFrameLatencyNeeded(false),
- mNeedHwcFence(false),
mFrameLatencyOffset(0),
mFormat(PIXEL_FORMAT_NONE),
mGLExtensions(GLExtensions::getInstance()),
@@ -72,21 +71,11 @@
glGenTextures(1, &mTextureName);
}
-void Layer::onLayerDisplayed(HWComposer::HWCLayerInterface* layer) {
+void Layer::onLayerDisplayed(const DisplayDevice& hw,
+ HWComposer::HWCLayerInterface* layer) {
if (layer) {
mSurfaceTexture->setReleaseFence(layer->getAndResetReleaseFenceFd());
}
-
- if (mFrameLatencyNeeded) {
- // we need a DisplayDevice for debugging only right now
- // XXX: should this be called per DisplayDevice?
- const DisplayDevice& hw(mFlinger->getDefaultDisplayDevice());
- mFrameStats[mFrameLatencyOffset].timestamp = mSurfaceTexture->getTimestamp();
- mFrameStats[mFrameLatencyOffset].set = systemTime();
- mFrameStats[mFrameLatencyOffset].vsync = hw.getRefreshTimestamp();
- mFrameLatencyOffset = (mFrameLatencyOffset + 1) % 128;
- mFrameLatencyNeeded = false;
- }
}
void Layer::onFirstRef()
@@ -285,16 +274,22 @@
layer.setCrop(computeBufferCrop());
}
-void Layer::setPerFrameData(HWComposer::HWCLayerInterface& layer) {
+void Layer::setPerFrameData(const DisplayDevice& hw,
+ HWComposer::HWCLayerInterface& layer) {
const sp<GraphicBuffer>& buffer(mActiveBuffer);
// NOTE: buffer can be NULL if the client never drew into this
// layer yet, or if we ran out of memory
layer.setBuffer(buffer);
}
-void Layer::setAcquireFence(HWComposer::HWCLayerInterface& layer) {
+void Layer::setAcquireFence(const DisplayDevice& hw,
+ HWComposer::HWCLayerInterface& layer) {
int fenceFd = -1;
- if (mNeedHwcFence && (layer.getCompositionType() == HWC_OVERLAY)) {
+
+ // TODO: there is a possible optimization here: we only need to set the
+ // acquire fence the first time a new buffer is acquired on EACH display.
+
+ if (layer.getCompositionType() == HWC_OVERLAY) {
sp<Fence> fence = mSurfaceTexture->getCurrentFence();
if (fence.get()) {
fenceFd = fence->dup();
@@ -302,7 +297,6 @@
ALOGW("failed to dup layer fence, skipping sync: %d", errno);
}
}
- mNeedHwcFence = false;
}
layer.setAcquireFenceFd(fenceFd);
}
@@ -517,6 +511,18 @@
return mQueuedFrames > 0;
}
+void Layer::onPostComposition() {
+ if (mFrameLatencyNeeded) {
+ const HWComposer& hwc = mFlinger->getHwComposer();
+ const size_t offset = mFrameLatencyOffset;
+ mFrameStats[offset].timestamp = mSurfaceTexture->getTimestamp();
+ mFrameStats[offset].set = systemTime();
+ mFrameStats[offset].vsync = hwc.getRefreshTimestamp();
+ mFrameLatencyOffset = (mFrameLatencyOffset + 1) % 128;
+ mFrameLatencyNeeded = false;
+ }
+}
+
Region Layer::latchBuffer(bool& recomputeVisibleRegions)
{
ATRACE_CALL();
@@ -646,7 +652,6 @@
mRefreshPending = true;
mFrameLatencyNeeded = true;
- mNeedHwcFence = true;
if (oldActiveBuffer == NULL) {
// the first time we receive a buffer, we need to trigger a
// geometry invalidation.
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 22a441d..5e55887 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -66,8 +66,14 @@
// LayerBase interface
virtual void setGeometry(const DisplayDevice& hw,
HWComposer::HWCLayerInterface& layer);
- virtual void setPerFrameData(HWComposer::HWCLayerInterface& layer);
- virtual void setAcquireFence(HWComposer::HWCLayerInterface& layer);
+ virtual void setPerFrameData(const DisplayDevice& hw,
+ HWComposer::HWCLayerInterface& layer);
+ virtual void setAcquireFence(const DisplayDevice& hw,
+ HWComposer::HWCLayerInterface& layer);
+ virtual void onLayerDisplayed(const DisplayDevice& hw,
+ HWComposer::HWCLayerInterface* layer);
+ virtual bool onPreComposition();
+ virtual void onPostComposition();
virtual void onDraw(const DisplayDevice& hw, const Region& clip) const;
virtual uint32_t doTransaction(uint32_t transactionFlags);
@@ -82,9 +88,6 @@
// LayerBaseClient interface
virtual wp<IBinder> getSurfaceTextureBinder() const;
- virtual void onLayerDisplayed(HWComposer::HWCLayerInterface* layer);
- virtual bool onPreComposition();
-
// only for debugging
inline const sp<GraphicBuffer>& getActiveBuffer() const { return mActiveBuffer; }
@@ -121,7 +124,6 @@
bool mCurrentOpacity;
bool mRefreshPending;
bool mFrameLatencyNeeded;
- bool mNeedHwcFence;
int mFrameLatencyOffset;
struct Statistics {
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index a92bf52..9d3a505 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -291,11 +291,13 @@
layer.setVisibleRegionScreen(tr.transform(visibleRegion));
}
-void LayerBase::setPerFrameData(HWComposer::HWCLayerInterface& layer) {
+void LayerBase::setPerFrameData(const DisplayDevice& hw,
+ HWComposer::HWCLayerInterface& layer) {
layer.setBuffer(0);
}
-void LayerBase::setAcquireFence(HWComposer::HWCLayerInterface& layer) {
+void LayerBase::setAcquireFence(const DisplayDevice& hw,
+ HWComposer::HWCLayerInterface& layer) {
layer.setAcquireFenceFd(-1);
}
@@ -314,7 +316,7 @@
onDraw(hw, clip);
}
-void LayerBase::drawForSreenShot(const DisplayDevice& hw)
+void LayerBase::drawForScreenShot(const DisplayDevice& hw)
{
setFiltering(true);
onDraw( hw, Region(hw.bounds()) );
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
index 5aab4fc..e1d6793 100644
--- a/services/surfaceflinger/LayerBase.h
+++ b/services/surfaceflinger/LayerBase.h
@@ -134,8 +134,10 @@
virtual void setGeometry(const DisplayDevice& hw,
HWComposer::HWCLayerInterface& layer);
- virtual void setPerFrameData(HWComposer::HWCLayerInterface& layer);
- virtual void setAcquireFence(HWComposer::HWCLayerInterface& layer);
+ virtual void setPerFrameData(const DisplayDevice& hw,
+ HWComposer::HWCLayerInterface& layer);
+ virtual void setAcquireFence(const DisplayDevice& hw,
+ HWComposer::HWCLayerInterface& layer);
/**
* draw - performs some global clipping optimizations
@@ -144,7 +146,7 @@
* to perform the actual drawing.
*/
virtual void draw(const DisplayDevice& hw, const Region& clip) const;
- virtual void drawForSreenShot(const DisplayDevice& hw);
+ virtual void drawForScreenShot(const DisplayDevice& hw);
/**
* onDraw - draws the surface.
@@ -216,13 +218,18 @@
/** called after page-flip
*/
- virtual void onLayerDisplayed(HWComposer::HWCLayerInterface* layer) { }
+ virtual void onLayerDisplayed(const DisplayDevice& hw,
+ HWComposer::HWCLayerInterface* layer) { }
/** called before composition.
* returns true if the layer has pending updates.
*/
virtual bool onPreComposition() { return false; }
+ /** called before composition.
+ */
+ virtual void onPostComposition() { }
+
/** always call base class first */
virtual void dump(String8& result, char* scratch, size_t size) const;
virtual void shortDump(String8& result, char* scratch, size_t size) const;
diff --git a/services/surfaceflinger/LayerDim.cpp b/services/surfaceflinger/LayerDim.cpp
index b78396e..aef37b1 100644
--- a/services/surfaceflinger/LayerDim.cpp
+++ b/services/surfaceflinger/LayerDim.cpp
@@ -18,6 +18,9 @@
#include <stdint.h>
#include <sys/types.h>
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
#include <utils/Errors.h>
#include <utils/Log.h>
diff --git a/services/surfaceflinger/LayerScreenshot.cpp b/services/surfaceflinger/LayerScreenshot.cpp
index 5b7cf68..280d85f 100644
--- a/services/surfaceflinger/LayerScreenshot.cpp
+++ b/services/surfaceflinger/LayerScreenshot.cpp
@@ -18,6 +18,9 @@
#include <stdint.h>
#include <sys/types.h>
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
#include <utils/Errors.h>
#include <utils/Log.h>
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);
}
}
}