diff options
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.h')
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h index 917b00cb6591..2e7b2f618a8a 100644 --- a/libs/hwui/renderthread/CanvasContext.h +++ b/libs/hwui/renderthread/CanvasContext.h @@ -37,6 +37,7 @@ #include <SkSize.h> #include <cutils/compiler.h> #include <utils/Functor.h> +#include <utils/Mutex.h> #include <functional> #include <future> @@ -196,6 +197,10 @@ public: SkISize getNextFrameSize() const; + // Called when SurfaceStats are available. + static void onSurfaceStatsAvailable(void* context, ASurfaceControl* control, + ASurfaceControlStats* stats); + private: CanvasContext(RenderThread& thread, bool translucent, RenderNode* rootRenderNode, IContextFactory* contextFactory, std::unique_ptr<IRenderPipeline> renderPipeline); @@ -212,6 +217,7 @@ private: void setupPipelineSurface(); SkRect computeDirtyRect(const Frame& frame, SkRect* dirty); + void finishFrame(FrameInfo* frameInfo); // The same type as Frame.mWidth and Frame.mHeight int32_t mLastFrameWidth = 0; @@ -261,7 +267,12 @@ private: std::vector<sp<RenderNode>> mRenderNodes; FrameInfo* mCurrentFrameInfo = nullptr; - RingBuffer<std::pair<FrameInfo*, int64_t>, 4> mLast4FrameInfos; + + // List of frames that are awaiting GPU completion reporting + RingBuffer<std::pair<FrameInfo*, int64_t>, 4> mLast4FrameInfos + GUARDED_BY(mLast4FrameInfosMutex); + std::mutex mLast4FrameInfosMutex; + std::string mName; JankTracker mJankTracker; FrameInfoVisualizer mProfiler; @@ -276,6 +287,9 @@ private: std::unique_ptr<IRenderPipeline> mRenderPipeline; std::vector<std::function<void(int64_t)>> mFrameCompleteCallbacks; + + // If set to true, we expect that callbacks into onSurfaceStatsAvailable + bool mExpectSurfaceStats = false; }; } /* namespace renderthread */ |