diff options
author | 2024-01-29 12:47:18 -0800 | |
---|---|---|
committer | 2024-01-29 12:47:18 -0800 | |
commit | 2d701e14093b2e699d7dca00db3d7d66d0c96e29 (patch) | |
tree | c1b5916d12ac356ec1732e50293b335475ea83d0 /libs/gui/LayerState.cpp | |
parent | c6e22d8533cee1d044b88f2eb4a94a8b6c041761 (diff) | |
parent | b507b71cc52f9203657f221808eef04d58dd6398 (diff) |
Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I264e728c49f0500f2f868c3a25b0910d0d527340
Change-Id: I0de5ae0000a29e4b9735e6c4f381f680eb0723cd
Diffstat (limited to 'libs/gui/LayerState.cpp')
-rw-r--r-- | libs/gui/LayerState.cpp | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index 2322b70d1c..38fab9cdaa 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -22,6 +22,7 @@ #include <android/gui/ISurfaceComposerClient.h> #include <android/native_window.h> #include <binder/Parcel.h> +#include <gui/FrameRateUtils.h> #include <gui/IGraphicBufferProducer.h> #include <gui/LayerState.h> #include <gui/SurfaceControl.h> @@ -83,6 +84,9 @@ layer_state_t::layer_state_t() frameRateCompatibility(ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT), changeFrameRateStrategy(ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS), defaultFrameRateCompatibility(ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT), + frameRateCategory(ANATIVEWINDOW_FRAME_RATE_CATEGORY_DEFAULT), + frameRateCategorySmoothSwitchOnly(false), + frameRateSelectionStrategy(ANATIVEWINDOW_FRAME_RATE_SELECTION_STRATEGY_PROPAGATE), fixedTransformHint(ui::Transform::ROT_INVALID), autoRefresh(false), isTrustedOverlay(false), @@ -158,6 +162,9 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeByte, frameRateCompatibility); SAFE_PARCEL(output.writeByte, changeFrameRateStrategy); SAFE_PARCEL(output.writeByte, defaultFrameRateCompatibility); + SAFE_PARCEL(output.writeByte, frameRateCategory); + SAFE_PARCEL(output.writeBool, frameRateCategorySmoothSwitchOnly); + SAFE_PARCEL(output.writeByte, frameRateSelectionStrategy); SAFE_PARCEL(output.writeUint32, fixedTransformHint); SAFE_PARCEL(output.writeBool, autoRefresh); SAFE_PARCEL(output.writeBool, dimmingEnabled); @@ -290,6 +297,9 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.readByte, &frameRateCompatibility); SAFE_PARCEL(input.readByte, &changeFrameRateStrategy); SAFE_PARCEL(input.readByte, &defaultFrameRateCompatibility); + SAFE_PARCEL(input.readByte, &frameRateCategory); + SAFE_PARCEL(input.readBool, &frameRateCategorySmoothSwitchOnly); + SAFE_PARCEL(input.readByte, &frameRateSelectionStrategy); SAFE_PARCEL(input.readUint32, &tmpUint32); fixedTransformHint = static_cast<ui::Transform::RotationFlags>(tmpUint32); SAFE_PARCEL(input.readBool, &autoRefresh); @@ -659,6 +669,15 @@ void layer_state_t::merge(const layer_state_t& other) { frameRateCompatibility = other.frameRateCompatibility; changeFrameRateStrategy = other.changeFrameRateStrategy; } + if (other.what & eFrameRateCategoryChanged) { + what |= eFrameRateCategoryChanged; + frameRateCategory = other.frameRateCategory; + frameRateCategorySmoothSwitchOnly = other.frameRateCategorySmoothSwitchOnly; + } + if (other.what & eFrameRateSelectionStrategyChanged) { + what |= eFrameRateSelectionStrategyChanged; + frameRateSelectionStrategy = other.frameRateSelectionStrategy; + } if (other.what & eFixedTransformHintChanged) { what |= eFixedTransformHintChanged; fixedTransformHint = other.fixedTransformHint; @@ -769,6 +788,9 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { CHECK_DIFF(diff, eFrameRateSelectionPriority, other, frameRateSelectionPriority); CHECK_DIFF3(diff, eFrameRateChanged, other, frameRate, frameRateCompatibility, changeFrameRateStrategy); + CHECK_DIFF2(diff, eFrameRateCategoryChanged, other, frameRateCategory, + frameRateCategorySmoothSwitchOnly); + CHECK_DIFF(diff, eFrameRateSelectionStrategyChanged, other, frameRateSelectionStrategy); CHECK_DIFF(diff, eFixedTransformHintChanged, other, fixedTransformHint); CHECK_DIFF(diff, eAutoRefreshChanged, other, autoRefresh); CHECK_DIFF(diff, eTrustedOverlayChanged, other, isTrustedOverlay); @@ -855,34 +877,6 @@ status_t InputWindowCommands::read(const Parcel& input) { return NO_ERROR; } -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) { - ALOGE("%s failed - invalid frame rate %f", functionName, frameRate); - return false; - } - - if (compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT && - compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE && - (!privileged || - (compatibility != ANATIVEWINDOW_FRAME_RATE_EXACT && - compatibility != ANATIVEWINDOW_FRAME_RATE_NO_VOTE))) { - ALOGE("%s failed - invalid compatibility value %d privileged: %s", functionName, - compatibility, privileged ? "yes" : "no"); - 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; -} - // ---------------------------------------------------------------------------- namespace gui { @@ -936,7 +930,6 @@ status_t DisplayCaptureArgs::writeToParcel(Parcel* output) const { SAFE_PARCEL(output->writeStrongBinder, displayToken); SAFE_PARCEL(output->writeUint32, width); SAFE_PARCEL(output->writeUint32, height); - SAFE_PARCEL(output->writeBool, useIdentityTransform); return NO_ERROR; } @@ -946,7 +939,6 @@ status_t DisplayCaptureArgs::readFromParcel(const Parcel* input) { SAFE_PARCEL(input->readStrongBinder, &displayToken); SAFE_PARCEL(input->readUint32, &width); SAFE_PARCEL(input->readUint32, &height); - SAFE_PARCEL(input->readBool, &useIdentityTransform); return NO_ERROR; } |