summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-07-02 18:11:53 -0700
committerMathias Agopian <mathias@google.com>2009-07-02 18:50:51 -0700
commit7303c6bf1a8b00a0e7d8165d774a1f259b4ccda9 (patch)
tree329ae25bcf03c06ddca3828a038bd499c63dbee0
parent6b5513538aedc19c624ff7a260c832dcfae630f2 (diff)
downloadframeworks_native-7303c6bf1a8b00a0e7d8165d774a1f259b4ccda9.zip
frameworks_native-7303c6bf1a8b00a0e7d8165d774a1f259b4ccda9.tar.gz
frameworks_native-7303c6bf1a8b00a0e7d8165d774a1f259b4ccda9.tar.bz2
get rid of references to MemoryDealer in SurfaceFlinger
-rw-r--r--include/ui/ISurfaceComposer.h2
-rw-r--r--include/ui/ISurfaceFlingerClient.h2
-rw-r--r--include/ui/SurfaceComposerClient.h2
-rw-r--r--libs/surfaceflinger/Layer.h1
-rw-r--r--libs/surfaceflinger/LayerBitmap.cpp1
-rw-r--r--libs/surfaceflinger/LayerBitmap.h1
-rw-r--r--libs/surfaceflinger/LayerBuffer.h1
-rw-r--r--libs/surfaceflinger/SurfaceFlinger.cpp54
-rw-r--r--libs/surfaceflinger/SurfaceFlinger.h28
-rw-r--r--libs/ui/ISurfaceComposer.cpp4
-rw-r--r--libs/ui/ISurfaceFlingerClient.cpp7
-rw-r--r--libs/ui/SurfaceComposerClient.cpp10
12 files changed, 55 insertions, 58 deletions
diff --git a/include/ui/ISurfaceComposer.h b/include/ui/ISurfaceComposer.h
index ce2b94c..1788265 100644
--- a/include/ui/ISurfaceComposer.h
+++ b/include/ui/ISurfaceComposer.h
@@ -92,7 +92,7 @@ public:
virtual sp<ISurfaceFlingerClient> createConnection() = 0;
/* retrieve the control block */
- virtual sp<IMemory> getCblk() const = 0;
+ virtual sp<IMemoryHeap> 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 e93a4fa..932a70a 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<IMemory>* ctl) const = 0;
+ virtual sp<IMemoryHeap> getControlBlock() const = 0;
virtual sp<ISurface> createSurface( surface_data_t* data,
int pid,
diff --git a/include/ui/SurfaceComposerClient.h b/include/ui/SurfaceComposerClient.h
index 2a35256..286f885 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<IMemory> mControlMemory;
+ sp<IMemoryHeap> mControlMemory;
sp<ISurfaceFlingerClient> mClient;
SurfaceFlingerSynchro* mSignalServer;
};
diff --git a/libs/surfaceflinger/Layer.h b/libs/surfaceflinger/Layer.h
index 54d994f..4c13d6e 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 e0984fe..9fffbbf 100644
--- a/libs/surfaceflinger/LayerBitmap.cpp
+++ b/libs/surfaceflinger/LayerBitmap.cpp
@@ -20,7 +20,6 @@
#include <utils/Errors.h>
#include <utils/Log.h>
-#include <binder/MemoryDealer.h>
#include <binder/MemoryBase.h>
#include <binder/IMemory.h>
diff --git a/libs/surfaceflinger/LayerBitmap.h b/libs/surfaceflinger/LayerBitmap.h
index f3636c0..22525ce 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 cd541a5..fe879eb 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 c386681..5ac1cfd 100644
--- a/libs/surfaceflinger/SurfaceFlinger.cpp
+++ b/libs/surfaceflinger/SurfaceFlinger.cpp
@@ -31,8 +31,8 @@
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
-#include <binder/MemoryDealer.h>
-#include <binder/MemoryBase.h>
+#include <binder/MemoryHeapBase.h>
+
#include <utils/String8.h>
#include <utils/String16.h>
#include <utils/StopWatch.h>
@@ -217,9 +217,9 @@ overlay_control_device_t* SurfaceFlinger::getOverlayEngine() const
return graphicPlane(0).displayHardware().getOverlayEngine();
}
-sp<IMemory> SurfaceFlinger::getCblk() const
+sp<IMemoryHeap> SurfaceFlinger::getCblk() const
{
- return mServerCblkMemory;
+ return mServerHeap;
}
sp<ISurfaceFlingerClient> SurfaceFlinger::createConnection()
@@ -238,7 +238,7 @@ sp<ISurfaceFlingerClient> SurfaceFlinger::createConnection()
return 0;
}
sp<BClient> 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<surface_flinger_cblk_t *>(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<surface_flinger_cblk_t*>(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<SurfaceFlinger>& 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<per_client_cblk_t *>(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<per_client_cblk_t *>(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<IMemory>& cblk)
+BClient::BClient(SurfaceFlinger *flinger, ClientID cid, const sp<IMemoryHeap>& cblk)
: mId(cid), mFlinger(flinger), mCblk(cblk)
{
}
@@ -1695,8 +1693,8 @@ BClient::~BClient() {
mFlinger->destroyConnection(mId);
}
-void BClient::getControlBlocks(sp<IMemory>* ctrl) const {
- *ctrl = mCblk;
+sp<IMemoryHeap> BClient::getControlBlock() const {
+ return mCblk;
}
sp<ISurface> BClient::createSurface(
diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/libs/surfaceflinger/SurfaceFlinger.h
index b7b008d..d0095a2 100644
--- a/libs/surfaceflinger/SurfaceFlinger.h
+++ b/libs/surfaceflinger/SurfaceFlinger.h
@@ -27,7 +27,7 @@
#include <utils/Errors.h>
#include <utils/RefBase.h>
-#include <binder/MemoryDealer.h>
+#include <binder/IMemory.h>
#include <binder/Permission.h>
#include <ui/PixelFormat.h>
@@ -76,25 +76,30 @@ public:
inline bool isValid(int32_t i) const;
sp<LayerBaseClient> getLayerUser(int32_t i) const;
- const Vector< wp<LayerBaseClient> >& getLayers() const { return mLayers; }
- const sp<IMemory>& controlBlockMemory() const { return mCblkMemory; }
void dump(const char* what);
+ const Vector< wp<LayerBaseClient> >& getLayers() const {
+ return mLayers;
+ }
+
+ const sp<IMemoryHeap>& 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<uint8_t> mInUse;
Vector< wp<LayerBaseClient> > mLayers;
- sp<MemoryDealer> mCblkHeap;
+ sp<IMemoryHeap> mCblkHeap;
sp<SurfaceFlinger> mFlinger;
- sp<IMemory> mCblkMemory;
};
// ---------------------------------------------------------------------------
@@ -154,7 +159,7 @@ public:
// ISurfaceComposer interface
virtual sp<ISurfaceFlingerClient> createConnection();
- virtual sp<IMemory> getCblk() const;
+ virtual sp<IMemoryHeap> getCblk() const;
virtual void bootFinished();
virtual void openGlobalTransaction();
virtual void closeGlobalTransaction();
@@ -317,8 +322,7 @@ private:
Vector< sp<Client> > mDisconnectedClients;
// constant members (no synchronization needed for access)
- sp<MemoryDealer> mServerHeap;
- sp<IMemory> mServerCblkMemory;
+ sp<IMemoryHeap> 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<IMemory>& cblk);
+ const sp<IMemoryHeap>& cblk);
~BClient();
// ISurfaceFlingerClient interface
- virtual void getControlBlocks(sp<IMemory>* ctrl) const;
+ virtual sp<IMemoryHeap> getControlBlock() const;
virtual sp<ISurface> createSurface(
surface_data_t* params, int pid,
@@ -394,7 +398,7 @@ public:
private:
ClientID mId;
SurfaceFlinger* mFlinger;
- sp<IMemory> mCblk;
+ sp<IMemoryHeap> mCblk;
};
// ---------------------------------------------------------------------------
diff --git a/libs/ui/ISurfaceComposer.cpp b/libs/ui/ISurfaceComposer.cpp
index 2aa1405..fd2a590 100644
--- a/libs/ui/ISurfaceComposer.cpp
+++ b/libs/ui/ISurfaceComposer.cpp
@@ -54,12 +54,12 @@ public:
return interface_cast<ISurfaceFlingerClient>(reply.readStrongBinder());
}
- virtual sp<IMemory> getCblk() const
+ virtual sp<IMemoryHeap> getCblk() const
{
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
remote()->transact(BnSurfaceComposer::GET_CBLK, data, &reply);
- return interface_cast<IMemory>(reply.readStrongBinder());
+ return interface_cast<IMemoryHeap>(reply.readStrongBinder());
}
virtual void openGlobalTransaction()
diff --git a/libs/ui/ISurfaceFlingerClient.cpp b/libs/ui/ISurfaceFlingerClient.cpp
index 46c12af..51e8422 100644
--- a/libs/ui/ISurfaceFlingerClient.cpp
+++ b/libs/ui/ISurfaceFlingerClient.cpp
@@ -64,12 +64,12 @@ public:
{
}
- virtual void getControlBlocks(sp<IMemory>* ctl) const
+ virtual sp<IMemoryHeap> getControlBlock() const
{
Parcel data, reply;
data.writeInterfaceToken(ISurfaceFlingerClient::getInterfaceDescriptor());
remote()->transact(GET_CBLK, data, &reply);
- *ctl = interface_cast<IMemory>(reply.readStrongBinder());
+ return interface_cast<IMemoryHeap>(reply.readStrongBinder());
}
virtual sp<ISurface> createSurface( surface_data_t* params,
@@ -126,8 +126,7 @@ status_t BnSurfaceFlingerClient::onTransact(
switch(code) {
case GET_CBLK: {
CHECK_INTERFACE(ISurfaceFlingerClient, data, reply);
- sp<IMemory> ctl;
- getControlBlocks(&ctl);
+ sp<IMemoryHeap> ctl(getControlBlock());
reply->writeStrongBinder(ctl->asBinder());
return NO_ERROR;
} break;
diff --git a/libs/ui/SurfaceComposerClient.cpp b/libs/ui/SurfaceComposerClient.cpp
index 025bf6e..d2cef78 100644
--- a/libs/ui/SurfaceComposerClient.cpp
+++ b/libs/ui/SurfaceComposerClient.cpp
@@ -59,7 +59,7 @@ static Mutex gLock;
static sp<ISurfaceComposer> gSurfaceManager;
static DefaultKeyedVector< sp<IBinder>, sp<SurfaceComposerClient> > gActiveConnections;
static SortedVector<sp<SurfaceComposerClient> > gOpenTransactions;
-static sp<IMemory> gServerCblkMemory;
+static sp<IMemoryHeap> gServerCblkMemory;
static volatile surface_flinger_cblk_t* gServerCblk;
const sp<ISurfaceComposer>& _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<per_client_cblk_t *>(mControlMemory->pointer());
+ mControl = static_cast<per_client_cblk_t *>(mControlMemory->getBase());
}
SurfaceComposerClient::~SurfaceComposerClient()
@@ -364,7 +364,7 @@ void SurfaceComposerClient::dispose()
{
// this can be called more than once.
- sp<IMemory> controlMemory;
+ sp<IMemoryHeap> controlMemory;
sp<ISurfaceFlingerClient> client;
{