From b7e930db175c192464cebdeb49eb56cf6dd60114 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 1 Jun 2010 15:12:58 -0700 Subject: split surface management from surface's buffers management Change-Id: If3c5655d1231f8f0c49ba68f972b1b20c93b3f87 --- include/private/surfaceflinger/SharedBufferStack.h | 3 +- include/surfaceflinger/ISurfaceComposer.h | 6 +++- include/surfaceflinger/ISurfaceComposerClient.h | 1 + include/surfaceflinger/Surface.h | 9 +++-- include/surfaceflinger/SurfaceComposerClient.h | 38 ++++++++++------------ include/ui/GraphicBuffer.h | 13 ++++---- 6 files changed, 37 insertions(+), 33 deletions(-) (limited to 'include') diff --git a/include/private/surfaceflinger/SharedBufferStack.h b/include/private/surfaceflinger/SharedBufferStack.h index dcce25e923..c11c855524 100644 --- a/include/private/surfaceflinger/SharedBufferStack.h +++ b/include/private/surfaceflinger/SharedBufferStack.h @@ -122,7 +122,8 @@ public: 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 3271cfd475..dd44aa5afa 100644 --- a/include/surfaceflinger/ISurfaceComposer.h +++ b/include/surfaceflinger/ISurfaceComposer.h @@ -85,9 +85,12 @@ public: /* create connection with surface flinger, requires * ACCESS_SURFACE_FLINGER permission */ - virtual sp createConnection() = 0; + /* create a client connection with surface flinger + */ + virtual sp createClientConnection() = 0; + /* retrieve the control block */ virtual sp getCblk() const = 0; @@ -123,6 +126,7 @@ public: // 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 b2a4766bc4..a1e9e04884 100644 --- a/include/surfaceflinger/ISurfaceComposerClient.h +++ b/include/surfaceflinger/ISurfaceComposerClient.h @@ -58,6 +58,7 @@ public: }; virtual sp getControlBlock() const = 0; + virtual ssize_t getTokenForSurface(const sp& sur) const = 0; /* * Requires ACCESS_SURFACE_FLINGER permission diff --git a/include/surfaceflinger/Surface.h b/include/surfaceflinger/Surface.h index 295797066f..67dc693429 100644 --- a/include/surfaceflinger/Surface.h +++ b/include/surfaceflinger/Surface.h @@ -229,7 +229,6 @@ private: */ void init(); status_t validate() const; - status_t initCheck() const; sp getISurface() const; inline const GraphicBufferMapper& getBufferMapper() const { return mBufferMapper; } @@ -264,15 +263,15 @@ private: }; // constants - sp mClient; + GraphicBufferMapper& mBufferMapper; + SurfaceClient& mClient; + SharedBufferClient* mSharedBufferClient; + status_t mInitCheck; sp 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 8e28a815bf..8773d7133b 100644 --- a/include/surfaceflinger/SurfaceComposerClient.h +++ b/include/surfaceflinger/SurfaceComposerClient.h @@ -22,8 +22,9 @@ #include -#include #include +#include +#include #include #include @@ -39,6 +40,22 @@ class Region; class SharedClient; class ISurfaceComposer; class DisplayInfo; +class surface_flinger_cblk_t; + +// --------------------------------------------------------------------------- + +class ComposerService : public Singleton +{ + // these are constants + sp mComposerService; + sp mServerCblkMemory; + surface_flinger_cblk_t volatile* mServerCblk; + ComposerService(); + friend class Singleton; +public: + static sp getComposerService(); + static surface_flinger_cblk_t const volatile * getControlBlock(); +}; // --------------------------------------------------------------------------- @@ -152,25 +169,6 @@ private: sp mClient; }; -// --------------------------------------------------------------------------- - -class SurfaceClient : public RefBase -{ - // all these attributes are constants - status_t mStatus; - SharedClient* mControl; - sp mControlMemory; - sp mConnection; - sp mComposerService; - void init(const sp& conn); -public: - explicit SurfaceClient(const sp& conn); - explicit SurfaceClient(const sp& client); - status_t initCheck() const; - SharedClient* getSharedClient() const; - void signalServer() const; -}; - // --------------------------------------------------------------------------- }; // namespace android diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h index e72b6b3b8e..a3e85a96aa 100644 --- a/include/ui/GraphicBuffer.h +++ b/include/ui/GraphicBuffer.h @@ -93,10 +93,8 @@ public: 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 @@ protected: 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 @@ private: GraphicBufferMapper& mBufferMapper; ssize_t mInitCheck; - uint32_t mVStride; int mIndex; }; -- cgit v1.2.3-59-g8ed1b