SF Generalization of Refresh Rates: Adding layer priority hint
Test: Device boots. Observe logs for errors.
Test: Open Swappy and Chrome in split screen, tap between apps,
SF prints the correct priority.
Test: Open Chrome, play video. SF prints correct priority.
Test: SF prints the correct priority received.
Bug: 142507166
Change-Id: I5fa8a857c950db01f42a380a72d098039badc289
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 76edfa5..58a360a 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -96,6 +96,7 @@
class Layer : public compositionengine::LayerFE {
static std::atomic<int32_t> sSequence;
+ static constexpr int32_t PRIORITY_UNSET = -1;
public:
mutable bool contentDirty{false};
@@ -220,6 +221,9 @@
// Length of the cast shadow. If the radius is > 0, a shadow of length shadowRadius will
// be rendered around the layer.
float shadowRadius;
+
+ // Priority of the layer assigned by Window Manager.
+ int32_t frameRateSelectionPriority;
};
explicit Layer(const LayerCreationArgs& args);
@@ -337,6 +341,10 @@
virtual bool setBackgroundColor(const half3& color, float alpha, ui::Dataspace dataspace);
virtual bool setColorSpaceAgnostic(const bool agnostic);
bool setShadowRadius(float shadowRadius);
+ virtual bool setFrameRateSelectionPriority(int32_t priority);
+ // If the variable is not set on the layer, it traverses up the tree to inherit the frame
+ // rate priority from its parent.
+ virtual int32_t getFrameRateSelectionPriority() const;
virtual ui::Dataspace getDataSpace() const { return ui::Dataspace::UNKNOWN; }
@@ -755,6 +763,7 @@
// For unit tests
friend class TestableSurfaceFlinger;
+ friend class RefreshRateSelectionTest;
virtual void commitTransaction(const State& stateToCommit);