summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
author Alec Mouri <alecmouri@google.com> 2019-06-14 18:59:51 -0700
committer Alec Mouri <alecmouri@google.com> 2019-06-18 10:19:43 -0700
commite60041e06161e28613b72206e38552e7fc621cbb (patch)
tree6068e67bad03d391367c45750ad9e1bd662c66f9 /services/surfaceflinger/Layer.cpp
parent4f65d3377b9f3b83fa75b94ccc7b459b98376b11 (diff)
[SurfaceFlinger] Add deferred txn trace points.
Currently there is not enough trace information to track down jank that is suspected to be related to deferred transactions, so adding some trace points in this patch. Bug: 134583193 Test: systrace Change-Id: Iecc367dcfaa85877be0b9d9c179986bac52473f5
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 898f3bc992..bda7e4308f 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -19,12 +19,7 @@
#define LOG_TAG "Layer"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-#include <math.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <algorithm>
-#include <mutex>
+#include "Layer.h"
#include <android-base/stringprintf.h>
#include <compositionengine/Display.h>
@@ -39,7 +34,11 @@
#include <gui/BufferItem.h>
#include <gui/LayerDebugInfo.h>
#include <gui/Surface.h>
+#include <math.h>
#include <renderengine/RenderEngine.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/types.h>
#include <ui/DebugUtils.h>
#include <ui/GraphicBuffer.h>
#include <ui/PixelFormat.h>
@@ -49,12 +48,15 @@
#include <utils/StopWatch.h>
#include <utils/Trace.h>
+#include <algorithm>
+#include <mutex>
+#include <sstream>
+
#include "BufferLayer.h"
#include "ColorLayer.h"
#include "Colorizer.h"
#include "DisplayDevice.h"
#include "DisplayHardware/HWComposer.h"
-#include "Layer.h"
#include "LayerProtoHelper.h"
#include "LayerRejecter.h"
#include "MonitoredProducer.h"
@@ -677,6 +679,7 @@ void Layer::pushPendingState() {
if (!mCurrentState.modified) {
return;
}
+ ATRACE_CALL();
// If this transaction is waiting on the receipt of a frame, generate a sync
// point and send it to the remote layer.
@@ -693,6 +696,9 @@ void Layer::pushPendingState() {
} else {
auto syncPoint = std::make_shared<SyncPoint>(mCurrentState.frameNumber_legacy, this);
if (barrierLayer->addSyncPoint(syncPoint)) {
+ std::stringstream ss;
+ ss << "Adding sync point " << mCurrentState.frameNumber_legacy;
+ ATRACE_NAME(ss.str().c_str());
mRemoteSyncPoints.push_back(std::move(syncPoint));
} else {
// We already missed the frame we're supposed to synchronize
@@ -710,6 +716,7 @@ void Layer::pushPendingState() {
}
void Layer::popPendingState(State* stateToCommit) {
+ ATRACE_CALL();
*stateToCommit = mPendingStates[0];
mPendingStates.removeAt(0);
@@ -741,6 +748,7 @@ bool Layer::applyPendingStates(State* stateToCommit) {
}
if (mRemoteSyncPoints.front()->frameIsAvailable()) {
+ ATRACE_NAME("frameIsAvailable");
// Apply the state update
popPendingState(stateToCommit);
stateUpdateAvailable = true;
@@ -749,6 +757,7 @@ bool Layer::applyPendingStates(State* stateToCommit) {
mRemoteSyncPoints.front()->setTransactionApplied();
mRemoteSyncPoints.pop_front();
} else {
+ ATRACE_NAME("!frameIsAvailable");
break;
}
} else {
@@ -1195,6 +1204,7 @@ uint32_t Layer::getLayerStack() const {
}
void Layer::deferTransactionUntil_legacy(const sp<Layer>& barrierLayer, uint64_t frameNumber) {
+ ATRACE_CALL();
mCurrentState.barrierLayer_legacy = barrierLayer;
mCurrentState.frameNumber_legacy = frameNumber;
// We don't set eTransactionNeeded, because just receiving a deferral