Skip to content

Commit 2766306

Browse files
cairno-googleAndroid (Google) Code Review
authored andcommitted
Merge "Remove client drawn shadow code" into main
2 parents 17d1c43 + 16dd6e3 commit 2766306

9 files changed

Lines changed: 3 additions & 61 deletions

File tree

libs/gui/LayerState.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ layer_state_t::layer_state_t()
6767
reserved(0),
6868
cornerRadius(0.0f),
6969
clientDrawnCornerRadius(0.0f),
70-
clientDrawnShadowRadius(0.0f),
7170
backgroundBlurRadius(0),
7271
color(0),
7372
bufferTransform(0),
@@ -143,7 +142,6 @@ status_t layer_state_t::write(Parcel& output) const
143142
SAFE_PARCEL(output.write, colorTransform.asArray(), 16 * sizeof(float));
144143
SAFE_PARCEL(output.writeFloat, cornerRadius);
145144
SAFE_PARCEL(output.writeFloat, clientDrawnCornerRadius);
146-
SAFE_PARCEL(output.writeFloat, clientDrawnShadowRadius);
147145
SAFE_PARCEL(output.writeUint32, backgroundBlurRadius);
148146
SAFE_PARCEL(output.writeParcelable, metadata);
149147
SAFE_PARCEL(output.writeFloat, bgColor.r);
@@ -279,7 +277,6 @@ status_t layer_state_t::read(const Parcel& input)
279277
SAFE_PARCEL(input.read, &colorTransform, 16 * sizeof(float));
280278
SAFE_PARCEL(input.readFloat, &cornerRadius);
281279
SAFE_PARCEL(input.readFloat, &clientDrawnCornerRadius);
282-
SAFE_PARCEL(input.readFloat, &clientDrawnShadowRadius);
283280
SAFE_PARCEL(input.readUint32, &backgroundBlurRadius);
284281
SAFE_PARCEL(input.readParcelable, &metadata);
285282

