From 1473f46cbc82aa6f0ba744cc896a36923823d55b Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 10 Apr 2009 14:24:30 -0700 Subject: Integrate from //sandbox/mathias/donut/...@145728 SurfaceFlinger rework for new EGL driver model support. --- libs/ui/ISurfaceComposer.cpp | 90 -------------------------------------------- 1 file changed, 90 deletions(-) (limited to 'libs/ui/ISurfaceComposer.cpp') diff --git a/libs/ui/ISurfaceComposer.cpp b/libs/ui/ISurfaceComposer.cpp index 76597e171259..1932bf90b2e9 100644 --- a/libs/ui/ISurfaceComposer.cpp +++ b/libs/ui/ISurfaceComposer.cpp @@ -114,36 +114,6 @@ public: remote()->transact(BnSurfaceComposer::BOOT_FINISHED, data, &reply); } - virtual status_t requestGPU( - const sp& callback, gpu_info_t* gpu) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeStrongBinder(callback->asBinder()); - remote()->transact(BnSurfaceComposer::REQUEST_GPU, data, &reply); - gpu->regs = interface_cast(reply.readStrongBinder()); - gpu->count = reply.readInt32(); - - // FIXME: for now, we don't dynamically allocate the regions array - size_t maxCount = sizeof(gpu->regions)/sizeof(*gpu->regions); - if (gpu->count > maxCount) - return BAD_VALUE; - - for (size_t i=0 ; icount ; i++) { - gpu->regions[i].region = interface_cast(reply.readStrongBinder()); - gpu->regions[i].reserved = reply.readInt32(); - } - return reply.readInt32(); - } - - virtual status_t revokeGPU() - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - remote()->transact(BnSurfaceComposer::REVOKE_GPU, data, &reply); - return reply.readInt32(); - } - virtual void signal() const { Parcel data, reply; @@ -201,9 +171,6 @@ status_t BnSurfaceComposer::onTransact( case BOOT_FINISHED: { bootFinished(); } break; - case REVOKE_GPU: { - reply->writeInt32( revokeGPU() ); - } break; case SIGNAL: { signal(); } break; @@ -211,26 +178,6 @@ status_t BnSurfaceComposer::onTransact( sp b = getCblk()->asBinder(); reply->writeStrongBinder(b); } break; - case REQUEST_GPU: { - // TODO: this should be protected by a permission - gpu_info_t info; - sp callback - = interface_cast(data.readStrongBinder()); - status_t res = requestGPU(callback, &info); - - // FIXME: for now, we don't dynamically allocate the regions array - size_t maxCount = sizeof(info.regions)/sizeof(*info.regions); - if (info.count > maxCount) - return BAD_VALUE; - - reply->writeStrongBinder(info.regs->asBinder()); - reply->writeInt32(info.count); - for (size_t i=0 ; iwriteStrongBinder(info.regions[i].region->asBinder()); - reply->writeInt32(info.regions[i].reserved); - } - reply->writeInt32(res); - } break; default: return UNKNOWN_TRANSACTION; } @@ -239,41 +186,4 @@ status_t BnSurfaceComposer::onTransact( // ---------------------------------------------------------------------------- -enum { - // Note: BOOT_FINISHED must remain this value, it is called by ActivityManagerService. - GPU_LOST = IBinder::FIRST_CALL_TRANSACTION -}; - -class BpGPUCallback : public BpInterface -{ -public: - BpGPUCallback(const sp& impl) - : BpInterface(impl) - { - } - - virtual void gpuLost() - { - Parcel data, reply; - data.writeInterfaceToken(IGPUCallback::getInterfaceDescriptor()); - remote()->transact(GPU_LOST, data, &reply, IBinder::FLAG_ONEWAY); - } -}; - -IMPLEMENT_META_INTERFACE(GPUCallback, "android.ui.IGPUCallback"); - -status_t BnGPUCallback::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) -{ - switch(code) { - case GPU_LOST: { - CHECK_INTERFACE(IGPUCallback, data, reply); - gpuLost(); - return NO_ERROR; - } break; - default: - return BBinder::onTransact(code, data, reply, flags); - } -} - }; -- cgit v1.2.3-59-g8ed1b From d763b5d9197e01662cafa376e1227e53e0463a3c Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Thu, 2 Jul 2009 18:11:53 -0700 Subject: get rid of references to MemoryDealer in SurfaceFlinger --- include/ui/ISurfaceComposer.h | 2 +- include/ui/ISurfaceFlingerClient.h | 2 +- include/ui/SurfaceComposerClient.h | 2 +- libs/surfaceflinger/Layer.h | 1 - libs/surfaceflinger/LayerBitmap.cpp | 1 - libs/surfaceflinger/LayerBitmap.h | 1 - libs/surfaceflinger/LayerBuffer.h | 1 - libs/surfaceflinger/SurfaceFlinger.cpp | 54 ++++++++++++++++------------------ libs/surfaceflinger/SurfaceFlinger.h | 28 ++++++++++-------- libs/ui/ISurfaceComposer.cpp | 4 +-- libs/ui/ISurfaceFlingerClient.cpp | 7 ++--- libs/ui/SurfaceComposerClient.cpp | 10 +++---- 12 files changed, 55 insertions(+), 58 deletions(-) (limited to 'libs/ui/ISurfaceComposer.cpp') diff --git a/include/ui/ISurfaceComposer.h b/include/ui/ISurfaceComposer.h index ce2b94c3e160..1788265b5840 100644 --- a/include/ui/ISurfaceComposer.h +++ b/include/ui/ISurfaceComposer.h @@ -92,7 +92,7 @@ public: virtual sp createConnection() = 0; /* retrieve the control block */ - virtual sp getCblk() const = 0; + virtual sp getCblk() const = 0; /* open/close transactions. recquires ACCESS_SURFACE_FLINGER permission */ virtual void openGlobalTransaction() = 0; diff --git a/include/ui/ISurfaceFlingerClient.h b/include/ui/ISurfaceFlingerClient.h index e93a4fafe281..932a70a854a1 100644 --- a/include/ui/ISurfaceFlingerClient.h +++ b/include/ui/ISurfaceFlingerClient.h @@ -56,7 +56,7 @@ public: status_t writeToParcel(Parcel* parcel) const; }; - virtual void getControlBlocks(sp* ctl) const = 0; + virtual sp getControlBlock() const = 0; virtual sp createSurface( surface_data_t* data, int pid, diff --git a/include/ui/SurfaceComposerClient.h b/include/ui/SurfaceComposerClient.h index 2a35256d2889..286f8850fd93 100644 --- a/include/ui/SurfaceComposerClient.h +++ b/include/ui/SurfaceComposerClient.h @@ -149,7 +149,7 @@ private: // after assignment status_t mStatus; per_client_cblk_t* mControl; - sp mControlMemory; + sp mControlMemory; sp mClient; SurfaceFlingerSynchro* mSignalServer; }; diff --git a/libs/surfaceflinger/Layer.h b/libs/surfaceflinger/Layer.h index 54d994facc7d..4c13d6ea2887 100644 --- a/libs/surfaceflinger/Layer.h +++ b/libs/surfaceflinger/Layer.h @@ -42,7 +42,6 @@ namespace android { class Client; class LayerBitmap; -class MemoryDealer; class FreezeLock; // --------------------------------------------------------------------------- diff --git a/libs/surfaceflinger/LayerBitmap.cpp b/libs/surfaceflinger/LayerBitmap.cpp index e0984fe48c7c..9fffbbfbb9ff 100644 --- a/libs/surfaceflinger/LayerBitmap.cpp +++ b/libs/surfaceflinger/LayerBitmap.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include diff --git a/libs/surfaceflinger/LayerBitmap.h b/libs/surfaceflinger/LayerBitmap.h index f3636c03e03b..22525cebdfc5 100644 --- a/libs/surfaceflinger/LayerBitmap.h +++ b/libs/surfaceflinger/LayerBitmap.h @@ -40,7 +40,6 @@ namespace android { // --------------------------------------------------------------------------- class IMemory; -class MemoryDealer; class LayerBitmap; // =========================================================================== diff --git a/libs/surfaceflinger/LayerBuffer.h b/libs/surfaceflinger/LayerBuffer.h index cd541a513024..fe879ebd976e 100644 --- a/libs/surfaceflinger/LayerBuffer.h +++ b/libs/surfaceflinger/LayerBuffer.h @@ -32,7 +32,6 @@ namespace android { // --------------------------------------------------------------------------- -class MemoryDealer; class Region; class OverlayRef; diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index c38668113213..5ac1cfd932c9 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -31,8 +31,8 @@ #include #include -#include -#include +#include + #include #include #include @@ -217,9 +217,9 @@ overlay_control_device_t* SurfaceFlinger::getOverlayEngine() const return graphicPlane(0).displayHardware().getOverlayEngine(); } -sp SurfaceFlinger::getCblk() const +sp SurfaceFlinger::getCblk() const { - return mServerCblkMemory; + return mServerHeap; } sp SurfaceFlinger::createConnection() @@ -238,7 +238,7 @@ sp SurfaceFlinger::createConnection() return 0; } sp bclient = - new BClient(this, token, client->controlBlockMemory()); + new BClient(this, token, client->getControlBlockMemory()); return bclient; } @@ -301,7 +301,6 @@ void SurfaceFlinger::onFirstRef() mReadyToRunBarrier.wait(); } - static inline uint16_t pack565(int r, int g, int b) { return (r<<11)|(g<<5)|b; } @@ -311,17 +310,6 @@ status_t SurfaceFlinger::readyToRun() LOGI( "SurfaceFlinger's main thread ready to run. " "Initializing graphics H/W..."); - // create the shared control-block - mServerHeap = new MemoryDealer(4096, MemoryDealer::READ_ONLY); - LOGE_IF(mServerHeap==0, "can't create shared memory dealer"); - - mServerCblkMemory = mServerHeap->allocate(4096); - LOGE_IF(mServerCblkMemory==0, "can't create shared control block"); - - mServerCblk = static_cast(mServerCblkMemory->pointer()); - LOGE_IF(mServerCblk==0, "can't get to shared control block's address"); - new(mServerCblk) surface_flinger_cblk_t; - // we only support one display currently int dpy = 0; @@ -332,6 +320,16 @@ status_t SurfaceFlinger::readyToRun() plane.setDisplayHardware(hw); } + // create the shared control-block + mServerHeap = new MemoryHeapBase(4096, + MemoryHeapBase::READ_ONLY, "SurfaceFlinger read-only heap"); + LOGE_IF(mServerHeap==0, "can't create shared memory dealer"); + + mServerCblk = static_cast(mServerHeap->getBase()); + LOGE_IF(mServerCblk==0, "can't get to shared control block's address"); + + new(mServerCblk) surface_flinger_cblk_t; + // initialize primary screen // (other display should be initialized in the same manner, but // asynchronously, as they could come and go. None of this is supported @@ -1615,14 +1613,14 @@ Client::Client(ClientID clientID, const sp& flinger) : ctrlblk(0), cid(clientID), mPid(0), mBitmap(0), mFlinger(flinger) { const int pgsize = getpagesize(); - const int cblksize=((sizeof(per_client_cblk_t)+(pgsize-1))&~(pgsize-1)); - mCblkHeap = new MemoryDealer(cblksize); - mCblkMemory = mCblkHeap->allocate(cblksize); - if (mCblkMemory != 0) { - ctrlblk = static_cast(mCblkMemory->pointer()); - if (ctrlblk) { // construct the shared structure in-place. - new(ctrlblk) per_client_cblk_t; - } + const int cblksize = ((sizeof(per_client_cblk_t)+(pgsize-1))&~(pgsize-1)); + + mCblkHeap = new MemoryHeapBase(cblksize, 0, + "SurfaceFlinger Client control-block"); + + ctrlblk = static_cast(mCblkHeap->getBase()); + if (ctrlblk) { // construct the shared structure in-place. + new(ctrlblk) per_client_cblk_t; } } @@ -1685,7 +1683,7 @@ void Client::dump(const char* what) #pragma mark - #endif -BClient::BClient(SurfaceFlinger *flinger, ClientID cid, const sp& cblk) +BClient::BClient(SurfaceFlinger *flinger, ClientID cid, const sp& cblk) : mId(cid), mFlinger(flinger), mCblk(cblk) { } @@ -1695,8 +1693,8 @@ BClient::~BClient() { mFlinger->destroyConnection(mId); } -void BClient::getControlBlocks(sp* ctrl) const { - *ctrl = mCblk; +sp BClient::getControlBlock() const { + return mCblk; } sp BClient::createSurface( diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/libs/surfaceflinger/SurfaceFlinger.h index b7b008d9ff06..d0095a2bdfeb 100644 --- a/libs/surfaceflinger/SurfaceFlinger.h +++ b/libs/surfaceflinger/SurfaceFlinger.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include @@ -76,25 +76,30 @@ public: inline bool isValid(int32_t i) const; sp getLayerUser(int32_t i) const; - const Vector< wp >& getLayers() const { return mLayers; } - const sp& controlBlockMemory() const { return mCblkMemory; } void dump(const char* what); + const Vector< wp >& getLayers() const { + return mLayers; + } + + const sp& getControlBlockMemory() const { + return mCblkHeap; + } + // pointer to this client's control block per_client_cblk_t* ctrlblk; ClientID cid; private: - int getClientPid() const { return mPid; } + int getClientPid() const { return mPid; } int mPid; uint32_t mBitmap; SortedVector mInUse; Vector< wp > mLayers; - sp mCblkHeap; + sp mCblkHeap; sp mFlinger; - sp mCblkMemory; }; // --------------------------------------------------------------------------- @@ -154,7 +159,7 @@ public: // ISurfaceComposer interface virtual sp createConnection(); - virtual sp getCblk() const; + virtual sp getCblk() const; virtual void bootFinished(); virtual void openGlobalTransaction(); virtual void closeGlobalTransaction(); @@ -317,8 +322,7 @@ private: Vector< sp > mDisconnectedClients; // constant members (no synchronization needed for access) - sp mServerHeap; - sp mServerCblkMemory; + sp mServerHeap; surface_flinger_cblk_t* mServerCblk; GLuint mWormholeTexName; nsecs_t mBootTime; @@ -377,11 +381,11 @@ class BClient : public BnSurfaceFlingerClient { public: BClient(SurfaceFlinger *flinger, ClientID cid, - const sp& cblk); + const sp& cblk); ~BClient(); // ISurfaceFlingerClient interface - virtual void getControlBlocks(sp* ctrl) const; + virtual sp getControlBlock() const; virtual sp createSurface( surface_data_t* params, int pid, @@ -394,7 +398,7 @@ public: private: ClientID mId; SurfaceFlinger* mFlinger; - sp mCblk; + sp mCblk; }; // --------------------------------------------------------------------------- diff --git a/libs/ui/ISurfaceComposer.cpp b/libs/ui/ISurfaceComposer.cpp index 2aa1405b0c75..fd2a590caff6 100644 --- a/libs/ui/ISurfaceComposer.cpp +++ b/libs/ui/ISurfaceComposer.cpp @@ -54,12 +54,12 @@ public: return interface_cast(reply.readStrongBinder()); } - virtual sp getCblk() const + virtual sp getCblk() const { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); remote()->transact(BnSurfaceComposer::GET_CBLK, data, &reply); - return interface_cast(reply.readStrongBinder()); + return interface_cast(reply.readStrongBinder()); } virtual void openGlobalTransaction() diff --git a/libs/ui/ISurfaceFlingerClient.cpp b/libs/ui/ISurfaceFlingerClient.cpp index 46c12afe898d..51e8422606f9 100644 --- a/libs/ui/ISurfaceFlingerClient.cpp +++ b/libs/ui/ISurfaceFlingerClient.cpp @@ -64,12 +64,12 @@ public: { } - virtual void getControlBlocks(sp* ctl) const + virtual sp getControlBlock() const { Parcel data, reply; data.writeInterfaceToken(ISurfaceFlingerClient::getInterfaceDescriptor()); remote()->transact(GET_CBLK, data, &reply); - *ctl = interface_cast(reply.readStrongBinder()); + return interface_cast(reply.readStrongBinder()); } virtual sp createSurface( surface_data_t* params, @@ -126,8 +126,7 @@ status_t BnSurfaceFlingerClient::onTransact( switch(code) { case GET_CBLK: { CHECK_INTERFACE(ISurfaceFlingerClient, data, reply); - sp ctl; - getControlBlocks(&ctl); + sp ctl(getControlBlock()); reply->writeStrongBinder(ctl->asBinder()); return NO_ERROR; } break; diff --git a/libs/ui/SurfaceComposerClient.cpp b/libs/ui/SurfaceComposerClient.cpp index 025bf6e385b0..d2cef785778a 100644 --- a/libs/ui/SurfaceComposerClient.cpp +++ b/libs/ui/SurfaceComposerClient.cpp @@ -59,7 +59,7 @@ static Mutex gLock; static sp gSurfaceManager; static DefaultKeyedVector< sp, sp > gActiveConnections; static SortedVector > gOpenTransactions; -static sp gServerCblkMemory; +static sp gServerCblkMemory; static volatile surface_flinger_cblk_t* gServerCblk; const sp& _get_surface_manager() @@ -94,7 +94,7 @@ static volatile surface_flinger_cblk_t const * get_cblk() if (gServerCblk == 0) { gServerCblkMemory = sm->getCblk(); LOGE_IF(gServerCblkMemory==0, "Can't get server control block"); - gServerCblk = (surface_flinger_cblk_t *)gServerCblkMemory->pointer(); + gServerCblk = (surface_flinger_cblk_t *)gServerCblkMemory->getBase(); LOGE_IF(gServerCblk==0, "Can't get server control block address"); } } @@ -313,9 +313,9 @@ void SurfaceComposerClient::_init( return; } - mClient->getControlBlocks(&mControlMemory); + mControlMemory = mClient->getControlBlock(); mSignalServer = new SurfaceFlingerSynchro(sm); - mControl = static_cast(mControlMemory->pointer()); + mControl = static_cast(mControlMemory->getBase()); } SurfaceComposerClient::~SurfaceComposerClient() @@ -364,7 +364,7 @@ void SurfaceComposerClient::dispose() { // this can be called more than once. - sp controlMemory; + sp controlMemory; sp client; { -- cgit v1.2.3-59-g8ed1b