summaryrefslogtreecommitdiffstats
path: root/include/gui/SurfaceTexture.h
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-07-13 19:12:20 -0700
committerJamie Gennis <jgennis@google.com>2011-07-14 17:48:32 -0700
commit9709687463dc5f1255f435e57b3d2beed8b70330 (patch)
tree3a3a66468d3cc2d7b86871eb2f17acea86af7907 /include/gui/SurfaceTexture.h
parenta775f0d4193dffc336b295dc06056f81801eba9e (diff)
downloadframeworks_base-9709687463dc5f1255f435e57b3d2beed8b70330.zip
frameworks_base-9709687463dc5f1255f435e57b3d2beed8b70330.tar.gz
frameworks_base-9709687463dc5f1255f435e57b3d2beed8b70330.tar.bz2
SurfaceTexture: make (dis)connect into an IPC
This change makes the ANativeWindow connect and disconnect calls result in an IPC to the SurfaceTexture object. This will allow us to prevent multiple simultaneous connections from different processes. Change-Id: Id9aa1003b1335b96ca6bd4a1f5a67aa433d42efb
Diffstat (limited to 'include/gui/SurfaceTexture.h')
-rw-r--r--include/gui/SurfaceTexture.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
index e36360c..4080f27 100644
--- a/include/gui/SurfaceTexture.h
+++ b/include/gui/SurfaceTexture.h
@@ -44,6 +44,7 @@ public:
MIN_SYNC_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS
};
enum { NUM_BUFFER_SLOTS = 32 };
+ enum { NO_CONNECTED_API = 0 };
struct FrameAvailableListener : public virtual RefBase {
// onFrameAvailable() is called from queueBuffer() each time an
@@ -97,6 +98,24 @@ public:
// The default mode is asynchronous.
virtual status_t setSynchronousMode(bool enabled);
+ // connect attempts to connect a client API to the SurfaceTexture. This
+ // must be called before any other ISurfaceTexture methods are called except
+ // for getAllocator.
+ //
+ // This method will fail if the connect was previously called on the
+ // SurfaceTexture and no corresponding disconnect call was made.
+ virtual status_t connect(int api);
+
+ // disconnect attempts to disconnect a client API from the SurfaceTexture.
+ // Calling this method will cause any subsequent calls to other
+ // ISurfaceTexture methods to fail except for getAllocator and connect.
+ // Successfully calling connect after this will allow the other methods to
+ // succeed again.
+ //
+ // This method will fail if the the SurfaceTexture is not currently
+ // connected to the specified client API.
+ virtual status_t disconnect(int api);
+
// updateTexImage sets the image contents of the target texture to that of
// the most recently queued buffer.
//
@@ -362,6 +381,11 @@ private:
// mAllowSynchronousMode whether we allow synchronous mode or not
const bool mAllowSynchronousMode;
+ // mConnectedApi indicates the API that is currently connected to this
+ // SurfaceTexture. It defaults to NO_CONNECTED_API (= 0), and gets updated
+ // by the connect and disconnect methods.
+ int mConnectedApi;
+
// mDequeueCondition condition used for dequeueBuffer in synchronous mode
mutable Condition mDequeueCondition;