From 71db8892acc0c80c343141139bde8cfd3f037c4a Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Wed, 3 Feb 2021 23:19:29 +0100 Subject: Add GPU completion to FrameMetrics (1/3) - Add SurfaceStatsCallback to TransactionCompletedListener - Register a callback in RenderProxy to be called when we have surface stats from SF via the BLAST callback. - Instead of finishing a frame for frame metrics reporting immediately, wait until BLAST callback fires, note GPU completion time and finish frame. - Expose GPU_COMPLETION in FrameMetrics - Modify TOTAL_DURATION to also include GPU_COMPLETION Test: FrameMetricsListenerTest Fixes: 171046219 Change-Id: I16fa1d80cfc4e7a5527c18fec7e885409f17ee4d --- libs/hwui/JankTracker.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libs/hwui/JankTracker.h') diff --git a/libs/hwui/JankTracker.h b/libs/hwui/JankTracker.h index b3fbbfe98669..096455372923 100644 --- a/libs/hwui/JankTracker.h +++ b/libs/hwui/JankTracker.h @@ -84,12 +84,15 @@ private: // This is only used if we are in pipelined mode and are using HWC2, // otherwise it's 0. nsecs_t mDequeueTimeForgiveness = 0; - ProfileDataContainer mData; - ProfileDataContainer* mGlobalData; + ProfileDataContainer mData GUARDED_BY(mDataMutex); + ProfileDataContainer* mGlobalData GUARDED_BY(mDataMutex); ProfileDataDescription mDescription; // Ring buffer large enough for 2 seconds worth of frames RingBuffer mFrames; + + // Mutex to protect acccess to mData and mGlobalData obtained from mGlobalData->getDataMutex + std::mutex& mDataMutex; }; } /* namespace uirenderer */ -- cgit v1.2.3-59-g8ed1b