SurfaceFlinger: Add touch events to Scheduler
Add the notion of Touch Events to Scheduler to enhance the algorithm
to move to Performance refresh rate.
Scheduler selects Performance when:
- There is a touch event
- There is a buffer to HWC
This change also removes the behavior of Scheduler to move to Performance
on Choreographer callbacks.
Test: Switch between apps using gesture navigation
Bug: 131906818
Change-Id: I588cfc32449e87744e829dc7c5261a2e4151a8f8
diff --git a/services/surfaceflinger/Scheduler/EventThread.h b/services/surfaceflinger/Scheduler/EventThread.h
index 7107d63..61530c6 100644
--- a/services/surfaceflinger/Scheduler/EventThread.h
+++ b/services/surfaceflinger/Scheduler/EventThread.h
@@ -45,7 +45,6 @@
// ---------------------------------------------------------------------------
using ResyncCallback = std::function<void()>;
-using ResetIdleTimerCallback = std::function<void()>;
enum class VSyncRequest {
None = -1,
@@ -70,7 +69,7 @@
class EventThreadConnection : public BnDisplayEventConnection {
public:
- EventThreadConnection(EventThread*, ResyncCallback, ResetIdleTimerCallback);
+ EventThreadConnection(EventThread*, ResyncCallback);
virtual ~EventThreadConnection();
virtual status_t postEvent(const DisplayEventReceiver::Event& event);
@@ -78,13 +77,9 @@
status_t stealReceiveChannel(gui::BitTube* outChannel) override;
status_t setVsyncRate(uint32_t rate) override;
void requestNextVsync() override; // asynchronous
- // Requesting Vsync for HWC does not reset the idle timer, since HWC requires a refresh
- // in order to update the configs.
- void requestNextVsyncForHWC();
// Called in response to requestNextVsync.
const ResyncCallback resyncCallback;
- const ResetIdleTimerCallback resetIdleTimerCallback;
VSyncRequest vsyncRequest = VSyncRequest::None;
@@ -98,8 +93,7 @@
public:
virtual ~EventThread();
- virtual sp<EventThreadConnection> createEventConnection(ResyncCallback,
- ResetIdleTimerCallback) const = 0;
+ virtual sp<EventThreadConnection> createEventConnection(ResyncCallback) const = 0;
// called before the screen is turned off from main thread
virtual void onScreenReleased() = 0;
@@ -120,8 +114,7 @@
const sp<EventThreadConnection>& connection) = 0;
virtual void setVsyncRate(uint32_t rate, const sp<EventThreadConnection>& connection) = 0;
// Requests the next vsync. If resetIdleTimer is set to true, it resets the idle timer.
- virtual void requestNextVsync(const sp<EventThreadConnection>& connection,
- bool resetIdleTimer) = 0;
+ virtual void requestNextVsync(const sp<EventThreadConnection>& connection) = 0;
};
namespace impl {
@@ -135,13 +128,11 @@
EventThread(std::unique_ptr<VSyncSource>, InterceptVSyncsCallback, const char* threadName);
~EventThread();
- sp<EventThreadConnection> createEventConnection(ResyncCallback,
- ResetIdleTimerCallback) const override;
+ sp<EventThreadConnection> createEventConnection(ResyncCallback) const override;
status_t registerDisplayEventConnection(const sp<EventThreadConnection>& connection) override;
void setVsyncRate(uint32_t rate, const sp<EventThreadConnection>& connection) override;
- void requestNextVsync(const sp<EventThreadConnection>& connection,
- bool resetIdleTimer) override;
+ void requestNextVsync(const sp<EventThreadConnection>& connection) override;
// called before the screen is turned off from main thread
void onScreenReleased() override;