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

Commit ae56a32b authored by Dan Stoza's avatar Dan Stoza
Browse files

Revert "SF: Fix a couple of Layer ref count issues"

This reverts commit 92cd24e5.

Change-Id: I551c292d8151d39bd34f2667eda384273f7cfd87
parent b669dfdb
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -43,7 +43,10 @@ Client::~Client()
{
    const size_t count = mLayers.size();
    for (size_t i=0 ; i<count ; i++) {
        mFlinger->removeLayer(mLayers.valueAt(i));
        sp<Layer> layer(mLayers.valueAt(i).promote());
        if (layer != 0) {
            mFlinger->removeLayer(layer);
        }
    }
}

+3 −8
Original line number Diff line number Diff line
@@ -1313,14 +1313,9 @@ void Layer::pushPendingState() {
    // If this transaction is waiting on the receipt of a frame, generate a sync
    // point and send it to the remote layer.
    if (mCurrentState.handle != nullptr) {
        sp<IBinder> strongBinder = mCurrentState.handle.promote();
        sp<Handle> handle = nullptr;
        sp<Layer> handleLayer = nullptr;
        if (strongBinder != nullptr) {
            handle = static_cast<Handle*>(strongBinder.get());
            handleLayer = handle->owner.promote();
        }
        if (strongBinder == nullptr || handleLayer == nullptr) {
        sp<Handle> handle = static_cast<Handle*>(mCurrentState.handle.get());
        sp<Layer> handleLayer = handle->owner.promote();
        if (handleLayer == nullptr) {
            ALOGE("[%s] Unable to promote Layer handle", mName.string());
            // If we can't promote the layer we are intended to wait on,
            // then it is expired or otherwise invalid. Allow this transaction
+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ public:

        // If set, defers this state update until the Layer identified by handle
        // receives a frame with the given frameNumber
        wp<IBinder> handle;
        sp<IBinder> handle;
        uint64_t frameNumber;

        // the transparentRegion hint is a bit special, it's latched only
+9 −8
Original line number Diff line number Diff line
@@ -2276,14 +2276,8 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client,
    return NO_ERROR;
}

status_t SurfaceFlinger::removeLayer(const wp<Layer>& weakLayer) {
status_t SurfaceFlinger::removeLayer(const sp<Layer>& layer) {
    Mutex::Autolock _l(mStateLock);
    sp<Layer> layer = weakLayer.promote();
    if (layer == nullptr) {
        // The layer has already been removed, carry on
        return NO_ERROR;
    }

    ssize_t index = mCurrentState.layersSortedByZ.remove(layer);
    if (index >= 0) {
        mLayersPendingRemoval.push(layer);
@@ -2627,7 +2621,14 @@ status_t SurfaceFlinger::onLayerDestroyed(const wp<Layer>& layer)
{
    // called by ~LayerCleaner() when all references to the IBinder (handle)
    // are gone
    return removeLayer(layer);
    status_t err = NO_ERROR;
    sp<Layer> l(layer.promote());
    if (l != NULL) {
        err = removeLayer(l);
        ALOGE_IF(err<0 && err != NAME_NOT_FOUND,
                "error removing layer=%p (%s)", l.get(), strerror(-err));
    }
    return err;
}

// ---------------------------------------------------------------------------
+1 −1
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ private:
    status_t onLayerDestroyed(const wp<Layer>& layer);

    // remove a layer from SurfaceFlinger immediately
    status_t removeLayer(const wp<Layer>& layer);
    status_t removeLayer(const sp<Layer>& layer);

    // add a layer to SurfaceFlinger
    status_t addClientLayer(const sp<Client>& client,
Loading