diff options
author | Alec Mouri <alecmouri@google.com> | 2019-11-19 16:17:53 -0800 |
---|---|---|
committer | Alec Mouri <alecmouri@google.com> | 2019-12-26 10:11:40 -0800 |
commit | 4a818f189c910810d6be72147a4567d97ad7232a (patch) | |
tree | e81e496ccc971026d0d80e357882034bed606a5c /libs/hwui/renderthread/RenderThread.h | |
parent | be8bafba54201866471cea3dd9e41ac1027b8f4c (diff) |
[HWUI] use AChoreographer in place of DisplayEventReceiver.
Bug: 136262896
Test: builds, boots
Test: scroll through settings app
Test: Toggle between 60/90hz and observe systrace
Change-Id: I8eef306a968525c55f3863ae688545faa43b23be
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.h')
-rw-r--r-- | libs/hwui/renderthread/RenderThread.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libs/hwui/renderthread/RenderThread.h b/libs/hwui/renderthread/RenderThread.h index da79e97a6ceb..8be46a6d16e1 100644 --- a/libs/hwui/renderthread/RenderThread.h +++ b/libs/hwui/renderthread/RenderThread.h @@ -19,6 +19,7 @@ #include <GrContext.h> #include <SkBitmap.h> +#include <apex/choreographer.h> #include <cutils/compiler.h> #include <thread/ThreadBase.h> #include <utils/Looper.h> @@ -73,10 +74,11 @@ protected: struct VsyncSource { virtual void requestNextVsync() = 0; - virtual nsecs_t latestVsyncEvent() = 0; + virtual void drainPendingEvents() = 0; virtual ~VsyncSource() {} }; +class ChoreographerSource; class DummyVsyncSource; typedef void (*JVMAttachHook)(const char* name); @@ -136,6 +138,7 @@ private: friend class DispatchFrameCallbacks; friend class RenderProxy; friend class DummyVsyncSource; + friend class ChoreographerSource; friend class android::uirenderer::AutoBackendTextureRelease; friend class android::uirenderer::TestUtils; friend class android::uirenderer::WebViewFunctor; @@ -149,13 +152,21 @@ private: static RenderThread& getInstance(); void initThreadLocals(); - void initializeDisplayEventReceiver(); + void initializeChoreographer(); void setupFrameInterval(); - static int displayEventReceiverCallback(int fd, int events, void* data); + // Callbacks for choreographer events: + // choreographerCallback will call AChoreograper_handleEvent to call the + // corresponding callbacks for each display event type + static int choreographerCallback(int fd, int events, void* data); + // Callback that will be run on vsync ticks. + static void frameCallback(int64_t frameTimeNanos, void* data); + // Callback that will be run whenver there is a refresh rate change. + static void refreshRateCallback(int64_t vsyncPeriod, void* data); void drainDisplayEventQueue(); void dispatchFrameCallbacks(); void requestVsync(); + AChoreographer* mChoreographer; VsyncSource* mVsyncSource; bool mVsyncRequested; std::set<IFrameCallback*> mFrameCallbacks; |