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

Commit dd350bb8 authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "Remove rotation based scaling" into sc-dev

parents 593d4330 6bdec7d9
Loading
Loading
Loading
Loading
+4 −16
Original line number Original line Diff line number Diff line
@@ -213,7 +213,8 @@ void BLASTBufferQueue::update(const sp<SurfaceControl>& surface, uint32_t width,
            // for this is the scale is calculated based on the requested size and buffer size.
            // for this is the scale is calculated based on the requested size and buffer size.
            // If there's no buffer, the scale will always be 1.
            // If there's no buffer, the scale will always be 1.
            if (mLastBufferInfo.hasBuffer) {
            if (mLastBufferInfo.hasBuffer) {
                setMatrix(&t, mLastBufferInfo);
                t.setDestinationFrame(mSurfaceControl,
                                      Rect(0, 0, newSize.getWidth(), newSize.getHeight()));
            }
            }
            applyTransaction = true;
            applyTransaction = true;
        }
        }
@@ -416,8 +417,8 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) {
    t->addTransactionCompletedCallback(transactionCallbackThunk, static_cast<void*>(this));
    t->addTransactionCompletedCallback(transactionCallbackThunk, static_cast<void*>(this));
    mSurfaceControlsWithPendingCallback.push(mSurfaceControl);
    mSurfaceControlsWithPendingCallback.push(mSurfaceControl);


    setMatrix(t, mLastBufferInfo);
    t->setDestinationFrame(mSurfaceControl, Rect(0, 0, mSize.getWidth(), mSize.getHeight()));
    t->setCrop(mSurfaceControl, crop);
    t->setBufferCrop(mSurfaceControl, crop);
    t->setTransform(mSurfaceControl, bufferItem.mTransform);
    t->setTransform(mSurfaceControl, bufferItem.mTransform);
    t->setTransformToDisplayInverse(mSurfaceControl, bufferItem.mTransformToDisplayInverse);
    t->setTransformToDisplayInverse(mSurfaceControl, bufferItem.mTransformToDisplayInverse);
    if (!bufferItem.mIsAutoTimestamp) {
    if (!bufferItem.mIsAutoTimestamp) {
@@ -543,19 +544,6 @@ bool BLASTBufferQueue::rejectBuffer(const BufferItem& item) {
    return mSize != bufferSize;
    return mSize != bufferSize;
}
}


void BLASTBufferQueue::setMatrix(SurfaceComposerClient::Transaction* t,
                                 const BufferInfo& bufferInfo) {
    uint32_t bufWidth = bufferInfo.crop.getWidth();
    uint32_t bufHeight = bufferInfo.crop.getHeight();

    float sx = mSize.width / static_cast<float>(bufWidth);
    float sy = mSize.height / static_cast<float>(bufHeight);

    t->setMatrix(mSurfaceControl, sx, 0, 0, sy);
    // Update position based on crop.
    t->setPosition(mSurfaceControl, bufferInfo.crop.left * sx * -1, bufferInfo.crop.top * sy * -1);
}

void BLASTBufferQueue::setTransactionCompleteCallback(
void BLASTBufferQueue::setTransactionCompleteCallback(
        uint64_t frameNumber, std::function<void(int64_t)>&& transactionCompleteCallback) {
        uint64_t frameNumber, std::function<void(int64_t)>&& transactionCompleteCallback) {
    std::lock_guard _lock{mMutex};
    std::lock_guard _lock{mMutex};
+8 −0
Original line number Original line Diff line number Diff line
@@ -64,6 +64,8 @@ layer_state_t::layer_state_t()
        fixedTransformHint(ui::Transform::ROT_INVALID),
        fixedTransformHint(ui::Transform::ROT_INVALID),
        frameNumber(0),
        frameNumber(0),
        autoRefresh(false),
        autoRefresh(false),
        bufferCrop(Rect::INVALID_RECT),
        destinationFrame(Rect::INVALID_RECT),
        releaseBufferListener(nullptr) {
        releaseBufferListener(nullptr) {
    matrix.dsdx = matrix.dtdy = 1.0f;
    matrix.dsdx = matrix.dtdy = 1.0f;
    matrix.dsdy = matrix.dtdx = 0.0f;
    matrix.dsdy = matrix.dtdx = 0.0f;
@@ -167,6 +169,7 @@ status_t layer_state_t::write(Parcel& output) const


    SAFE_PARCEL(output.write, stretchEffect);
    SAFE_PARCEL(output.write, stretchEffect);
    SAFE_PARCEL(output.write, bufferCrop);
    SAFE_PARCEL(output.write, bufferCrop);
    SAFE_PARCEL(output.write, destinationFrame);


    return NO_ERROR;
    return NO_ERROR;
}
}
@@ -296,6 +299,7 @@ status_t layer_state_t::read(const Parcel& input)


    SAFE_PARCEL(input.read, stretchEffect);
    SAFE_PARCEL(input.read, stretchEffect);
    SAFE_PARCEL(input.read, bufferCrop);
    SAFE_PARCEL(input.read, bufferCrop);
    SAFE_PARCEL(input.read, destinationFrame);


    return NO_ERROR;
    return NO_ERROR;
}
}
@@ -543,6 +547,10 @@ void layer_state_t::merge(const layer_state_t& other) {
        what |= eBufferCropChanged;
        what |= eBufferCropChanged;
        bufferCrop = other.bufferCrop;
        bufferCrop = other.bufferCrop;
    }
    }
    if (other.what & eDestinationFrameChanged) {
        what |= eDestinationFrameChanged;
        destinationFrame = other.destinationFrame;
    }
    if ((other.what & what) != other.what) {
    if ((other.what & what) != other.what) {
        ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? "
        ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? "
              "other.what=0x%" PRIu64 " what=0x%" PRIu64,
              "other.what=0x%" PRIu64 " what=0x%" PRIu64,
+15 −0
Original line number Original line Diff line number Diff line
@@ -1675,6 +1675,21 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBuffe
    return *this;
    return *this;
}
}


SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setDestinationFrame(
        const sp<SurfaceControl>& sc, const Rect& destinationFrame) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }

    s->what |= layer_state_t::eDestinationFrameChanged;
    s->destinationFrame = destinationFrame;

    registerSurfaceControlForCallback(sc);
    return *this;
}

// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------


DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {
DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {
+2 −1
Original line number Original line Diff line number Diff line
@@ -104,7 +104,7 @@ struct layer_state_t {
        eHasListenerCallbacksChanged = 0x20000000,
        eHasListenerCallbacksChanged = 0x20000000,
        eInputInfoChanged = 0x40000000,
        eInputInfoChanged = 0x40000000,
        eCornerRadiusChanged = 0x80000000,
        eCornerRadiusChanged = 0x80000000,
        /* was eFrameChanged, now available 0x1'00000000, */
        eDestinationFrameChanged = 0x1'00000000,
        eCachedBufferChanged = 0x2'00000000,
        eCachedBufferChanged = 0x2'00000000,
        eBackgroundColorChanged = 0x4'00000000,
        eBackgroundColorChanged = 0x4'00000000,
        eMetadataChanged = 0x8'00000000,
        eMetadataChanged = 0x8'00000000,
@@ -228,6 +228,7 @@ struct layer_state_t {
    StretchEffect stretchEffect;
    StretchEffect stretchEffect;


    Rect bufferCrop;
    Rect bufferCrop;
    Rect destinationFrame;


    // Listens to when the buffer is safe to be released. This is used for blast
    // Listens to when the buffer is safe to be released. This is used for blast
    // layers only. The callback includes a release fence as well as the graphic
    // layers only. The callback includes a release fence as well as the graphic
+2 −0
Original line number Original line Diff line number Diff line
@@ -554,6 +554,8 @@ public:
                                      const StretchEffect& stretchEffect);
                                      const StretchEffect& stretchEffect);


        Transaction& setBufferCrop(const sp<SurfaceControl>& sc, const Rect& bufferCrop);
        Transaction& setBufferCrop(const sp<SurfaceControl>& sc, const Rect& bufferCrop);
        Transaction& setDestinationFrame(const sp<SurfaceControl>& sc,
                                         const Rect& destinationFrame);


        status_t setDisplaySurface(const sp<IBinder>& token,
        status_t setDisplaySurface(const sp<IBinder>& token,
                const sp<IGraphicBufferProducer>& bufferProducer);
                const sp<IGraphicBufferProducer>& bufferProducer);
Loading