split surface management from surface's buffers management
Change-Id: If3c5655d1231f8f0c49ba68f972b1b20c93b3f87
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -85,9 +85,12 @@ public:
|
||||
/* 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 @@ public:
|
||||
// Java by ActivityManagerService.
|
||||
BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
|
||||
CREATE_CONNECTION,
|
||||
CREATE_CLIENT_CONNECTION,
|
||||
GET_CBLK,
|
||||
OPEN_GLOBAL_TRANSACTION,
|
||||
CLOSE_GLOBAL_TRANSACTION,
|
||||
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
};
|
||||
|
||||
virtual sp<IMemoryHeap> getControlBlock() const = 0;
|
||||
virtual ssize_t getTokenForSurface(const sp<ISurface>& sur) const = 0;
|
||||
|
||||
/*
|
||||
* Requires ACCESS_SURFACE_FLINGER permission
|
||||
|
||||
@@ -229,7 +229,6 @@ private:
|
||||
*/
|
||||
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 @@ private:
|
||||
};
|
||||
|
||||
// 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;
|
||||
|
||||
@@ -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 Region;
|
||||
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();
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -152,25 +169,6 @@ private:
|
||||
sp<ISurfaceComposerClient> mClient;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user