summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
author Brian Lindahl <blindahl@google.com> 2022-11-14 11:16:55 -0700
committer Brian Lindahl <blindahl@google.com> 2022-12-09 12:06:58 -0700
commit439afadf859e15f01cb2781949d2402e69e4b4b7 (patch)
treec0dcca7383ebe2e2e58678e7e2ff88f99244677c /services/surfaceflinger/Layer.cpp
parent0cbe46547ecbb237101d0d27c6bdb7761254b268 (diff)
Push HWC cache slot generation down into CompositionEngine
Stop caching buffers inside SurfaceFlinger and remove the tight coupling between SurfaceFlinger's ClientCache and the Hardware Composer cache. This allows a better seperation of responsibility, where buffer cache management is not split between HwcSlotGenerator and HwcBufferCache, but is instead solely handled by HwcBufferCache. Note that FramebufferSurface and VirtualDisplaySurface no longer use HwcBufferCache, but instead use their own cache slot management that is solely based on BufferQueue slot numbers. Also do minor refactoring in FramebufferSurface to simplify code. Bug: 258196272 Test: started and stopped multiple YouTube videos on adt4 and verified no change in graphic buffer usage Test: atest HwcBufferCacheTest Test: atest OutputPrepareTest Change-Id: Ica7955ab4bc70e3c70207390e36dff73a2fc4949
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 0017af0476..b0ee850541 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -144,7 +144,6 @@ Layer::Layer(const LayerCreationArgs& args)
mLayerCreationFlags(args.flags),
mBorderEnabled(false),
mTextureName(args.textureName),
- mHwcSlotGenerator(sp<HwcSlotGenerator>::make()),
mLayerFE(args.flinger->getFactory().createLayerFE(mName)) {
ALOGV("Creating Layer %s", getDebugName());
@@ -573,9 +572,6 @@ void Layer::preparePerFrameBufferCompositionState() {
}
snapshot->buffer = getBuffer();
- snapshot->bufferSlot = (mBufferInfo.mBufferSlot == BufferQueue::INVALID_BUFFER_SLOT)
- ? 0
- : mBufferInfo.mBufferSlot;
snapshot->acquireFence = mBufferInfo.mFence;
snapshot->frameNumber = mBufferInfo.mFrameNumber;
snapshot->sidebandStreamHasFrame = false;
@@ -2840,7 +2836,7 @@ bool Layer::setPosition(float x, float y) {
bool Layer::setBuffer(std::shared_ptr<renderengine::ExternalTexture>& buffer,
const BufferData& bufferData, nsecs_t postTime, nsecs_t desiredPresentTime,
bool isAutoTimestamp, std::optional<nsecs_t> dequeueTime,
- const FrameTimelineInfo& info, int hwcBufferSlot) {
+ const FrameTimelineInfo& info) {
ATRACE_FORMAT("setBuffer %s - hasBuffer=%s", getDebugName(), (buffer ? "true" : "false"));
if (!buffer) {
return false;
@@ -2886,7 +2882,6 @@ bool Layer::setBuffer(std::shared_ptr<renderengine::ExternalTexture>& buffer,
mDrawingState.releaseBufferListener = bufferData.releaseBufferListener;
mDrawingState.buffer = std::move(buffer);
mDrawingState.clientCacheId = bufferData.cachedBuffer;
- mDrawingState.hwcBufferSlot = hwcBufferSlot;
mDrawingState.acquireFence = bufferData.flags.test(BufferData::BufferDataChange::fenceChanged)
? bufferData.acquireFence
: Fence::NO_FENCE;
@@ -3185,7 +3180,6 @@ void Layer::gatherBufferInfo() {
mBufferInfo.mHdrMetadata = mDrawingState.hdrMetadata;
mBufferInfo.mApi = mDrawingState.api;
mBufferInfo.mTransformToDisplayInverse = mDrawingState.transformToDisplayInverse;
- mBufferInfo.mBufferSlot = mDrawingState.hwcBufferSlot;
}
Rect Layer::computeBufferCrop(const State& s) {
@@ -3968,10 +3962,6 @@ void Layer::updateRelativeMetadataSnapshot(const LayerMetadata& relativeLayerMet
}
}
-int Layer::getHwcCacheSlot(const client_cache_t& clientCacheId) {
- return mHwcSlotGenerator->getHwcCacheSlot(clientCacheId);
-}
-
LayerSnapshotGuard::LayerSnapshotGuard(Layer* layer) : mLayer(layer) {
if (mLayer) {
mLayer->mLayerFE->mSnapshot = std::move(mLayer->mSnapshot);