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

Commit 35c20c7e authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Automerger Merge Worker
Browse files

Merge "Use transform, width, and height instead of active and requested" into sc-dev am: f1da94b9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14389097

Change-Id: I21701f37fb13171929de54b95f1a3e7f23c4d164
parents d92e5b0a f1da94b9
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -51,9 +51,6 @@ public:
        return flags;
        return flags;
    }
    }


    uint32_t getActiveWidth(const Layer::State& s) const override { return s.width; }
    uint32_t getActiveHeight(const Layer::State& s) const override { return s.height; }
    ui::Transform getActiveTransform(const Layer::State& s) const override { return s.transform; }
    Region getActiveTransparentRegion(const Layer::State& s) const override {
    Region getActiveTransparentRegion(const Layer::State& s) const override {
        return s.transparentRegionHint;
        return s.transparentRegionHint;
    }
    }
+14 −16
Original line number Original line Diff line number Diff line
@@ -858,7 +858,7 @@ uint32_t Layer::doTransaction(uint32_t flags) {
    const State& s(getDrawingState());
    const State& s(getDrawingState());
    State& c(getCurrentState());
    State& c(getCurrentState());


    if (getActiveGeometry(c) != getActiveGeometry(s)) {
    if (c.width != s.width || c.height != s.height || !(c.transform == s.transform)) {
        // invalidate and recompute the visible regions if needed
        // invalidate and recompute the visible regions if needed
        flags |= Layer::eVisibleRegion;
        flags |= Layer::eVisibleRegion;
    }
    }
@@ -933,20 +933,18 @@ uint32_t Layer::setTransactionFlags(uint32_t flags) {
}
}


