diff options
| author | 2022-03-10 19:32:43 +0000 | |
|---|---|---|
| committer | 2022-03-10 19:32:43 +0000 | |
| commit | 2d54df60dca410f29c5a1139a3dcb5e6327dba61 (patch) | |
| tree | 332fcd533224b1feeb38095cb5de2452e733e16d | |
| parent | aedf10c2d5dbb93a75988920dc95f7afa7c631ab (diff) | |
| parent | c2f84139f48115bd9552a762e3bdaf4f22c66a11 (diff) | |
Merge "SurfaceFlinger: Disable early-release on multi displays" into tm-dev
| -rw-r--r-- | services/surfaceflinger/BufferLayer.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/BufferStateLayer.cpp | 18 | ||||
| -rw-r--r-- | services/surfaceflinger/Layer.h | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp index 0aca24ae70..0b23a5a5bb 100644 --- a/services/surfaceflinger/BufferLayer.cpp +++ b/services/surfaceflinger/BufferLayer.cpp @@ -362,6 +362,8 @@ void BufferLayer::onPostComposition(const DisplayDevice* display, // composition. if (!mBufferInfo.mFrameLatencyNeeded) return; + mAlreadyDisplayedThisCompose = false; + // Update mFrameEventHistory. { Mutex::Autolock lock(mFrameEventHistoryMutex); diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp index e6a76e8ea9..bcae8d9564 100644 --- a/services/surfaceflinger/BufferStateLayer.cpp +++ b/services/surfaceflinger/BufferStateLayer.cpp @@ -75,17 +75,15 @@ BufferStateLayer::~BufferStateLayer() { // ----------------------------------------------------------------------- void BufferStateLayer::onLayerDisplayed( std::shared_future<renderengine::RenderEngineResult> futureRenderEngineResult) { - // If a layer has been displayed again we may need to clear - // the mLastClientComposition fence that we use for early release in setBuffer - // (as we now have a new fence which won't pass through the client composition path in some cases - // e.g. screenshot). We expect one call to onLayerDisplayed after receiving the GL comp fence - // from a single composition cycle, and want to clear on the second call - // (which we track with mLastClientCompositionDisplayed) - if (mLastClientCompositionDisplayed) { + // If we are displayed on multiple displays in a single composition cycle then we would + // need to do careful tracking to enable the use of the mLastClientCompositionFence. + // For example we can only use it if all the displays are client comp, and we need + // to merge all the client comp fences. We could do this, but for now we just + // disable the optimization when a layer is composed on multiple displays. + if (mAlreadyDisplayedThisCompose) { mLastClientCompositionFence = nullptr; - mLastClientCompositionDisplayed = false; - } else if (mLastClientCompositionFence) { - mLastClientCompositionDisplayed = true; + } else { + mAlreadyDisplayedThisCompose = true; } // The previous release fence notifies the client that SurfaceFlinger is done with the previous diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 2b5e337095..0fb16f2f12 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -1049,7 +1049,7 @@ protected: mutable bool mDrawingStateModified = false; sp<Fence> mLastClientCompositionFence; - bool mLastClientCompositionDisplayed = false; + bool mAlreadyDisplayedThisCompose = false; private: virtual void setTransformHint(ui::Transform::RotationFlags) {} |