summaryrefslogtreecommitdiff
path: root/libs/gui/DisplayEventDispatcher.cpp
diff options
context:
space:
mode:
author Ady Abraham <adyabr@google.com> 2020-10-05 17:50:41 -0700
committer Ady Abraham <adyabr@google.com> 2020-10-09 16:11:12 -0700
commit0d28d76a34e82b3133b17854017698995c589cb1 (patch)
treebf117cda6cc00c60bef67f3cf1e9432eacbe7eb0 /libs/gui/DisplayEventDispatcher.cpp
parentf5c9e22f380adb5c886df38ce6eddcf610c5e918 (diff)
SurfaceFlinger: pass frame deadline to Choreographer
Pass the frame deadline calculated by SF to AChoreographer so hwui would be able to improve its stats by knowing if a frame is likely to be late. Bug: 169858174 Test: manul Change-Id: I9433d990684b968cbe1cd3ce17717b616d01b9a2
Diffstat (limited to 'libs/gui/DisplayEventDispatcher.cpp')
-rw-r--r--libs/gui/DisplayEventDispatcher.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/libs/gui/DisplayEventDispatcher.cpp b/libs/gui/DisplayEventDispatcher.cpp
index 7e894b4b79..abfee61685 100644
--- a/libs/gui/DisplayEventDispatcher.cpp
+++ b/libs/gui/DisplayEventDispatcher.cpp
@@ -73,8 +73,8 @@ status_t DisplayEventDispatcher::scheduleVsync() {
nsecs_t vsyncTimestamp;
PhysicalDisplayId vsyncDisplayId;
uint32_t vsyncCount;
- int64_t vsyncId;
- if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount, &vsyncId)) {
+ VsyncEventData vsyncEventData;
+ if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount, &vsyncEventData)) {
ALOGE("dispatcher %p ~ last event processed while scheduling was for %" PRId64 "", this,
ns2ms(static_cast<nsecs_t>(vsyncTimestamp)));
}
@@ -117,13 +117,14 @@ int DisplayEventDispatcher::handleEvent(int, int events, void*) {
nsecs_t vsyncTimestamp;
PhysicalDisplayId vsyncDisplayId;
uint32_t vsyncCount;
- int64_t vsyncId;
- if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount, &vsyncId)) {
+ VsyncEventData vsyncEventData;
+ if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount, &vsyncEventData)) {
ALOGV("dispatcher %p ~ Vsync pulse: timestamp=%" PRId64
", displayId=%s, count=%d, vsyncId=%" PRId64,
- this, ns2ms(vsyncTimestamp), to_string(vsyncDisplayId).c_str(), vsyncCount, vsyncId);
+ this, ns2ms(vsyncTimestamp), to_string(vsyncDisplayId).c_str(), vsyncCount,
+ vsyncEventData.id);
mWaitingForVsync = false;
- dispatchVsync(vsyncTimestamp, vsyncDisplayId, vsyncCount, vsyncId);
+ dispatchVsync(vsyncTimestamp, vsyncDisplayId, vsyncCount, vsyncEventData);
}
return 1; // keep the callback
@@ -131,11 +132,11 @@ int DisplayEventDispatcher::handleEvent(int, int events, void*) {
bool DisplayEventDispatcher::processPendingEvents(nsecs_t* outTimestamp,
PhysicalDisplayId* outDisplayId,
- uint32_t* outCount, int64_t* outVsyncId) {
+ uint32_t* outCount,
+ VsyncEventData* outVsyncEventData) {
bool gotVsync = false;
DisplayEventReceiver::Event buf[EVENT_BUFFER_SIZE];
ssize_t n;
- *outVsyncId = 0;
while ((n = mReceiver.getEvents(buf, EVENT_BUFFER_SIZE)) > 0) {
ALOGV("dispatcher %p ~ Read %d events.", this, int(n));
for (ssize_t i = 0; i < n; i++) {
@@ -148,7 +149,8 @@ bool DisplayEventDispatcher::processPendingEvents(nsecs_t* outTimestamp,
*outTimestamp = ev.header.timestamp;
*outDisplayId = ev.header.displayId;
*outCount = ev.vsync.count;
- *outVsyncId = ev.vsync.vsyncId;
+ outVsyncEventData->id = ev.vsync.vsyncId;
+ outVsyncEventData->deadlineTimestamp = ev.vsync.deadlineTimestamp;
break;
case DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG:
dispatchHotplug(ev.header.timestamp, ev.header.displayId, ev.hotplug.connected);