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

Commit e1a4232e authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Handle buffer orientation when rejecting buffers via blast

Bug: 168504870
Test: SurfaceViewBufferTests
Test: go/wm-smoke with `adb shell device_config put window_manager_native_boot wm_use_blast_adapter true`
Test: atest libgui_test
Change-Id: Ib699b3d388b1b62346515d32bcde81bf03e6f5fd
parent 5bdb7e6e
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -252,8 +252,8 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) {
    }

    if (rejectBuffer(bufferItem)) {
        BQA_LOGE("rejecting buffer: configured width=%d, height=%d, buffer{w=%d, h=%d}", mWidth,
                 mHeight, buffer->getWidth(), buffer->getHeight());
        BQA_LOGE("rejecting buffer:configured size=%dx%d, buffer{size=%dx%d transform=%d}", mWidth,
                 mHeight, buffer->getWidth(), buffer->getHeight(), bufferItem.mTransform);
        mBufferItemConsumer->releaseBuffer(bufferItem, Fence::NO_FENCE);
        return;
    }
@@ -330,7 +330,15 @@ bool BLASTBufferQueue::rejectBuffer(const BufferItem& item) const {
        return false;
    }

    uint32_t bufWidth = item.mGraphicBuffer->getWidth();
    uint32_t bufHeight = item.mGraphicBuffer->getHeight();

    // Take the buffer's orientation into account
    if (item.mTransform & ui::Transform::ROT_90) {
        std::swap(bufWidth, bufHeight);
    }

    // reject buffers if the buffer size doesn't match.
    return item.mGraphicBuffer->getWidth() != mWidth || item.mGraphicBuffer->getHeight() != mHeight;
    return bufWidth != mWidth || bufHeight != mHeight;
}
} // namespace android
+2 −2
Original line number Diff line number Diff line
@@ -490,8 +490,8 @@ public:
        IGraphicBufferProducer::QueueBufferOutput qbOutput;
        IGraphicBufferProducer::QueueBufferInput input(systemTime(), false, HAL_DATASPACE_UNKNOWN,
                                                       Rect(bufWidth, bufHeight),
                                                       NATIVE_WINDOW_SCALING_MODE_FREEZE, tr,
                                                       Fence::NO_FENCE);
                                                       NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW,
                                                       tr, Fence::NO_FENCE);
        igbProducer->queueBuffer(slot, input, &qbOutput);
        ASSERT_NE(ui::Transform::ROT_INVALID, qbOutput.transformHint);