summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger
diff options
context:
space:
mode:
authorOmprakash Dhyade <odhyade@codeaurora.org>2016-02-05 14:54:08 -0800
committerSteve Kondik <steve@cyngn.com>2016-02-29 09:37:36 +0000
commit9e3751980f9748f77acef3fd277735667d02901f (patch)
tree43a26bb17b7934e0ca655cabde92a06254ad3ae7 /services/surfaceflinger
parentb0cda680c2aaa3cbc0ae080c51f8c21a3e93adb0 (diff)
downloadframeworks_native-9e3751980f9748f77acef3fd277735667d02901f.zip
frameworks_native-9e3751980f9748f77acef3fd277735667d02901f.tar.gz
frameworks_native-9e3751980f9748f77acef3fd277735667d02901f.tar.bz2
surfaceflinger: Use only one EventThread when phase offsets are same.
SurfaceFlinger uses two event-threads to support phase-offsets for application and SurfaceFlinger itself. Extra thread may cause scheduling issues and wake-up latency for either SurfaceFlinger or Application, depending on scheduling, even when running at higher priority as these threads have low-load and qualify for task-packing. Use single event-thread when phase offsets are same. Debug runtime service call behavior change when same phase-offset: 1018 (set phase offset for Application): will change both Application and SurfaceFlinger phase offsets. 1019 (set phase offset for SurfaceFlinger): Will be a no-op. Change-Id: I2514b4ff6249e9bce3eb19f60b1dfe0de12b86d9
Diffstat (limited to 'services/surfaceflinger')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index b27fc2b..43a0bd8 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -453,13 +453,20 @@ void SurfaceFlinger::init() {
eglInitialize(mEGLDisplay, NULL, NULL);
// start the EventThread
- sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync,
- vsyncPhaseOffsetNs, true, "app");
- mEventThread = new EventThread(vsyncSrc);
- sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync,
- sfVsyncPhaseOffsetNs, true, "sf");
- mSFEventThread = new EventThread(sfVsyncSrc);
- mEventQueue.setEventThread(mSFEventThread);
+ if (vsyncPhaseOffsetNs != sfVsyncPhaseOffsetNs) {
+ sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync,
+ vsyncPhaseOffsetNs, true, "app");
+ mEventThread = new EventThread(vsyncSrc);
+ sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync,
+ sfVsyncPhaseOffsetNs, true, "sf");
+ mSFEventThread = new EventThread(sfVsyncSrc);
+ mEventQueue.setEventThread(mSFEventThread);
+ } else {
+ sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync,
+ vsyncPhaseOffsetNs, true, "sf-app");
+ mEventThread = new EventThread(vsyncSrc);
+ mEventQueue.setEventThread(mEventThread);
+ }
// Initialize the H/W composer object. There may or may not be an
// actual hardware composer underneath.
@@ -3137,12 +3144,14 @@ status_t SurfaceFlinger::onTransact(
}
case 1018: { // Modify Choreographer's phase offset
n = data.readInt32();
- mEventThread->setPhaseOffset(static_cast<nsecs_t>(n));
+ if (mEventThread != NULL)
+ mEventThread->setPhaseOffset(static_cast<nsecs_t>(n));
return NO_ERROR;
}
case 1019: { // Modify SurfaceFlinger's phase offset
n = data.readInt32();
- mSFEventThread->setPhaseOffset(static_cast<nsecs_t>(n));
+ if (mSFEventThread != NULL)
+ mSFEventThread->setPhaseOffset(static_cast<nsecs_t>(n));
return NO_ERROR;
}
}