diff options
| author | 2021-03-31 14:30:26 +0000 | |
|---|---|---|
| committer | 2021-03-31 14:30:26 +0000 | |
| commit | 75ba8bcd4209377ddd32b3e23e89b7ad9c382a9e (patch) | |
| tree | d2a5274d70ce0053e76c6b43086bff02f0d31099 /libs/gui/LayerState.cpp | |
| parent | 7f56cf876a74bd778f38c6d1dab6632f010cf6f8 (diff) | |
| parent | c5986778d0d6c7ab3f96fafb1b84887e901ed92b (diff) | |
Merge "setFrameRate: Make shouldBeSeamless an enum" into sc-dev
Diffstat (limited to 'libs/gui/LayerState.cpp')
| -rw-r--r-- | libs/gui/LayerState.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index d653ae71be..ae4f8fe4f8 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -19,6 +19,7 @@ #include <apex/window.h> #include <inttypes.h> +#include <android/native_window.h> #include <binder/Parcel.h> #include <gui/IGraphicBufferProducer.h> #include <gui/ISurfaceComposerClient.h> @@ -60,7 +61,7 @@ layer_state_t::layer_state_t() frameRateSelectionPriority(-1), frameRate(0.0f), frameRateCompatibility(ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT), - shouldBeSeamless(true), + changeFrameRateStrategy(ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS), fixedTransformHint(ui::Transform::ROT_INVALID), frameNumber(0), autoRefresh(false), @@ -148,7 +149,7 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeInt32, frameRateSelectionPriority); SAFE_PARCEL(output.writeFloat, frameRate); SAFE_PARCEL(output.writeByte, frameRateCompatibility); - SAFE_PARCEL(output.writeBool, shouldBeSeamless); + SAFE_PARCEL(output.writeByte, changeFrameRateStrategy); SAFE_PARCEL(output.writeUint32, fixedTransformHint); SAFE_PARCEL(output.writeUint64, frameNumber); SAFE_PARCEL(output.writeBool, autoRefresh); @@ -269,7 +270,7 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readInt32, &frameRateSelectionPriority); SAFE_PARCEL(input.readFloat, &frameRate); SAFE_PARCEL(input.readByte, &frameRateCompatibility); - SAFE_PARCEL(input.readBool, &shouldBeSeamless); + SAFE_PARCEL(input.readByte, &changeFrameRateStrategy); SAFE_PARCEL(input.readUint32, &tmpUint32); fixedTransformHint = static_cast<ui::Transform::RotationFlags>(tmpUint32); SAFE_PARCEL(input.readUint64, &frameNumber); @@ -531,7 +532,7 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eFrameRateChanged; frameRate = other.frameRate; frameRateCompatibility = other.frameRateCompatibility; - shouldBeSeamless = other.shouldBeSeamless; + changeFrameRateStrategy = other.changeFrameRateStrategy; } if (other.what & eFixedTransformHintChanged) { what |= eFixedTransformHintChanged; @@ -624,8 +625,8 @@ status_t InputWindowCommands::read(const Parcel& input) { return NO_ERROR; } -bool ValidateFrameRate(float frameRate, int8_t compatibility, const char* inFunctionName, - bool privileged) { +bool ValidateFrameRate(float frameRate, int8_t compatibility, int8_t changeFrameRateStrategy, + const char* inFunctionName, bool privileged) { const char* functionName = inFunctionName != nullptr ? inFunctionName : "call"; int floatClassification = std::fpclassify(frameRate); if (frameRate < 0 || floatClassification == FP_INFINITE || floatClassification == FP_NAN) { @@ -641,6 +642,12 @@ bool ValidateFrameRate(float frameRate, int8_t compatibility, const char* inFunc return false; } + if (changeFrameRateStrategy != ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS && + changeFrameRateStrategy != ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS) { + ALOGE("%s failed - invalid change frame rate strategy value %d", functionName, + changeFrameRateStrategy); + } + return true; } |