diff options
author | 2020-01-16 21:18:46 +0000 | |
---|---|---|
committer | 2020-01-16 21:18:46 +0000 | |
commit | 92bd250eda0de9b0d3d966f285a8a75fcfd85149 (patch) | |
tree | 81b6b59e7beaf1d49a4c31f452fbe937e2c1e8d6 /services/surfaceflinger/Layer.cpp | |
parent | 0dbbf7492c2816376129c8751f7e1ddd7c3bdf7f (diff) | |
parent | c84d09b6464242b1809ffb4f7faa5b2632f4a5e0 (diff) |
Merge "SF Generalization of Refresh Rates: Adding layer priority hint"
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 2593681b6b..5bba7d312b 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -108,6 +108,7 @@ Layer::Layer(const LayerCreationArgs& args) mCurrentState.api = -1; mCurrentState.hasColorTransform = false; mCurrentState.colorSpaceAgnostic = false; + mCurrentState.frameRateSelectionPriority = PRIORITY_UNSET; mCurrentState.metadata = args.metadata; mCurrentState.shadowRadius = 0.f; @@ -1120,6 +1121,7 @@ bool Layer::setTransparentRegionHint(const Region& transparent) { setTransactionFlags(eTransactionNeeded); return true; } + bool Layer::setFlags(uint8_t flags, uint8_t mask) { const uint32_t newFlags = (mCurrentState.flags & ~mask) | (flags & mask); if (mCurrentState.flags == newFlags) return false; @@ -1176,6 +1178,29 @@ bool Layer::setColorSpaceAgnostic(const bool agnostic) { return true; } +bool Layer::setFrameRateSelectionPriority(int32_t priority) { + if (mCurrentState.frameRateSelectionPriority == priority) return false; + mCurrentState.frameRateSelectionPriority = priority; + mCurrentState.sequence++; + mCurrentState.modified = true; + setTransactionFlags(eTransactionNeeded); + return true; +} + +int32_t Layer::getFrameRateSelectionPriority() const { + // Check if layer has priority set. + if (mDrawingState.frameRateSelectionPriority != PRIORITY_UNSET) { + return mDrawingState.frameRateSelectionPriority; + } + // If not, search whether its parents have it set. + sp<Layer> parent = getParent(); + if (parent != nullptr) { + return parent->getFrameRateSelectionPriority(); + } + + return Layer::PRIORITY_UNSET; +} + uint32_t Layer::getLayerStack() const { auto p = mDrawingParent.promote(); if (p == nullptr) { |