summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp2
-rw-r--r--services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp17
2 files changed, 18 insertions, 1 deletions
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
index ce0222cee5..82d24222f1 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
@@ -231,7 +231,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);
diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
index 2e030a1823..0e579fa7e1 100644
--- a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
@@ -364,6 +364,7 @@ TEST_F(OutputLayerTest, calculateOutputRelativeBufferTransformTestsNeeded) {
mLayerFEState.geomLayerTransform.set(entry.layer, 1920, 1080);
mLayerFEState.geomBufferTransform = entry.buffer;
mOutputState.orientation = entry.display;
+ mOutputState.transform = ui::Transform{entry.display};
auto actual = mOutputLayer.calculateOutputRelativeBufferTransform();
EXPECT_EQ(entry.expected, actual) << "entry " << i;
@@ -422,6 +423,7 @@ TEST_F(OutputLayerTest,
mLayerFEState.geomLayerTransform = ui::Transform{entry.layer};
mLayerFEState.geomBufferTransform = entry.buffer;
mOutputState.orientation = entry.display;
+ mOutputState.transform = ui::Transform{entry.display};
auto actual = mOutputLayer.calculateOutputRelativeBufferTransform();
EXPECT_EQ(entry.expected, actual) << "entry " << i;
@@ -764,6 +766,21 @@ TEST_F(OutputLayerWriteStateToHWCTest, canSetAllState) {
mOutputLayer.writeStateToHWC(true);
}
+TEST_F(OutputLayerTest, displayInstallOrientationBufferTransformSetTo90) {
+ mLayerFEState.geomBufferUsesDisplayInverseTransform = false;
+ mLayerFEState.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.
+ mLayerFEState.geomBufferTransform = TR_ROT_270;
+
+ EXPECT_EQ(TR_IDENT, mOutputLayer.calculateOutputRelativeBufferTransform());
+}
+
TEST_F(OutputLayerWriteStateToHWCTest, canSetPerFrameStateForSolidColor) {
mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;