bool Layer::setPosition(float x, float y) {
bool Layer::setPosition(float x, float y) {
    if (mCurrentState.requested_legacy.transform.tx() == x &&
    if (mCurrentState.transform.tx() == x && mCurrentState.transform.ty() == y) return false;
        mCurrentState.requested_legacy.transform.ty() == y)
        return false;
    mCurrentState.sequence++;
    mCurrentState.sequence++;


    // We update the requested and active position simultaneously because
    // We update the requested and active position simultaneously because
    // we want to apply the position portion of the transform matrix immediately,
    // we want to apply the position portion of the transform matrix immediately,
    // but still delay scaling when resizing a SCALING_MODE_FREEZE layer.
    // but still delay scaling when resizing a SCALING_MODE_FREEZE layer.
    mCurrentState.requested_legacy.transform.set(x, y);
    mCurrentState.transform.set(x, y);
    // Here we directly update the active state
    // Here we directly update the active state
    // unlike other setters, because we store it within
    // unlike other setters, because we store it within
    // the transform, but use different latching rules.
    // the transform, but use different latching rules.
    // b/38182305
    // b/38182305
    mCurrentState.active_legacy.transform.set(x, y);
    mCurrentState.transform.set(x, y);


    mCurrentState.modified = true;
    mCurrentState.modified = true;
    setTransactionFlags(eTransactionNeeded);
    setTransactionFlags(eTransactionNeeded);
@@ -1065,6 +1063,7 @@ bool Layer::setSize(uint32_t w, uint32_t h) {
    setDefaultBufferSize(mCurrentState.requested_legacy.w, mCurrentState.requested_legacy.h);
    setDefaultBufferSize(mCurrentState.requested_legacy.w, mCurrentState.requested_legacy.h);
    return true;
    return true;
}
}

bool Layer::setAlpha(float alpha) {
bool Layer::setAlpha(float alpha) {
    if (mCurrentState.color.a == alpha) return false;
    if (mCurrentState.color.a == alpha) return false;
    mCurrentState.sequence++;
    mCurrentState.sequence++;
@@ -1143,8 +1142,7 @@ bool Layer::setMatrix(const layer_state_t::matrix22_t& matrix,
        return false;
        return false;
    }
    }
    mCurrentState.sequence++;
    mCurrentState.sequence++;
    mCurrentState.requested_legacy.transform.set(matrix.dsdx, matrix.dtdy, matrix.dtdx,
    mCurrentState.transform.set(matrix.dsdx, matrix.dtdy, matrix.dtdx, matrix.dsdy);
                                                 matrix.dsdy);
    mCurrentState.modified = true;
    mCurrentState.modified = true;
    setTransactionFlags(eTransactionNeeded);
    setTransactionFlags(eTransactionNeeded);
    return true;
    return true;
@@ -1560,20 +1558,20 @@ LayerDebugInfo Layer::getLayerDebugInfo(const DisplayDevice* display) const {
    info.mVisibleRegion = getVisibleRegion(display);
    info.mVisibleRegion = getVisibleRegion(display);
    info.mSurfaceDamageRegion = surfaceDamageRegion;
    info.mSurfaceDamageRegion = surfaceDamageRegion;
    info.mLayerStack = getLayerStack();
    info.mLayerStack = getLayerStack();
    info.mX = ds.active_legacy.transform.tx();
    info.mX = ds.transform.tx();
    info.mY = ds.active_legacy.transform.ty();
    info.mY = ds.transform.ty();
    info.mZ = ds.z;
    info.mZ = ds.z;
    info.mWidth = ds.active_legacy.w;
    info.mWidth = ds.width;
    info.mHeight = ds.active_legacy.h;
    info.mHeight = ds.height;
    info.mCrop = ds.crop;
    info.mCrop = ds.crop;
    info.mColor = ds.color;
    info.mColor = ds.color;
    info.mFlags = ds.flags;
    info.mFlags = ds.flags;
    info.mPixelFormat = getPixelFormat();
    info.mPixelFormat = getPixelFormat();
    info.mDataSpace = static_cast<android_dataspace>(getDataSpace());
    info.mDataSpace = static_cast<android_dataspace>(getDataSpace());
    info.mMatrix[0][0] = ds.active_legacy.transform[0][0];
    info.mMatrix[0][0] = ds.transform[0][0];
    info.mMatrix[0][1] = ds.active_legacy.transform[0][1];
    info.mMatrix[0][1] = ds.transform[0][1];
    info.mMatrix[1][0] = ds.active_legacy.transform[1][0];
    info.mMatrix[1][0] = ds.transform[1][0];
    info.mMatrix[1][1] = ds.active_legacy.transform[1][1];
    info.mMatrix[1][1] = ds.transform[1][1];
    {
    {
        sp<const GraphicBuffer> buffer = getBuffer();
        sp<const GraphicBuffer> buffer = getBuffer();
        if (buffer != 0) {
        if (buffer != 0) {
+3 −6
Original line number Original line Diff line number Diff line
@@ -484,12 +484,9 @@ public:
    // to avoid grabbing the lock again to avoid deadlock
    // to avoid grabbing the lock again to avoid deadlock
    virtual bool isCreatedFromMainThread() const { return false; }
    virtual bool isCreatedFromMainThread() const { return false; }


    virtual Geometry getActiveGeometry(const Layer::State& s) const { return s.active_legacy; }
    uint32_t getActiveWidth(const Layer::State& s) const { return s.width; }
    virtual uint32_t getActiveWidth(const Layer::State& s) const { return s.active_legacy.w; }
    uint32_t getActiveHeight(const Layer::State& s) const { return s.height; }
    virtual uint32_t getActiveHeight(const Layer::State& s) const { return s.active_legacy.h; }
    ui::Transform getActiveTransform(const Layer::State& s) const { return s.transform; }
    virtual ui::Transform getActiveTransform(const Layer::State& s) const {
        return s.active_legacy.transform;
    }
    virtual Region getActiveTransparentRegion(const Layer::State& s) const {
    virtual Region getActiveTransparentRegion(const Layer::State& s) const {
        return s.activeTransparentRegion_legacy;
        return s.activeTransparentRegion_legacy;
    }
    }
+2 −2
Original line number Original line Diff line number Diff line
@@ -130,8 +130,8 @@ void SurfaceInterceptor::addInitialSurfaceStateLocked(Increment* increment,
    transaction->set_animation(layerFlags & BnSurfaceComposer::eAnimation);
    transaction->set_animation(layerFlags & BnSurfaceComposer::eAnimation);


    const int32_t layerId(getLayerId(layer));
    const int32_t layerId(getLayerId(layer));
    addPositionLocked(transaction, layerId, layer->mCurrentState.active_legacy.transform.tx(),
    addPositionLocked(transaction, layerId, layer->mCurrentState.transform.tx(),
                      layer->mCurrentState.active_legacy.transform.ty());
                      layer->mCurrentState.transform.ty());
    addDepthLocked(transaction, layerId, layer->mCurrentState.z);
    addDepthLocked(transaction, layerId, layer->mCurrentState.z);
    addAlphaLocked(transaction, layerId, layer->mCurrentState.color.a);
    addAlphaLocked(transaction, layerId, layer->mCurrentState.color.a);
    addTransparentRegionLocked(transaction, layerId,
    addTransparentRegionLocked(transaction, layerId,