2011-11-18 01:49:17 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-03-01 23:44:37 +00:00
|
|
|
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
|
|
|
|
|
2011-11-18 01:49:17 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2012-08-21 03:07:34 +00:00
|
|
|
#include <cutils/compiler.h>
|
|
|
|
|
2012-04-04 00:48:03 +00:00
|
|
|
#include <gui/BitTube.h>
|
2011-11-18 01:49:17 +00:00
|
|
|
#include <gui/IDisplayEventConnection.h>
|
|
|
|
#include <gui/DisplayEventReceiver.h>
|
|
|
|
|
|
|
|
#include <utils/Errors.h>
|
2012-07-24 06:11:29 +00:00
|
|
|
#include <utils/String8.h>
|
2012-03-01 23:44:37 +00:00
|
|
|
#include <utils/Trace.h>
|
2011-11-18 01:49:17 +00:00
|
|
|
|
|
|
|
#include "EventThread.h"
|
|
|
|
#include "SurfaceFlinger.h"
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
namespace android {
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2013-07-30 22:10:32 +00:00
|
|
|
EventThread::EventThread(const sp<VSyncSource>& src)
|
|
|
|
: mVSyncSource(src),
|
2012-04-11 04:04:02 +00:00
|
|
|
mUseSoftwareVSync(false),
|
2013-07-30 22:10:32 +00:00
|
|
|
mVsyncEnabled(false),
|
2012-07-24 06:11:29 +00:00
|
|
|
mDebugVsyncEnabled(false) {
|
2012-09-21 06:24:19 +00:00
|
|
|
|
2013-08-16 21:28:37 +00:00
|
|
|
for (int32_t i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) {
|
2012-09-21 06:24:19 +00:00
|
|
|
mVSyncEvent[i].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC;
|
|
|
|
mVSyncEvent[i].header.id = 0;
|
|
|
|
mVSyncEvent[i].header.timestamp = 0;
|
|
|
|
mVSyncEvent[i].vsync.count = 0;
|
|
|
|
}
|
2011-11-18 01:49:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EventThread::onFirstRef() {
|
|
|
|
run("EventThread", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE);
|
|
|
|
}
|
|
|
|
|
2012-04-04 00:48:03 +00:00
|
|
|
sp<EventThread::Connection> EventThread::createEventConnection() const {
|
|
|
|
return new Connection(const_cast<EventThread*>(this));
|
2012-01-25 00:39:14 +00:00
|
|
|
}
|
|
|
|
|
2011-11-18 01:49:17 +00:00
|
|
|
status_t EventThread::registerDisplayEventConnection(
|
2012-04-04 00:48:03 +00:00
|
|
|
const sp<EventThread::Connection>& connection) {
|
2011-11-18 01:49:17 +00:00
|
|
|
Mutex::Autolock _l(mLock);
|
2012-04-04 00:48:03 +00:00
|
|
|
mDisplayEventConnections.add(connection);
|
2012-06-15 06:39:35 +00:00
|
|
|
mCondition.broadcast();
|
2011-11-18 01:49:17 +00:00
|
|
|
return NO_ERROR;
|
|
|
|
}
|
|
|
|
|
2011-12-07 01:22:19 +00:00
|
|
|
void EventThread::removeDisplayEventConnection(
|
2012-04-04 00:48:03 +00:00
|
|
|
const wp<EventThread::Connection>& connection) {
|
2011-12-05 22:33:34 +00:00
|
|
|
Mutex::Autolock _l(mLock);
|
2012-04-04 00:48:03 +00:00
|
|
|
mDisplayEventConnections.remove(connection);
|
2011-12-07 01:22:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EventThread::setVsyncRate(uint32_t count,
|
2012-04-04 00:48:03 +00:00
|
|
|
const sp<EventThread::Connection>& connection) {
|
2011-12-07 01:22:19 +00:00
|
|
|
if (int32_t(count) >= 0) { // server must protect against bad params
|
|
|
|
Mutex::Autolock _l(mLock);
|
2012-04-04 00:48:03 +00:00
|
|
|
const int32_t new_count = (count == 0) ? -1 : count;
|
|
|
|
if (connection->count != new_count) {
|
|
|
|
connection->count = new_count;
|
2012-06-15 06:39:35 +00:00
|
|
|
mCondition.broadcast();
|
2011-12-07 01:22:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventThread::requestNextVsync(
|
2012-04-04 00:48:03 +00:00
|
|
|
const sp<EventThread::Connection>& connection) {
|
2011-12-07 01:22:19 +00:00
|
|
|
Mutex::Autolock _l(mLock);
|
2012-04-04 00:48:03 +00:00
|
|
|
if (connection->count < 0) {
|
|
|
|
connection->count = 0;
|
2012-06-15 06:39:35 +00:00
|
|
|
mCondition.broadcast();
|
2011-12-07 01:22:19 +00:00
|
|
|
}
|
2011-12-05 22:33:34 +00:00
|
|
|
}
|
|
|
|
|
2012-04-11 04:04:02 +00:00
|
|
|
void EventThread::onScreenReleased() {
|
|
|
|
Mutex::Autolock _l(mLock);
|
|
|
|
if (!mUseSoftwareVSync) {
|
2012-06-15 06:39:35 +00:00
|
|
|
// disable reliance on h/w vsync
|
|
|
|
mUseSoftwareVSync = true;
|
|
|
|
mCondition.broadcast();
|
2012-04-11 04:04:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventThread::onScreenAcquired() {
|
|
|
|
Mutex::Autolock _l(mLock);
|
2012-06-15 06:39:35 +00:00
|
|
|
if (mUseSoftwareVSync) {
|
|
|
|
// resume use of h/w vsync
|
|
|
|
mUseSoftwareVSync = false;
|
|
|
|
mCondition.broadcast();
|
|
|
|
}
|
2012-04-11 04:04:02 +00:00
|
|
|
}
|
|
|
|
|
2013-07-30 22:10:32 +00:00
|
|
|
void EventThread::onVSyncEvent(nsecs_t timestamp) {
|
2012-04-04 05:09:52 +00:00
|
|
|
Mutex::Autolock _l(mLock);
|
2013-07-30 22:10:32 +00:00
|
|
|
mVSyncEvent[0].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC;
|
|
|
|
mVSyncEvent[0].header.id = 0;
|
|
|
|
mVSyncEvent[0].header.timestamp = timestamp;
|
|
|
|
mVSyncEvent[0].vsync.count++;
|
|
|
|
mCondition.broadcast();
|
2012-04-04 05:09:52 +00:00
|
|
|
}
|
|
|
|
|
2012-09-20 00:31:36 +00:00
|
|
|
void EventThread::onHotplugReceived(int type, bool connected) {
|
2013-08-16 21:28:37 +00:00
|
|
|
ALOGE_IF(type >= DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES,
|
2013-03-07 00:13:49 +00:00
|
|
|
"received hotplug event for an invalid display (id=%d)", type);
|
2012-09-21 06:24:19 +00:00
|
|
|
|
2012-09-20 00:31:36 +00:00
|
|
|
Mutex::Autolock _l(mLock);
|
2013-08-16 21:28:37 +00:00
|
|
|
if (type < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) {
|
2012-09-21 06:24:19 +00:00
|
|
|
DisplayEventReceiver::Event event;
|
|
|
|
event.header.type = DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG;
|
|
|
|
event.header.id = type;
|
|
|
|
event.header.timestamp = systemTime();
|
|
|
|
event.hotplug.connected = connected;
|
|
|
|
mPendingEvents.add(event);
|
|
|
|
mCondition.broadcast();
|
|
|
|
}
|
2012-09-20 00:31:36 +00:00
|
|
|
}
|
|
|
|
|
2011-11-18 01:49:17 +00:00
|
|
|
bool EventThread::threadLoop() {
|
2012-09-21 06:14:05 +00:00
|
|
|
DisplayEventReceiver::Event event;
|
2012-08-21 03:07:34 +00:00
|
|
|
Vector< sp<EventThread::Connection> > signalConnections;
|
2012-09-21 06:14:05 +00:00
|
|
|
signalConnections = waitForEvent(&event);
|
2011-12-05 22:33:34 +00:00
|
|
|
|
2012-09-20 00:31:36 +00:00
|
|
|
// dispatch events to listeners...
|
2012-08-21 22:47:28 +00:00
|
|
|
const size_t count = signalConnections.size();
|
|
|
|
for (size_t i=0 ; i<count ; i++) {
|
|
|
|
const sp<Connection>& conn(signalConnections[i]);
|
2012-09-21 06:14:05 +00:00
|
|
|
// now see if we still need to report this event
|
|
|
|
status_t err = conn->postEvent(event);
|
2012-08-21 22:47:28 +00:00
|
|
|
if (err == -EAGAIN || err == -EWOULDBLOCK) {
|
|
|
|
// The destination doesn't accept events anymore, it's probably
|
|
|
|
// full. For now, we just drop the events on the floor.
|
2012-09-21 06:14:05 +00:00
|
|
|
// FIXME: Note that some events cannot be dropped and would have
|
|
|
|
// to be re-sent later.
|
|
|
|
// Right-now we don't have the ability to do this.
|
|
|
|
ALOGW("EventThread: dropping event (%08x) for connection %p",
|
|
|
|
event.header.type, conn.get());
|
2012-08-21 22:47:28 +00:00
|
|
|
} else if (err < 0) {
|
|
|
|
// handle any other error on the pipe as fatal. the only
|
|
|
|
// reasonable thing to do is to clean-up this connection.
|
|
|
|
// The most common error we'll get here is -EPIPE.
|
|
|
|
removeDisplayEventConnection(signalConnections[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2012-08-21 03:07:34 +00:00
|
|
|
|
2012-08-30 23:34:41 +00:00
|
|
|
// This will return when (1) a vsync event has been received, and (2) there was
|
|
|
|
// at least one connection interested in receiving it when we started waiting.
|
2012-08-21 22:47:28 +00:00
|
|
|
Vector< sp<EventThread::Connection> > EventThread::waitForEvent(
|
|
|
|
DisplayEventReceiver::Event* event)
|
|
|
|
{
|
|
|
|
Mutex::Autolock _l(mLock);
|
|
|
|
Vector< sp<EventThread::Connection> > signalConnections;
|
2012-08-21 03:07:34 +00:00
|
|
|
|
2012-08-21 22:47:28 +00:00
|
|
|
do {
|
2012-09-20 00:31:36 +00:00
|
|
|
bool eventPending = false;
|
2012-08-21 03:07:34 +00:00
|
|
|
bool waitForVSync = false;
|
2012-09-21 06:24:19 +00:00
|
|
|
|
|
|
|
size_t vsyncCount = 0;
|
|
|
|
nsecs_t timestamp = 0;
|
2013-08-16 21:28:37 +00:00
|
|
|
for (int32_t i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) {
|
2012-09-21 06:24:19 +00:00
|
|
|
timestamp = mVSyncEvent[i].header.timestamp;
|
|
|
|
if (timestamp) {
|
|
|
|
// we have a vsync event to dispatch
|
|
|
|
*event = mVSyncEvent[i];
|
|
|
|
mVSyncEvent[i].header.timestamp = 0;
|
|
|
|
vsyncCount = mVSyncEvent[i].vsync.count;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!timestamp) {
|
|
|
|
// no vsync event, see if there are some other event
|
2012-09-20 00:31:36 +00:00
|
|
|
eventPending = !mPendingEvents.isEmpty();
|
|
|
|
if (eventPending) {
|
|
|
|
// we have some other event to dispatch
|
|
|
|
*event = mPendingEvents[0];
|
|
|
|
mPendingEvents.removeAt(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-21 22:47:28 +00:00
|
|
|
// find out connections waiting for events
|
2012-08-17 22:06:02 +00:00
|
|
|
size_t count = mDisplayEventConnections.size();
|
|
|
|
for (size_t i=0 ; i<count ; i++) {
|
|
|
|
sp<Connection> connection(mDisplayEventConnections[i].promote());
|
|
|
|
if (connection != NULL) {
|
2012-09-21 06:14:05 +00:00
|
|
|
bool added = false;
|
2012-08-17 22:06:02 +00:00
|
|
|
if (connection->count >= 0) {
|
2012-08-21 03:07:34 +00:00
|
|
|
// we need vsync events because at least
|
|
|
|
// one connection is waiting for it
|
|
|
|
waitForVSync = true;
|
2012-08-21 22:47:28 +00:00
|
|
|
if (timestamp) {
|
|
|
|
// we consume the event only if it's time
|
|
|
|
// (ie: we received a vsync event)
|
|
|
|
if (connection->count == 0) {
|
|
|
|
// fired this time around
|
2012-08-21 03:07:34 +00:00
|
|
|
connection->count = -1;
|
2012-08-21 22:47:28 +00:00
|
|
|
signalConnections.add(connection);
|
2012-09-21 06:14:05 +00:00
|
|
|
added = true;
|
2012-08-21 22:47:28 +00:00
|
|
|
} else if (connection->count == 1 ||
|
|
|
|
(vsyncCount % connection->count) == 0) {
|
|
|
|
// continuous event, and time to report it
|
|
|
|
signalConnections.add(connection);
|
2012-09-21 06:14:05 +00:00
|
|
|
added = true;
|
2012-08-21 03:07:34 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-10 02:19:18 +00:00
|
|
|
}
|
2012-09-21 06:14:05 +00:00
|
|
|
|
|
|
|
if (eventPending && !timestamp && !added) {
|
|
|
|
// we don't have a vsync event to process
|
|
|
|
// (timestamp==0), but we have some pending
|
|
|
|
// messages.
|
|
|
|
signalConnections.add(connection);
|
|
|
|
}
|
2012-08-21 22:47:28 +00:00
|
|
|
} else {
|
|
|
|
// we couldn't promote this reference, the connection has
|
|
|
|
// died, so clean-up!
|
|
|
|
mDisplayEventConnections.removeAt(i);
|
|
|
|
--i; --count;
|
2012-04-04 05:09:52 +00:00
|
|
|
}
|
2012-08-17 22:06:02 +00:00
|
|
|
}
|
2012-04-04 05:09:52 +00:00
|
|
|
|
2012-08-21 22:47:28 +00:00
|
|
|
// Here we figure out if we need to enable or disable vsyncs
|
|
|
|
if (timestamp && !waitForVSync) {
|
|
|
|
// we received a VSYNC but we have no clients
|
|
|
|
// don't report it, and disable VSYNC events
|
|
|
|
disableVSyncLocked();
|
|
|
|
} else if (!timestamp && waitForVSync) {
|
2012-08-30 23:34:41 +00:00
|
|
|
// we have at least one client, so we want vsync enabled
|
|
|
|
// (TODO: this function is called right after we finish
|
|
|
|
// notifying clients of a vsync, so this call will be made
|
|
|
|
// at the vsync rate, e.g. 60fps. If we can accurately
|
|
|
|
// track the current state we could avoid making this call
|
|
|
|
// so often.)
|
2012-08-21 22:47:28 +00:00
|
|
|
enableVSyncLocked();
|
2012-08-17 22:06:02 +00:00
|
|
|
}
|
2012-04-04 05:09:52 +00:00
|
|
|
|
2012-08-30 23:34:41 +00:00
|
|
|
// note: !timestamp implies signalConnections.isEmpty(), because we
|
|
|
|
// don't populate signalConnections if there's no vsync pending
|
2012-09-20 00:31:36 +00:00
|
|
|
if (!timestamp && !eventPending) {
|
2012-08-21 22:47:28 +00:00
|
|
|
// wait for something to happen
|
2012-08-30 23:34:41 +00:00
|
|
|
if (waitForVSync) {
|
|
|
|
// This is where we spend most of our time, waiting
|
|
|
|
// for vsync events and new client registrations.
|
|
|
|
//
|
|
|
|
// If the screen is off, we can't use h/w vsync, so we
|
|
|
|
// use a 16ms timeout instead. It doesn't need to be
|
|
|
|
// precise, we just need to keep feeding our clients.
|
|
|
|
//
|
|
|
|
// We don't want to stall if there's a driver bug, so we
|
|
|
|
// use a (long) timeout when waiting for h/w vsync, and
|
|
|
|
// generate fake events when necessary.
|
|
|
|
bool softwareSync = mUseSoftwareVSync;
|
|
|
|
nsecs_t timeout = softwareSync ? ms2ns(16) : ms2ns(1000);
|
|
|
|
if (mCondition.waitRelative(mLock, timeout) == TIMED_OUT) {
|
|
|
|
if (!softwareSync) {
|
|
|
|
ALOGW("Timed out waiting for hw vsync; faking it");
|
|
|
|
}
|
2012-09-21 06:24:19 +00:00
|
|
|
// FIXME: how do we decide which display id the fake
|
|
|
|
// vsync came from ?
|
|
|
|
mVSyncEvent[0].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC;
|
2013-08-16 21:28:37 +00:00
|
|
|
mVSyncEvent[0].header.id = DisplayDevice::DISPLAY_PRIMARY;
|
2012-09-21 06:24:19 +00:00
|
|
|
mVSyncEvent[0].header.timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
|
|
|
|
mVSyncEvent[0].vsync.count++;
|
2012-08-21 22:47:28 +00:00
|
|
|
}
|
|
|
|
} else {
|
2012-08-30 23:34:41 +00:00
|
|
|
// Nobody is interested in vsync, so we just want to sleep.
|
|
|
|
// h/w vsync should be disabled, so this will wait until we
|
|
|
|
// get a new connection, or an existing connection becomes
|
|
|
|
// interested in receiving vsync again.
|
2012-08-21 03:07:34 +00:00
|
|
|
mCondition.wait(mLock);
|
|
|
|
}
|
2012-04-04 05:09:52 +00:00
|
|
|
}
|
2012-08-21 22:47:28 +00:00
|
|
|
} while (signalConnections.isEmpty());
|
2011-11-18 01:49:17 +00:00
|
|
|
|
2012-08-21 22:47:28 +00:00
|
|
|
// here we're guaranteed to have a timestamp and some connections to signal
|
2012-08-30 23:34:41 +00:00
|
|
|
// (The connections might have dropped out of mDisplayEventConnections
|
|
|
|
// while we were asleep, but we'll still have strong references to them.)
|
2012-08-21 22:47:28 +00:00
|
|
|
return signalConnections;
|
2011-11-18 01:49:17 +00:00
|
|
|
}
|
|
|
|
|
2012-04-11 04:04:02 +00:00
|
|
|
void EventThread::enableVSyncLocked() {
|
|
|
|
if (!mUseSoftwareVSync) {
|
|
|
|
// never enable h/w VSYNC when screen is off
|
2013-07-30 22:10:32 +00:00
|
|
|
if (!mVsyncEnabled) {
|
|
|
|
mVsyncEnabled = true;
|
|
|
|
mVSyncSource->setCallback(static_cast<VSyncSource::Callback*>(this));
|
|
|
|
mVSyncSource->setVSyncEnabled(true);
|
|
|
|
mPowerHAL.vsyncHint(true);
|
|
|
|
}
|
2012-04-11 04:04:02 +00:00
|
|
|
}
|
2012-04-11 01:25:31 +00:00
|
|
|
mDebugVsyncEnabled = true;
|
|
|
|
}
|
|
|
|
|
2012-04-11 04:04:02 +00:00
|
|
|
void EventThread::disableVSyncLocked() {
|
2013-07-30 22:10:32 +00:00
|
|
|
if (mVsyncEnabled) {
|
|
|
|
mVsyncEnabled = false;
|
|
|
|
mVSyncSource->setVSyncEnabled(false);
|
|
|
|
mPowerHAL.vsyncHint(false);
|
|
|
|
mDebugVsyncEnabled = false;
|
|
|
|
}
|
2012-04-11 01:25:31 +00:00
|
|
|
}
|
|
|
|
|
2013-04-22 14:55:35 +00:00
|
|
|
void EventThread::dump(String8& result) const {
|
2011-11-18 01:49:17 +00:00
|
|
|
Mutex::Autolock _l(mLock);
|
2012-04-11 01:25:31 +00:00
|
|
|
result.appendFormat("VSYNC state: %s\n",
|
|
|
|
mDebugVsyncEnabled?"enabled":"disabled");
|
2012-04-11 04:04:02 +00:00
|
|
|
result.appendFormat(" soft-vsync: %s\n",
|
|
|
|
mUseSoftwareVSync?"enabled":"disabled");
|
2012-04-11 01:25:31 +00:00
|
|
|
result.appendFormat(" numListeners=%u,\n events-delivered: %u\n",
|
2012-09-21 06:24:19 +00:00
|
|
|
mDisplayEventConnections.size(),
|
2013-08-16 21:28:37 +00:00
|
|
|
mVSyncEvent[DisplayDevice::DISPLAY_PRIMARY].vsync.count);
|
2012-04-11 01:25:31 +00:00
|
|
|
for (size_t i=0 ; i<mDisplayEventConnections.size() ; i++) {
|
|
|
|
sp<Connection> connection =
|
|
|
|
mDisplayEventConnections.itemAt(i).promote();
|
|
|
|
result.appendFormat(" %p: count=%d\n",
|
|
|
|
connection.get(), connection!=NULL ? connection->count : 0);
|
|
|
|
}
|
2011-11-18 01:49:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2012-04-04 00:48:03 +00:00
|
|
|
EventThread::Connection::Connection(
|
|
|
|
const sp<EventThread>& eventThread)
|
|
|
|
: count(-1), mEventThread(eventThread), mChannel(new BitTube())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
EventThread::Connection::~Connection() {
|
2012-08-21 22:47:28 +00:00
|
|
|
// do nothing here -- clean-up will happen automatically
|
|
|
|
// when the main thread wakes up
|
2012-04-04 00:48:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EventThread::Connection::onFirstRef() {
|
|
|
|
// NOTE: mEventThread doesn't hold a strong reference on us
|
|
|
|
mEventThread->registerDisplayEventConnection(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
sp<BitTube> EventThread::Connection::getDataChannel() const {
|
|
|
|
return mChannel;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventThread::Connection::setVsyncRate(uint32_t count) {
|
|
|
|
mEventThread->setVsyncRate(count, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventThread::Connection::requestNextVsync() {
|
|
|
|
mEventThread->requestNextVsync(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
status_t EventThread::Connection::postEvent(
|
|
|
|
const DisplayEventReceiver::Event& event) {
|
|
|
|
ssize_t size = DisplayEventReceiver::sendEvents(mChannel, &event, 1);
|
|
|
|
return size < 0 ? status_t(size) : status_t(NO_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2011-11-18 01:49:17 +00:00
|
|
|
}; // namespace android
|