diff options
author | 2018-03-16 13:38:54 -0700 | |
---|---|---|
committer | 2018-03-17 00:06:30 +0000 | |
commit | 0a0158c25c74de41770a9fa2f8d7da234a0dacee (patch) | |
tree | 82e24d581b1370d86c47f0b8269714917032fb78 | |
parent | 5f643f8f4f9ca0f93b5b6ab9b9130b753c425cca (diff) |
SF: Add IGBP list leak debugging info
Adds a few things intended to make debugging IGBP list leaks easier:
1) A dumpsys line listing the current and max occupancies of the list
2) A debug property to set the max: debug.sf.max_igbp_list_size
3) Printing the current number of Layers when aborting
Since we still have an unknown leak, this also sets the default limit
four times higher to avoid hitting it in dogfood/automation.
Bug: 74616334
Test: Manual, set max to 100 and verify above behaviors
Change-Id: I7a6227a1d6fc05c197ec632db7dd9f875c64c6c9
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 14 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 1 |
2 files changed, 13 insertions, 2 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 5dd5d7c9f2..282957fc68 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -260,6 +260,11 @@ SurfaceFlinger::SurfaceFlinger() mLayerTripleBufferingDisabled = atoi(value); ALOGI_IF(mLayerTripleBufferingDisabled, "Disabling Triple Buffering"); + // TODO (b/74616334): Reduce the default value once we isolate the leak + const size_t defaultListSize = 4 * MAX_LAYERS; + auto listSize = property_get_int32("debug.sf.max_igbp_list_size", int32_t(defaultListSize)); + mMaxGraphicBufferProducerListSize = (listSize > 0) ? size_t(listSize) : defaultListSize; + // We should be reading 'persist.sys.sf.color_saturation' here // but since /data may be encrypted, we need to wait until after vold // comes online to attempt to read the property. The property is @@ -2896,8 +2901,11 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client, } mGraphicBufferProducerList.insert(IInterface::asBinder(gbc).get()); - LOG_ALWAYS_FATAL_IF(mGraphicBufferProducerList.size() > MAX_LAYERS, - "Suspected IGBP leak"); + // TODO (b/74616334): Change this back to a fatal assert once the leak is fixed + ALOGE_IF(mGraphicBufferProducerList.size() > mMaxGraphicBufferProducerListSize, + "Suspected IGBP leak: %zu IGBPs (%zu max), %zu Layers", + mGraphicBufferProducerList.size(), mMaxGraphicBufferProducerListSize, + mNumLayers); mLayersAdded = true; mNumLayers++; } @@ -3966,6 +3974,8 @@ void SurfaceFlinger::dumpAllLocked(const Vector<String16>& args, size_t& index, */ colorizer.bold(result); result.appendFormat("Visible layers (count = %zu)\n", mNumLayers); + result.appendFormat("GraphicBufferProducers: %zu, max %zu\n", + mGraphicBufferProducerList.size(), mMaxGraphicBufferProducerListSize); colorizer.reset(result); LayersProto layersProto = dumpProtoInfo(LayerVector::StateSet::Current); diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 104adef4d3..51001e599d 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -720,6 +720,7 @@ private: // Can't be unordered_set because wp<> isn't hashable std::set<wp<IBinder>> mGraphicBufferProducerList; + size_t mMaxGraphicBufferProducerListSize = MAX_LAYERS; // protected by mStateLock (but we could use another lock) bool mLayersRemoved; |