summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-05-23 14:35:49 -0700
committerMathias Agopian <mathias@google.com>2012-05-23 18:01:24 -0700
commit05cec9d1275fd939c2d1aec235dca2bdb8edef63 (patch)
tree8e444d605f3f8f8ef0ed1d4297045410d45e1367
parent419e196e639c8adb875da2765abcef95017b6d4a (diff)
downloadnative-05cec9d1275fd939c2d1aec235dca2bdb8edef63.tar.gz
improve resize transactions
use a flag instead of pre-committing the "requested" state to prevent propagation or "requested" to "active", which makes things a lot clearer when reading the code. also avoid going through the "resized" code-path when requested size is equal to "active" size. Bug: 6498869 Change-Id: I24f893ba0ec5ca06aac5b8da9818989ae7ce4005
-rw-r--r--services/surfaceflinger/Layer.cpp7
-rw-r--r--services/surfaceflinger/LayerBase.cpp8
-rw-r--r--services/surfaceflinger/LayerBase.h3
3 files changed, 10 insertions, 8 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index fc7c767b55..722813db07 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -428,8 +428,8 @@ uint32_t Layer::doTransaction(uint32_t flags)
const Layer::State& front(drawingState());
const Layer::State& temp(currentState());
- const bool sizeChanged = (front.requested.w != temp.requested.w) ||
- (front.requested.h != temp.requested.h);
+ const bool sizeChanged = (temp.requested.w != front.active.w) ||
+ (temp.requested.h != front.active.h);
if (sizeChanged) {
// the size changed, we need to ask our client to request a new buffer
@@ -472,8 +472,7 @@ uint32_t Layer::doTransaction(uint32_t flags)
if (!isFixedSize()) {
// this will make sure LayerBase::doTransaction doesn't update
// the drawing state's geometry
- Layer::State& editDraw(mDrawingState);
- editDraw.requested = temp.requested;
+ flags |= eDontUpdateGeometryState;
}
// record the new size, form this point on, when the client request
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index 7c6a28afb7..16bac8f79c 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -201,12 +201,14 @@ uint32_t LayerBase::doTransaction(uint32_t flags)
const Layer::State& front(drawingState());
const Layer::State& temp(currentState());
- if (front.requested != temp.requested) {
- // geometry of the layer has changed, set the active geometry
- // to the requested geometry.
+ // always set active to requested, unless we're asked not to
+ // this is used by Layer, which special cases resizes.
+ if (flags & eDontUpdateGeometryState) {
+ } else {
Layer::State& editTemp(currentState());
editTemp.active = temp.requested;
}
+
if (front.active != temp.active) {
// invalidate and recompute the visible regions if needed
flags |= Layer::eVisibleRegion;
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
index 9542424427..c547a40725 100644
--- a/services/surfaceflinger/LayerBase.h
+++ b/services/surfaceflinger/LayerBase.h
@@ -227,7 +227,8 @@ public:
enum { // flags for doTransaction()
- eVisibleRegion = 0x00000002,
+ eDontUpdateGeometryState = 0x00000001,
+ eVisibleRegion = 0x00000002,
};