summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-05-12 00:09:04 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-05-12 00:09:04 +0000
commit5705de86b465f287b5fab48f9c99d6ac0a82dcad (patch)
tree426e6afa031b9fefa064155a9093dc098fa4f08c /services/surfaceflinger/Layer.cpp
parent5005714718cc5173df5c85b8c1780cf322a5ce47 (diff)
parent942c53703fa4d1dec14d0e68b594c83e5fd30c4f (diff)
Merge "Provide a fixed transform hint if the layer is in a fixed orientation 1/2" into rvc-dev am: 942c53703f
Change-Id: I25879fed381d7b53dfa0bed31b32304147a37815
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 752407aedc..25929ed1d7 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -117,6 +117,7 @@ Layer::Layer(const LayerCreationArgs& args)
mCurrentState.metadata = args.metadata;
mCurrentState.shadowRadius = 0.f;
mCurrentState.treeHasFrameRateVote = false;
+ mCurrentState.fixedTransformHint = ui::Transform::ROT_INVALID;
// drawing state & current state are identical
mDrawingState = mCurrentState;
@@ -1333,6 +1334,18 @@ bool Layer::setShadowRadius(float shadowRadius) {
return true;
}
+bool Layer::setFixedTransformHint(ui::Transform::RotationFlags fixedTransformHint) {
+ if (mCurrentState.fixedTransformHint == fixedTransformHint) {
+ return false;
+ }
+
+ mCurrentState.sequence++;
+ mCurrentState.fixedTransformHint = fixedTransformHint;
+ mCurrentState.modified = true;
+ setTransactionFlags(eTransactionNeeded);
+ return true;
+}
+
void Layer::updateTreeHasFrameRateVote() {
const auto traverseTree = [&](const LayerVector::Visitor& visitor) {
auto parent = getParent();
@@ -1460,19 +1473,19 @@ uint32_t Layer::getEffectiveUsage(uint32_t usage) const {
}
void Layer::updateTransformHint(const sp<const DisplayDevice>& display) const {
- uint32_t orientation = 0;
+ ui::Transform::RotationFlags transformHint = ui::Transform::ROT_0;
// Disable setting transform hint if the debug flag is set.
if (!mFlinger->mDebugDisableTransformHint) {
// The transform hint is used to improve performance, but we can
// only have a single transform hint, it cannot
// apply to all displays.
const ui::Transform& planeTransform = display->getTransform();
- orientation = planeTransform.getOrientation();
- if (orientation & ui::Transform::ROT_INVALID) {
- orientation = 0;
+ transformHint = static_cast<ui::Transform::RotationFlags>(planeTransform.getOrientation());
+ if (transformHint & ui::Transform::ROT_INVALID) {
+ transformHint = ui::Transform::ROT_0;
}
}
- setTransformHint(orientation);
+ setTransformHint(transformHint);
}
// ----------------------------------------------------------------------------
@@ -2076,6 +2089,16 @@ half Layer::getAlpha() const {
return parentAlpha * getDrawingState().color.a;
}
+ui::Transform::RotationFlags Layer::getFixedTransformHint() const {
+ ui::Transform::RotationFlags fixedTransformHint = mCurrentState.fixedTransformHint;
+ if (fixedTransformHint != ui::Transform::ROT_INVALID) {
+ return fixedTransformHint;
+ }
+ const auto& p = mCurrentParent.promote();
+ if (!p) return fixedTransformHint;
+ return p->getFixedTransformHint();
+}
+
half4 Layer::getColor() const {
const half4 color(getDrawingState().color);
return half4(color.r, color.g, color.b, getAlpha());