diff options
author | 2016-09-23 16:31:30 -0700 | |
---|---|---|
committer | 2016-12-13 13:06:16 -0800 | |
commit | 3d4039d7a291cd9b6f2dd4b46fcdb576f2db3356 (patch) | |
tree | 4f98394f38900a920987db69e74446ba1a88aa09 /libs/gui/GLConsumer.cpp | |
parent | 13e4db237135006e801d3f9d75adaca82687002a (diff) |
Use FenceTime to share fence times and reduce open fds.
FenceTimes are created and shared for each Fence that
FrameTimestampHistory and FrameTracker care about.
On the consumer side, the FenceTimes are also added to
shared timelines that are owned by SurfaceFlinger or
unshared timelines owned by Layer. The timelines are
checked at the end of every frame to minimize the number
of file descriptors open.
On the producer side, the FenceTimes are added to
the ConsumerFrameEventHistory instead, since the timelines
that would be tracked by SurfaceFlinger are not shared
with anyone else in the consumer's process. The timelines
are checked just after a frame is queued to minimize
the number of file descriptors open.
Test: adb shell /data/nativetest/libgui_test/libgui_test
--gtest_filter=*GetFrameTimestamps*
Change-Id: Ifd4301affe1b24705b2bee7608c5a2c09dfb4041
Diffstat (limited to 'libs/gui/GLConsumer.cpp')
-rw-r--r-- | libs/gui/GLConsumer.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp index 10e999c228..316e1d624e 100644 --- a/libs/gui/GLConsumer.cpp +++ b/libs/gui/GLConsumer.cpp @@ -322,6 +322,7 @@ status_t GLConsumer::releaseTexImage() { mCurrentTransform = 0; mCurrentTimestamp = 0; mCurrentFence = Fence::NO_FENCE; + mCurrentFenceTime = FenceTime::NO_FENCE; if (mAttached) { // This binds a dummy buffer (mReleasedTexImage). @@ -488,6 +489,7 @@ status_t GLConsumer::updateAndReleaseLocked(const BufferItem& item, mCurrentScalingMode = item.mScalingMode; mCurrentTimestamp = item.mTimestamp; mCurrentFence = item.mFence; + mCurrentFenceTime = item.mFenceTime; mCurrentFrameNumber = item.mFrameNumber; computeCurrentTransformMatrixLocked(); @@ -981,6 +983,11 @@ sp<Fence> GLConsumer::getCurrentFence() const { return mCurrentFence; } +std::shared_ptr<FenceTime> GLConsumer::getCurrentFenceTime() const { + Mutex::Autolock lock(mMutex); + return mCurrentFenceTime; +} + status_t GLConsumer::doGLFenceWait() const { Mutex::Autolock lock(mMutex); return doGLFenceWaitLocked(); |