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

Commit 1af98ee6 authored by Robert Carr's avatar Robert Carr
Browse files

SurfaceFlinger: Hold lock while constructing BufferStateLayer

This mirrors the createBufferQueue layer function. We have a crash
cluster around here and I'm not able to think of a better explanation.
Still unsure exactly what would trigger the problem though, will
monitor if this stops the crashes.

Bug: 173538294
Test: Existing tests pass
Change-Id: Id3324ebdde6f4b83274abddba59bb8c2adc68a36
parent 69df21f1
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -4036,7 +4036,14 @@ status_t SurfaceFlinger::createBufferStateLayer(const sp<Client>& client, std::s
                                                sp<Layer>* outLayer) {
    LayerCreationArgs args(this, client, std::move(name), w, h, flags, std::move(metadata));
    args.textureName = getNewTexture();
    sp<BufferStateLayer> layer = getFactory().createBufferStateLayer(args);
    sp<BufferStateLayer> layer;
    {
        // TODO (b/173538294): Investigate why we need mStateLock here and above in
        // createBufferQueue layer. Is it the renderengine::Image?
        Mutex::Autolock lock(mStateLock);
        layer = getFactory().createBufferStateLayer(args);

    }
    *handle = layer->getHandle();
    *outLayer = layer;