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

Commit 9876e1fc authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "CompositionEngine: fix HWC transform calculation" am: cc56eff3

Change-Id: Ic0d70e23586897ebdfd98345f88365d5bd4993db
parents 6053d837 cc56eff3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -261,7 +261,7 @@ uint32_t OutputLayer::calculateOutputRelativeBufferTransform() const {
     * (NOTE: the matrices are multiplied in reverse order)
     */
    const ui::Transform& layerTransform = layerState.geomLayerTransform;
    const ui::Transform displayTransform{outputState.orientation};
    const ui::Transform displayTransform{outputState.transform};
    const ui::Transform bufferTransform{layerState.geomBufferTransform};
    ui::Transform transform(displayTransform * layerTransform * bufferTransform);

+16 −0
Original line number Diff line number Diff line
@@ -236,6 +236,7 @@ TEST_F(OutputLayerTest, calculateOutputRelativeBufferTransformTestsNeeded) {
        mLayerState.frontEnd.geomLayerTransform.set(entry.layer, 1920, 1080);
        mLayerState.frontEnd.geomBufferTransform = entry.buffer;
        mOutputState.orientation = entry.display;
        mOutputState.transform = ui::Transform{entry.display};

        auto actual = mOutputLayer.calculateOutputRelativeBufferTransform();
        EXPECT_EQ(entry.expected, actual) << "entry " << i;
@@ -310,5 +311,20 @@ TEST_F(OutputLayerWriteStateToHWCTest, canSetsAllState) {
    mOutputLayer.writeStateToHWC(true);
}

TEST_F(OutputLayerTest, displayInstallOrientationBufferTransformSetTo90) {
    mLayerState.frontEnd.geomBufferUsesDisplayInverseTransform = false;
    mLayerState.frontEnd.geomLayerTransform = ui::Transform{TR_IDENT};
    // This test simulates a scenario where displayInstallOrientation is set to
    // ROT_90. This only has an effect on the transform; orientation stays 0 (see
    // DisplayDevice::setProjection).
    mOutputState.orientation = TR_IDENT;
    mOutputState.transform = ui::Transform{TR_ROT_90};
    // Buffers are pre-rotated based on the transform hint (ROT_90); their
    // geomBufferTransform is set to the inverse transform.
    mLayerState.frontEnd.geomBufferTransform = TR_ROT_270;

    EXPECT_EQ(TR_IDENT, mOutputLayer.calculateOutputRelativeBufferTransform());
}

} // namespace
} // namespace android::compositionengine