am 5220af87: am 770492cb: more clean-up in preparation of bigger changes
This commit is contained in:
commit
d13f23fca6
@ -136,9 +136,7 @@ class SharedClient
|
||||
public:
|
||||
SharedClient();
|
||||
~SharedClient();
|
||||
|
||||
status_t validate(size_t token) const;
|
||||
uint32_t getIdentity(size_t token) const;
|
||||
|
||||
private:
|
||||
friend class SharedBufferBase;
|
||||
@ -160,6 +158,7 @@ public:
|
||||
int32_t identity);
|
||||
~SharedBufferBase();
|
||||
status_t getStatus() const;
|
||||
int32_t getIdentity() const;
|
||||
size_t getFrontBuffer() const;
|
||||
String8 dump(char const* prefix) const;
|
||||
|
||||
|
@ -53,10 +53,24 @@ protected:
|
||||
public:
|
||||
DECLARE_META_INTERFACE(Surface);
|
||||
|
||||
/*
|
||||
* requests a new buffer for the given index. If w, h, or format are
|
||||
* null the buffer is created with the parameters assigned to the
|
||||
* surface it is bound to. Otherwise the buffer's parameters are
|
||||
* set to those specified.
|
||||
*/
|
||||
virtual sp<GraphicBuffer> requestBuffer(int bufferIdx,
|
||||
uint32_t w, uint32_t h, uint32_t format, uint32_t usage) = 0;
|
||||
|
||||
/*
|
||||
* sets the number of buffers dequeuable for this surface.
|
||||
*/
|
||||
virtual status_t setBufferCount(int bufferCount) = 0;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Deprecated...
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
class BufferHeap {
|
||||
public:
|
||||
enum {
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <ui/PixelFormat.h>
|
||||
|
||||
#include <surfaceflinger/ISurfaceFlingerClient.h>
|
||||
#include <surfaceflinger/ISurfaceComposerClient.h>
|
||||
|
||||
namespace android {
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -86,7 +86,7 @@ public:
|
||||
* ACCESS_SURFACE_FLINGER permission
|
||||
*/
|
||||
|
||||
virtual sp<ISurfaceFlingerClient> createConnection() = 0;
|
||||
virtual sp<ISurfaceComposerClient> createConnection() = 0;
|
||||
|
||||
/* retrieve the control block */
|
||||
virtual sp<IMemoryHeap> getCblk() const = 0;
|
||||
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_SF_ISURFACE_FLINGER_CLIENT_H
|
||||
#define ANDROID_SF_ISURFACE_FLINGER_CLIENT_H
|
||||
#ifndef ANDROID_SF_ISURFACE_COMPOSER_CLIENT_H
|
||||
#define ANDROID_SF_ISURFACE_COMPOSER_CLIENT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
@ -26,7 +26,7 @@
|
||||
#include <binder/IInterface.h>
|
||||
|
||||
#include <ui/PixelFormat.h>
|
||||
|
||||
|
||||
#include <surfaceflinger/ISurface.h>
|
||||
|
||||
namespace android {
|
||||
@ -42,10 +42,10 @@ typedef int32_t DisplayID;
|
||||
|
||||
class layer_state_t;
|
||||
|
||||
class ISurfaceFlingerClient : public IInterface
|
||||
class ISurfaceComposerClient : public IInterface
|
||||
{
|
||||
public:
|
||||
DECLARE_META_INTERFACE(SurfaceFlingerClient);
|
||||
public:
|
||||
DECLARE_META_INTERFACE(SurfaceComposerClient);
|
||||
|
||||
struct surface_data_t {
|
||||
int32_t token;
|
||||
@ -56,21 +56,21 @@ public:
|
||||
status_t readFromParcel(const Parcel& parcel);
|
||||
status_t writeToParcel(Parcel* parcel) const;
|
||||
};
|
||||
|
||||
|
||||
virtual sp<IMemoryHeap> getControlBlock() const = 0;
|
||||
|
||||
/*
|
||||
* Requires ACCESS_SURFACE_FLINGER permission
|
||||
*/
|
||||
virtual sp<ISurface> createSurface( surface_data_t* data,
|
||||
int pid,
|
||||
int pid,
|
||||
const String8& name,
|
||||
DisplayID display,
|
||||
uint32_t w,
|
||||
uint32_t h,
|
||||
PixelFormat format,
|
||||
uint32_t flags) = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Requires ACCESS_SURFACE_FLINGER permission
|
||||
*/
|
||||
@ -84,7 +84,7 @@ public:
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class BnSurfaceFlingerClient : public BnInterface<ISurfaceFlingerClient>
|
||||
class BnSurfaceComposerClient : public BnInterface<ISurfaceComposerClient>
|
||||
{
|
||||
public:
|
||||
virtual status_t onTransact( uint32_t code,
|
||||
@ -97,4 +97,4 @@ public:
|
||||
|
||||
}; // namespace android
|
||||
|
||||
#endif // ANDROID_SF_ISURFACE_FLINGER_CLIENT_H
|
||||
#endif // ANDROID_SF_ISURFACE_COMPOSER_CLIENT_H
|
@ -28,7 +28,7 @@
|
||||
#include <ui/egl/android_natives.h>
|
||||
|
||||
#include <surfaceflinger/ISurface.h>
|
||||
#include <surfaceflinger/ISurfaceFlingerClient.h>
|
||||
#include <surfaceflinger/ISurfaceComposerClient.h>
|
||||
|
||||
#define ANDROID_VIEW_SURFACE_JNI_ID "mNativeSurface"
|
||||
|
||||
@ -108,7 +108,7 @@ private:
|
||||
SurfaceControl(
|
||||
const sp<SurfaceComposerClient>& client,
|
||||
const sp<ISurface>& surface,
|
||||
const ISurfaceFlingerClient::surface_data_t& data,
|
||||
const ISurfaceComposerClient::surface_data_t& data,
|
||||
uint32_t w, uint32_t h, PixelFormat format, uint32_t flags);
|
||||
|
||||
~SurfaceControl();
|
||||
|
@ -149,7 +149,7 @@ private:
|
||||
// these don't need to be protected because they never change
|
||||
// after assignment
|
||||
status_t mStatus;
|
||||
sp<ISurfaceFlingerClient> mClient;
|
||||
sp<ISurfaceComposerClient> mClient;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -161,7 +161,7 @@ class SurfaceClient : public RefBase
|
||||
SharedClient* mControl;
|
||||
sp<IMemoryHeap> mControlMemory;
|
||||
sp<IBinder> mConnection;
|
||||
sp<ISurfaceComposer> mSignalServer;
|
||||
sp<ISurfaceComposer> mComposerService;
|
||||
void init(const sp<IBinder>& conn);
|
||||
public:
|
||||
explicit SurfaceClient(const sp<IBinder>& conn);
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <ui/Region.h>
|
||||
#include <ui/Overlay.h>
|
||||
|
||||
#include <surfaceflinger/ISurfaceFlingerClient.h>
|
||||
#include <surfaceflinger/ISurfaceComposerClient.h>
|
||||
#include <private/surfaceflinger/SharedBufferStack.h>
|
||||
#include <private/surfaceflinger/LayerState.h>
|
||||
|
||||
|
@ -225,7 +225,7 @@ sp<IMemoryHeap> SurfaceFlinger::getCblk() const
|
||||
return mServerHeap;
|
||||
}
|
||||
|
||||
sp<ISurfaceFlingerClient> SurfaceFlinger::createConnection()
|
||||
sp<ISurfaceComposerClient> SurfaceFlinger::createConnection()
|
||||
{
|
||||
Mutex::Autolock _l(mStateLock);
|
||||
uint32_t token = mTokens.acquire();
|
||||
@ -1230,7 +1230,7 @@ int SurfaceFlinger::setOrientation(DisplayID dpy,
|
||||
}
|
||||
|
||||
sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid,
|
||||
const String8& name, ISurfaceFlingerClient::surface_data_t* params,
|
||||
const String8& name, ISurfaceComposerClient::surface_data_t* params,
|
||||
DisplayID d, uint32_t w, uint32_t h, PixelFormat format,
|
||||
uint32_t flags)
|
||||
{
|
||||
@ -1740,7 +1740,7 @@ sp<IMemoryHeap> BClient::getControlBlock() const {
|
||||
}
|
||||
|
||||
sp<ISurface> BClient::createSurface(
|
||||
ISurfaceFlingerClient::surface_data_t* params, int pid,
|
||||
ISurfaceComposerClient::surface_data_t* params, int pid,
|
||||
const String8& name,
|
||||
DisplayID display, uint32_t w, uint32_t h, PixelFormat format,
|
||||
uint32_t flags)
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include <ui/PixelFormat.h>
|
||||
#include <surfaceflinger/ISurfaceComposer.h>
|
||||
#include <surfaceflinger/ISurfaceFlingerClient.h>
|
||||
#include <surfaceflinger/ISurfaceComposerClient.h>
|
||||
|
||||
#include "Barrier.h"
|
||||
#include "Layer.h"
|
||||
@ -158,7 +158,7 @@ public:
|
||||
virtual status_t dump(int fd, const Vector<String16>& args);
|
||||
|
||||
// ISurfaceComposer interface
|
||||
virtual sp<ISurfaceFlingerClient> createConnection();
|
||||
virtual sp<ISurfaceComposerClient> createConnection();
|
||||
virtual sp<IMemoryHeap> getCblk() const;
|
||||
virtual void bootFinished();
|
||||
virtual void openGlobalTransaction();
|
||||
@ -189,7 +189,7 @@ private:
|
||||
friend class LayerDim;
|
||||
|
||||
sp<ISurface> createSurface(ClientID client, int pid, const String8& name,
|
||||
ISurfaceFlingerClient::surface_data_t* params,
|
||||
ISurfaceComposerClient::surface_data_t* params,
|
||||
DisplayID display, uint32_t w, uint32_t h, PixelFormat format,
|
||||
uint32_t flags);
|
||||
|
||||
@ -393,14 +393,14 @@ public:
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class BClient : public BnSurfaceFlingerClient
|
||||
class BClient : public BnSurfaceComposerClient
|
||||
{
|
||||
public:
|
||||
BClient(SurfaceFlinger *flinger, ClientID cid,
|
||||
const sp<IMemoryHeap>& cblk);
|
||||
~BClient();
|
||||
|
||||
// ISurfaceFlingerClient interface
|
||||
// ISurfaceComposerClient interface
|
||||
virtual sp<IMemoryHeap> getControlBlock() const;
|
||||
|
||||
virtual sp<ISurface> createSurface(
|
||||
|
@ -4,7 +4,7 @@ include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES:= \
|
||||
ISurfaceComposer.cpp \
|
||||
ISurface.cpp \
|
||||
ISurfaceFlingerClient.cpp \
|
||||
ISurfaceComposerClient.cpp \
|
||||
LayerState.cpp \
|
||||
SharedBufferStack.cpp \
|
||||
Surface.cpp \
|
||||
|
@ -46,13 +46,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual sp<ISurfaceFlingerClient> createConnection()
|
||||
virtual sp<ISurfaceComposerClient> createConnection()
|
||||
{
|
||||
uint32_t n;
|
||||
Parcel data, reply;
|
||||
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
|
||||
remote()->transact(BnSurfaceComposer::CREATE_CONNECTION, data, &reply);
|
||||
return interface_cast<ISurfaceFlingerClient>(reply.readStrongBinder());
|
||||
return interface_cast<ISurfaceComposerClient>(reply.readStrongBinder());
|
||||
}
|
||||
|
||||
virtual sp<IMemoryHeap> getCblk() const
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <ui/Rect.h>
|
||||
|
||||
#include <surfaceflinger/ISurface.h>
|
||||
#include <surfaceflinger/ISurfaceFlingerClient.h>
|
||||
#include <surfaceflinger/ISurfaceComposerClient.h>
|
||||
#include <private/surfaceflinger/LayerState.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -56,18 +56,18 @@ enum {
|
||||
SET_STATE
|
||||
};
|
||||
|
||||
class BpSurfaceFlingerClient : public BpInterface<ISurfaceFlingerClient>
|
||||
class BpSurfaceComposerClient : public BpInterface<ISurfaceComposerClient>
|
||||
{
|
||||
public:
|
||||
BpSurfaceFlingerClient(const sp<IBinder>& impl)
|
||||
: BpInterface<ISurfaceFlingerClient>(impl)
|
||||
BpSurfaceComposerClient(const sp<IBinder>& impl)
|
||||
: BpInterface<ISurfaceComposerClient>(impl)
|
||||
{
|
||||
}
|
||||
|
||||
virtual sp<IMemoryHeap> getControlBlock() const
|
||||
{
|
||||
Parcel data, reply;
|
||||
data.writeInterfaceToken(ISurfaceFlingerClient::getInterfaceDescriptor());
|
||||
data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor());
|
||||
remote()->transact(GET_CBLK, data, &reply);
|
||||
return interface_cast<IMemoryHeap>(reply.readStrongBinder());
|
||||
}
|
||||
@ -82,7 +82,7 @@ public:
|
||||
uint32_t flags)
|
||||
{
|
||||
Parcel data, reply;
|
||||
data.writeInterfaceToken(ISurfaceFlingerClient::getInterfaceDescriptor());
|
||||
data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor());
|
||||
data.writeInt32(pid);
|
||||
data.writeString8(name);
|
||||
data.writeInt32(display);
|
||||
@ -94,11 +94,11 @@ public:
|
||||
params->readFromParcel(reply);
|
||||
return interface_cast<ISurface>(reply.readStrongBinder());
|
||||
}
|
||||
|
||||
|
||||
virtual status_t destroySurface(SurfaceID sid)
|
||||
{
|
||||
Parcel data, reply;
|
||||
data.writeInterfaceToken(ISurfaceFlingerClient::getInterfaceDescriptor());
|
||||
data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor());
|
||||
data.writeInt32(sid);
|
||||
remote()->transact(DESTROY_SURFACE, data, &reply);
|
||||
return reply.readInt32();
|
||||
@ -107,7 +107,7 @@ public:
|
||||
virtual status_t setState(int32_t count, const layer_state_t* states)
|
||||
{
|
||||
Parcel data, reply;
|
||||
data.writeInterfaceToken(ISurfaceFlingerClient::getInterfaceDescriptor());
|
||||
data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor());
|
||||
data.writeInt32(count);
|
||||
for (int i=0 ; i<count ; i++)
|
||||
states[i].write(data);
|
||||
@ -116,18 +116,18 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_META_INTERFACE(SurfaceFlingerClient, "android.ui.ISurfaceFlingerClient");
|
||||
IMPLEMENT_META_INTERFACE(SurfaceComposerClient, "android.ui.ISurfaceComposerClient");
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
status_t BnSurfaceFlingerClient::onTransact(
|
||||
status_t BnSurfaceComposerClient::onTransact(
|
||||
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
|
||||
{
|
||||
// codes that don't require permission check
|
||||
|
||||
switch(code) {
|
||||
case GET_CBLK: {
|
||||
CHECK_INTERFACE(ISurfaceFlingerClient, data, reply);
|
||||
CHECK_INTERFACE(ISurfaceComposerClient, data, reply);
|
||||
sp<IMemoryHeap> ctl(getControlBlock());
|
||||
reply->writeStrongBinder(ctl->asBinder());
|
||||
return NO_ERROR;
|
||||
@ -135,7 +135,7 @@ status_t BnSurfaceFlingerClient::onTransact(
|
||||
}
|
||||
|
||||
// these must be checked
|
||||
|
||||
|
||||
IPCThreadState* ipc = IPCThreadState::self();
|
||||
const int pid = ipc->getCallingPid();
|
||||
const int uid = ipc->getCallingUid();
|
||||
@ -150,10 +150,10 @@ status_t BnSurfaceFlingerClient::onTransact(
|
||||
return PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch(code) {
|
||||
case CREATE_SURFACE: {
|
||||
CHECK_INTERFACE(ISurfaceFlingerClient, data, reply);
|
||||
CHECK_INTERFACE(ISurfaceComposerClient, data, reply);
|
||||
surface_data_t params;
|
||||
int32_t pid = data.readInt32();
|
||||
String8 name = data.readString8();
|
||||
@ -169,12 +169,12 @@ status_t BnSurfaceFlingerClient::onTransact(
|
||||
return NO_ERROR;
|
||||
} break;
|
||||
case DESTROY_SURFACE: {
|
||||
CHECK_INTERFACE(ISurfaceFlingerClient, data, reply);
|
||||
CHECK_INTERFACE(ISurfaceComposerClient, data, reply);
|
||||
reply->writeInt32( destroySurface( data.readInt32() ) );
|
||||
return NO_ERROR;
|
||||
} break;
|
||||
case SET_STATE: {
|
||||
CHECK_INTERFACE(ISurfaceFlingerClient, data, reply);
|
||||
CHECK_INTERFACE(ISurfaceComposerClient, data, reply);
|
||||
int32_t count = data.readInt32();
|
||||
layer_state_t* states = new layer_state_t[count];
|
||||
for (int i=0 ; i<count ; i++)
|
||||
@ -191,7 +191,7 @@ status_t BnSurfaceFlingerClient::onTransact(
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
status_t ISurfaceFlingerClient::surface_data_t::readFromParcel(const Parcel& parcel)
|
||||
status_t ISurfaceComposerClient::surface_data_t::readFromParcel(const Parcel& parcel)
|
||||
{
|
||||
token = parcel.readInt32();
|
||||
identity = parcel.readInt32();
|
||||
@ -201,7 +201,7 @@ status_t ISurfaceFlingerClient::surface_data_t::readFromParcel(const Parcel& par
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
status_t ISurfaceFlingerClient::surface_data_t::writeToParcel(Parcel* parcel) const
|
||||
status_t ISurfaceComposerClient::surface_data_t::writeToParcel(Parcel* parcel) const
|
||||
{
|
||||
parcel->writeInt32(token);
|
||||
parcel->writeInt32(identity);
|
@ -49,10 +49,6 @@ status_t SharedClient::validate(size_t i) const {
|
||||
return surfaces[i].status;
|
||||
}
|
||||
|
||||
uint32_t SharedClient::getIdentity(size_t token) const {
|
||||
return uint32_t(surfaces[token].identity);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -161,6 +157,12 @@ status_t SharedBufferBase::getStatus() const
|
||||
return stack.status;
|
||||
}
|
||||
|
||||
int32_t SharedBufferBase::getIdentity() const
|
||||
{
|
||||
SharedBufferStack& stack( *mSharedStack );
|
||||
return stack.identity;
|
||||
}
|
||||
|
||||
size_t SharedBufferBase::getFrontBuffer() const
|
||||
{
|
||||
SharedBufferStack& stack( *mSharedStack );
|
||||
|
@ -104,7 +104,7 @@ static status_t copyBlt(
|
||||
SurfaceControl::SurfaceControl(
|
||||
const sp<SurfaceComposerClient>& client,
|
||||
const sp<ISurface>& surface,
|
||||
const ISurfaceFlingerClient::surface_data_t& data,
|
||||
const ISurfaceComposerClient::surface_data_t& data,
|
||||
uint32_t w, uint32_t h, PixelFormat format, uint32_t flags)
|
||||
: mClient(client), mSurface(surface),
|
||||
mToken(data.token), mIdentity(data.identity),
|
||||
@ -278,7 +278,6 @@ sp<Surface> SurfaceControl::getSurface() const
|
||||
// Surface
|
||||
// ============================================================================
|
||||
|
||||
|
||||
Surface::Surface(const sp<SurfaceControl>& surface)
|
||||
: mSurface(surface->mSurface),
|
||||
mToken(surface->mToken), mIdentity(surface->mIdentity),
|
||||
@ -369,7 +368,7 @@ status_t Surface::initCheck() const
|
||||
LOGE("cblk is null (surface id=%d, identity=%u)", mToken, mIdentity);
|
||||
return NO_INIT;
|
||||
}
|
||||
return NO_ERROR;
|
||||
return cblk->validate(mToken);
|
||||
}
|
||||
|
||||
bool Surface::isValid() {
|
||||
@ -386,9 +385,7 @@ status_t Surface::validate() const
|
||||
}
|
||||
|
||||
// verify the identity of this surface
|
||||
SharedClient const* cblk = mClient->getSharedClient();
|
||||
|
||||
uint32_t identity = cblk->getIdentity(mToken);
|
||||
uint32_t identity = mSharedBufferClient->getIdentity();
|
||||
|
||||
// this is a bit of a (temporary) special case, identity==0 means that
|
||||
// no operation are allowed from the client (eg: dequeue/queue), this
|
||||
@ -406,7 +403,7 @@ status_t Surface::validate() const
|
||||
}
|
||||
|
||||
// check the surface didn't become invalid
|
||||
status_t err = cblk->validate(mToken);
|
||||
status_t err = mSharedBufferClient->getStatus();
|
||||
if (err != NO_ERROR) {
|
||||
LOGE("surface (id=%d, identity=%u) is invalid, err=%d (%s)",
|
||||
mToken, mIdentity, err, strerror(-err));
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <ui/DisplayInfo.h>
|
||||
|
||||
#include <surfaceflinger/ISurfaceComposer.h>
|
||||
#include <surfaceflinger/ISurfaceFlingerClient.h>
|
||||
#include <surfaceflinger/ISurfaceComposerClient.h>
|
||||
#include <surfaceflinger/ISurface.h>
|
||||
#include <surfaceflinger/SurfaceComposerClient.h>
|
||||
|
||||
@ -42,18 +42,14 @@
|
||||
namespace android {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class Composer : public Singleton<Composer>
|
||||
class ComposerService : public Singleton<ComposerService>
|
||||
{
|
||||
// these are constants
|
||||
sp<ISurfaceComposer> mComposerService;
|
||||
sp<IMemoryHeap> mServerCblkMemory;
|
||||
surface_flinger_cblk_t volatile* mServerCblk;
|
||||
|
||||
Mutex mLock;
|
||||
SortedVector< wp<SurfaceComposerClient> > mActiveConnections;
|
||||
SortedVector<sp<SurfaceComposerClient> > mOpenTransactions;
|
||||
|
||||
Composer() : Singleton<Composer>() {
|
||||
ComposerService() : Singleton<ComposerService>() {
|
||||
const String16 name("SurfaceFlinger");
|
||||
while (getService(name, &mComposerService) != NO_ERROR) {
|
||||
usleep(250000);
|
||||
@ -63,6 +59,39 @@ class Composer : public Singleton<Composer>
|
||||
mServerCblkMemory->getBase());
|
||||
}
|
||||
|
||||
friend class Singleton<ComposerService>;
|
||||
|
||||
public:
|
||||
static sp<ISurfaceComposer> getComposerService() {
|
||||
return ComposerService::getInstance().mComposerService;
|
||||
}
|
||||
static surface_flinger_cblk_t const volatile * getControlBlock() {
|
||||
return ComposerService::getInstance().mServerCblk;
|
||||
}
|
||||
};
|
||||
|
||||
ANDROID_SINGLETON_STATIC_INSTANCE(ComposerService);
|
||||
|
||||
|
||||
static inline sp<ISurfaceComposer> getComposerService() {
|
||||
return ComposerService::getComposerService();
|
||||
}
|
||||
|
||||
static inline surface_flinger_cblk_t const volatile * get_cblk() {
|
||||
return ComposerService::getControlBlock();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class Composer : public Singleton<Composer>
|
||||
{
|
||||
Mutex mLock;
|
||||
SortedVector< wp<SurfaceComposerClient> > mActiveConnections;
|
||||
SortedVector<sp<SurfaceComposerClient> > mOpenTransactions;
|
||||
|
||||
Composer() : Singleton<Composer>() {
|
||||
}
|
||||
|
||||
void addClientImpl(const sp<SurfaceComposerClient>& client) {
|
||||
Mutex::Autolock _l(mLock);
|
||||
mActiveConnections.add(client);
|
||||
@ -102,7 +131,7 @@ class Composer : public Singleton<Composer>
|
||||
mOpenTransactions.clear();
|
||||
mLock.unlock();
|
||||
|
||||
sp<ISurfaceComposer> sm(mComposerService);
|
||||
sp<ISurfaceComposer> sm(getComposerService());
|
||||
sm->openGlobalTransaction();
|
||||
const size_t N = clients.size();
|
||||
for (size_t i=0; i<N; i++) {
|
||||
@ -114,12 +143,6 @@ class Composer : public Singleton<Composer>
|
||||
friend class Singleton<Composer>;
|
||||
|
||||
public:
|
||||
static sp<ISurfaceComposer> getComposerService() {
|
||||
return Composer::getInstance().mComposerService;
|
||||
}
|
||||
static surface_flinger_cblk_t const volatile * getControlBlock() {
|
||||
return Composer::getInstance().mServerCblk;
|
||||
}
|
||||
static void addClient(const sp<SurfaceComposerClient>& client) {
|
||||
Composer::getInstance().addClientImpl(client);
|
||||
}
|
||||
@ -136,14 +159,6 @@ public:
|
||||
|
||||
ANDROID_SINGLETON_STATIC_INSTANCE(Composer);
|
||||
|
||||
static inline sp<ISurfaceComposer> getComposerService() {
|
||||
return Composer::getComposerService();
|
||||
}
|
||||
|
||||
static inline surface_flinger_cblk_t const volatile * get_cblk() {
|
||||
return Composer::getControlBlock();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
static inline int compare_type( const layer_state_t& lhs,
|
||||
@ -162,7 +177,7 @@ void SurfaceComposerClient::onFirstRef()
|
||||
{
|
||||
sp<ISurfaceComposer> sm(getComposerService());
|
||||
if (sm != 0) {
|
||||
sp<ISurfaceFlingerClient> conn = sm->createConnection();
|
||||
sp<ISurfaceComposerClient> conn = sm->createConnection();
|
||||
if (conn != 0) {
|
||||
mClient = conn;
|
||||
Composer::addClient(this);
|
||||
@ -199,7 +214,7 @@ status_t SurfaceComposerClient::linkToComposerDeath(
|
||||
void SurfaceComposerClient::dispose()
|
||||
{
|
||||
// this can be called more than once.
|
||||
sp<ISurfaceFlingerClient> client;
|
||||
sp<ISurfaceComposerClient> client;
|
||||
Mutex::Autolock _lm(mLock);
|
||||
if (mClient != 0) {
|
||||
Composer::removeClient(this);
|
||||
@ -296,7 +311,7 @@ sp<SurfaceControl> SurfaceComposerClient::createSurface(
|
||||
{
|
||||
sp<SurfaceControl> result;
|
||||
if (mStatus == NO_ERROR) {
|
||||
ISurfaceFlingerClient::surface_data_t data;
|
||||
ISurfaceComposerClient::surface_data_t data;
|
||||
sp<ISurface> surface = mClient->createSurface(&data, pid, name,
|
||||
display, w, h, format, flags);
|
||||
if (surface != 0) {
|
||||
@ -558,8 +573,8 @@ SurfaceClient::SurfaceClient(const sp<IBinder>& conn)
|
||||
}
|
||||
void SurfaceClient::init(const sp<IBinder>& conn)
|
||||
{
|
||||
mSignalServer = getComposerService();
|
||||
sp<ISurfaceFlingerClient> sf(interface_cast<ISurfaceFlingerClient>(conn));
|
||||
mComposerService = getComposerService();
|
||||
sp<ISurfaceComposerClient> sf(interface_cast<ISurfaceComposerClient>(conn));
|
||||
if (sf != 0) {
|
||||
mConnection = conn;
|
||||
mControlMemory = sf->getControlBlock();
|
||||
@ -574,7 +589,7 @@ SharedClient* SurfaceClient::getSharedClient() const {
|
||||
return mControl;
|
||||
}
|
||||
void SurfaceClient::signalServer() const {
|
||||
mSignalServer->signal();
|
||||
mComposerService->signal();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user