Improve the VSYNC api a bit.
- add the ability to set the vsync delivery rate, when the rate is
set to N>1 (ie: receive every N vsync), SF process' is woken up for
all of vsync, but clients only see the every N events.
- add the concept of one-shot vsync events, with a call-back
to request the next one. currently the call-back is a binder IPC.
Change-Id: I09f71df0b0ba0d88ed997645e2e2497d553c9a1b
diff --git a/libs/gui/DisplayEventReceiver.cpp b/libs/gui/DisplayEventReceiver.cpp
index 3b29a11..fee1feb 100644
--- a/libs/gui/DisplayEventReceiver.cpp
+++ b/libs/gui/DisplayEventReceiver.cpp
@@ -58,6 +58,26 @@
return mDataChannel->getFd();
}
+status_t DisplayEventReceiver::setVsyncRate(uint32_t count) {
+ if (int32_t(count) < 0)
+ return BAD_VALUE;
+
+ if (mEventConnection != NULL) {
+ mEventConnection->setVsyncRate(count);
+ return NO_ERROR;
+ }
+ return NO_INIT;
+}
+
+status_t DisplayEventReceiver::requestNextVsync() {
+ if (mEventConnection != NULL) {
+ mEventConnection->requestNextVsync();
+ return NO_ERROR;
+ }
+ return NO_INIT;
+}
+
+
ssize_t DisplayEventReceiver::getEvents(DisplayEventReceiver::Event* events,
size_t count) {
ssize_t size = mDataChannel->read(events, sizeof(events[0])*count);