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

Commit c351d6fc authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Remove barrierGbp_legacy from layer state

BarrierGbp is no longer used, so we can remove it to make it possible to dump all LayerState data exclusively on the client side without requiring access to Surface Flinger

Test: Existing tests

Change-Id: Ib1465f57ff8d39d12abfe35548c0106b434d2acf
parent 11dcc220
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ status_t layer_state_t::write(Parcel& output) const
    SAFE_PARCEL(SurfaceControl::writeNullableToParcel, output, reparentSurfaceControl);
    SAFE_PARCEL(output.writeUint64, barrierFrameNumber);
    SAFE_PARCEL(output.writeInt32, overrideScalingMode);
    SAFE_PARCEL(output.writeStrongBinder, IInterface::asBinder(barrierGbp_legacy));
    SAFE_PARCEL(SurfaceControl::writeNullableToParcel, output, relativeLayerSurfaceControl);
    SAFE_PARCEL(SurfaceControl::writeNullableToParcel, output, parentSurfaceControlForChild);
    SAFE_PARCEL(output.writeFloat, color.r);
@@ -179,10 +178,6 @@ status_t layer_state_t::read(const Parcel& input)
    SAFE_PARCEL(input.readUint64, &barrierFrameNumber);
    SAFE_PARCEL(input.readInt32, &overrideScalingMode);

    sp<IBinder> tmpBinder;
    SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder);
    barrierGbp_legacy = interface_cast<IGraphicBufferProducer>(tmpBinder);

    SAFE_PARCEL(SurfaceControl::readNullableFromParcel, input, &relativeLayerSurfaceControl);
    SAFE_PARCEL(SurfaceControl::readNullableFromParcel, input, &parentSurfaceControlForChild);

@@ -230,6 +225,7 @@ status_t layer_state_t::read(const Parcel& input)
    SAFE_PARCEL(input.read, &colorTransform, 16 * sizeof(float));
    SAFE_PARCEL(input.readFloat, &cornerRadius);
    SAFE_PARCEL(input.readUint32, &backgroundBlurRadius);
    sp<IBinder> tmpBinder;
    SAFE_PARCEL(input.readNullableStrongBinder, &tmpBinder);
    cachedBuffer.token = tmpBinder;
    SAFE_PARCEL(input.readUint64, &cachedBuffer.id);
@@ -383,7 +379,6 @@ void layer_state_t::merge(const layer_state_t& other) {
    if (other.what & eDeferTransaction_legacy) {
        what |= eDeferTransaction_legacy;
        barrierSurfaceControl_legacy = other.barrierSurfaceControl_legacy;
        barrierGbp_legacy = other.barrierGbp_legacy;
        barrierFrameNumber = other.barrierFrameNumber;
    }
    if (other.what & eOverrideScalingModeChanged) {
+0 −17
Original line number Diff line number Diff line
@@ -1044,23 +1044,6 @@ SurfaceComposerClient::Transaction::deferTransactionUntil_legacy(
    return *this;
}

SurfaceComposerClient::Transaction&
SurfaceComposerClient::Transaction::deferTransactionUntil_legacy(const sp<SurfaceControl>& sc,
                                                                 const sp<Surface>& barrierSurface,
                                                                 uint64_t frameNumber) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }
    s->what |= layer_state_t::eDeferTransaction_legacy;
    s->barrierGbp_legacy = barrierSurface->getIGraphicBufferProducer();
    s->barrierFrameNumber = frameNumber;

    registerSurfaceControlForCallback(sc);
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::reparentChildren(
        const sp<SurfaceControl>& sc, const sp<SurfaceControl>& newParent) {
    layer_state_t* s = getLayerState(sc);
+0 −2
Original line number Diff line number Diff line
@@ -165,8 +165,6 @@ struct layer_state_t {
    uint64_t barrierFrameNumber;
    int32_t overrideScalingMode;

    sp<IGraphicBufferProducer> barrierGbp_legacy;

    sp<SurfaceControl> relativeLayerSurfaceControl;

    sp<SurfaceControl> parentSurfaceControlForChild;
+0 −6
Original line number Diff line number Diff line
@@ -446,12 +446,6 @@ public:
        Transaction& deferTransactionUntil_legacy(const sp<SurfaceControl>& sc,
                                                  const sp<SurfaceControl>& barrierSurfaceControl,
                                                  uint64_t frameNumber);
        // A variant of deferTransactionUntil_legacy which identifies the Layer we wait for by
        // Surface instead of Handle. Useful for clients which may not have the
        // SurfaceControl for some of their Surfaces. Otherwise behaves identically.
        Transaction& deferTransactionUntil_legacy(const sp<SurfaceControl>& sc,
                                                  const sp<Surface>& barrierSurface,
                                                  uint64_t frameNumber);
        // Reparents all children of this layer to the new parent handle.
        Transaction& reparentChildren(const sp<SurfaceControl>& sc,
                                      const sp<SurfaceControl>& newParent);
+3 −15
Original line number Diff line number Diff line
@@ -328,7 +328,7 @@ SurfaceFlingerBE::SurfaceFlingerBE() : mHwcServiceName(getHwcServiceName()) {}

SurfaceFlinger::SurfaceFlinger(Factory& factory, SkipInitializationTag)
      : mFactory(factory),
        mInterceptor(mFactory.createSurfaceInterceptor(this)),
        mInterceptor(mFactory.createSurfaceInterceptor()),
        mTimeStats(std::make_shared<impl::TimeStats>()),
        mFrameTracer(std::make_unique<FrameTracer>()),
        mFrameTimeline(std::make_unique<frametimeline::impl::FrameTimeline>()),
@@ -3686,20 +3686,8 @@ uint32_t SurfaceFlinger::setClientStateLocked(
        }
    }
    if (what & layer_state_t::eDeferTransaction_legacy) {
        if (s.barrierSurfaceControl_legacy != nullptr) {
        layer->deferTransactionUntil_legacy(s.barrierSurfaceControl_legacy->getHandle(),
                                            s.barrierFrameNumber);
        } else if (s.barrierGbp_legacy != nullptr) {
            const sp<IGraphicBufferProducer>& gbp = s.barrierGbp_legacy;
            if (authenticateSurfaceTextureLocked(gbp)) {
                const auto& otherLayer =
                    (static_cast<MonitoredProducer*>(gbp.get()))->getLayer();
                layer->deferTransactionUntil_legacy(otherLayer, s.barrierFrameNumber);
            } else {
                ALOGE("Attempt to defer transaction to to an"
                        " unrecognized GraphicBufferProducer");
            }
        }
        // We don't trigger a traversal here because if no other state is
        // changed, we don't want this to cause any more work
    }
Loading