Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 223831d2 authored by Dan Stoza's avatar Dan Stoza Committed by android-build-merger
Browse files

Merge "SF: Add IGBP list leak debugging info" into pi-dev

am: 43bfc23b

Change-Id: Id128b43068de15014d94d58ce6067815073af89d
parents ee9cb31f 43bfc23b
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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;