blob: d42bce6ed51b635d86eded6e50c606d40baafa0a [file] [log] [blame]
Vishnu Nair8fc721b2022-12-22 20:06:32 +00001/*
2 * Copyright 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define ATRACE_TAG ATRACE_TAG_GRAPHICS
18#undef LOG_TAG
Vishnu Naira02943f2023-06-03 13:44:46 -070019#define LOG_TAG "SurfaceFlinger"
Vishnu Nair8fc721b2022-12-22 20:06:32 +000020
21#include "LayerSnapshot.h"
Vishnu Nair3996ee32023-08-14 04:32:31 +000022#include "Layer.h"
Vishnu Nair8fc721b2022-12-22 20:06:32 +000023
24namespace android::surfaceflinger::frontend {
25
26using namespace ftl::flag_operators;
27
Vishnu Naira02943f2023-06-03 13:44:46 -070028namespace {
29
30void updateSurfaceDamage(const RequestedLayerState& requested, bool hasReadyFrame,
31 bool forceFullDamage, Region& outSurfaceDamageRegion) {
32 if (!hasReadyFrame) {
33 outSurfaceDamageRegion.clear();
34 return;
35 }
36 if (forceFullDamage) {
37 outSurfaceDamageRegion = Region::INVALID_REGION;
38 } else {
39 outSurfaceDamageRegion = requested.surfaceDamageRegion;
40 }
41}
42
Vishnu Nair3cc15a42023-06-30 06:20:22 +000043std::ostream& operator<<(std::ostream& os, const ui::Transform& transform) {
44 const uint32_t type = transform.getType();
45 const uint32_t orientation = transform.getOrientation();
46 if (type == ui::Transform::IDENTITY) {
47 return os;
48 }
49
50 if (type & ui::Transform::UNKNOWN) {
51 std::string out;
52 transform.dump(out, "", "");
53 os << out;
54 return os;
55 }
56
57 if (type & ui::Transform::ROTATE) {
58 switch (orientation) {
59 case ui::Transform::ROT_0:
60 os << "ROT_0";
61 break;
62 case ui::Transform::FLIP_H:
63 os << "FLIP_H";
64 break;
65 case ui::Transform::FLIP_V:
66 os << "FLIP_V";
67 break;
68 case ui::Transform::ROT_90:
69 os << "ROT_90";
70 break;
71 case ui::Transform::ROT_180:
72 os << "ROT_180";
73 break;
74 case ui::Transform::ROT_270:
75 os << "ROT_270";
76 break;
77 case ui::Transform::ROT_INVALID:
78 default:
79 os << "ROT_INVALID";
80 break;
81 }
82 }
83
84 if (type & ui::Transform::SCALE) {
85 std::string out;
86 android::base::StringAppendF(&out, " scale x=%.4f y=%.4f ", transform.getScaleX(),
87 transform.getScaleY());
88 os << out;
89 }
90
91 if (type & ui::Transform::TRANSLATE) {
92 std::string out;
93 android::base::StringAppendF(&out, " tx=%.4f ty=%.4f ", transform.tx(), transform.ty());
94 os << out;
95 }
96
97 return os;
98}
99
Vishnu Naira02943f2023-06-03 13:44:46 -0700100} // namespace
101
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000102LayerSnapshot::LayerSnapshot(const RequestedLayerState& state,
103 const LayerHierarchy::TraversalPath& path)
104 : path(path) {
Vishnu Naird0183602023-03-16 18:52:15 +0000105 // Provide a unique id for all snapshots.
106 // A front end layer can generate multiple snapshots if its mirrored.
107 // Additionally, if the layer is not reachable, we may choose to destroy
108 // and recreate the snapshot in which case the unique sequence id will
109 // change. The consumer shouldn't tie any lifetimes to this unique id but
110 // register a LayerLifecycleManager::ILifecycleListener or get a list of
111 // destroyed layers from LayerLifecycleManager.
Vishnu Nair150065b2023-04-17 19:14:11 -0700112 if (path.isClone()) {
113 uniqueSequence =
114 LayerCreationArgs::getInternalLayerId(LayerCreationArgs::sInternalSequence++);
115 } else {
116 uniqueSequence = state.id;
117 }
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000118 sequence = static_cast<int32_t>(state.id);
119 name = state.name;
Vishnu Nair3cc15a42023-06-30 06:20:22 +0000120 debugName = state.debugName;
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000121 textureName = state.textureName;
122 premultipliedAlpha = state.premultipliedAlpha;
123 inputInfo.name = state.name;
Vishnu Nair93b8b792023-02-27 19:40:24 +0000124 inputInfo.id = static_cast<int32_t>(uniqueSequence);
Prabir Pradhan8a5c41d2023-06-08 19:13:46 +0000125 inputInfo.ownerUid = gui::Uid{state.ownerUid};
Prabir Pradhane59c6dc2023-06-13 19:53:03 +0000126 inputInfo.ownerPid = gui::Pid{state.ownerPid};
Vishnu Nair36d5f8e2023-03-19 13:31:35 -0700127 uid = state.ownerUid;
128 pid = state.ownerPid;
Vishnu Nair92990e22023-02-24 20:01:05 +0000129 changes = RequestedLayerState::Changes::Created;
Vishnu Naira02943f2023-06-03 13:44:46 -0700130 clientChanges = 0;
Vishnu Nair92990e22023-02-24 20:01:05 +0000131 mirrorRootPath = path.variant == LayerHierarchy::Variant::Mirror
132 ? path
133 : LayerHierarchy::TraversalPath::ROOT;
Vishnu Naira02943f2023-06-03 13:44:46 -0700134 reachablilty = LayerSnapshot::Reachablilty::Unreachable;
Vishnu Nair3d8565a2023-06-30 07:23:24 +0000135 frameRateSelectionPriority = state.frameRateSelectionPriority;
136 layerMetadata = state.metadata;
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000137}
138
139// As documented in libhardware header, formats in the range
140// 0x100 - 0x1FF are specific to the HAL implementation, and
141// are known to have no alpha channel
142// TODO: move definition for device-specific range into
143// hardware.h, instead of using hard-coded values here.
144#define HARDWARE_IS_DEVICE_FORMAT(f) ((f) >= 0x100 && (f) <= 0x1FF)
145
146bool LayerSnapshot::isOpaqueFormat(PixelFormat format) {
147 if (HARDWARE_IS_DEVICE_FORMAT(format)) {
148 return true;
149 }
150 switch (format) {
151 case PIXEL_FORMAT_RGBA_8888:
152 case PIXEL_FORMAT_BGRA_8888:
153 case PIXEL_FORMAT_RGBA_FP16:
154 case PIXEL_FORMAT_RGBA_1010102:
155 case PIXEL_FORMAT_R_8:
156 return false;
157 }
158 // in all other case, we have no blending (also for unknown formats)
159 return true;
160}
161
162bool LayerSnapshot::hasBufferOrSidebandStream() const {
Vishnu Naircfb2d252023-01-19 04:44:02 +0000163 return ((sidebandStream != nullptr) || (externalTexture != nullptr));
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000164}
165
166bool LayerSnapshot::drawShadows() const {
167 return shadowSettings.length > 0.f;
168}
169
170bool LayerSnapshot::fillsColor() const {
171 return !hasBufferOrSidebandStream() && color.r >= 0.0_hf && color.g >= 0.0_hf &&
172 color.b >= 0.0_hf;
173}
174
175bool LayerSnapshot::hasBlur() const {
176 return backgroundBlurRadius > 0 || blurRegions.size() > 0;
177}
178
179bool LayerSnapshot::hasEffect() const {
180 return fillsColor() || drawShadows() || hasBlur();
181}
182
183bool LayerSnapshot::hasSomethingToDraw() const {
184 return hasEffect() || hasBufferOrSidebandStream();
185}
186
187bool LayerSnapshot::isContentOpaque() const {
188 // if we don't have a buffer or sidebandStream yet, we're translucent regardless of the
189 // layer's opaque flag.
190 if (!hasSomethingToDraw()) {
191 return false;
192 }
193
194 // if the layer has the opaque flag, then we're always opaque
195 if (layerOpaqueFlagSet) {
196 return true;
197 }
198
199 // If the buffer has no alpha channel, then we are opaque
200 if (hasBufferOrSidebandStream() &&
Vishnu Naircfb2d252023-01-19 04:44:02 +0000201 isOpaqueFormat(externalTexture ? externalTexture->getPixelFormat() : PIXEL_FORMAT_NONE)) {
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000202 return true;
203 }
204
205 // Lastly consider the layer opaque if drawing a color with alpha == 1.0
206 return fillsColor() && color.a == 1.0_hf;
207}
208
209bool LayerSnapshot::isHiddenByPolicy() const {
Vishnu Naircfb2d252023-01-19 04:44:02 +0000210 return invalidTransform || isHiddenByPolicyFromParent || isHiddenByPolicyFromRelativeParent;
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000211}
212
213bool LayerSnapshot::getIsVisible() const {
Vishnu Naira02943f2023-06-03 13:44:46 -0700214 if (reachablilty != LayerSnapshot::Reachablilty::Reachable) {
215 return false;
216 }
217
Vishnu Naira9c43762023-01-27 19:10:25 +0000218 if (handleSkipScreenshotFlag & outputFilter.toInternalDisplay) {
219 return false;
220 }
221
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000222 if (!hasSomethingToDraw()) {
223 return false;
224 }
225
226 if (isHiddenByPolicy()) {
227 return false;
228 }
229
230 return color.a > 0.0f || hasBlur();
231}
232
233std::string LayerSnapshot::getIsVisibleReason() const {
Vishnu Naircfb2d252023-01-19 04:44:02 +0000234 // not visible
Vishnu Naira02943f2023-06-03 13:44:46 -0700235 if (reachablilty == LayerSnapshot::Reachablilty::Unreachable)
236 return "layer not reachable from root";
237 if (reachablilty == LayerSnapshot::Reachablilty::ReachableByRelativeParent)
238 return "layer only reachable via relative parent";
Vishnu Naircfb2d252023-01-19 04:44:02 +0000239 if (isHiddenByPolicyFromParent) return "hidden by parent or layer flag";
240 if (isHiddenByPolicyFromRelativeParent) return "hidden by relative parent";
Vishnu Naira02943f2023-06-03 13:44:46 -0700241 if (handleSkipScreenshotFlag & outputFilter.toInternalDisplay) return "eLayerSkipScreenshot";
242 if (invalidTransform) return "invalidTransform";
Vishnu Naircfb2d252023-01-19 04:44:02 +0000243 if (color.a == 0.0f && !hasBlur()) return "alpha = 0 and no blur";
Vishnu Nair3cc15a42023-06-30 06:20:22 +0000244 if (!hasSomethingToDraw()) return "nothing to draw";
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000245
Vishnu Naircfb2d252023-01-19 04:44:02 +0000246 // visible
247 std::stringstream reason;
248 if (sidebandStream != nullptr) reason << " sidebandStream";
Vishnu Naird47bcee2023-02-24 18:08:51 +0000249 if (externalTexture != nullptr)
Vishnu Nair3cc15a42023-06-30 06:20:22 +0000250 reason << " buffer=" << externalTexture->getId() << " frame=" << frameNumber;
Vishnu Naircfb2d252023-01-19 04:44:02 +0000251 if (fillsColor() || color.a > 0.0f) reason << " color{" << color << "}";
252 if (drawShadows()) reason << " shadowSettings.length=" << shadowSettings.length;
253 if (backgroundBlurRadius > 0) reason << " backgroundBlurRadius=" << backgroundBlurRadius;
254 if (blurRegions.size() > 0) reason << " blurRegions.size()=" << blurRegions.size();
255 return reason.str();
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000256}
257
258bool LayerSnapshot::canReceiveInput() const {
259 return !isHiddenByPolicy() && (!hasBufferOrSidebandStream() || color.a > 0.0f);
260}
261
262bool LayerSnapshot::isTransformValid(const ui::Transform& t) {
263 float transformDet = t.det();
264 return transformDet != 0 && !isinf(transformDet) && !isnan(transformDet);
265}
266
Vishnu Naircfb2d252023-01-19 04:44:02 +0000267bool LayerSnapshot::hasInputInfo() const {
Vishnu Naira02943f2023-06-03 13:44:46 -0700268 return (inputInfo.token != nullptr ||
269 inputInfo.inputConfig.test(gui::WindowInfo::InputConfig::NO_INPUT_CHANNEL)) &&
270 reachablilty == Reachablilty::Reachable;
Vishnu Naircfb2d252023-01-19 04:44:02 +0000271}
272
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000273std::string LayerSnapshot::getDebugString() const {
Vishnu Naircfb2d252023-01-19 04:44:02 +0000274 std::stringstream debug;
275 debug << "Snapshot{" << path.toString() << name << " isVisible=" << isVisible << " {"
Vishnu Nair92990e22023-02-24 20:01:05 +0000276 << getIsVisibleReason() << "} changes=" << changes.string()
Vishnu Nair36d5f8e2023-03-19 13:31:35 -0700277 << " layerStack=" << outputFilter.layerStack.id << " geomLayerBounds={"
278 << geomLayerBounds.left << "," << geomLayerBounds.top << "," << geomLayerBounds.bottom
279 << "," << geomLayerBounds.right << "}"
280 << " geomLayerTransform={tx=" << geomLayerTransform.tx()
281 << ",ty=" << geomLayerTransform.ty() << "}"
282 << "}";
Vishnu Naira02943f2023-06-03 13:44:46 -0700283 if (hasInputInfo()) {
284 debug << " input{"
285 << "(" << inputInfo.inputConfig.string() << ")";
286 if (touchCropId != UNASSIGNED_LAYER_ID) debug << " touchCropId=" << touchCropId;
287 if (inputInfo.replaceTouchableRegionWithCrop) debug << " replaceTouchableRegionWithCrop";
288 auto touchableRegion = inputInfo.touchableRegion.getBounds();
289 debug << " touchableRegion={" << touchableRegion.left << "," << touchableRegion.top << ","
290 << touchableRegion.bottom << "," << touchableRegion.right << "}"
291 << "}";
292 }
Vishnu Naircfb2d252023-01-19 04:44:02 +0000293 return debug.str();
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000294}
295
Vishnu Nair3cc15a42023-06-30 06:20:22 +0000296std::ostream& operator<<(std::ostream& out, const LayerSnapshot& obj) {
297 out << "Layer [" << obj.path.id;
298 if (obj.path.mirrorRootId != UNASSIGNED_LAYER_ID) {
299 out << " mirrored from " << obj.path.mirrorRootId;
300 }
301 out << "] " << obj.name << "\n " << (obj.isVisible ? "visible" : "invisible")
302 << " reason=" << obj.getIsVisibleReason();
303
304 if (!obj.geomLayerBounds.isEmpty()) {
305 out << "\n bounds={" << obj.transformedBounds.left << "," << obj.transformedBounds.top
306 << "," << obj.transformedBounds.bottom << "," << obj.transformedBounds.right << "}";
307 }
308
309 if (obj.geomLayerTransform.getType() != ui::Transform::IDENTITY) {
310 out << " toDisplayTransform={" << obj.geomLayerTransform << "}";
311 }
312
313 if (obj.hasInputInfo()) {
314 out << "\n input{"
315 << "(" << obj.inputInfo.inputConfig.string() << ")";
316 if (obj.touchCropId != UNASSIGNED_LAYER_ID) out << " touchCropId=" << obj.touchCropId;
317 if (obj.inputInfo.replaceTouchableRegionWithCrop) out << " replaceTouchableRegionWithCrop";
318 auto touchableRegion = obj.inputInfo.touchableRegion.getBounds();
319 out << " touchableRegion={" << touchableRegion.left << "," << touchableRegion.top << ","
320 << touchableRegion.bottom << "," << touchableRegion.right << "}"
321 << "}";
322 }
323 return out;
324}
325
Vishnu Nair781d7252023-01-30 18:16:01 +0000326FloatRect LayerSnapshot::sourceBounds() const {
327 if (!externalTexture) {
328 return geomLayerBounds;
329 }
330 return geomBufferSize.toFloatRect();
331}
332
Vishnu Naira02943f2023-06-03 13:44:46 -0700333Hwc2::IComposerClient::BlendMode LayerSnapshot::getBlendMode(
334 const RequestedLayerState& requested) const {
335 auto blendMode = Hwc2::IComposerClient::BlendMode::NONE;
336 if (alpha != 1.0f || !contentOpaque) {
337 blendMode = requested.premultipliedAlpha ? Hwc2::IComposerClient::BlendMode::PREMULTIPLIED
338 : Hwc2::IComposerClient::BlendMode::COVERAGE;
339 }
340 return blendMode;
341}
342
343void LayerSnapshot::merge(const RequestedLayerState& requested, bool forceUpdate,
344 bool displayChanges, bool forceFullDamage,
345 uint32_t displayRotationFlags) {
346 clientChanges = requested.what;
347 changes = requested.changes;
348 contentDirty = requested.what & layer_state_t::CONTENT_DIRTY;
Vishnu Nair6f209e22023-08-04 16:33:23 +0000349 hasReadyFrame = requested.autoRefresh;
Vishnu Naira02943f2023-06-03 13:44:46 -0700350 sidebandStreamHasFrame = requested.hasSidebandStreamFrame();
Vishnu Nair6f209e22023-08-04 16:33:23 +0000351 updateSurfaceDamage(requested, requested.hasReadyFrame(), forceFullDamage, surfaceDamage);
Vishnu Naira02943f2023-06-03 13:44:46 -0700352
353 if (forceUpdate || requested.what & layer_state_t::eTransparentRegionChanged) {
354 transparentRegionHint = requested.transparentRegion;
355 }
356 if (forceUpdate || requested.what & layer_state_t::eFlagsChanged) {
357 layerOpaqueFlagSet =
358 (requested.flags & layer_state_t::eLayerOpaque) == layer_state_t::eLayerOpaque;
359 }
360 if (forceUpdate || requested.what & layer_state_t::eBufferTransformChanged) {
361 geomBufferTransform = requested.bufferTransform;
362 }
363 if (forceUpdate || requested.what & layer_state_t::eTransformToDisplayInverseChanged) {
364 geomBufferUsesDisplayInverseTransform = requested.transformToDisplayInverse;
365 }
366 if (forceUpdate || requested.what & layer_state_t::eDataspaceChanged) {
Vishnu Nair3996ee32023-08-14 04:32:31 +0000367 dataspace = Layer::translateDataspace(requested.dataspace);
Vishnu Naira02943f2023-06-03 13:44:46 -0700368 }
369 if (forceUpdate || requested.what & layer_state_t::eExtendedRangeBrightnessChanged) {
370 currentHdrSdrRatio = requested.currentHdrSdrRatio;
371 desiredHdrSdrRatio = requested.desiredHdrSdrRatio;
372 }
373 if (forceUpdate || requested.what & layer_state_t::eCachingHintChanged) {
374 cachingHint = requested.cachingHint;
375 }
376 if (forceUpdate || requested.what & layer_state_t::eHdrMetadataChanged) {
377 hdrMetadata = requested.hdrMetadata;
378 }
379 if (forceUpdate || requested.what & layer_state_t::eSidebandStreamChanged) {
380 sidebandStream = requested.sidebandStream;
381 }
382 if (forceUpdate || requested.what & layer_state_t::eShadowRadiusChanged) {
383 shadowRadius = requested.shadowRadius;
384 shadowSettings.length = requested.shadowRadius;
385 }
386 if (forceUpdate || requested.what & layer_state_t::eFrameRateSelectionPriority) {
387 frameRateSelectionPriority = requested.frameRateSelectionPriority;
388 }
389 if (forceUpdate || requested.what & layer_state_t::eColorSpaceAgnosticChanged) {
390 isColorspaceAgnostic = requested.colorSpaceAgnostic;
391 }
392 if (forceUpdate || requested.what & layer_state_t::eDimmingEnabledChanged) {
393 dimmingEnabled = requested.dimmingEnabled;
394 }
395 if (forceUpdate || requested.what & layer_state_t::eCropChanged) {
396 geomCrop = requested.crop;
397 }
398
399 if (forceUpdate ||
400 requested.what &
401 (layer_state_t::eFlagsChanged | layer_state_t::eBufferChanged |
402 layer_state_t::eSidebandStreamChanged)) {
403 compositionType = requested.getCompositionType();
404 }
405
406 if (forceUpdate || requested.what & layer_state_t::eInputInfoChanged) {
407 if (requested.windowInfoHandle) {
408 inputInfo = *requested.windowInfoHandle->getInfo();
409 } else {
410 inputInfo = {};
411 // b/271132344 revisit this and see if we can always use the layers uid/pid
412 inputInfo.name = requested.name;
413 inputInfo.ownerUid = requested.ownerUid;
414 inputInfo.ownerPid = requested.ownerPid;
415 }
416 inputInfo.id = static_cast<int32_t>(uniqueSequence);
417 touchCropId = requested.touchCropId;
418 }
419
420 if (forceUpdate ||
421 requested.what &
422 (layer_state_t::eColorChanged | layer_state_t::eBufferChanged |
423 layer_state_t::eSidebandStreamChanged)) {
424 color.rgb = requested.getColor().rgb;
425 }
426
427 if (forceUpdate || requested.what & layer_state_t::eBufferChanged) {
428 acquireFence =
429 (requested.externalTexture &&
430 requested.bufferData->flags.test(BufferData::BufferDataChange::fenceChanged))
431 ? requested.bufferData->acquireFence
432 : Fence::NO_FENCE;
433 buffer = requested.externalTexture ? requested.externalTexture->getBuffer() : nullptr;
434 externalTexture = requested.externalTexture;
435 frameNumber = (requested.bufferData) ? requested.bufferData->frameNumber : 0;
436 hasProtectedContent = requested.externalTexture &&
437 requested.externalTexture->getUsage() & GRALLOC_USAGE_PROTECTED;
438 geomUsesSourceCrop = hasBufferOrSidebandStream();
439 }
440
441 if (forceUpdate ||
442 requested.what &
443 (layer_state_t::eCropChanged | layer_state_t::eBufferCropChanged |
444 layer_state_t::eBufferTransformChanged |
445 layer_state_t::eTransformToDisplayInverseChanged) ||
446 requested.changes.test(RequestedLayerState::Changes::BufferSize) || displayChanges) {
447 bufferSize = requested.getBufferSize(displayRotationFlags);
448 geomBufferSize = bufferSize;
449 croppedBufferSize = requested.getCroppedBufferSize(bufferSize);
450 geomContentCrop = requested.getBufferCrop();
451 }
452
453 if (forceUpdate ||
454 requested.what &
455 (layer_state_t::eFlagsChanged | layer_state_t::eDestinationFrameChanged |
456 layer_state_t::ePositionChanged | layer_state_t::eMatrixChanged |
457 layer_state_t::eBufferTransformChanged |
458 layer_state_t::eTransformToDisplayInverseChanged) ||
459 requested.changes.test(RequestedLayerState::Changes::BufferSize) || displayChanges) {
460 localTransform = requested.getTransform(displayRotationFlags);
461 localTransformInverse = localTransform.inverse();
462 }
463
464 if (forceUpdate || requested.what & (layer_state_t::eColorChanged) ||
465 requested.changes.test(RequestedLayerState::Changes::BufferSize)) {
466 color.rgb = requested.getColor().rgb;
467 }
468
469 if (forceUpdate ||
470 requested.what &
471 (layer_state_t::eBufferChanged | layer_state_t::eDataspaceChanged |
Vishnu Naira02943f2023-06-03 13:44:46 -0700472 layer_state_t::eApiChanged | layer_state_t::eShadowRadiusChanged |
473 layer_state_t::eBlurRegionsChanged | layer_state_t::eStretchChanged)) {
Alec Mouri994761f2023-08-04 21:50:55 +0000474 forceClientComposition = shadowSettings.length > 0 || stretchEffect.hasEffect();
Vishnu Naira02943f2023-06-03 13:44:46 -0700475 }
476
477 if (forceUpdate ||
478 requested.what &
479 (layer_state_t::eColorChanged | layer_state_t::eShadowRadiusChanged |
480 layer_state_t::eBlurRegionsChanged | layer_state_t::eBackgroundBlurRadiusChanged |
481 layer_state_t::eCornerRadiusChanged | layer_state_t::eAlphaChanged |
482 layer_state_t::eFlagsChanged | layer_state_t::eBufferChanged |
483 layer_state_t::eSidebandStreamChanged)) {
484 contentOpaque = isContentOpaque();
485 isOpaque = contentOpaque && !roundedCorner.hasRoundedCorners() && color.a == 1.f;
486 blendMode = getBlendMode(requested);
487 }
488}
489
Vishnu Nair8fc721b2022-12-22 20:06:32 +0000490} // namespace android::surfaceflinger::frontend