From 221de2a33d456738f7f64db0b015a960211d4834 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 21 Sep 2016 16:53:28 -0700 Subject: Add Fence helpers: Time, Timeline, Snapshot FenceTime will be used to: 1) Cache and share the result of a Fence's getSignalTime with all clients that care about it, instead of requiring a syscall for each client. 2) Allow tests to override the valid state and signalTimes of the underlying fence by acting as a shim. FenceTimeline will be used to efficiently get the signal times of Fences without having query for Fences that likely haven't signaled. FenceTime::Snapshot is a stable copy of a FenceTime that can be used for serialization since it doesn't change while flattening. Test: adb shell /data/nativetest/libgui_test/libgui_test --gtest_filter=*GetFrameTimestamps* Change-Id: I9a28df7ce797311dc4d56b1147edf590e9de1517 --- libs/ui/Fence.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libs/ui/Fence.cpp') diff --git a/libs/ui/Fence.cpp b/libs/ui/Fence.cpp index 7cf8233820..a1dda3a475 100644 --- a/libs/ui/Fence.cpp +++ b/libs/ui/Fence.cpp @@ -109,17 +109,17 @@ int Fence::dup() const { nsecs_t Fence::getSignalTime() const { if (mFenceFd == -1) { - return -1; + return SIGNAL_TIME_INVALID; } struct sync_fence_info_data* finfo = sync_fence_info(mFenceFd); if (finfo == NULL) { ALOGE("sync_fence_info returned NULL for fd %d", mFenceFd); - return -1; + return SIGNAL_TIME_INVALID; } if (finfo->status != 1) { sync_fence_info_free(finfo); - return INT64_MAX; + return SIGNAL_TIME_PENDING; } struct sync_pt_info* pinfo = NULL; -- cgit v1.2.3-59-g8ed1b