Loading services/surfaceflinger/SurfaceFlinger.cpp +28 −2 Original line number Diff line number Diff line Loading @@ -2840,15 +2840,17 @@ status_t SurfaceFlinger::createLayer( sp<Layer> layer; String8 uniqueName = getUniqueLayerName(name); switch (flags & ISurfaceComposerClient::eFXSurfaceMask) { case ISurfaceComposerClient::eFXSurfaceNormal: result = createNormalLayer(client, name, w, h, flags, format, uniqueName, w, h, flags, format, handle, gbp, &layer); break; case ISurfaceComposerClient::eFXSurfaceDim: result = createDimLayer(client, name, w, h, flags, uniqueName, w, h, flags, handle, gbp, &layer); break; default: Loading @@ -2872,6 +2874,30 @@ status_t SurfaceFlinger::createLayer( return result; } String8 SurfaceFlinger::getUniqueLayerName(const String8& name) { bool matchFound = true; uint32_t dupeCounter = 0; // Tack on our counter whether there is a hit or not, so everyone gets a tag String8 uniqueName = name + "#" + String8(std::to_string(dupeCounter).c_str()); // Loop over layers until we're sure there is no matching name while (matchFound) { matchFound = false; mDrawingState.traverseInZOrder([&](Layer* layer) { if (layer->getName() == uniqueName) { matchFound = true; uniqueName = name + "#" + String8(std::to_string(++dupeCounter).c_str()); } }); } ALOGD_IF(dupeCounter > 0, "duplicate layer name: changing %s to %s", name.c_str(), uniqueName.c_str()); return uniqueName; } status_t SurfaceFlinger::createNormalLayer(const sp<Client>& client, const String8& name, uint32_t w, uint32_t h, uint32_t flags, PixelFormat& format, sp<IBinder>* handle, sp<IGraphicBufferProducer>* gbp, sp<Layer>* outLayer) Loading services/surfaceflinger/SurfaceFlinger.h +2 −0 Original line number Diff line number Diff line Loading @@ -364,6 +364,8 @@ private: uint32_t w, uint32_t h, uint32_t flags, sp<IBinder>* outHandle, sp<IGraphicBufferProducer>* outGbp, sp<Layer>* outLayer); String8 getUniqueLayerName(const String8& name); // called in response to the window-manager calling // ISurfaceComposerClient::destroySurface() status_t onLayerRemoved(const sp<Client>& client, const sp<IBinder>& handle); Loading services/surfaceflinger/SurfaceFlinger_hwc1.cpp +28 −2 Original line number Diff line number Diff line Loading @@ -2637,15 +2637,17 @@ status_t SurfaceFlinger::createLayer( sp<Layer> layer; String8 uniqueName = getUniqueLayerName(name); switch (flags & ISurfaceComposerClient::eFXSurfaceMask) { case ISurfaceComposerClient::eFXSurfaceNormal: result = createNormalLayer(client, name, w, h, flags, format, uniqueName, w, h, flags, format, handle, gbp, &layer); break; case ISurfaceComposerClient::eFXSurfaceDim: result = createDimLayer(client, name, w, h, flags, uniqueName, w, h, flags, handle, gbp, &layer); break; default: Loading @@ -2669,6 +2671,30 @@ status_t SurfaceFlinger::createLayer( return result; } String8 SurfaceFlinger::getUniqueLayerName(const String8& name) { bool matchFound = true; uint32_t dupeCounter = 0; // Tack on our counter whether there is a hit or not, so everyone gets a tag String8 uniqueName = name + "#" + String8(std::to_string(dupeCounter).c_str()); // Loop over layers until we're sure there is no matching name while (matchFound) { matchFound = false; mDrawingState.traverseInZOrder([&](Layer* layer) { if (layer->getName() == uniqueName) { matchFound = true; uniqueName = name + "#" + String8(std::to_string(++dupeCounter).c_str()); } }); } ALOGD_IF(dupeCounter > 0, "duplicate layer name: changing %s to %s", name.c_str(), uniqueName.c_str()); return uniqueName; } status_t SurfaceFlinger::createNormalLayer(const sp<Client>& client, const String8& name, uint32_t w, uint32_t h, uint32_t flags, PixelFormat& format, sp<IBinder>* handle, sp<IGraphicBufferProducer>* gbp, sp<Layer>* outLayer) Loading Loading
services/surfaceflinger/SurfaceFlinger.cpp +28 −2 Original line number Diff line number Diff line Loading @@ -2840,15 +2840,17 @@ status_t SurfaceFlinger::createLayer( sp<Layer> layer; String8 uniqueName = getUniqueLayerName(name); switch (flags & ISurfaceComposerClient::eFXSurfaceMask) { case ISurfaceComposerClient::eFXSurfaceNormal: result = createNormalLayer(client, name, w, h, flags, format, uniqueName, w, h, flags, format, handle, gbp, &layer); break; case ISurfaceComposerClient::eFXSurfaceDim: result = createDimLayer(client, name, w, h, flags, uniqueName, w, h, flags, handle, gbp, &layer); break; default: Loading @@ -2872,6 +2874,30 @@ status_t SurfaceFlinger::createLayer( return result; } String8 SurfaceFlinger::getUniqueLayerName(const String8& name) { bool matchFound = true; uint32_t dupeCounter = 0; // Tack on our counter whether there is a hit or not, so everyone gets a tag String8 uniqueName = name + "#" + String8(std::to_string(dupeCounter).c_str()); // Loop over layers until we're sure there is no matching name while (matchFound) { matchFound = false; mDrawingState.traverseInZOrder([&](Layer* layer) { if (layer->getName() == uniqueName) { matchFound = true; uniqueName = name + "#" + String8(std::to_string(++dupeCounter).c_str()); } }); } ALOGD_IF(dupeCounter > 0, "duplicate layer name: changing %s to %s", name.c_str(), uniqueName.c_str()); return uniqueName; } status_t SurfaceFlinger::createNormalLayer(const sp<Client>& client, const String8& name, uint32_t w, uint32_t h, uint32_t flags, PixelFormat& format, sp<IBinder>* handle, sp<IGraphicBufferProducer>* gbp, sp<Layer>* outLayer) Loading
services/surfaceflinger/SurfaceFlinger.h +2 −0 Original line number Diff line number Diff line Loading @@ -364,6 +364,8 @@ private: uint32_t w, uint32_t h, uint32_t flags, sp<IBinder>* outHandle, sp<IGraphicBufferProducer>* outGbp, sp<Layer>* outLayer); String8 getUniqueLayerName(const String8& name); // called in response to the window-manager calling // ISurfaceComposerClient::destroySurface() status_t onLayerRemoved(const sp<Client>& client, const sp<IBinder>& handle); Loading
services/surfaceflinger/SurfaceFlinger_hwc1.cpp +28 −2 Original line number Diff line number Diff line Loading @@ -2637,15 +2637,17 @@ status_t SurfaceFlinger::createLayer( sp<Layer> layer; String8 uniqueName = getUniqueLayerName(name); switch (flags & ISurfaceComposerClient::eFXSurfaceMask) { case ISurfaceComposerClient::eFXSurfaceNormal: result = createNormalLayer(client, name, w, h, flags, format, uniqueName, w, h, flags, format, handle, gbp, &layer); break; case ISurfaceComposerClient::eFXSurfaceDim: result = createDimLayer(client, name, w, h, flags, uniqueName, w, h, flags, handle, gbp, &layer); break; default: Loading @@ -2669,6 +2671,30 @@ status_t SurfaceFlinger::createLayer( return result; } String8 SurfaceFlinger::getUniqueLayerName(const String8& name) { bool matchFound = true; uint32_t dupeCounter = 0; // Tack on our counter whether there is a hit or not, so everyone gets a tag String8 uniqueName = name + "#" + String8(std::to_string(dupeCounter).c_str()); // Loop over layers until we're sure there is no matching name while (matchFound) { matchFound = false; mDrawingState.traverseInZOrder([&](Layer* layer) { if (layer->getName() == uniqueName) { matchFound = true; uniqueName = name + "#" + String8(std::to_string(++dupeCounter).c_str()); } }); } ALOGD_IF(dupeCounter > 0, "duplicate layer name: changing %s to %s", name.c_str(), uniqueName.c_str()); return uniqueName; } status_t SurfaceFlinger::createNormalLayer(const sp<Client>& client, const String8& name, uint32_t w, uint32_t h, uint32_t flags, PixelFormat& format, sp<IBinder>* handle, sp<IGraphicBufferProducer>* gbp, sp<Layer>* outLayer) Loading