diff options
author | 2020-01-21 14:36:08 -0800 | |
---|---|---|
committer | 2020-01-21 21:17:50 -0800 | |
commit | 9b079a2fef76ed1dfa69b158889edd0af5e6e52c (patch) | |
tree | 0072ca6810ee57122aa5b56abf52b18032b0f6f1 /services/surfaceflinger/BufferLayer.cpp | |
parent | 0a4b951a590910bab35f20f03d25316426dbf8ae (diff) |
Skip client composition requests
Keep track of client compositions requests in CompositionEngine and
the buffer used to render the request. If the requests do not change
and the buffer matches, reuse the buffer instead of going
to client composition.
Certain layers properties (buffer format, rounded corner or shadows)
will force the device to go into GPU or mixed composition. In mixed
composition scenarios, we can avoid redundant client composition
requests by reusing the RenderSurface buffers. If the device goes
into GPU composition then all the layers will be composited and there
will be no performance benefit.
Bug: b/136561771, b/144690120
Test: dump SurfaceFlinger --timestats -dump
Test: manual testing with mixed and gpu composition scenarios
Test: atest libcompositionengine_test libsurfaceflinger_unittest SurfaceFlinger_test
Change-Id: I466d5dcded0c9fcfa64bc72fd91dfaddd795f315
Diffstat (limited to 'services/surfaceflinger/BufferLayer.cpp')
-rw-r--r-- | services/surfaceflinger/BufferLayer.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp index 7845cab397..35d0215fa1 100644 --- a/services/surfaceflinger/BufferLayer.cpp +++ b/services/surfaceflinger/BufferLayer.cpp @@ -144,11 +144,12 @@ static constexpr mat4 inverseOrientation(uint32_t transform) { return inverse(tr); } -std::optional<renderengine::LayerSettings> BufferLayer::prepareClientComposition( +std::optional<compositionengine::LayerFE::LayerSettings> BufferLayer::prepareClientComposition( compositionengine::LayerFE::ClientCompositionTargetSettings& targetSettings) { ATRACE_CALL(); - auto result = Layer::prepareClientComposition(targetSettings); + std::optional<compositionengine::LayerFE::LayerSettings> result = + Layer::prepareClientComposition(targetSettings); if (!result) { return result; } @@ -183,7 +184,7 @@ std::optional<renderengine::LayerSettings> BufferLayer::prepareClientComposition bool blackOutLayer = (isProtected() && !targetSettings.supportsProtectedContent) || (isSecure() && !targetSettings.isSecure); const State& s(getDrawingState()); - auto& layer = *result; + LayerFE::LayerSettings& layer = *result; if (!blackOutLayer) { layer.source.buffer.buffer = mBufferInfo.mBuffer; layer.source.buffer.isOpaque = isOpaque(s); @@ -199,6 +200,9 @@ std::optional<renderengine::LayerSettings> BufferLayer::prepareClientComposition layer.source.buffer.maxContentLuminance = hasCta861_3 ? mBufferInfo.mHdrMetadata.cta8613.maxContentLightLevel : defaultMaxContentLuminance; + layer.frameNumber = mCurrentFrameNumber; + layer.bufferId = mBufferInfo.mBuffer ? mBufferInfo.mBuffer->getId() : 0; + // TODO: we could be more subtle with isFixedSize() const bool useFiltering = targetSettings.needsFiltering || mNeedsFiltering || isFixedSize(); @@ -264,9 +268,11 @@ std::optional<renderengine::LayerSettings> BufferLayer::prepareClientComposition // layer. layer.source.buffer.buffer = nullptr; layer.alpha = 1.0; + layer.frameNumber = 0; + layer.bufferId = 0; } - return result; + return layer; } bool BufferLayer::isHdrY410() const { |