summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/RegionSamplingThread.cpp
diff options
context:
space:
mode:
author Dominik Laskowski <domlaskowski@google.com> 2019-08-01 18:35:59 -0700
committer Dominik Laskowski <domlaskowski@google.com> 2019-08-16 16:27:58 -0700
commit980418350b15d595ebe17ec9ae895dac374c6ee0 (patch)
treef451791885e6a6d6dadea3d78f0a52fe70f89a44 /services/surfaceflinger/RegionSamplingThread.cpp
parent13db07b6bcccb58ce51a385399e7288aaab0e077 (diff)
SF: Clean up Scheduler
Remove dynamic allocation for Scheduler::{Connection,ConnectionHandle}, as well as ref-counting for the latter. Also, remove dead code and make members private. Bug: 130554049 Test: libsurfaceflinger_unittest Change-Id: Ibb9dc8d4cb66451a4172c852a36032bbc0a54411
Diffstat (limited to 'services/surfaceflinger/RegionSamplingThread.cpp')
-rw-r--r--services/surfaceflinger/RegionSamplingThread.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp
index 07fdead310..1c1367c916 100644
--- a/services/surfaceflinger/RegionSamplingThread.cpp
+++ b/services/surfaceflinger/RegionSamplingThread.cpp
@@ -21,15 +21,18 @@
#include "RegionSamplingThread.h"
+#include <compositionengine/Display.h>
+#include <compositionengine/impl/OutputCompositionState.h>
#include <cutils/properties.h>
#include <gui/IRegionSamplingListener.h>
+#include <ui/DisplayStatInfo.h>
#include <utils/Trace.h>
+
#include <string>
-#include <compositionengine/Display.h>
-#include <compositionengine/impl/OutputCompositionState.h>
#include "DisplayDevice.h"
#include "Layer.h"
+#include "Scheduler/DispSync.h"
#include "SurfaceFlinger.h"
namespace android {
@@ -105,9 +108,8 @@ struct SamplingOffsetCallback : DispSync::Callback {
if (mVsyncListening) return;
mPhaseIntervalSetting = Phase::ZERO;
- mScheduler.withPrimaryDispSync([this](android::DispSync& sync) {
- sync.addEventListener("SamplingThreadDispSyncListener", 0, this, mLastCallbackTime);
- });
+ mScheduler.getPrimaryDispSync().addEventListener("SamplingThreadDispSyncListener", 0, this,
+ mLastCallbackTime);
mVsyncListening = true;
}
@@ -120,9 +122,7 @@ private:
void stopVsyncListenerLocked() /*REQUIRES(mMutex)*/ {
if (!mVsyncListening) return;
- mScheduler.withPrimaryDispSync([this](android::DispSync& sync) {
- sync.removeEventListener(this, &mLastCallbackTime);
- });
+ mScheduler.getPrimaryDispSync().removeEventListener(this, &mLastCallbackTime);
mVsyncListening = false;
}
@@ -132,16 +132,13 @@ private:
if (mPhaseIntervalSetting == Phase::ZERO) {
ATRACE_INT(lumaSamplingStepTag, static_cast<int>(samplingStep::waitForSamplePhase));
mPhaseIntervalSetting = Phase::SAMPLING;
- mScheduler.withPrimaryDispSync([this](android::DispSync& sync) {
- sync.changePhaseOffset(this, mTargetSamplingOffset.count());
- });
+ mScheduler.getPrimaryDispSync().changePhaseOffset(this, mTargetSamplingOffset.count());
return;
}
if (mPhaseIntervalSetting == Phase::SAMPLING) {
mPhaseIntervalSetting = Phase::ZERO;
- mScheduler.withPrimaryDispSync(
- [this](android::DispSync& sync) { sync.changePhaseOffset(this, 0); });
+ mScheduler.getPrimaryDispSync().changePhaseOffset(this, 0);
stopVsyncListenerLocked();
lock.unlock();
mRegionSamplingThread.notifySamplingOffset();