blob: f7602000063ea682005e5220f9e9d41fc9b90eca [file] [log] [blame]
Mathias Agopiand0566bc2011-11-17 17:49:17 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Mathias Agopian841cde52012-03-01 15:44:37 -080017#define ATRACE_TAG ATRACE_TAG_GRAPHICS
18
Mathias Agopiand0566bc2011-11-17 17:49:17 -080019#include <stdint.h>
20#include <sys/types.h>
21
Mathias Agopiana4cb35a2012-08-20 20:07:34 -070022#include <cutils/compiler.h>
23
Mathias Agopiancb9732a2012-04-03 17:48:03 -070024#include <gui/BitTube.h>
Mathias Agopiand0566bc2011-11-17 17:49:17 -080025#include <gui/IDisplayEventConnection.h>
26#include <gui/DisplayEventReceiver.h>
27
28#include <utils/Errors.h>
Mathias Agopian921e6ac2012-07-23 23:11:29 -070029#include <utils/String8.h>
Mathias Agopian841cde52012-03-01 15:44:37 -080030#include <utils/Trace.h>
Mathias Agopiand0566bc2011-11-17 17:49:17 -080031
Mathias Agopiand0566bc2011-11-17 17:49:17 -080032#include "EventThread.h"
33#include "SurfaceFlinger.h"
34
35// ---------------------------------------------------------------------------
Mathias Agopiand0566bc2011-11-17 17:49:17 -080036namespace android {
Mathias Agopiand0566bc2011-11-17 17:49:17 -080037// ---------------------------------------------------------------------------
Ruchi Kandoief472ec2014-04-02 12:50:06 -070038// time to wait between VSYNC requests before sending a VSYNC OFF power hint: 40msec.
39const long vsyncHintOffDelay = 40000000;
40
41static void vsyncOffCallback(union sigval val) {
42 EventThread *ev = (EventThread *)val.sival_ptr;
43 ev->sendVsyncHintOff();
44 return;
45}
Mathias Agopiand0566bc2011-11-17 17:49:17 -080046
Jamie Gennisfaf77cc2013-07-30 15:10:32 -070047EventThread::EventThread(const sp<VSyncSource>& src)
48 : mVSyncSource(src),
Mathias Agopian22ffb112012-04-10 21:04:02 -070049 mUseSoftwareVSync(false),
Jamie Gennisfaf77cc2013-07-30 15:10:32 -070050 mVsyncEnabled(false),
Ruchi Kandoief472ec2014-04-02 12:50:06 -070051 mDebugVsyncEnabled(false),
52 mVsyncHintSent(false) {
Mathias Agopianff28e202012-09-20 23:24:19 -070053
Jesse Hall9e663de2013-08-16 14:28:37 -070054 for (int32_t i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) {
Mathias Agopianff28e202012-09-20 23:24:19 -070055 mVSyncEvent[i].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC;
56 mVSyncEvent[i].header.id = 0;
57 mVSyncEvent[i].header.timestamp = 0;
58 mVSyncEvent[i].vsync.count = 0;
59 }
Ruchi Kandoief472ec2014-04-02 12:50:06 -070060 struct sigevent se;
61 se.sigev_notify = SIGEV_THREAD;
62 se.sigev_value.sival_ptr = this;
63 se.sigev_notify_function = vsyncOffCallback;
64 se.sigev_notify_attributes = NULL;
65 timer_create(CLOCK_MONOTONIC, &se, &mTimerId);
66}
67
68void EventThread::sendVsyncHintOff() {
69 Mutex::Autolock _l(mLock);
70 mPowerHAL.vsyncHint(false);
71 mVsyncHintSent = false;
72}
73
Dan Stozadb4ac3c2015-04-14 11:34:01 -070074void EventThread::setPhaseOffset(nsecs_t phaseOffset) {
75 Mutex::Autolock _l(mLock);
76 mVSyncSource->setPhaseOffset(phaseOffset);
77}
78
Ruchi Kandoief472ec2014-04-02 12:50:06 -070079void EventThread::sendVsyncHintOnLocked() {
80 struct itimerspec ts;
81 if(!mVsyncHintSent) {
82 mPowerHAL.vsyncHint(true);
83 mVsyncHintSent = true;
84 }
85 ts.it_value.tv_sec = 0;
86 ts.it_value.tv_nsec = vsyncHintOffDelay;
87 ts.it_interval.tv_sec = 0;
88 ts.it_interval.tv_nsec = 0;
89 timer_settime(mTimerId, 0, &ts, NULL);
Mathias Agopiand0566bc2011-11-17 17:49:17 -080090}
91
92void EventThread::onFirstRef() {
93 run("EventThread", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE);
94}
95
Mathias Agopiancb9732a2012-04-03 17:48:03 -070096sp<EventThread::Connection> EventThread::createEventConnection() const {
97 return new Connection(const_cast<EventThread*>(this));
Mathias Agopian8aedd472012-01-24 16:39:14 -080098}
99
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800100status_t EventThread::registerDisplayEventConnection(
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700101 const sp<EventThread::Connection>& connection) {
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800102 Mutex::Autolock _l(mLock);
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700103 mDisplayEventConnections.add(connection);
Mathias Agopian7d886472012-06-14 23:39:35 -0700104 mCondition.broadcast();
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800105 return NO_ERROR;
106}
107
Mathias Agopian478ae5e2011-12-06 17:22:19 -0800108void EventThread::removeDisplayEventConnection(
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700109 const wp<EventThread::Connection>& connection) {
Mathias Agopian23748662011-12-05 14:33:34 -0800110 Mutex::Autolock _l(mLock);
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700111 mDisplayEventConnections.remove(connection);
Mathias Agopian478ae5e2011-12-06 17:22:19 -0800112}
113
114void EventThread::setVsyncRate(uint32_t count,
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700115 const sp<EventThread::Connection>& connection) {
Mathias Agopian478ae5e2011-12-06 17:22:19 -0800116 if (int32_t(count) >= 0) { // server must protect against bad params
117 Mutex::Autolock _l(mLock);
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700118 const int32_t new_count = (count == 0) ? -1 : count;
119 if (connection->count != new_count) {
120 connection->count = new_count;
Mathias Agopian7d886472012-06-14 23:39:35 -0700121 mCondition.broadcast();
Mathias Agopian478ae5e2011-12-06 17:22:19 -0800122 }
123 }
124}
125
126void EventThread::requestNextVsync(
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700127 const sp<EventThread::Connection>& connection) {
Mathias Agopian478ae5e2011-12-06 17:22:19 -0800128 Mutex::Autolock _l(mLock);
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700129 if (connection->count < 0) {
130 connection->count = 0;
Mathias Agopian7d886472012-06-14 23:39:35 -0700131 mCondition.broadcast();
Mathias Agopian478ae5e2011-12-06 17:22:19 -0800132 }
Mathias Agopian23748662011-12-05 14:33:34 -0800133}
134
Mathias Agopian22ffb112012-04-10 21:04:02 -0700135void EventThread::onScreenReleased() {
136 Mutex::Autolock _l(mLock);
Mathias Agopian22ffb112012-04-10 21:04:02 -0700137 if (!mUseSoftwareVSync) {
Mathias Agopian7d886472012-06-14 23:39:35 -0700138 // disable reliance on h/w vsync
139 mUseSoftwareVSync = true;
140 mCondition.broadcast();
Mathias Agopian22ffb112012-04-10 21:04:02 -0700141 }
Mathias Agopian22ffb112012-04-10 21:04:02 -0700142}
143
144void EventThread::onScreenAcquired() {
145 Mutex::Autolock _l(mLock);
Mathias Agopian7d886472012-06-14 23:39:35 -0700146 if (mUseSoftwareVSync) {
147 // resume use of h/w vsync
148 mUseSoftwareVSync = false;
149 mCondition.broadcast();
150 }
Mathias Agopian22ffb112012-04-10 21:04:02 -0700151}
152
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700153void EventThread::onVSyncEvent(nsecs_t timestamp) {
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700154 Mutex::Autolock _l(mLock);
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700155 mVSyncEvent[0].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC;
156 mVSyncEvent[0].header.id = 0;
157 mVSyncEvent[0].header.timestamp = timestamp;
158 mVSyncEvent[0].vsync.count++;
159 mCondition.broadcast();
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700160}
161
Mathias Agopian148994e2012-09-19 17:31:36 -0700162void EventThread::onHotplugReceived(int type, bool connected) {
Jesse Hall9e663de2013-08-16 14:28:37 -0700163 ALOGE_IF(type >= DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES,
Jesse Hall7adb0f82013-03-06 16:13:49 -0800164 "received hotplug event for an invalid display (id=%d)", type);
Mathias Agopianff28e202012-09-20 23:24:19 -0700165
Mathias Agopian148994e2012-09-19 17:31:36 -0700166 Mutex::Autolock _l(mLock);
Jesse Hall9e663de2013-08-16 14:28:37 -0700167 if (type < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) {
Mathias Agopianff28e202012-09-20 23:24:19 -0700168 DisplayEventReceiver::Event event;
169 event.header.type = DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG;
170 event.header.id = type;
171 event.header.timestamp = systemTime();
172 event.hotplug.connected = connected;
173 mPendingEvents.add(event);
174 mCondition.broadcast();
175 }
Mathias Agopian148994e2012-09-19 17:31:36 -0700176}
177
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800178bool EventThread::threadLoop() {
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700179 DisplayEventReceiver::Event event;
Mathias Agopiana4cb35a2012-08-20 20:07:34 -0700180 Vector< sp<EventThread::Connection> > signalConnections;
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700181 signalConnections = waitForEvent(&event);
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700182
Mathias Agopian148994e2012-09-19 17:31:36 -0700183 // dispatch events to listeners...
Mathias Agopiana4cb35a2012-08-20 20:07:34 -0700184 const size_t count = signalConnections.size();
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800185 for (size_t i=0 ; i<count ; i++) {
Mathias Agopiana4cb35a2012-08-20 20:07:34 -0700186 const sp<Connection>& conn(signalConnections[i]);
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700187 // now see if we still need to report this event
188 status_t err = conn->postEvent(event);
Mathias Agopiana4cb35a2012-08-20 20:07:34 -0700189 if (err == -EAGAIN || err == -EWOULDBLOCK) {
190 // The destination doesn't accept events anymore, it's probably
191 // full. For now, we just drop the events on the floor.
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700192 // FIXME: Note that some events cannot be dropped and would have
193 // to be re-sent later.
194 // Right-now we don't have the ability to do this.
195 ALOGW("EventThread: dropping event (%08x) for connection %p",
196 event.header.type, conn.get());
Mathias Agopiana4cb35a2012-08-20 20:07:34 -0700197 } else if (err < 0) {
198 // handle any other error on the pipe as fatal. the only
199 // reasonable thing to do is to clean-up this connection.
200 // The most common error we'll get here is -EPIPE.
201 removeDisplayEventConnection(signalConnections[i]);
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800202 }
203 }
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800204 return true;
205}
206
Andy McFadden6bf552e2012-08-30 16:34:41 -0700207// This will return when (1) a vsync event has been received, and (2) there was
208// at least one connection interested in receiving it when we started waiting.
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700209Vector< sp<EventThread::Connection> > EventThread::waitForEvent(
210 DisplayEventReceiver::Event* event)
211{
212 Mutex::Autolock _l(mLock);
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700213 Vector< sp<EventThread::Connection> > signalConnections;
214
215 do {
Mathias Agopian148994e2012-09-19 17:31:36 -0700216 bool eventPending = false;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700217 bool waitForVSync = false;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700218
Mathias Agopianff28e202012-09-20 23:24:19 -0700219 size_t vsyncCount = 0;
220 nsecs_t timestamp = 0;
Jesse Hall9e663de2013-08-16 14:28:37 -0700221 for (int32_t i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) {
Mathias Agopianff28e202012-09-20 23:24:19 -0700222 timestamp = mVSyncEvent[i].header.timestamp;
223 if (timestamp) {
224 // we have a vsync event to dispatch
225 *event = mVSyncEvent[i];
226 mVSyncEvent[i].header.timestamp = 0;
227 vsyncCount = mVSyncEvent[i].vsync.count;
228 break;
229 }
230 }
231
232 if (!timestamp) {
233 // no vsync event, see if there are some other event
Mathias Agopian148994e2012-09-19 17:31:36 -0700234 eventPending = !mPendingEvents.isEmpty();
235 if (eventPending) {
236 // we have some other event to dispatch
237 *event = mPendingEvents[0];
238 mPendingEvents.removeAt(0);
239 }
240 }
241
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700242 // find out connections waiting for events
243 size_t count = mDisplayEventConnections.size();
244 for (size_t i=0 ; i<count ; i++) {
245 sp<Connection> connection(mDisplayEventConnections[i].promote());
246 if (connection != NULL) {
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700247 bool added = false;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700248 if (connection->count >= 0) {
249 // we need vsync events because at least
250 // one connection is waiting for it
251 waitForVSync = true;
252 if (timestamp) {
253 // we consume the event only if it's time
254 // (ie: we received a vsync event)
255 if (connection->count == 0) {
256 // fired this time around
257 connection->count = -1;
258 signalConnections.add(connection);
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700259 added = true;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700260 } else if (connection->count == 1 ||
261 (vsyncCount % connection->count) == 0) {
262 // continuous event, and time to report it
263 signalConnections.add(connection);
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700264 added = true;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700265 }
266 }
267 }
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700268
269 if (eventPending && !timestamp && !added) {
270 // we don't have a vsync event to process
271 // (timestamp==0), but we have some pending
272 // messages.
273 signalConnections.add(connection);
274 }
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700275 } else {
276 // we couldn't promote this reference, the connection has
277 // died, so clean-up!
278 mDisplayEventConnections.removeAt(i);
279 --i; --count;
280 }
281 }
282
283 // Here we figure out if we need to enable or disable vsyncs
284 if (timestamp && !waitForVSync) {
285 // we received a VSYNC but we have no clients
286 // don't report it, and disable VSYNC events
287 disableVSyncLocked();
288 } else if (!timestamp && waitForVSync) {
Andy McFadden6bf552e2012-08-30 16:34:41 -0700289 // we have at least one client, so we want vsync enabled
290 // (TODO: this function is called right after we finish
291 // notifying clients of a vsync, so this call will be made
292 // at the vsync rate, e.g. 60fps. If we can accurately
293 // track the current state we could avoid making this call
294 // so often.)
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700295 enableVSyncLocked();
296 }
297
Andy McFadden6bf552e2012-08-30 16:34:41 -0700298 // note: !timestamp implies signalConnections.isEmpty(), because we
299 // don't populate signalConnections if there's no vsync pending
Mathias Agopian148994e2012-09-19 17:31:36 -0700300 if (!timestamp && !eventPending) {
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700301 // wait for something to happen
Andy McFadden6bf552e2012-08-30 16:34:41 -0700302 if (waitForVSync) {
303 // This is where we spend most of our time, waiting
304 // for vsync events and new client registrations.
305 //
306 // If the screen is off, we can't use h/w vsync, so we
307 // use a 16ms timeout instead. It doesn't need to be
308 // precise, we just need to keep feeding our clients.
309 //
310 // We don't want to stall if there's a driver bug, so we
311 // use a (long) timeout when waiting for h/w vsync, and
312 // generate fake events when necessary.
313 bool softwareSync = mUseSoftwareVSync;
314 nsecs_t timeout = softwareSync ? ms2ns(16) : ms2ns(1000);
315 if (mCondition.waitRelative(mLock, timeout) == TIMED_OUT) {
316 if (!softwareSync) {
317 ALOGW("Timed out waiting for hw vsync; faking it");
318 }
Mathias Agopianff28e202012-09-20 23:24:19 -0700319 // FIXME: how do we decide which display id the fake
320 // vsync came from ?
321 mVSyncEvent[0].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC;
Jesse Hall9e663de2013-08-16 14:28:37 -0700322 mVSyncEvent[0].header.id = DisplayDevice::DISPLAY_PRIMARY;
Mathias Agopianff28e202012-09-20 23:24:19 -0700323 mVSyncEvent[0].header.timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
324 mVSyncEvent[0].vsync.count++;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700325 }
326 } else {
Andy McFadden6bf552e2012-08-30 16:34:41 -0700327 // Nobody is interested in vsync, so we just want to sleep.
328 // h/w vsync should be disabled, so this will wait until we
329 // get a new connection, or an existing connection becomes
330 // interested in receiving vsync again.
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700331 mCondition.wait(mLock);
332 }
333 }
334 } while (signalConnections.isEmpty());
335
336 // here we're guaranteed to have a timestamp and some connections to signal
Andy McFadden6bf552e2012-08-30 16:34:41 -0700337 // (The connections might have dropped out of mDisplayEventConnections
338 // while we were asleep, but we'll still have strong references to them.)
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700339 return signalConnections;
340}
341
Mathias Agopian22ffb112012-04-10 21:04:02 -0700342void EventThread::enableVSyncLocked() {
343 if (!mUseSoftwareVSync) {
344 // never enable h/w VSYNC when screen is off
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700345 if (!mVsyncEnabled) {
346 mVsyncEnabled = true;
347 mVSyncSource->setCallback(static_cast<VSyncSource::Callback*>(this));
348 mVSyncSource->setVSyncEnabled(true);
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700349 }
Mathias Agopian22ffb112012-04-10 21:04:02 -0700350 }
Mathias Agopiane2c4f4e2012-04-10 18:25:31 -0700351 mDebugVsyncEnabled = true;
Ruchi Kandoief472ec2014-04-02 12:50:06 -0700352 sendVsyncHintOnLocked();
Mathias Agopiane2c4f4e2012-04-10 18:25:31 -0700353}
354
Mathias Agopian22ffb112012-04-10 21:04:02 -0700355void EventThread::disableVSyncLocked() {
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700356 if (mVsyncEnabled) {
357 mVsyncEnabled = false;
358 mVSyncSource->setVSyncEnabled(false);
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700359 mDebugVsyncEnabled = false;
360 }
Mathias Agopiane2c4f4e2012-04-10 18:25:31 -0700361}
362
Mathias Agopian74d211a2013-04-22 16:55:35 +0200363void EventThread::dump(String8& result) const {
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800364 Mutex::Autolock _l(mLock);
Mathias Agopiane2c4f4e2012-04-10 18:25:31 -0700365 result.appendFormat("VSYNC state: %s\n",
366 mDebugVsyncEnabled?"enabled":"disabled");
Mathias Agopian22ffb112012-04-10 21:04:02 -0700367 result.appendFormat(" soft-vsync: %s\n",
368 mUseSoftwareVSync?"enabled":"disabled");
Greg Hackmann86efcc02014-03-07 12:44:02 -0800369 result.appendFormat(" numListeners=%zu,\n events-delivered: %u\n",
Mathias Agopianff28e202012-09-20 23:24:19 -0700370 mDisplayEventConnections.size(),
Jesse Hall9e663de2013-08-16 14:28:37 -0700371 mVSyncEvent[DisplayDevice::DISPLAY_PRIMARY].vsync.count);
Mathias Agopiane2c4f4e2012-04-10 18:25:31 -0700372 for (size_t i=0 ; i<mDisplayEventConnections.size() ; i++) {
373 sp<Connection> connection =
374 mDisplayEventConnections.itemAt(i).promote();
375 result.appendFormat(" %p: count=%d\n",
376 connection.get(), connection!=NULL ? connection->count : 0);
377 }
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800378}
379
380// ---------------------------------------------------------------------------
381
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700382EventThread::Connection::Connection(
383 const sp<EventThread>& eventThread)
384 : count(-1), mEventThread(eventThread), mChannel(new BitTube())
385{
386}
387
388EventThread::Connection::~Connection() {
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700389 // do nothing here -- clean-up will happen automatically
390 // when the main thread wakes up
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700391}
392
393void EventThread::Connection::onFirstRef() {
394 // NOTE: mEventThread doesn't hold a strong reference on us
395 mEventThread->registerDisplayEventConnection(this);
396}
397
398sp<BitTube> EventThread::Connection::getDataChannel() const {
399 return mChannel;
400}
401
402void EventThread::Connection::setVsyncRate(uint32_t count) {
403 mEventThread->setVsyncRate(count, this);
404}
405
406void EventThread::Connection::requestNextVsync() {
407 mEventThread->requestNextVsync(this);
408}
409
410status_t EventThread::Connection::postEvent(
411 const DisplayEventReceiver::Event& event) {
412 ssize_t size = DisplayEventReceiver::sendEvents(mChannel, &event, 1);
413 return size < 0 ? status_t(size) : status_t(NO_ERROR);
414}
415
416// ---------------------------------------------------------------------------
417
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800418}; // namespace android