diff options
author | 2025-02-06 07:18:54 -0800 | |
---|---|---|
committer | 2025-02-06 07:18:54 -0800 | |
commit | 2766306267e35a80a419dacd73b64200ddf28138 (patch) | |
tree | b315cdf2b4ef8aa54987e56957af757075f9f65c | |
parent | 17d1c43b7691f4cf20a1125a25baa8fa87e17fba (diff) | |
parent | 16dd6e3e6f6500fe74ef27b8430c717ed5e7e9d8 (diff) |
Merge "Remove client drawn shadow code" into main
-rw-r--r-- | libs/gui/LayerState.cpp | 8 | ||||
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 11 | ||||
-rw-r--r-- | libs/gui/include/gui/LayerState.h | 4 | ||||
-rw-r--r-- | libs/gui/include/gui/SurfaceComposerClient.h | 4 | ||||
-rw-r--r-- | libs/ui/include/ui/ShadowSettings.h | 4 | ||||
-rw-r--r-- | services/surfaceflinger/FrontEnd/LayerSnapshot.cpp | 7 | ||||
-rw-r--r-- | services/surfaceflinger/FrontEnd/RequestedLayerState.cpp | 7 | ||||
-rw-r--r-- | services/surfaceflinger/tests/common/LayerLifecycleManagerHelper.h | 11 | ||||
-rw-r--r-- | services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp | 8 |
9 files changed, 3 insertions, 61 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index 44aac9bfae..ebfc62f33f 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -67,7 +67,6 @@ layer_state_t::layer_state_t() reserved(0), cornerRadius(0.0f), clientDrawnCornerRadius(0.0f), - clientDrawnShadowRadius(0.0f), backgroundBlurRadius(0), color(0), bufferTransform(0), @@ -143,7 +142,6 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.write, colorTransform.asArray(), 16 * sizeof(float)); SAFE_PARCEL(output.writeFloat, cornerRadius); SAFE_PARCEL(output.writeFloat, clientDrawnCornerRadius); - SAFE_PARCEL(output.writeFloat, clientDrawnShadowRadius); SAFE_PARCEL(output.writeUint32, backgroundBlurRadius); SAFE_PARCEL(output.writeParcelable, metadata); SAFE_PARCEL(output.writeFloat, bgColor.r); @@ -279,7 +277,6 @@ status_t layer_state_t::read(const Parcel& input) SAFE_PARCEL(input.read, &colorTransform, 16 * sizeof(float)); SAFE_PARCEL(input.readFloat, &cornerRadius); SAFE_PARCEL(input.readFloat, &clientDrawnCornerRadius); - SAFE_PARCEL(input.readFloat, &clientDrawnShadowRadius); SAFE_PARCEL(input.readUint32, &backgroundBlurRadius); SAFE_PARCEL(input.readParcelable, &metadata); @@ -606,10 +603,6 @@ void layer_state_t::merge(const layer_state_t& other) { what |= eClientDrawnCornerRadiusChanged; clientDrawnCornerRadius = other.clientDrawnCornerRadius; } - if (other.what & eClientDrawnShadowsChanged) { - what |= eClientDrawnShadowsChanged; - clientDrawnShadowRadius = other.clientDrawnShadowRadius; - } if (other.what & eBackgroundBlurRadiusChanged) { what |= eBackgroundBlurRadiusChanged; backgroundBlurRadius = other.backgroundBlurRadius; @@ -824,7 +817,6 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const { CHECK_DIFF(diff, eLayerStackChanged, other, layerStack); CHECK_DIFF(diff, eCornerRadiusChanged, other, cornerRadius); CHECK_DIFF(diff, eClientDrawnCornerRadiusChanged, other, clientDrawnCornerRadius); - CHECK_DIFF(diff, eClientDrawnShadowsChanged, other, clientDrawnShadowRadius); CHECK_DIFF(diff, eBackgroundBlurRadiusChanged, other, backgroundBlurRadius); if (other.what & eBlurRegionsChanged) diff |= eBlurRegionsChanged; if (other.what & eRelativeLayerChanged) { diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index f964c4dad2..37ed23bd6b 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -1687,17 +1687,6 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setClien return *this; } -SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setClientDrawnShadowRadius( - const sp<SurfaceControl>& sc, float clientDrawnShadowRadius) { - layer_state_t* s = getLayerState(sc); - if (!s) { - mStatus = BAD_INDEX; - return *this; - } - s->what |= layer_state_t::eClientDrawnShadowsChanged; - s->clientDrawnShadowRadius = clientDrawnShadowRadius; - return *this; -} SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBackgroundBlurRadius( const sp<SurfaceControl>& sc, int backgroundBlurRadius) { layer_state_t* s = getLayerState(sc); diff --git a/libs/gui/include/gui/LayerState.h b/libs/gui/include/gui/LayerState.h index 100261423a..d04b8618f7 100644 --- a/libs/gui/include/gui/LayerState.h +++ b/libs/gui/include/gui/LayerState.h @@ -232,7 +232,6 @@ struct layer_state_t { ePictureProfileHandleChanged = 0x80000'00000000, eAppContentPriorityChanged = 0x100000'00000000, eClientDrawnCornerRadiusChanged = 0x200000'00000000, - eClientDrawnShadowsChanged = 0x400000'00000000, }; layer_state_t(); @@ -276,7 +275,7 @@ struct layer_state_t { layer_state_t::eColorSpaceAgnosticChanged | layer_state_t::eColorTransformChanged | layer_state_t::eCornerRadiusChanged | layer_state_t::eDimmingEnabledChanged | layer_state_t::eHdrMetadataChanged | layer_state_t::eShadowRadiusChanged | - layer_state_t::eClientDrawnShadowsChanged | layer_state_t::eStretchChanged | + layer_state_t::eStretchChanged | layer_state_t::ePictureProfileHandleChanged | layer_state_t::eAppContentPriorityChanged; // Changes which invalidates the layer's visible region in CE. @@ -336,7 +335,6 @@ struct layer_state_t { matrix22_t matrix; float cornerRadius; float clientDrawnCornerRadius; - float clientDrawnShadowRadius; uint32_t backgroundBlurRadius; sp<SurfaceControl> relativeLayerSurfaceControl; diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h index d30a830863..10225cc114 100644 --- a/libs/gui/include/gui/SurfaceComposerClient.h +++ b/libs/gui/include/gui/SurfaceComposerClient.h @@ -569,10 +569,6 @@ public: // radius is drawn by the client and not SurfaceFlinger. Transaction& setClientDrawnCornerRadius(const sp<SurfaceControl>& sc, float clientDrawnCornerRadius); - // Sets the client drawn shadow radius for the layer. This indicates that the shadows - // are drawn by the client and not SurfaceFlinger. - Transaction& setClientDrawnShadowRadius(const sp<SurfaceControl>& sc, - float clientDrawnShadowRadius); Transaction& setBackgroundBlurRadius(const sp<SurfaceControl>& sc, int backgroundBlurRadius); Transaction& setBlurRegions(const sp<SurfaceControl>& sc, diff --git a/libs/ui/include/ui/ShadowSettings.h b/libs/ui/include/ui/ShadowSettings.h index 06be6dbbf5..c0b83b8691 100644 --- a/libs/ui/include/ui/ShadowSettings.h +++ b/libs/ui/include/ui/ShadowSettings.h @@ -46,9 +46,6 @@ struct ShadowSettings { // Length of the cast shadow. If length is <= 0.f no shadows will be drawn. float length = 0.f; - // Length of the cast shadow that is drawn by the client. - float clientDrawnLength = 0.f; - // If true fill in the casting layer is translucent and the shadow needs to fill the bounds. // Otherwise the shadow will only be drawn around the edges of the casting layer. bool casterIsTranslucent = false; @@ -58,7 +55,6 @@ static inline bool operator==(const ShadowSettings& lhs, const ShadowSettings& r return lhs.boundaries == rhs.boundaries && lhs.ambientColor == rhs.ambientColor && lhs.spotColor == rhs.spotColor && lhs.lightPos == rhs.lightPos && lhs.lightRadius == rhs.lightRadius && lhs.length == rhs.length && - lhs.clientDrawnLength == rhs.clientDrawnLength && lhs.casterIsTranslucent == rhs.casterIsTranslucent; } diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshot.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshot.cpp index bbf42a81aa..839bd79dac 100644 --- a/services/surfaceflinger/FrontEnd/LayerSnapshot.cpp +++ b/services/surfaceflinger/FrontEnd/LayerSnapshot.cpp @@ -403,11 +403,8 @@ void LayerSnapshot::merge(const RequestedLayerState& requested, bool forceUpdate if (forceUpdate || requested.what & layer_state_t::eSidebandStreamChanged) { sidebandStream = requested.sidebandStream; } - if (forceUpdate || requested.what & layer_state_t::eShadowRadiusChanged || - requested.what & layer_state_t::eClientDrawnShadowsChanged) { - shadowSettings.length = - requested.clientDrawnShadowRadius > 0 ? 0.f : requested.shadowRadius; - shadowSettings.clientDrawnLength = requested.clientDrawnShadowRadius; + if (forceUpdate || requested.what & layer_state_t::eShadowRadiusChanged) { + shadowSettings.length = requested.shadowRadius; } if (forceUpdate || requested.what & layer_state_t::eFrameRateSelectionPriority) { diff --git a/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp b/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp index 1d53e719ab..58c235ed91 100644 --- a/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp +++ b/services/surfaceflinger/FrontEnd/RequestedLayerState.cpp @@ -108,7 +108,6 @@ RequestedLayerState::RequestedLayerState(const LayerCreationArgs& args) surfaceDamageRegion = Region::INVALID_REGION; cornerRadius = 0.0f; clientDrawnCornerRadius = 0.0f; - clientDrawnShadowRadius = 0.0f; backgroundBlurRadius = 0; api = -1; hasColorTransform = false; @@ -355,11 +354,6 @@ void RequestedLayerState::merge(const ResolvedComposerState& resolvedComposerSta clientDrawnCornerRadius = clientState.clientDrawnCornerRadius; changes |= RequestedLayerState::Changes::Geometry; } - - if (clientState.what & layer_state_t::eClientDrawnShadowsChanged) { - clientDrawnShadowRadius = clientState.clientDrawnShadowRadius; - changes |= RequestedLayerState::Changes::Geometry; - } } ui::Size RequestedLayerState::getUnrotatedBufferSize(uint32_t displayRotationFlags) const { @@ -646,7 +640,6 @@ bool RequestedLayerState::isSimpleBufferUpdate(const layer_state_t& s) const { layer_state_t::eColorTransformChanged | layer_state_t::eBackgroundColorChanged | layer_state_t::eMatrixChanged | layer_state_t::eCornerRadiusChanged | layer_state_t::eClientDrawnCornerRadiusChanged | - layer_state_t::eClientDrawnShadowsChanged | layer_state_t::eBackgroundBlurRadiusChanged | layer_state_t::eBufferTransformChanged | layer_state_t::eTransformToDisplayInverseChanged | layer_state_t::eCropChanged | layer_state_t::eDataspaceChanged | layer_state_t::eHdrMetadataChanged | diff --git a/services/surfaceflinger/tests/common/LayerLifecycleManagerHelper.h b/services/surfaceflinger/tests/common/LayerLifecycleManagerHelper.h index ee5d9193ea..7910e775f6 100644 --- a/services/surfaceflinger/tests/common/LayerLifecycleManagerHelper.h +++ b/services/surfaceflinger/tests/common/LayerLifecycleManagerHelper.h @@ -497,17 +497,6 @@ public: mLifecycleManager.applyTransactions(transactions); } - void setClientDrawnShadowRadius(uint32_t id, float clientDrawnShadowRadius) { - std::vector<QueuedTransactionState> transactions; - transactions.emplace_back(); - transactions.back().states.push_back({}); - - transactions.back().states.front().state.what = layer_state_t::eClientDrawnShadowsChanged; - transactions.back().states.front().layerId = id; - transactions.back().states.front().state.clientDrawnShadowRadius = clientDrawnShadowRadius; - mLifecycleManager.applyTransactions(transactions); - } - void setShadowRadius(uint32_t id, float shadowRadius) { std::vector<QueuedTransactionState> transactions; transactions.emplace_back(); diff --git a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp index 453c053eb5..7aad84b545 100644 --- a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp +++ b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp @@ -1505,14 +1505,6 @@ TEST_F(LayerSnapshotTest, childIgnoreCornerRadiusOverridesParent) { EXPECT_EQ(getSnapshot({.id = 111})->roundedCorner.radius.x, RADIUS); } -TEST_F(LayerSnapshotTest, ignoreShadows) { - static constexpr float SHADOW_RADIUS = 123.f; - setClientDrawnShadowRadius(1, SHADOW_RADIUS); - setShadowRadius(1, SHADOW_RADIUS); - UPDATE_AND_VERIFY(mSnapshotBuilder, STARTING_ZORDER); - EXPECT_EQ(getSnapshot({.id = 1})->shadowSettings.length, 0.f); -} - TEST_F(LayerSnapshotTest, setShadowRadius) { static constexpr float SHADOW_RADIUS = 123.f; setShadowRadius(1, SHADOW_RADIUS); |