From b04c6f03a2334b03ae0105ec005aeecfa61f4a90 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 21 Oct 2016 12:57:46 -0700 Subject: Change GL references to GPU for getFrameTimestamps. Test: Rename only. Change-Id: Idaf7ab38f78f58aa8387823f47dac084e21eb1f0 --- libs/gui/Surface.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'libs/gui/Surface.cpp') diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index d285ef0ce9..45bf8c8a6b 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -196,7 +196,7 @@ static bool checkConsumerForUpdates( const nsecs_t* outLatchTime, const nsecs_t* outFirstRefreshStartTime, const nsecs_t* outLastRefreshStartTime, - const nsecs_t* outGlCompositionDoneTime, + const nsecs_t* outGpuCompositionDoneTime, const nsecs_t* outDisplayPresentTime, const nsecs_t* outDisplayRetireTime, const nsecs_t* outDequeueReadyTime, @@ -204,7 +204,7 @@ static bool checkConsumerForUpdates( bool checkForLatch = (outLatchTime != nullptr) && !e->hasLatchInfo(); bool checkForFirstRefreshStart = (outFirstRefreshStartTime != nullptr) && !e->hasFirstRefreshStartInfo(); - bool checkForGlCompositionDone = (outGlCompositionDoneTime != nullptr) && + bool checkForGpuCompositionDone = (outGpuCompositionDoneTime != nullptr) && !e->hasGpuCompositionDoneInfo(); bool checkForDisplayPresent = (outDisplayPresentTime != nullptr) && !e->hasDisplayPresentInfo(); @@ -223,7 +223,7 @@ static bool checkConsumerForUpdates( // RequestedPresent and Acquire info are always available producer-side. return checkForLatch || checkForFirstRefreshStart || - checkForLastRefreshStart || checkForGlCompositionDone || + checkForLastRefreshStart || checkForGpuCompositionDone || checkForDisplayPresent || checkForDisplayRetire || checkForDequeueReady || checkForRelease; } @@ -244,7 +244,7 @@ static void getFrameTimestampFence(nsecs_t *dst, const std::shared_ptrgetFrameTimestamps(&delta); @@ -296,7 +296,7 @@ status_t Surface::getFrameTimestamps(uint64_t frameNumber, getFrameTimestampFence(outAcquireTime, events->acquireFence); getFrameTimestampFence( - outGlCompositionDoneTime, events->gpuCompositionDoneFence); + outGpuCompositionDoneTime, events->gpuCompositionDoneFence); getFrameTimestampFence( outDisplayPresentTime, events->displayPresentFence); getFrameTimestampFence(outDisplayRetireTime, events->displayRetireFence); @@ -1032,7 +1032,7 @@ int Surface::dispatchGetFrameTimestamps(va_list args) { nsecs_t* outLatchTime = va_arg(args, int64_t*); nsecs_t* outFirstRefreshStartTime = va_arg(args, int64_t*); nsecs_t* outLastRefreshStartTime = va_arg(args, int64_t*); - nsecs_t* outGlCompositionDoneTime = va_arg(args, int64_t*); + nsecs_t* outGpuCompositionDoneTime = va_arg(args, int64_t*); nsecs_t* outDisplayPresentTime = va_arg(args, int64_t*); nsecs_t* outDisplayRetireTime = va_arg(args, int64_t*); nsecs_t* outDequeueReadyTime = va_arg(args, int64_t*); @@ -1040,7 +1040,7 @@ int Surface::dispatchGetFrameTimestamps(va_list args) { return getFrameTimestamps(frameId, outRequestedPresentTime, outAcquireTime, outLatchTime, outFirstRefreshStartTime, outLastRefreshStartTime, - outGlCompositionDoneTime, outDisplayPresentTime, + outGpuCompositionDoneTime, outDisplayPresentTime, outDisplayRetireTime, outDequeueReadyTime, outReleaseTime); } -- cgit v1.2.3-59-g8ed1b From ed816e6cb4ca15181bf6120890c85290b5f7c02b Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 26 Oct 2016 16:12:21 -0700 Subject: Add FrameEvents::isValidTimestamp Refactor only. Test: adb shell /data/nativetest/libgui_test/libgui_test --gtest_filter=*GetFrameTimestamps* Change-Id: I86653ac14186ca509f58a94047f25a7b74231b30 --- include/gui/FrameTimestamps.h | 38 ++++++++++++++++++++++---------------- libs/gui/FrameTimestamps.cpp | 20 ++++++++++---------- libs/gui/Surface.cpp | 2 +- 3 files changed, 33 insertions(+), 27 deletions(-) (limited to 'libs/gui/Surface.cpp') diff --git a/include/gui/FrameTimestamps.h b/include/gui/FrameTimestamps.h index 174c5ea525..0c4af469c4 100644 --- a/include/gui/FrameTimestamps.h +++ b/include/gui/FrameTimestamps.h @@ -52,6 +52,16 @@ enum class FrameEvent { // A collection of timestamps corresponding to a single frame. struct FrameEvents { + static constexpr auto EVENT_COUNT = + static_cast(FrameEvent::EVENT_COUNT); + static_assert(EVENT_COUNT <= 32, "Event count sanity check failed."); + static constexpr nsecs_t TIMESTAMP_PENDING = + std::numeric_limits::max(); + + static inline bool isValidTimestamp(nsecs_t time) { + return time != TIMESTAMP_PENDING; + } + bool hasPostedInfo() const; bool hasRequestedPresentInfo() const; bool hasLatchInfo() const; @@ -67,10 +77,6 @@ struct FrameEvents { void checkFencesForCompletion(); void dump(String8& outString) const; - static constexpr size_t EVENT_COUNT = - static_cast(FrameEvent::EVENT_COUNT); - static_assert(EVENT_COUNT <= 32, "Event count sanity check failed."); - bool valid{false}; uint64_t frameNumber{0}; @@ -81,12 +87,12 @@ struct FrameEvents { bool addRetireCalled{false}; bool addReleaseCalled{false}; - nsecs_t postedTime{-1}; - nsecs_t requestedPresentTime{-1}; - nsecs_t latchTime{-1}; - nsecs_t firstRefreshStartTime{-1}; - nsecs_t lastRefreshStartTime{-1}; - nsecs_t dequeueReadyTime{-1}; + nsecs_t postedTime{TIMESTAMP_PENDING}; + nsecs_t requestedPresentTime{TIMESTAMP_PENDING}; + nsecs_t latchTime{TIMESTAMP_PENDING}; + nsecs_t firstRefreshStartTime{TIMESTAMP_PENDING}; + nsecs_t lastRefreshStartTime{TIMESTAMP_PENDING}; + nsecs_t dequeueReadyTime{TIMESTAMP_PENDING}; std::shared_ptr acquireFence{FenceTime::NO_FENCE}; std::shared_ptr gpuCompositionDoneFence{FenceTime::NO_FENCE}; @@ -273,12 +279,12 @@ private: bool mAddRetireCalled{0}; bool mAddReleaseCalled{0}; - nsecs_t mPostedTime{0}; - nsecs_t mRequestedPresentTime{0}; - nsecs_t mLatchTime{0}; - nsecs_t mFirstRefreshStartTime{0}; - nsecs_t mLastRefreshStartTime{0}; - nsecs_t mDequeueReadyTime{0}; + nsecs_t mPostedTime{FrameEvents::TIMESTAMP_PENDING}; + nsecs_t mRequestedPresentTime{FrameEvents::TIMESTAMP_PENDING}; + nsecs_t mLatchTime{FrameEvents::TIMESTAMP_PENDING}; + nsecs_t mFirstRefreshStartTime{FrameEvents::TIMESTAMP_PENDING}; + nsecs_t mLastRefreshStartTime{FrameEvents::TIMESTAMP_PENDING}; + nsecs_t mDequeueReadyTime{FrameEvents::TIMESTAMP_PENDING}; FenceTime::Snapshot mGpuCompositionDoneFence; FenceTime::Snapshot mDisplayPresentFence; diff --git a/libs/gui/FrameTimestamps.cpp b/libs/gui/FrameTimestamps.cpp index f11ffdd546..f427e6899f 100644 --- a/libs/gui/FrameTimestamps.cpp +++ b/libs/gui/FrameTimestamps.cpp @@ -35,19 +35,19 @@ namespace android { // ============================================================================ bool FrameEvents::hasPostedInfo() const { - return Fence::isValidTimestamp(postedTime); + return FrameEvents::isValidTimestamp(postedTime); } bool FrameEvents::hasRequestedPresentInfo() const { - return Fence::isValidTimestamp(requestedPresentTime); + return FrameEvents::isValidTimestamp(requestedPresentTime); } bool FrameEvents::hasLatchInfo() const { - return Fence::isValidTimestamp(latchTime); + return FrameEvents::isValidTimestamp(latchTime); } bool FrameEvents::hasFirstRefreshStartInfo() const { - return Fence::isValidTimestamp(firstRefreshStartTime); + return FrameEvents::isValidTimestamp(firstRefreshStartTime); } bool FrameEvents::hasLastRefreshStartInfo() const { @@ -58,7 +58,7 @@ bool FrameEvents::hasLastRefreshStartInfo() const { } bool FrameEvents::hasDequeueReadyInfo() const { - return Fence::isValidTimestamp(dequeueReadyTime); + return FrameEvents::isValidTimestamp(dequeueReadyTime); } bool FrameEvents::hasAcquireInfo() const { @@ -119,21 +119,21 @@ void FrameEvents::dump(String8& outString) const outString.appendFormat("--- Req. Present\t%" PRId64 "\n", requestedPresentTime); outString.appendFormat("--- Latched \t"); - if (Fence::isValidTimestamp(latchTime)) { + if (FrameEvents::isValidTimestamp(latchTime)) { outString.appendFormat("%" PRId64 "\n", latchTime); } else { outString.appendFormat("Pending\n"); } outString.appendFormat("--- Refresh (First)\t"); - if (Fence::isValidTimestamp(firstRefreshStartTime)) { + if (FrameEvents::isValidTimestamp(firstRefreshStartTime)) { outString.appendFormat("%" PRId64 "\n", firstRefreshStartTime); } else { outString.appendFormat("Pending\n"); } outString.appendFormat("--- Refresh (Last)\t"); - if (Fence::isValidTimestamp(lastRefreshStartTime)) { + if (FrameEvents::isValidTimestamp(lastRefreshStartTime)) { outString.appendFormat("%" PRId64 "\n", lastRefreshStartTime); } else { outString.appendFormat("Pending\n"); @@ -149,7 +149,7 @@ void FrameEvents::dump(String8& outString) const !addRetireCalled, *displayRetireFence); outString.appendFormat("--- DequeueReady \t"); - if (Fence::isValidTimestamp(dequeueReadyTime)) { + if (FrameEvents::isValidTimestamp(dequeueReadyTime)) { outString.appendFormat("%" PRId64 "\n", dequeueReadyTime); } else { outString.appendFormat("Pending\n"); @@ -408,7 +408,7 @@ void ConsumerFrameEventHistory::addPreComposition( } frame->lastRefreshStartTime = refreshStartTime; mFramesDirty[mCompositionOffset].setDirty(); - if (!Fence::isValidTimestamp(frame->firstRefreshStartTime)) { + if (!FrameEvents::isValidTimestamp(frame->firstRefreshStartTime)) { frame->firstRefreshStartTime = refreshStartTime; mFramesDirty[mCompositionOffset].setDirty(); } diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index 45bf8c8a6b..efb15245a6 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -230,7 +230,7 @@ static bool checkConsumerForUpdates( static void getFrameTimestamp(nsecs_t *dst, const nsecs_t& src) { if (dst != nullptr) { - *dst = Fence::isValidTimestamp(src) ? src : 0; + *dst = FrameEvents::isValidTimestamp(src) ? src : 0; } } -- cgit v1.2.3-59-g8ed1b