@@ -606,10 +603,6 @@ void layer_state_t::merge(const layer_state_t& other) {
606603
what |= eClientDrawnCornerRadiusChanged;
607604
clientDrawnCornerRadius = other.clientDrawnCornerRadius;
608605
}
609-
if (other.what & eClientDrawnShadowsChanged) {
610-
what |= eClientDrawnShadowsChanged;
611-
clientDrawnShadowRadius = other.clientDrawnShadowRadius;
612-
}
613606
if (other.what & eBackgroundBlurRadiusChanged) {
614607
what |= eBackgroundBlurRadiusChanged;
615608
backgroundBlurRadius = other.backgroundBlurRadius;
@@ -824,7 +817,6 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const {
824817
CHECK_DIFF(diff, eLayerStackChanged, other, layerStack);
825818
CHECK_DIFF(diff, eCornerRadiusChanged, other, cornerRadius);
826819
CHECK_DIFF(diff, eClientDrawnCornerRadiusChanged, other, clientDrawnCornerRadius);
827-
CHECK_DIFF(diff, eClientDrawnShadowsChanged, other, clientDrawnShadowRadius);
828820
CHECK_DIFF(diff, eBackgroundBlurRadiusChanged, other, backgroundBlurRadius);
829821
if (other.what & eBlurRegionsChanged) diff |= eBlurRegionsChanged;
830822
if (other.what & eRelativeLayerChanged) {

libs/gui/SurfaceComposerClient.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,17 +1687,6 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setClien
16871687
return *this;
16881688
}
16891689

1690-
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setClientDrawnShadowRadius(
1691-
const sp<SurfaceControl>& sc, float clientDrawnShadowRadius) {
1692-
layer_state_t* s = getLayerState(sc);
1693-
if (!s) {
1694-
mStatus = BAD_INDEX;
1695-
return *this;
1696-
}
1697-
s->what |= layer_state_t::eClientDrawnShadowsChanged;
1698-
s->clientDrawnShadowRadius = clientDrawnShadowRadius;
1699-
return *this;
1700-
}
17011690
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBackgroundBlurRadius(
17021691
const sp<SurfaceControl>& sc, int backgroundBlurRadius) {
17031692
layer_state_t* s = getLayerState(sc);

libs/gui/include/gui/LayerState.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ struct layer_state_t {
232232
ePictureProfileHandleChanged = 0x80000'00000000,
233233
eAppContentPriorityChanged = 0x100000'00000000,
234234
eClientDrawnCornerRadiusChanged = 0x200000'00000000,
235-
eClientDrawnShadowsChanged = 0x400000'00000000,
236235
};
237236

238237
layer_state_t();
@@ -276,7 +275,7 @@ struct layer_state_t {
276275
layer_state_t::eColorSpaceAgnosticChanged | layer_state_t::eColorTransformChanged |
277276
layer_state_t::eCornerRadiusChanged | layer_state_t::eDimmingEnabledChanged |
278277
layer_state_t::eHdrMetadataChanged | layer_state_t::eShadowRadiusChanged |
279-
layer_state_t::eClientDrawnShadowsChanged | layer_state_t::eStretchChanged |
278+
layer_state_t::eStretchChanged |
280279
layer_state_t::ePictureProfileHandleChanged | layer_state_t::eAppContentPriorityChanged;
281280

282281
// Changes which invalidates the layer's visible region in CE.
@@ -336,7 +335,6 @@ struct layer_state_t {
336335
matrix22_t matrix;
337336
float cornerRadius;
338337
float clientDrawnCornerRadius;
339-
float clientDrawnShadowRadius;
340338
uint32_t backgroundBlurRadius;
341339

342340
sp<SurfaceControl> relativeLayerSurfaceControl;

libs/gui/include/gui/SurfaceComposerClient.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,6 @@ class SurfaceComposerClient : public RefBase
569569
// radius is drawn by the client and not SurfaceFlinger.
570570
Transaction& setClientDrawnCornerRadius(const sp<SurfaceControl>& sc,
571571
float clientDrawnCornerRadius);
572-
// Sets the client drawn shadow radius for the layer. This indicates that the shadows
573-
// are drawn by the client and not SurfaceFlinger.
574-
Transaction& setClientDrawnShadowRadius(const sp<SurfaceControl>& sc,
575-
float clientDrawnShadowRadius);
576572
Transaction& setBackgroundBlurRadius(const sp<SurfaceControl>& sc,
577573
int backgroundBlurRadius);
578574
Transaction& setBlurRegions(const sp<SurfaceControl>& sc,

libs/ui/include/ui/ShadowSettings.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ struct ShadowSettings {
4646
// Length of the cast shadow. If length is <= 0.f no shadows will be drawn.
4747
float length = 0.f;
4848

49-
// Length of the cast shadow that is drawn by the client.
50-
float clientDrawnLength = 0.f;
51-
5249
// If true fill in the casting layer is translucent and the shadow needs to fill the bounds.
5350
// Otherwise the shadow will only be drawn around the edges of the casting layer.
5451
bool casterIsTranslucent = false;
@@ -58,7 +55,6 @@ static inline bool operator==(const ShadowSettings& lhs, const ShadowSettings& r
5855
return lhs.boundaries == rhs.boundaries && lhs.ambientColor == rhs.ambientColor &&
5956
lhs.spotColor == rhs.spotColor && lhs.lightPos == rhs.lightPos &&
6057
lhs.lightRadius == rhs.lightRadius && lhs.length == rhs.length &&
61-
lhs.clientDrawnLength == rhs.clientDrawnLength &&
6258
lhs.casterIsTranslucent == rhs.casterIsTranslucent;
6359
}
6460

services/surfaceflinger/FrontEnd/LayerSnapshot.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,8 @@ void LayerSnapshot::merge(const RequestedLayerState& requested, bool forceUpdate
403403
if (forceUpdate || requested.what & layer_state_t::eSidebandStreamChanged) {
404404
sidebandStream = requested.sidebandStream;
405405
}
406-
if (forceUpdate || requested.what & layer_state_t::eShadowRadiusChanged ||
407-
requested.what & layer_state_t::eClientDrawnShadowsChanged) {
408-
shadowSettings.length =
409-
requested.clientDrawnShadowRadius > 0 ? 0.f : requested.shadowRadius;
410-
shadowSettings.clientDrawnLength = requested.clientDrawnShadowRadius;
406+
if (forceUpdate || requested.what & layer_state_t::eShadowRadiusChanged) {
407+
shadowSettings.length = requested.shadowRadius;
411408
}
412409

413410
if (forceUpdate || requested.what & layer_state_t::eFrameRateSelectionPriority) {

services/surfaceflinger/FrontEnd/RequestedLayerState.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ RequestedLayerState::RequestedLayerState(const LayerCreationArgs& args)
108108
surfaceDamageRegion = Region::INVALID_REGION;
109109
cornerRadius = 0.0f;
110110
clientDrawnCornerRadius = 0.0f;
111-
clientDrawnShadowRadius = 0.0f;
112111
backgroundBlurRadius = 0;
113112
api = -1;
114113
hasColorTransform = false;
@@ -355,11 +354,6 @@ void RequestedLayerState::merge(const ResolvedComposerState& resolvedComposerSta
355354
clientDrawnCornerRadius = clientState.clientDrawnCornerRadius;
356355
changes |= RequestedLayerState::Changes::Geometry;
357356
}
358-
359-
if (clientState.what & layer_state_t::eClientDrawnShadowsChanged) {
360-
clientDrawnShadowRadius = clientState.clientDrawnShadowRadius;
361-
changes |= RequestedLayerState::Changes::Geometry;
362-
}
363357
}
364358

365359
ui::Size RequestedLayerState::getUnrotatedBufferSize(uint32_t displayRotationFlags) const {
@@ -646,7 +640,6 @@ bool RequestedLayerState::isSimpleBufferUpdate(const layer_state_t& s) const {
646640
layer_state_t::eColorTransformChanged | layer_state_t::eBackgroundColorChanged |
647641
layer_state_t::eMatrixChanged | layer_state_t::eCornerRadiusChanged |
648642
layer_state_t::eClientDrawnCornerRadiusChanged |
649-
layer_state_t::eClientDrawnShadowsChanged |
650643
layer_state_t::eBackgroundBlurRadiusChanged | layer_state_t::eBufferTransformChanged |
651644
layer_state_t::eTransformToDisplayInverseChanged | layer_state_t::eCropChanged |
652645
layer_state_t::eDataspaceChanged | layer_state_t::eHdrMetadataChanged |

services/surfaceflinger/tests/common/LayerLifecycleManagerHelper.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -497,17 +497,6 @@ class LayerLifecycleManagerHelper {
497497
mLifecycleManager.applyTransactions(transactions);
498498
}
499499

500-
void setClientDrawnShadowRadius(uint32_t id, float clientDrawnShadowRadius) {
501-
std::vector<QueuedTransactionState> transactions;
502-
transactions.emplace_back();
503-
transactions.back().states.push_back({});
504-
505-
transactions.back().states.front().state.what = layer_state_t::eClientDrawnShadowsChanged;
506-
transactions.back().states.front().layerId = id;
507-
transactions.back().states.front().state.clientDrawnShadowRadius = clientDrawnShadowRadius;
508-
mLifecycleManager.applyTransactions(transactions);
509-
}
510-
511500
void setShadowRadius(uint32_t id, float shadowRadius) {
512501
std::vector<QueuedTransactionState> transactions;
513502
transactions.emplace_back();

services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,14 +1505,6 @@ TEST_F(LayerSnapshotTest, childIgnoreCornerRadiusOverridesParent) {
15051505
EXPECT_EQ(getSnapshot({.id = 111})->roundedCorner.radius.x, RADIUS);
15061506
}
15071507

1508-
TEST_F(LayerSnapshotTest, ignoreShadows) {
1509-
static constexpr float SHADOW_RADIUS = 123.f;
1510-
setClientDrawnShadowRadius(1, SHADOW_RADIUS);
1511-
setShadowRadius(1, SHADOW_RADIUS);
1512-
UPDATE_AND_VERIFY(mSnapshotBuilder, STARTING_ZORDER);
1513-
EXPECT_EQ(getSnapshot({.id = 1})->shadowSettings.length, 0.f);
1514-
}
1515-
15161508
TEST_F(LayerSnapshotTest, setShadowRadius) {
15171509
static constexpr float SHADOW_RADIUS = 123.f;
15181510
setShadowRadius(1, SHADOW_RADIUS);

0 commit comments

Comments
 (0)