diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaceflinger/LayerBase.cpp | 8 | ||||
-rw-r--r-- | libs/surfaceflinger/LayerBase.h | 4 | ||||
-rw-r--r-- | libs/surfaceflinger/SurfaceFlinger.cpp | 13 | ||||
-rw-r--r-- | libs/surfaceflinger/SurfaceFlinger.h | 4 | ||||
-rw-r--r-- | libs/surfaceflinger_client/ISurfaceFlingerClient.cpp | 6 | ||||
-rw-r--r-- | libs/surfaceflinger_client/SurfaceComposerClient.cpp | 22 |
6 files changed, 49 insertions, 8 deletions
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp index a3d293f..b0109ca 100644 --- a/libs/surfaceflinger/LayerBase.cpp +++ b/libs/surfaceflinger/LayerBase.cpp @@ -728,6 +728,14 @@ LayerBaseClient::~LayerBaseClient() delete lcblk; } +void LayerBaseClient::setName(const String8& name) { + mName = name; +} + +String8 LayerBaseClient::getName() const { + return mName; +} + int32_t LayerBaseClient::serverIndex() const { sp<Client> client(this->client.promote()); diff --git a/libs/surfaceflinger/LayerBase.h b/libs/surfaceflinger/LayerBase.h index 6aacd82..7ac8bc5 100644 --- a/libs/surfaceflinger/LayerBase.h +++ b/libs/surfaceflinger/LayerBase.h @@ -320,6 +320,8 @@ public: const sp<Client>& client, int32_t i); virtual ~LayerBaseClient(); virtual void onFirstRef(); + void setName(const String8& name); + String8 getName() const; const wp<Client> client; @@ -333,6 +335,7 @@ public: virtual void onRemoved(); + class Surface : public BnSurface { public: @@ -371,6 +374,7 @@ private: mutable Mutex mLock; mutable wp<Surface> mClientSurface; // only read + String8 mName; const uint32_t mIdentity; static int32_t sIdentity; }; diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index 4555b3c..66ac4d2 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -1186,7 +1186,7 @@ int SurfaceFlinger::setOrientation(DisplayID dpy, } sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid, - ISurfaceFlingerClient::surface_data_t* params, + const String8& name, ISurfaceFlingerClient::surface_data_t* params, DisplayID d, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags) { @@ -1232,6 +1232,7 @@ sp<ISurface> SurfaceFlinger::createSurface(ClientID clientId, int pid, } if (layer != 0) { + layer->setName(name); setTransactionFlags(eTransactionNeeded); surfaceHandle = layer->getSurface(); if (surfaceHandle != 0) { @@ -1506,8 +1507,10 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) if (lbc != 0) { sp<Client> client(lbc->client.promote()); snprintf(buffer, SIZE, - " " - "id=0x%08x, client=0x%08x, identity=%u\n", + " name=%s\n", lbc->getName().string()); + result.append(buffer); + snprintf(buffer, SIZE, + " id=0x%08x, client=0x%08x, identity=%u\n", lbc->clientIndex(), client.get() ? client->cid : 0, lbc->getIdentity()); @@ -1760,10 +1763,12 @@ sp<IMemoryHeap> BClient::getControlBlock() const { sp<ISurface> BClient::createSurface( ISurfaceFlingerClient::surface_data_t* params, int pid, + const String8& name, DisplayID display, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags) { - return mFlinger->createSurface(mId, pid, params, display, w, h, format, flags); + return mFlinger->createSurface(mId, pid, name, params, display, w, h, + format, flags); } status_t BClient::destroySurface(SurfaceID sid) diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/libs/surfaceflinger/SurfaceFlinger.h index 4520c0e..d75dc15 100644 --- a/libs/surfaceflinger/SurfaceFlinger.h +++ b/libs/surfaceflinger/SurfaceFlinger.h @@ -189,7 +189,7 @@ private: friend class LayerBlur; friend class LayerDim; - sp<ISurface> createSurface(ClientID client, int pid, + sp<ISurface> createSurface(ClientID client, int pid, const String8& name, ISurfaceFlingerClient::surface_data_t* params, DisplayID display, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags); @@ -401,7 +401,7 @@ public: virtual sp<IMemoryHeap> getControlBlock() const; virtual sp<ISurface> createSurface( - surface_data_t* params, int pid, + surface_data_t* params, int pid, const String8& name, DisplayID display, uint32_t w, uint32_t h,PixelFormat format, uint32_t flags); diff --git a/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp b/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp index e636c52..def96d7 100644 --- a/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp +++ b/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp @@ -74,6 +74,7 @@ public: virtual sp<ISurface> createSurface( surface_data_t* params, int pid, + const String8& name, DisplayID display, uint32_t w, uint32_t h, @@ -83,6 +84,7 @@ public: Parcel data, reply; data.writeInterfaceToken(ISurfaceFlingerClient::getInterfaceDescriptor()); data.writeInt32(pid); + data.writeString8(name); data.writeInt32(display); data.writeInt32(w); data.writeInt32(h); @@ -154,12 +156,14 @@ status_t BnSurfaceFlingerClient::onTransact( CHECK_INTERFACE(ISurfaceFlingerClient, data, reply); surface_data_t params; int32_t pid = data.readInt32(); + String8 name = data.readString8(); DisplayID display = data.readInt32(); uint32_t w = data.readInt32(); uint32_t h = data.readInt32(); PixelFormat format = data.readInt32(); uint32_t flags = data.readInt32(); - sp<ISurface> s = createSurface(¶ms, pid, display, w, h, format, flags); + sp<ISurface> s = createSurface(¶ms, pid, name, display, w, h, + format, flags); params.writeToParcel(reply); reply->writeStrongBinder(s->asBinder()); return NO_ERROR; diff --git a/libs/surfaceflinger_client/SurfaceComposerClient.cpp b/libs/surfaceflinger_client/SurfaceComposerClient.cpp index 0b5e504..3117495 100644 --- a/libs/surfaceflinger_client/SurfaceComposerClient.cpp +++ b/libs/surfaceflinger_client/SurfaceComposerClient.cpp @@ -319,10 +319,30 @@ sp<SurfaceControl> SurfaceComposerClient::createSurface( PixelFormat format, uint32_t flags) { + String8 name; + const size_t SIZE = 128; + char buffer[SIZE]; + snprintf(buffer, SIZE, "<pid_%d>", getpid()); + name.append(buffer); + + return SurfaceComposerClient::createSurface(pid, name, display, + w, h, format, flags); + +} + +sp<SurfaceControl> SurfaceComposerClient::createSurface( + int pid, + const String8& name, + DisplayID display, + uint32_t w, + uint32_t h, + PixelFormat format, + uint32_t flags) +{ sp<SurfaceControl> result; if (mStatus == NO_ERROR) { ISurfaceFlingerClient::surface_data_t data; - sp<ISurface> surface = mClient->createSurface(&data, pid, + sp<ISurface> surface = mClient->createSurface(&data, pid, name, display, w, h, format, flags); if (surface != 0) { if (uint32_t(data.token) < NUM_LAYERS_MAX) { |