diff options
author | Mathias Agopian <mathias@google.com> | 2013-04-02 18:30:32 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2013-04-02 18:30:32 -0700 |
commit | 2ca79399b933935eb1b6c0ec1f746f8c4475369c (patch) | |
tree | 3fbffc3056ceac9214aa8bfeed8cce8f6d9446bc /services | |
parent | 128fcea1c6f8b5f66a5d88a80789e65aac798416 (diff) | |
download | frameworks_native-2ca79399b933935eb1b6c0ec1f746f8c4475369c.zip frameworks_native-2ca79399b933935eb1b6c0ec1f746f8c4475369c.tar.gz frameworks_native-2ca79399b933935eb1b6c0ec1f746f8c4475369c.tar.bz2 |
latch transparent region hint only when we get a new frame
since the transparent region hint really depends on the
content of the window containing the SurfaceView
(it's calculated by the view hierarchy based on
overlapping views), it makes sense to latch it only when
the content of the window (the app) changes.
This should help fixing drawing artifacts when changing the
layout of a window containing a SurfaceView.
Bug: 8511430
Change-Id: Ic3aa668495293cb4d82a2cd7dcf3b6a337287678
Diffstat (limited to 'services')
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 17 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.h | 6 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 4 |
3 files changed, 20 insertions, 7 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index a4c613c..2302367 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -881,8 +881,7 @@ bool Layer::setMatrix(const layer_state_t::matrix22_t& matrix) { return true; } bool Layer::setTransparentRegionHint(const Region& transparent) { - mCurrentState.sequence++; - mCurrentState.transparentRegion = transparent; + mCurrentState.requestedTransparentRegion = transparent; setTransactionFlags(eTransactionNeeded); return true; } @@ -1008,7 +1007,6 @@ Region Layer::latchBuffer(bool& recomputeVisibleRegions) swap(bufWidth, bufHeight); } - bool isFixedSize = item.mScalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE; if (front.active != front.requested) { @@ -1061,6 +1059,17 @@ Region Layer::latchBuffer(bool& recomputeVisibleRegions) return true; } } + + // if the transparent region has changed (this test is + // conservative, but that's fine, worst case we're doing + // a bit of extra work), we latch the new one and we + // trigger a visible-region recompute. + if (!front.activeTransparentRegion.isTriviallyEqual( + front.requestedTransparentRegion)) { + front.activeTransparentRegion = front.requestedTransparentRegion; + recomputeVisibleRegions = true; + } + return false; } }; @@ -1168,7 +1177,7 @@ void Layer::dump(String8& result, char* buffer, size_t SIZE) const getTypeId(), this, getName().string()); result.append(buffer); - s.transparentRegion.dump(result, "transparentRegion"); + s.activeTransparentRegion.dump(result, "transparentRegion"); visibleRegion.dump(result, "visibleRegion"); sp<Client> client(mClientRef.promote()); diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 6bca941..2765db1 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -103,7 +103,11 @@ public: uint8_t reserved[2]; int32_t sequence; // changes when visible regions can change Transform transform; - Region transparentRegion; + // the transparentRegion hint is a bit special, it's latched only + // when we receive a buffer -- this is because it's "content" + // dependent. + Region activeTransparentRegion; + Region requestedTransparentRegion; }; class LayerMesh { diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 3ed8b1b..5c7cf07 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1360,14 +1360,14 @@ void SurfaceFlinger::computeVisibleRegions( if (tr.transformed()) { if (tr.preserveRects()) { // transform the transparent region - transparentRegion = tr.transform(s.transparentRegion); + transparentRegion = tr.transform(s.activeTransparentRegion); } else { // transformation too complex, can't do the // transparent region optimization. transparentRegion.clear(); } } else { - transparentRegion = s.transparentRegion; + transparentRegion = s.activeTransparentRegion; } } |