summaryrefslogtreecommitdiff
path: root/libs/gui/ISurfaceComposer.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2011-11-17 17:49:17 -0800
committer Mathias Agopian <mathias@google.com> 2011-11-29 11:44:05 -0800
commit461afeb9fde149f9455acbadf1257d08d33e8eb3 (patch)
tree5ebdaeee094ef363806ab45502980e120bed434d /libs/gui/ISurfaceComposer.cpp
parent3ad3807a5c4039618175c042a1121c926c2c62e9 (diff)
Add support for sending VSYNC events to the framework
use gui/DisplayEvent to receive the events. Events are dispatched through a unix pipe, so the API is compatible with utils/Looper. see gui/DisplayEvent.h for more info. Bug: 1475048 Change-Id: If4126023fc9c067e56087ec7d16a8fd542ce1794
Diffstat (limited to 'libs/gui/ISurfaceComposer.cpp')
-rw-r--r--libs/gui/ISurfaceComposer.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 86bc62aa28..db3282781a 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -29,6 +29,9 @@
#include <surfaceflinger/ISurfaceComposer.h>
+#include <gui/BitTube.h>
+#include <gui/IDisplayEventConnection.h>
+
#include <ui/DisplayInfo.h>
#include <gui/ISurfaceTexture.h>
@@ -44,6 +47,8 @@
namespace android {
+class IDisplayEventConnection;
+
class BpSurfaceComposer : public BpInterface<ISurfaceComposer>
{
public:
@@ -174,6 +179,27 @@ public:
}
return result != 0;
}
+
+ virtual sp<IDisplayEventConnection> createDisplayEventConnection()
+ {
+ Parcel data, reply;
+ sp<IDisplayEventConnection> result;
+ int err = data.writeInterfaceToken(
+ ISurfaceComposer::getInterfaceDescriptor());
+ if (err != NO_ERROR) {
+ return result;
+ }
+ err = remote()->transact(
+ BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION,
+ data, &reply);
+ if (err != NO_ERROR) {
+ LOGE("ISurfaceComposer::createDisplayEventConnection: error performing "
+ "transaction: %s (%d)", strerror(-err), -err);
+ return result;
+ }
+ result = interface_cast<IDisplayEventConnection>(reply.readStrongBinder());
+ return result;
+ }
};
IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer");
@@ -254,6 +280,12 @@ status_t BnSurfaceComposer::onTransact(
int32_t result = authenticateSurfaceTexture(surfaceTexture) ? 1 : 0;
reply->writeInt32(result);
} break;
+ case CREATE_DISPLAY_EVENT_CONNECTION: {
+ CHECK_INTERFACE(ISurfaceComposer, data, reply);
+ sp<IDisplayEventConnection> connection(createDisplayEventConnection());
+ reply->writeStrongBinder(connection->asBinder());
+ return NO_ERROR;
+ } break;
default:
return BBinder::onTransact(code, data, reply, flags);
}