SF: Remove layer mRefreshPending tracking
This flag was used to ensure we do not latch a
second buffer without going through the
composition stage. This flag is not needed because
if we latch a buffer, then we are guaranteed to go
into the composition stage.
Incentive for this change: to rebuild the layer state,
via layertracegenerator, we invoke the commit stage
over and over again. This flag prevents us from
latching another buffer because the tool does not
call composite.
Test: presubmit, also presubmit with fatal log if we ever try
to latch when mRefreshPending is true (ag/16790650)
Bug: 200284593
Change-Id: I332349865b19ae7a205002167f26f5a2f76688af
diff --git a/libs/gui/LayerDebugInfo.cpp b/libs/gui/LayerDebugInfo.cpp
index 0827bbe..ea5fb29 100644
--- a/libs/gui/LayerDebugInfo.cpp
+++ b/libs/gui/LayerDebugInfo.cpp
@@ -58,7 +58,6 @@
RETURN_ON_ERROR(parcel->writeInt32(mActiveBufferStride));
RETURN_ON_ERROR(parcel->writeInt32(mActiveBufferFormat));
RETURN_ON_ERROR(parcel->writeInt32(mNumQueuedFrames));
- RETURN_ON_ERROR(parcel->writeBool(mRefreshPending));
RETURN_ON_ERROR(parcel->writeBool(mIsOpaque));
RETURN_ON_ERROR(parcel->writeBool(mContentDirty));
RETURN_ON_ERROR(parcel->write(mStretchEffect));
@@ -103,7 +102,6 @@
RETURN_ON_ERROR(parcel->readInt32(&mActiveBufferStride));
RETURN_ON_ERROR(parcel->readInt32(&mActiveBufferFormat));
RETURN_ON_ERROR(parcel->readInt32(&mNumQueuedFrames));
- RETURN_ON_ERROR(parcel->readBool(&mRefreshPending));
RETURN_ON_ERROR(parcel->readBool(&mIsOpaque));
RETURN_ON_ERROR(parcel->readBool(&mContentDirty));
RETURN_ON_ERROR(parcel->read(mStretchEffect));
@@ -146,8 +144,7 @@
StringAppendF(&result, " activeBuffer=[%4ux%4u:%4u,%s],", info.mActiveBufferWidth,
info.mActiveBufferHeight, info.mActiveBufferStride,
decodePixelFormat(info.mActiveBufferFormat).c_str());
- StringAppendF(&result, " queued-frames=%d, mRefreshPending=%d", info.mNumQueuedFrames,
- info.mRefreshPending);
+ StringAppendF(&result, " queued-frames=%d", info.mNumQueuedFrames);
result.append("\n");
return result;
}
diff --git a/libs/gui/include/gui/LayerDebugInfo.h b/libs/gui/include/gui/LayerDebugInfo.h
index 8b7d32c..af834d7 100644
--- a/libs/gui/include/gui/LayerDebugInfo.h
+++ b/libs/gui/include/gui/LayerDebugInfo.h
@@ -64,7 +64,6 @@
int32_t mActiveBufferStride = 0;
PixelFormat mActiveBufferFormat = PIXEL_FORMAT_NONE;
int32_t mNumQueuedFrames = -1;
- bool mRefreshPending = false;
bool mIsOpaque = false;
bool mContentDirty = false;
StretchEffect mStretchEffect = {};
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index b7e2ff3..18a6bae 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -319,7 +319,6 @@
Mutex::Autolock lock(mFrameEventHistoryMutex);
mFrameEventHistory.addPreComposition(mCurrentFrameNumber, refreshStartTime);
}
- mRefreshPending = false;
return hasReadyFrame();
}
namespace {
@@ -474,19 +473,6 @@
return refreshRequired;
}
- if (!hasReadyFrame()) {
- return false;
- }
-
- // if we've already called updateTexImage() without going through
- // a composition step, we have to skip this layer at this point
- // because we cannot call updateTeximage() without a corresponding
- // compositionComplete() call.
- // we'll trigger an update in onPreComposition().
- if (mRefreshPending) {
- return false;
- }
-
// If the head buffer's acquire fence hasn't signaled yet, return and
// try again later
if (!fenceHasSignaled()) {
@@ -518,7 +504,6 @@
gatherBufferInfo();
- mRefreshPending = true;
if (oldBufferInfo.mBuffer == nullptr) {
// the first time we receive a buffer, we need to trigger a
// geometry invalidation.
@@ -689,7 +674,6 @@
}
void BufferLayer::latchAndReleaseBuffer() {
- mRefreshPending = false;
if (hasReadyFrame()) {
bool ignored = false;
latchBuffer(ignored, systemTime(), 0 /* expectedPresentTime */);
diff --git a/services/surfaceflinger/BufferLayer.h b/services/surfaceflinger/BufferLayer.h
index 99267be..3e70493 100644
--- a/services/surfaceflinger/BufferLayer.h
+++ b/services/surfaceflinger/BufferLayer.h
@@ -88,9 +88,6 @@
// to figure out if the content or size of a surface has changed.
bool latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime,
nsecs_t expectedPresentTime) override;
-
- bool isBufferLatched() const override { return mRefreshPending; }
-
bool hasReadyFrame() const override;
// Returns the current scaling mode
@@ -158,9 +155,6 @@
// from graphics API
const uint32_t mTextureName;
-
- bool mRefreshPending{false};
-
ui::Dataspace translateDataspace(ui::Dataspace dataspace);
void setInitialValuesForClone(const sp<Layer>& clonedFrom);
void updateCloneBufferInfo() override;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 645d4d1..a039250 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1398,7 +1398,6 @@
}
}
info.mNumQueuedFrames = getQueuedFrameCount();
- info.mRefreshPending = isBufferLatched();
info.mIsOpaque = isOpaque(ds);
info.mContentDirty = contentDirty;
info.mStretchEffect = getStretchEffect();
@@ -2029,7 +2028,6 @@
layerInfo->set_is_protected(isProtected());
layerInfo->set_dataspace(dataspaceDetails(static_cast<android_dataspace>(getDataSpace())));
layerInfo->set_queued_frames(getQueuedFrameCount());
- layerInfo->set_refresh_pending(isBufferLatched());
layerInfo->set_curr_frame(mCurrentFrameNumber);
layerInfo->set_effective_scaling_mode(getEffectiveScalingMode());
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 605a27e..ddcd641 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -549,8 +549,6 @@
return false;
}
- virtual bool isBufferLatched() const { return false; }
-
virtual void latchAndReleaseBuffer() {}
/*
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 3459a8f..d5f340b 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3563,11 +3563,9 @@
for (const auto& layer : mLayersWithQueuedFrames) {
if (layer->latchBuffer(visibleRegions, latchTime, expectedPresentTime)) {
mLayersPendingRefresh.push_back(layer);
- }
- layer->useSurfaceDamage();
- if (layer->isBufferLatched()) {
newDataLatched = true;
}
+ layer->useSurfaceDamage();
}
}
diff --git a/services/surfaceflinger/layerproto/LayerProtoParser.cpp b/services/surfaceflinger/layerproto/LayerProtoParser.cpp
index 2841f7c..854084e 100644
--- a/services/surfaceflinger/layerproto/LayerProtoParser.cpp
+++ b/services/surfaceflinger/layerproto/LayerProtoParser.cpp
@@ -305,7 +305,7 @@
zOrderRelativeOf == nullptr ? "none" : zOrderRelativeOf->name.c_str());
StringAppendF(&result, " activeBuffer=%s,", activeBuffer.to_string().c_str());
StringAppendF(&result, " tr=%s", bufferTransform.to_string().c_str());
- StringAppendF(&result, " queued-frames=%d, mRefreshPending=%d,", queuedFrames, refreshPending);
+ StringAppendF(&result, " queued-frames=%d", queuedFrames);
StringAppendF(&result, " metadata={");
bool first = true;
for (const auto& entry : metadata.mMap) {