split surface management from surface's buffers management
Change-Id: If3c5655d1231f8f0c49ba68f972b1b20c93b3f87
diff --git a/include/private/surfaceflinger/SharedBufferStack.h b/include/private/surfaceflinger/SharedBufferStack.h
index dcce25e..c11c855 100644
--- a/include/private/surfaceflinger/SharedBufferStack.h
+++ b/include/private/surfaceflinger/SharedBufferStack.h
@@ -122,7 +122,8 @@
volatile int8_t index[NUM_BUFFER_MAX];
int32_t identity; // surface's identity (const)
- int32_t reserved32[2];
+ int32_t token; // surface's token (for debugging)
+ int32_t reserved32[1];
Statistics stats;
int32_t reserved;
BufferData buffers[NUM_BUFFER_MAX]; // 960 bytes
diff --git a/include/surfaceflinger/ISurfaceComposer.h b/include/surfaceflinger/ISurfaceComposer.h
index 3271cfd..dd44aa5 100644
--- a/include/surfaceflinger/ISurfaceComposer.h
+++ b/include/surfaceflinger/ISurfaceComposer.h
@@ -85,9 +85,12 @@
/* create connection with surface flinger, requires
* ACCESS_SURFACE_FLINGER permission
*/
-
virtual sp<ISurfaceComposerClient> createConnection() = 0;
+ /* create a client connection with surface flinger
+ */
+ virtual sp<ISurfaceComposerClient> createClientConnection() = 0;
+
/* retrieve the control block */
virtual sp<IMemoryHeap> getCblk() const = 0;
@@ -123,6 +126,7 @@
// Java by ActivityManagerService.
BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
CREATE_CONNECTION,
+ CREATE_CLIENT_CONNECTION,
GET_CBLK,
OPEN_GLOBAL_TRANSACTION,
CLOSE_GLOBAL_TRANSACTION,
diff --git a/include/surfaceflinger/ISurfaceComposerClient.h b/include/surfaceflinger/ISurfaceComposerClient.h
index b2a4766..a1e9e04 100644
--- a/include/surfaceflinger/ISurfaceComposerClient.h
+++ b/include/surfaceflinger/ISurfaceComposerClient.h
@@ -58,6 +58,7 @@
};
virtual sp<IMemoryHeap> getControlBlock() const = 0;
+ virtual ssize_t getTokenForSurface(const sp<ISurface>& sur) const = 0;
/*
* Requires ACCESS_SURFACE_FLINGER permission
diff --git a/include/surfaceflinger/Surface.h b/include/surfaceflinger/Surface.h
index 2957970..67dc693 100644
--- a/include/surfaceflinger/Surface.h
+++ b/include/surfaceflinger/Surface.h
@@ -229,7 +229,6 @@
*/
void init();
status_t validate() const;
- status_t initCheck() const;
sp<ISurface> getISurface() const;
inline const GraphicBufferMapper& getBufferMapper() const { return mBufferMapper; }
@@ -264,15 +263,15 @@
};
// constants
- sp<SurfaceClient> mClient;
+ GraphicBufferMapper& mBufferMapper;
+ SurfaceClient& mClient;
+ SharedBufferClient* mSharedBufferClient;
+ status_t mInitCheck;
sp<ISurface> mSurface;
SurfaceID mToken;
uint32_t mIdentity;
PixelFormat mFormat;
uint32_t mFlags;
- GraphicBufferMapper& mBufferMapper;
- SharedBufferClient* mSharedBufferClient;
- status_t mInitCheck;
// protected by mSurfaceLock
Rect mSwapRectangle;
diff --git a/include/surfaceflinger/SurfaceComposerClient.h b/include/surfaceflinger/SurfaceComposerClient.h
index 8e28a81..8773d71 100644
--- a/include/surfaceflinger/SurfaceComposerClient.h
+++ b/include/surfaceflinger/SurfaceComposerClient.h
@@ -22,8 +22,9 @@
#include <binder/IBinder.h>
-#include <utils/SortedVector.h>
#include <utils/RefBase.h>
+#include <utils/Singleton.h>
+#include <utils/SortedVector.h>
#include <utils/threads.h>
#include <ui/PixelFormat.h>
@@ -39,6 +40,22 @@
class SharedClient;
class ISurfaceComposer;
class DisplayInfo;
+class surface_flinger_cblk_t;
+
+// ---------------------------------------------------------------------------
+
+class ComposerService : public Singleton<ComposerService>
+{
+ // these are constants
+ sp<ISurfaceComposer> mComposerService;
+ sp<IMemoryHeap> mServerCblkMemory;
+ surface_flinger_cblk_t volatile* mServerCblk;
+ ComposerService();
+ friend class Singleton<ComposerService>;
+public:
+ static sp<ISurfaceComposer> getComposerService();
+ static surface_flinger_cblk_t const volatile * getControlBlock();
+};
// ---------------------------------------------------------------------------
@@ -153,25 +170,6 @@
};
// ---------------------------------------------------------------------------
-
-class SurfaceClient : public RefBase
-{
- // all these attributes are constants
- status_t mStatus;
- SharedClient* mControl;
- sp<IMemoryHeap> mControlMemory;
- sp<IBinder> mConnection;
- sp<ISurfaceComposer> mComposerService;
- void init(const sp<IBinder>& conn);
-public:
- explicit SurfaceClient(const sp<IBinder>& conn);
- explicit SurfaceClient(const sp<SurfaceComposerClient>& client);
- status_t initCheck() const;
- SharedClient* getSharedClient() const;
- void signalServer() const;
-};
-
-// ---------------------------------------------------------------------------
}; // namespace android
#endif // ANDROID_SF_SURFACE_COMPOSER_CLIENT_H
diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h
index e72b6b3..a3e85a9 100644
--- a/include/ui/GraphicBuffer.h
+++ b/include/ui/GraphicBuffer.h
@@ -93,10 +93,8 @@
void setIndex(int index);
int getIndex() const;
- void setVerticalStride(uint32_t vstride);
- uint32_t getVerticalStride() const;
-protected:
+private:
virtual ~GraphicBuffer();
enum {
@@ -105,8 +103,12 @@
ownData = 2,
};
- inline const GraphicBufferMapper& getBufferMapper() const { return mBufferMapper; }
- inline GraphicBufferMapper& getBufferMapper() { return mBufferMapper; }
+ inline const GraphicBufferMapper& getBufferMapper() const {
+ return mBufferMapper;
+ }
+ inline GraphicBufferMapper& getBufferMapper() {
+ return mBufferMapper;
+ }
uint8_t mOwner;
private:
@@ -134,7 +136,6 @@
GraphicBufferMapper& mBufferMapper;
ssize_t mInitCheck;
- uint32_t mVStride;
int mIndex;
};