diff options
| author | 2020-03-06 04:14:54 +0000 | |
|---|---|---|
| committer | 2020-03-06 04:14:54 +0000 | |
| commit | 1d2d8b03657e6cc4bc13f7b4014cee4dad25f37f (patch) | |
| tree | 9dae17cf0ce54ce63a588da2f96a069b1312b468 /services/surfaceflinger/Layer.cpp | |
| parent | 24e9660ce414a5f4a1fcf9900db2be9b718de2c1 (diff) | |
| parent | a125784e31c6be4441c5f17bed40510a85bd4540 (diff) | |
Merge "SurfaceFlinger: Cache updateInputWindows call" into rvc-dev
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 64cfb3d699..3765d0d39d 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -993,6 +993,9 @@ uint32_t Layer::doTransaction(uint32_t flags) { commitTransaction(c); mPendingStatesSnapshot = mPendingStates; mCurrentState.callbackHandles = {}; + + maybeDirtyInput(); + return flags; } @@ -2472,6 +2475,32 @@ Layer::FrameRateCompatibility Layer::FrameRate::convertCompatibility(int8_t comp } } +bool Layer::maybeDirtyInput() { + // No sense redirtying input. + if (mFlinger->inputDirty()) return true; + + if (hasInput()) { + mFlinger->dirtyInput(); + return true; + } + + // If a child or relative dirties the input, no sense continuing to traverse + // so we return early and halt the recursion. We traverse ourselves instead + // of using traverse() so we can implement this early halt. + for (const sp<Layer>& child : mDrawingChildren) { + if (child->maybeDirtyInput()) { + return true; + } + } + for (const wp<Layer>& weakRelative : mDrawingState.zOrderRelatives) { + sp<Layer> relative = weakRelative.promote(); + if (relative && relative->maybeDirtyInput()) { + return true; + } + } + return false; +} + // --------------------------------------------------------------------------- }; // namespace android |