1*38e8c45fSAndroid Build Coastguard Worker /*
2*38e8c45fSAndroid Build Coastguard Worker * Copyright 2022 The Android Open Source Project
3*38e8c45fSAndroid Build Coastguard Worker *
4*38e8c45fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*38e8c45fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*38e8c45fSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*38e8c45fSAndroid Build Coastguard Worker *
8*38e8c45fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
9*38e8c45fSAndroid Build Coastguard Worker *
10*38e8c45fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*38e8c45fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*38e8c45fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*38e8c45fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*38e8c45fSAndroid Build Coastguard Worker * limitations under the License.
15*38e8c45fSAndroid Build Coastguard Worker */
16*38e8c45fSAndroid Build Coastguard Worker
17*38e8c45fSAndroid Build Coastguard Worker #define ATRACE_TAG ATRACE_TAG_GRAPHICS
18*38e8c45fSAndroid Build Coastguard Worker #undef LOG_TAG
19*38e8c45fSAndroid Build Coastguard Worker #define LOG_TAG "SurfaceFlinger"
20*38e8c45fSAndroid Build Coastguard Worker
21*38e8c45fSAndroid Build Coastguard Worker #include "LayerSnapshot.h"
22*38e8c45fSAndroid Build Coastguard Worker #include "Layer.h"
23*38e8c45fSAndroid Build Coastguard Worker
24*38e8c45fSAndroid Build Coastguard Worker namespace android::surfaceflinger::frontend {
25*38e8c45fSAndroid Build Coastguard Worker
26*38e8c45fSAndroid Build Coastguard Worker using namespace ftl::flag_operators;
27*38e8c45fSAndroid Build Coastguard Worker
28*38e8c45fSAndroid Build Coastguard Worker namespace {
29*38e8c45fSAndroid Build Coastguard Worker
updateSurfaceDamage(const RequestedLayerState & requested,bool hasReadyFrame,bool forceFullDamage,Region & outSurfaceDamageRegion)30*38e8c45fSAndroid Build Coastguard Worker void updateSurfaceDamage(const RequestedLayerState& requested, bool hasReadyFrame,
31*38e8c45fSAndroid Build Coastguard Worker bool forceFullDamage, Region& outSurfaceDamageRegion) {
32*38e8c45fSAndroid Build Coastguard Worker if (!hasReadyFrame) {
33*38e8c45fSAndroid Build Coastguard Worker outSurfaceDamageRegion.clear();
34*38e8c45fSAndroid Build Coastguard Worker return;
35*38e8c45fSAndroid Build Coastguard Worker }
36*38e8c45fSAndroid Build Coastguard Worker if (forceFullDamage) {
37*38e8c45fSAndroid Build Coastguard Worker outSurfaceDamageRegion = Region::INVALID_REGION;
38*38e8c45fSAndroid Build Coastguard Worker } else {
39*38e8c45fSAndroid Build Coastguard Worker outSurfaceDamageRegion = requested.surfaceDamageRegion;
40*38e8c45fSAndroid Build Coastguard Worker }
41*38e8c45fSAndroid Build Coastguard Worker }
42*38e8c45fSAndroid Build Coastguard Worker
operator <<(std::ostream & os,const ui::Transform & transform)43*38e8c45fSAndroid Build Coastguard Worker std::ostream& operator<<(std::ostream& os, const ui::Transform& transform) {
44*38e8c45fSAndroid Build Coastguard Worker const uint32_t type = transform.getType();
45*38e8c45fSAndroid Build Coastguard Worker const uint32_t orientation = transform.getOrientation();
46*38e8c45fSAndroid Build Coastguard Worker if (type == ui::Transform::IDENTITY) {
47*38e8c45fSAndroid Build Coastguard Worker return os;
48*38e8c45fSAndroid Build Coastguard Worker }
49*38e8c45fSAndroid Build Coastguard Worker
50*38e8c45fSAndroid Build Coastguard Worker if (type & ui::Transform::UNKNOWN) {
51*38e8c45fSAndroid Build Coastguard Worker std::string out;
52*38e8c45fSAndroid Build Coastguard Worker transform.dump(out, "", "");
53*38e8c45fSAndroid Build Coastguard Worker os << out;
54*38e8c45fSAndroid Build Coastguard Worker return os;
55*38e8c45fSAndroid Build Coastguard Worker }
56*38e8c45fSAndroid Build Coastguard Worker
57*38e8c45fSAndroid Build Coastguard Worker if (type & ui::Transform::ROTATE) {
58*38e8c45fSAndroid Build Coastguard Worker switch (orientation) {
59*38e8c45fSAndroid Build Coastguard Worker case ui::Transform::ROT_0:
60*38e8c45fSAndroid Build Coastguard Worker os << "ROT_0";
61*38e8c45fSAndroid Build Coastguard Worker break;
62*38e8c45fSAndroid Build Coastguard Worker case ui::Transform::FLIP_H:
63*38e8c45fSAndroid Build Coastguard Worker os << "FLIP_H";
64*38e8c45fSAndroid Build Coastguard Worker break;
65*38e8c45fSAndroid Build Coastguard Worker case ui::Transform::FLIP_V:
66*38e8c45fSAndroid Build Coastguard Worker os << "FLIP_V";
67*38e8c45fSAndroid Build Coastguard Worker break;
68*38e8c45fSAndroid Build Coastguard Worker case ui::Transform::ROT_90:
69*38e8c45fSAndroid Build Coastguard Worker os << "ROT_90";
70*38e8c45fSAndroid Build Coastguard Worker break;
71*38e8c45fSAndroid Build Coastguard Worker case ui::Transform::ROT_180:
72*38e8c45fSAndroid Build Coastguard Worker os << "ROT_180";
73*38e8c45fSAndroid Build Coastguard Worker break;
74*38e8c45fSAndroid Build Coastguard Worker case ui::Transform::ROT_270:
75*38e8c45fSAndroid Build Coastguard Worker os << "ROT_270";
76*38e8c45fSAndroid Build Coastguard Worker break;
77*38e8c45fSAndroid Build Coastguard Worker case ui::Transform::ROT_INVALID:
78*38e8c45fSAndroid Build Coastguard Worker default:
79*38e8c45fSAndroid Build Coastguard Worker os << "ROT_INVALID";
80*38e8c45fSAndroid Build Coastguard Worker break;
81*38e8c45fSAndroid Build Coastguard Worker }
82*38e8c45fSAndroid Build Coastguard Worker }
83*38e8c45fSAndroid Build Coastguard Worker
84*38e8c45fSAndroid Build Coastguard Worker if (type & ui::Transform::SCALE) {
85*38e8c45fSAndroid Build Coastguard Worker std::string out;
86*38e8c45fSAndroid Build Coastguard Worker android::base::StringAppendF(&out, " scale x=%.4f y=%.4f ", transform.getScaleX(),
87*38e8c45fSAndroid Build Coastguard Worker transform.getScaleY());
88*38e8c45fSAndroid Build Coastguard Worker os << out;
89*38e8c45fSAndroid Build Coastguard Worker }
90*38e8c45fSAndroid Build Coastguard Worker
91*38e8c45fSAndroid Build Coastguard Worker if (type & ui::Transform::TRANSLATE) {
92*38e8c45fSAndroid Build Coastguard Worker std::string out;
93*38e8c45fSAndroid Build Coastguard Worker android::base::StringAppendF(&out, " tx=%.4f ty=%.4f ", transform.tx(), transform.ty());
94*38e8c45fSAndroid Build Coastguard Worker os << out;
95*38e8c45fSAndroid Build Coastguard Worker }
96*38e8c45fSAndroid Build Coastguard Worker
97*38e8c45fSAndroid Build Coastguard Worker return os;
98*38e8c45fSAndroid Build Coastguard Worker }
99*38e8c45fSAndroid Build Coastguard Worker
100*38e8c45fSAndroid Build Coastguard Worker } // namespace
101*38e8c45fSAndroid Build Coastguard Worker
LayerSnapshot(const RequestedLayerState & state,const LayerHierarchy::TraversalPath & path)102*38e8c45fSAndroid Build Coastguard Worker LayerSnapshot::LayerSnapshot(const RequestedLayerState& state,
103*38e8c45fSAndroid Build Coastguard Worker const LayerHierarchy::TraversalPath& path)
104*38e8c45fSAndroid Build Coastguard Worker : path(path) {
105*38e8c45fSAndroid Build Coastguard Worker // Provide a unique id for all snapshots.
106*38e8c45fSAndroid Build Coastguard Worker // A front end layer can generate multiple snapshots if its mirrored.
107*38e8c45fSAndroid Build Coastguard Worker // Additionally, if the layer is not reachable, we may choose to destroy
108*38e8c45fSAndroid Build Coastguard Worker // and recreate the snapshot in which case the unique sequence id will
109*38e8c45fSAndroid Build Coastguard Worker // change. The consumer shouldn't tie any lifetimes to this unique id but
110*38e8c45fSAndroid Build Coastguard Worker // register a LayerLifecycleManager::ILifecycleListener or get a list of
111*38e8c45fSAndroid Build Coastguard Worker // destroyed layers from LayerLifecycleManager.
112*38e8c45fSAndroid Build Coastguard Worker if (path.isClone()) {
113*38e8c45fSAndroid Build Coastguard Worker uniqueSequence =
114*38e8c45fSAndroid Build Coastguard Worker LayerCreationArgs::getInternalLayerId(LayerCreationArgs::sInternalSequence++);
115*38e8c45fSAndroid Build Coastguard Worker } else {
116*38e8c45fSAndroid Build Coastguard Worker uniqueSequence = state.id;
117*38e8c45fSAndroid Build Coastguard Worker }
118*38e8c45fSAndroid Build Coastguard Worker sequence = static_cast<int32_t>(state.id);
119*38e8c45fSAndroid Build Coastguard Worker name = state.name;
120*38e8c45fSAndroid Build Coastguard Worker debugName = state.debugName;
121*38e8c45fSAndroid Build Coastguard Worker premultipliedAlpha = state.premultipliedAlpha;
122*38e8c45fSAndroid Build Coastguard Worker inputInfo.name = state.name;
123*38e8c45fSAndroid Build Coastguard Worker inputInfo.id = static_cast<int32_t>(uniqueSequence);
124*38e8c45fSAndroid Build Coastguard Worker inputInfo.ownerUid = gui::Uid{state.ownerUid};
125*38e8c45fSAndroid Build Coastguard Worker inputInfo.ownerPid = gui::Pid{state.ownerPid};
126*38e8c45fSAndroid Build Coastguard Worker uid = state.ownerUid;
127*38e8c45fSAndroid Build Coastguard Worker pid = state.ownerPid;
128*38e8c45fSAndroid Build Coastguard Worker changes = RequestedLayerState::Changes::Created;
129*38e8c45fSAndroid Build Coastguard Worker clientChanges = 0;
130*38e8c45fSAndroid Build Coastguard Worker mirrorRootPath =
131*38e8c45fSAndroid Build Coastguard Worker LayerHierarchy::isMirror(path.variant) ? path : LayerHierarchy::TraversalPath::ROOT;
132*38e8c45fSAndroid Build Coastguard Worker reachablilty = LayerSnapshot::Reachablilty::Unreachable;
133*38e8c45fSAndroid Build Coastguard Worker frameRateSelectionPriority = state.frameRateSelectionPriority;
134*38e8c45fSAndroid Build Coastguard Worker layerMetadata = state.metadata;
135*38e8c45fSAndroid Build Coastguard Worker }
136*38e8c45fSAndroid Build Coastguard Worker
137*38e8c45fSAndroid Build Coastguard Worker // As documented in libhardware header, formats in the range
138*38e8c45fSAndroid Build Coastguard Worker // 0x100 - 0x1FF are specific to the HAL implementation, and
139*38e8c45fSAndroid Build Coastguard Worker // are known to have no alpha channel
140*38e8c45fSAndroid Build Coastguard Worker // TODO: move definition for device-specific range into
141*38e8c45fSAndroid Build Coastguard Worker // hardware.h, instead of using hard-coded values here.
142*38e8c45fSAndroid Build Coastguard Worker #define HARDWARE_IS_DEVICE_FORMAT(f) ((f) >= 0x100 && (f) <= 0x1FF)
143*38e8c45fSAndroid Build Coastguard Worker
isOpaqueFormat(PixelFormat format)144*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::isOpaqueFormat(PixelFormat format) {
145*38e8c45fSAndroid Build Coastguard Worker if (HARDWARE_IS_DEVICE_FORMAT(format)) {
146*38e8c45fSAndroid Build Coastguard Worker return true;
147*38e8c45fSAndroid Build Coastguard Worker }
148*38e8c45fSAndroid Build Coastguard Worker switch (format) {
149*38e8c45fSAndroid Build Coastguard Worker case PIXEL_FORMAT_RGBA_8888:
150*38e8c45fSAndroid Build Coastguard Worker case PIXEL_FORMAT_BGRA_8888:
151*38e8c45fSAndroid Build Coastguard Worker case PIXEL_FORMAT_RGBA_FP16:
152*38e8c45fSAndroid Build Coastguard Worker case PIXEL_FORMAT_RGBA_1010102:
153*38e8c45fSAndroid Build Coastguard Worker case PIXEL_FORMAT_R_8:
154*38e8c45fSAndroid Build Coastguard Worker return false;
155*38e8c45fSAndroid Build Coastguard Worker }
156*38e8c45fSAndroid Build Coastguard Worker // in all other case, we have no blending (also for unknown formats)
157*38e8c45fSAndroid Build Coastguard Worker return true;
158*38e8c45fSAndroid Build Coastguard Worker }
159*38e8c45fSAndroid Build Coastguard Worker
hasBufferOrSidebandStream() const160*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::hasBufferOrSidebandStream() const {
161*38e8c45fSAndroid Build Coastguard Worker return ((sidebandStream != nullptr) || (externalTexture != nullptr));
162*38e8c45fSAndroid Build Coastguard Worker }
163*38e8c45fSAndroid Build Coastguard Worker
drawShadows() const164*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::drawShadows() const {
165*38e8c45fSAndroid Build Coastguard Worker return shadowSettings.length > 0.f;
166*38e8c45fSAndroid Build Coastguard Worker }
167*38e8c45fSAndroid Build Coastguard Worker
fillsColor() const168*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::fillsColor() const {
169*38e8c45fSAndroid Build Coastguard Worker return !hasBufferOrSidebandStream() && color.r >= 0.0_hf && color.g >= 0.0_hf &&
170*38e8c45fSAndroid Build Coastguard Worker color.b >= 0.0_hf;
171*38e8c45fSAndroid Build Coastguard Worker }
172*38e8c45fSAndroid Build Coastguard Worker
hasBlur() const173*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::hasBlur() const {
174*38e8c45fSAndroid Build Coastguard Worker return backgroundBlurRadius > 0 || blurRegions.size() > 0;
175*38e8c45fSAndroid Build Coastguard Worker }
176*38e8c45fSAndroid Build Coastguard Worker
hasEffect() const177*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::hasEffect() const {
178*38e8c45fSAndroid Build Coastguard Worker return fillsColor() || drawShadows() || hasBlur();
179*38e8c45fSAndroid Build Coastguard Worker }
180*38e8c45fSAndroid Build Coastguard Worker
hasSomethingToDraw() const181*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::hasSomethingToDraw() const {
182*38e8c45fSAndroid Build Coastguard Worker return hasEffect() || hasBufferOrSidebandStream();
183*38e8c45fSAndroid Build Coastguard Worker }
184*38e8c45fSAndroid Build Coastguard Worker
isContentOpaque() const185*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::isContentOpaque() const {
186*38e8c45fSAndroid Build Coastguard Worker // if we don't have a buffer or sidebandStream yet, we're translucent regardless of the
187*38e8c45fSAndroid Build Coastguard Worker // layer's opaque flag.
188*38e8c45fSAndroid Build Coastguard Worker if (!hasSomethingToDraw()) {
189*38e8c45fSAndroid Build Coastguard Worker return false;
190*38e8c45fSAndroid Build Coastguard Worker }
191*38e8c45fSAndroid Build Coastguard Worker
192*38e8c45fSAndroid Build Coastguard Worker // if the layer has the opaque flag, then we're always opaque
193*38e8c45fSAndroid Build Coastguard Worker if (layerOpaqueFlagSet) {
194*38e8c45fSAndroid Build Coastguard Worker return true;
195*38e8c45fSAndroid Build Coastguard Worker }
196*38e8c45fSAndroid Build Coastguard Worker
197*38e8c45fSAndroid Build Coastguard Worker // If the buffer has no alpha channel, then we are opaque
198*38e8c45fSAndroid Build Coastguard Worker if (hasBufferOrSidebandStream() &&
199*38e8c45fSAndroid Build Coastguard Worker isOpaqueFormat(externalTexture ? externalTexture->getPixelFormat() : PIXEL_FORMAT_NONE)) {
200*38e8c45fSAndroid Build Coastguard Worker return true;
201*38e8c45fSAndroid Build Coastguard Worker }
202*38e8c45fSAndroid Build Coastguard Worker
203*38e8c45fSAndroid Build Coastguard Worker // Lastly consider the layer opaque if drawing a color with alpha == 1.0
204*38e8c45fSAndroid Build Coastguard Worker return fillsColor() && color.a == 1.0_hf;
205*38e8c45fSAndroid Build Coastguard Worker }
206*38e8c45fSAndroid Build Coastguard Worker
isHiddenByPolicy() const207*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::isHiddenByPolicy() const {
208*38e8c45fSAndroid Build Coastguard Worker return invalidTransform || isHiddenByPolicyFromParent || isHiddenByPolicyFromRelativeParent;
209*38e8c45fSAndroid Build Coastguard Worker }
210*38e8c45fSAndroid Build Coastguard Worker
getIsVisible() const211*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::getIsVisible() const {
212*38e8c45fSAndroid Build Coastguard Worker if (reachablilty != LayerSnapshot::Reachablilty::Reachable) {
213*38e8c45fSAndroid Build Coastguard Worker return false;
214*38e8c45fSAndroid Build Coastguard Worker }
215*38e8c45fSAndroid Build Coastguard Worker
216*38e8c45fSAndroid Build Coastguard Worker if (handleSkipScreenshotFlag & outputFilter.toInternalDisplay) {
217*38e8c45fSAndroid Build Coastguard Worker return false;
218*38e8c45fSAndroid Build Coastguard Worker }
219*38e8c45fSAndroid Build Coastguard Worker
220*38e8c45fSAndroid Build Coastguard Worker if (!hasSomethingToDraw()) {
221*38e8c45fSAndroid Build Coastguard Worker return false;
222*38e8c45fSAndroid Build Coastguard Worker }
223*38e8c45fSAndroid Build Coastguard Worker
224*38e8c45fSAndroid Build Coastguard Worker if (isHiddenByPolicy()) {
225*38e8c45fSAndroid Build Coastguard Worker return false;
226*38e8c45fSAndroid Build Coastguard Worker }
227*38e8c45fSAndroid Build Coastguard Worker
228*38e8c45fSAndroid Build Coastguard Worker return color.a > 0.0f || hasBlur();
229*38e8c45fSAndroid Build Coastguard Worker }
230*38e8c45fSAndroid Build Coastguard Worker
getIsVisibleReason() const231*38e8c45fSAndroid Build Coastguard Worker std::string LayerSnapshot::getIsVisibleReason() const {
232*38e8c45fSAndroid Build Coastguard Worker // not visible
233*38e8c45fSAndroid Build Coastguard Worker if (reachablilty == LayerSnapshot::Reachablilty::Unreachable)
234*38e8c45fSAndroid Build Coastguard Worker return "layer not reachable from root";
235*38e8c45fSAndroid Build Coastguard Worker if (reachablilty == LayerSnapshot::Reachablilty::ReachableByRelativeParent)
236*38e8c45fSAndroid Build Coastguard Worker return "layer only reachable via relative parent";
237*38e8c45fSAndroid Build Coastguard Worker if (isHiddenByPolicyFromParent) return "hidden by parent or layer flag";
238*38e8c45fSAndroid Build Coastguard Worker if (isHiddenByPolicyFromRelativeParent) return "hidden by relative parent";
239*38e8c45fSAndroid Build Coastguard Worker if (handleSkipScreenshotFlag & outputFilter.toInternalDisplay) return "eLayerSkipScreenshot";
240*38e8c45fSAndroid Build Coastguard Worker if (invalidTransform) return "invalidTransform";
241*38e8c45fSAndroid Build Coastguard Worker if (color.a == 0.0f && !hasBlur()) return "alpha = 0 and no blur";
242*38e8c45fSAndroid Build Coastguard Worker if (!hasSomethingToDraw()) return "nothing to draw";
243*38e8c45fSAndroid Build Coastguard Worker
244*38e8c45fSAndroid Build Coastguard Worker // visible
245*38e8c45fSAndroid Build Coastguard Worker std::stringstream reason;
246*38e8c45fSAndroid Build Coastguard Worker if (sidebandStream != nullptr) reason << " sidebandStream";
247*38e8c45fSAndroid Build Coastguard Worker if (externalTexture != nullptr)
248*38e8c45fSAndroid Build Coastguard Worker reason << " buffer=" << externalTexture->getId() << " frame=" << frameNumber;
249*38e8c45fSAndroid Build Coastguard Worker if (fillsColor() || color.a > 0.0f) reason << " color{" << color << "}";
250*38e8c45fSAndroid Build Coastguard Worker if (drawShadows()) reason << " shadowSettings.length=" << shadowSettings.length;
251*38e8c45fSAndroid Build Coastguard Worker if (backgroundBlurRadius > 0) reason << " backgroundBlurRadius=" << backgroundBlurRadius;
252*38e8c45fSAndroid Build Coastguard Worker if (blurRegions.size() > 0) reason << " blurRegions.size()=" << blurRegions.size();
253*38e8c45fSAndroid Build Coastguard Worker if (contentDirty) reason << " contentDirty";
254*38e8c45fSAndroid Build Coastguard Worker return reason.str();
255*38e8c45fSAndroid Build Coastguard Worker }
256*38e8c45fSAndroid Build Coastguard Worker
canReceiveInput() const257*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::canReceiveInput() const {
258*38e8c45fSAndroid Build Coastguard Worker return !isHiddenByPolicy() && (!hasBufferOrSidebandStream() || color.a > 0.0f);
259*38e8c45fSAndroid Build Coastguard Worker }
260*38e8c45fSAndroid Build Coastguard Worker
isTransformValid(const ui::Transform & t)261*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::isTransformValid(const ui::Transform& t) {
262*38e8c45fSAndroid Build Coastguard Worker float transformDet = t.det();
263*38e8c45fSAndroid Build Coastguard Worker return transformDet != 0 && !isinf(transformDet) && !isnan(transformDet);
264*38e8c45fSAndroid Build Coastguard Worker }
265*38e8c45fSAndroid Build Coastguard Worker
hasInputInfo() const266*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::hasInputInfo() const {
267*38e8c45fSAndroid Build Coastguard Worker return (inputInfo.token != nullptr ||
268*38e8c45fSAndroid Build Coastguard Worker inputInfo.inputConfig.test(gui::WindowInfo::InputConfig::NO_INPUT_CHANNEL)) &&
269*38e8c45fSAndroid Build Coastguard Worker reachablilty == Reachablilty::Reachable;
270*38e8c45fSAndroid Build Coastguard Worker }
271*38e8c45fSAndroid Build Coastguard Worker
getDebugString() const272*38e8c45fSAndroid Build Coastguard Worker std::string LayerSnapshot::getDebugString() const {
273*38e8c45fSAndroid Build Coastguard Worker std::stringstream debug;
274*38e8c45fSAndroid Build Coastguard Worker debug << "Snapshot{" << path.toString() << name << " isVisible=" << isVisible << " {"
275*38e8c45fSAndroid Build Coastguard Worker << getIsVisibleReason() << "} changes=" << changes.string()
276*38e8c45fSAndroid Build Coastguard Worker << " layerStack=" << outputFilter.layerStack.id << " geomLayerBounds={"
277*38e8c45fSAndroid Build Coastguard Worker << geomLayerBounds.left << "," << geomLayerBounds.top << "," << geomLayerBounds.bottom
278*38e8c45fSAndroid Build Coastguard Worker << "," << geomLayerBounds.right << "}"
279*38e8c45fSAndroid Build Coastguard Worker << " geomLayerTransform={tx=" << geomLayerTransform.tx()
280*38e8c45fSAndroid Build Coastguard Worker << ",ty=" << geomLayerTransform.ty() << "}"
281*38e8c45fSAndroid Build Coastguard Worker << "}";
282*38e8c45fSAndroid Build Coastguard Worker if (hasInputInfo()) {
283*38e8c45fSAndroid Build Coastguard Worker debug << " input{"
284*38e8c45fSAndroid Build Coastguard Worker << "(" << inputInfo.inputConfig.string() << ")";
285*38e8c45fSAndroid Build Coastguard Worker if (touchCropId != UNASSIGNED_LAYER_ID) debug << " touchCropId=" << touchCropId;
286*38e8c45fSAndroid Build Coastguard Worker if (inputInfo.replaceTouchableRegionWithCrop) debug << " replaceTouchableRegionWithCrop";
287*38e8c45fSAndroid Build Coastguard Worker auto touchableRegion = inputInfo.touchableRegion.getBounds();
288*38e8c45fSAndroid Build Coastguard Worker debug << " touchableRegion={" << touchableRegion.left << "," << touchableRegion.top << ","
289*38e8c45fSAndroid Build Coastguard Worker << touchableRegion.bottom << "," << touchableRegion.right << "}"
290*38e8c45fSAndroid Build Coastguard Worker << "}";
291*38e8c45fSAndroid Build Coastguard Worker }
292*38e8c45fSAndroid Build Coastguard Worker return debug.str();
293*38e8c45fSAndroid Build Coastguard Worker }
294*38e8c45fSAndroid Build Coastguard Worker
operator <<(std::ostream & out,const LayerSnapshot & obj)295*38e8c45fSAndroid Build Coastguard Worker std::ostream& operator<<(std::ostream& out, const LayerSnapshot& obj) {
296*38e8c45fSAndroid Build Coastguard Worker out << "Layer [" << obj.path.id;
297*38e8c45fSAndroid Build Coastguard Worker if (!obj.path.mirrorRootIds.empty()) {
298*38e8c45fSAndroid Build Coastguard Worker out << " mirrored from ";
299*38e8c45fSAndroid Build Coastguard Worker for (auto rootId : obj.path.mirrorRootIds) {
300*38e8c45fSAndroid Build Coastguard Worker out << rootId << ",";
301*38e8c45fSAndroid Build Coastguard Worker }
302*38e8c45fSAndroid Build Coastguard Worker }
303*38e8c45fSAndroid Build Coastguard Worker out << "] " << obj.name << "\n " << (obj.isVisible ? "visible" : "invisible")
304*38e8c45fSAndroid Build Coastguard Worker << " reason=" << obj.getIsVisibleReason();
305*38e8c45fSAndroid Build Coastguard Worker
306*38e8c45fSAndroid Build Coastguard Worker if (!obj.geomLayerBounds.isEmpty()) {
307*38e8c45fSAndroid Build Coastguard Worker out << "\n bounds={" << obj.transformedBounds.left << "," << obj.transformedBounds.top
308*38e8c45fSAndroid Build Coastguard Worker << "," << obj.transformedBounds.bottom << "," << obj.transformedBounds.right << "}";
309*38e8c45fSAndroid Build Coastguard Worker }
310*38e8c45fSAndroid Build Coastguard Worker
311*38e8c45fSAndroid Build Coastguard Worker if (obj.geomLayerTransform.getType() != ui::Transform::IDENTITY) {
312*38e8c45fSAndroid Build Coastguard Worker out << " toDisplayTransform={" << obj.geomLayerTransform << "}";
313*38e8c45fSAndroid Build Coastguard Worker }
314*38e8c45fSAndroid Build Coastguard Worker
315*38e8c45fSAndroid Build Coastguard Worker if (obj.hasInputInfo()) {
316*38e8c45fSAndroid Build Coastguard Worker out << "\n input{"
317*38e8c45fSAndroid Build Coastguard Worker << "(" << obj.inputInfo.inputConfig.string() << ")";
318*38e8c45fSAndroid Build Coastguard Worker if (obj.inputInfo.canOccludePresentation) out << " canOccludePresentation";
319*38e8c45fSAndroid Build Coastguard Worker if (obj.touchCropId != UNASSIGNED_LAYER_ID) out << " touchCropId=" << obj.touchCropId;
320*38e8c45fSAndroid Build Coastguard Worker if (obj.inputInfo.replaceTouchableRegionWithCrop) out << " replaceTouchableRegionWithCrop";
321*38e8c45fSAndroid Build Coastguard Worker auto touchableRegion = obj.inputInfo.touchableRegion.getBounds();
322*38e8c45fSAndroid Build Coastguard Worker out << " touchableRegion={" << touchableRegion.left << "," << touchableRegion.top << ","
323*38e8c45fSAndroid Build Coastguard Worker << touchableRegion.bottom << "," << touchableRegion.right << "}"
324*38e8c45fSAndroid Build Coastguard Worker << "}";
325*38e8c45fSAndroid Build Coastguard Worker }
326*38e8c45fSAndroid Build Coastguard Worker
327*38e8c45fSAndroid Build Coastguard Worker if (obj.edgeExtensionEffect.hasEffect()) {
328*38e8c45fSAndroid Build Coastguard Worker out << obj.edgeExtensionEffect;
329*38e8c45fSAndroid Build Coastguard Worker }
330*38e8c45fSAndroid Build Coastguard Worker return out;
331*38e8c45fSAndroid Build Coastguard Worker }
332*38e8c45fSAndroid Build Coastguard Worker
sourceBounds() const333*38e8c45fSAndroid Build Coastguard Worker FloatRect LayerSnapshot::sourceBounds() const {
334*38e8c45fSAndroid Build Coastguard Worker if (!externalTexture) {
335*38e8c45fSAndroid Build Coastguard Worker return geomLayerBounds;
336*38e8c45fSAndroid Build Coastguard Worker }
337*38e8c45fSAndroid Build Coastguard Worker return geomBufferSize.toFloatRect();
338*38e8c45fSAndroid Build Coastguard Worker }
339*38e8c45fSAndroid Build Coastguard Worker
isFrontBuffered() const340*38e8c45fSAndroid Build Coastguard Worker bool LayerSnapshot::isFrontBuffered() const {
341*38e8c45fSAndroid Build Coastguard Worker if (!externalTexture) {
342*38e8c45fSAndroid Build Coastguard Worker return false;
343*38e8c45fSAndroid Build Coastguard Worker }
344*38e8c45fSAndroid Build Coastguard Worker
345*38e8c45fSAndroid Build Coastguard Worker return externalTexture->getUsage() & AHARDWAREBUFFER_USAGE_FRONT_BUFFER;
346*38e8c45fSAndroid Build Coastguard Worker }
347*38e8c45fSAndroid Build Coastguard Worker
getBlendMode(const RequestedLayerState & requested) const348*38e8c45fSAndroid Build Coastguard Worker Hwc2::IComposerClient::BlendMode LayerSnapshot::getBlendMode(
349*38e8c45fSAndroid Build Coastguard Worker const RequestedLayerState& requested) const {
350*38e8c45fSAndroid Build Coastguard Worker auto blendMode = Hwc2::IComposerClient::BlendMode::NONE;
351*38e8c45fSAndroid Build Coastguard Worker if (alpha != 1.0f || !contentOpaque) {
352*38e8c45fSAndroid Build Coastguard Worker blendMode = requested.premultipliedAlpha ? Hwc2::IComposerClient::BlendMode::PREMULTIPLIED
353*38e8c45fSAndroid Build Coastguard Worker : Hwc2::IComposerClient::BlendMode::COVERAGE;
354*38e8c45fSAndroid Build Coastguard Worker }
355*38e8c45fSAndroid Build Coastguard Worker return blendMode;
356*38e8c45fSAndroid Build Coastguard Worker }
357*38e8c45fSAndroid Build Coastguard Worker
merge(const RequestedLayerState & requested,bool forceUpdate,bool displayChanges,bool forceFullDamage,uint32_t displayRotationFlags)358*38e8c45fSAndroid Build Coastguard Worker void LayerSnapshot::merge(const RequestedLayerState& requested, bool forceUpdate,
359*38e8c45fSAndroid Build Coastguard Worker bool displayChanges, bool forceFullDamage,
360*38e8c45fSAndroid Build Coastguard Worker uint32_t displayRotationFlags) {
361*38e8c45fSAndroid Build Coastguard Worker clientChanges = requested.what;
362*38e8c45fSAndroid Build Coastguard Worker changes = requested.changes;
363*38e8c45fSAndroid Build Coastguard Worker autoRefresh = requested.autoRefresh;
364*38e8c45fSAndroid Build Coastguard Worker contentDirty = requested.what & layer_state_t::CONTENT_DIRTY || autoRefresh;
365*38e8c45fSAndroid Build Coastguard Worker hasReadyFrame = autoRefresh;
366*38e8c45fSAndroid Build Coastguard Worker sidebandStreamHasFrame = requested.hasSidebandStreamFrame();
367*38e8c45fSAndroid Build Coastguard Worker updateSurfaceDamage(requested, requested.hasReadyFrame(), forceFullDamage, surfaceDamage);
368*38e8c45fSAndroid Build Coastguard Worker
369*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eTransparentRegionChanged) {
370*38e8c45fSAndroid Build Coastguard Worker transparentRegionHint = requested.transparentRegion;
371*38e8c45fSAndroid Build Coastguard Worker }
372*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eFlagsChanged) {
373*38e8c45fSAndroid Build Coastguard Worker layerOpaqueFlagSet =
374*38e8c45fSAndroid Build Coastguard Worker (requested.flags & layer_state_t::eLayerOpaque) == layer_state_t::eLayerOpaque;
375*38e8c45fSAndroid Build Coastguard Worker }
376*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eBufferTransformChanged) {
377*38e8c45fSAndroid Build Coastguard Worker geomBufferTransform = requested.bufferTransform;
378*38e8c45fSAndroid Build Coastguard Worker }
379*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eTransformToDisplayInverseChanged) {
380*38e8c45fSAndroid Build Coastguard Worker geomBufferUsesDisplayInverseTransform = requested.transformToDisplayInverse;
381*38e8c45fSAndroid Build Coastguard Worker }
382*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eDataspaceChanged) {
383*38e8c45fSAndroid Build Coastguard Worker dataspace = Layer::translateDataspace(requested.dataspace);
384*38e8c45fSAndroid Build Coastguard Worker }
385*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eExtendedRangeBrightnessChanged) {
386*38e8c45fSAndroid Build Coastguard Worker currentHdrSdrRatio = requested.currentHdrSdrRatio;
387*38e8c45fSAndroid Build Coastguard Worker desiredHdrSdrRatio = requested.desiredHdrSdrRatio;
388*38e8c45fSAndroid Build Coastguard Worker }
389*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eDesiredHdrHeadroomChanged) {
390*38e8c45fSAndroid Build Coastguard Worker desiredHdrSdrRatio = requested.desiredHdrSdrRatio;
391*38e8c45fSAndroid Build Coastguard Worker }
392*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eCachingHintChanged) {
393*38e8c45fSAndroid Build Coastguard Worker cachingHint = requested.cachingHint;
394*38e8c45fSAndroid Build Coastguard Worker }
395*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eHdrMetadataChanged) {
396*38e8c45fSAndroid Build Coastguard Worker hdrMetadata = requested.hdrMetadata;
397*38e8c45fSAndroid Build Coastguard Worker }
398*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eSidebandStreamChanged) {
399*38e8c45fSAndroid Build Coastguard Worker sidebandStream = requested.sidebandStream;
400*38e8c45fSAndroid Build Coastguard Worker }
401*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eShadowRadiusChanged) {
402*38e8c45fSAndroid Build Coastguard Worker shadowSettings.length = requested.shadowRadius;
403*38e8c45fSAndroid Build Coastguard Worker }
404*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eFrameRateSelectionPriority) {
405*38e8c45fSAndroid Build Coastguard Worker frameRateSelectionPriority = requested.frameRateSelectionPriority;
406*38e8c45fSAndroid Build Coastguard Worker }
407*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eColorSpaceAgnosticChanged) {
408*38e8c45fSAndroid Build Coastguard Worker isColorspaceAgnostic = requested.colorSpaceAgnostic;
409*38e8c45fSAndroid Build Coastguard Worker }
410*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eDimmingEnabledChanged) {
411*38e8c45fSAndroid Build Coastguard Worker dimmingEnabled = requested.dimmingEnabled;
412*38e8c45fSAndroid Build Coastguard Worker }
413*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eCropChanged) {
414*38e8c45fSAndroid Build Coastguard Worker geomCrop = requested.crop;
415*38e8c45fSAndroid Build Coastguard Worker }
416*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::ePictureProfileHandleChanged) {
417*38e8c45fSAndroid Build Coastguard Worker pictureProfileHandle = requested.pictureProfileHandle;
418*38e8c45fSAndroid Build Coastguard Worker }
419*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eAppContentPriorityChanged) {
420*38e8c45fSAndroid Build Coastguard Worker // TODO(b/337330263): Also consider the system-determined priority of the app
421*38e8c45fSAndroid Build Coastguard Worker pictureProfilePriority = requested.appContentPriority;
422*38e8c45fSAndroid Build Coastguard Worker }
423*38e8c45fSAndroid Build Coastguard Worker
424*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eDefaultFrameRateCompatibilityChanged) {
425*38e8c45fSAndroid Build Coastguard Worker const auto compatibility =
426*38e8c45fSAndroid Build Coastguard Worker Layer::FrameRate::convertCompatibility(requested.defaultFrameRateCompatibility);
427*38e8c45fSAndroid Build Coastguard Worker if (defaultFrameRateCompatibility != compatibility) {
428*38e8c45fSAndroid Build Coastguard Worker clientChanges |= layer_state_t::eDefaultFrameRateCompatibilityChanged;
429*38e8c45fSAndroid Build Coastguard Worker }
430*38e8c45fSAndroid Build Coastguard Worker defaultFrameRateCompatibility = compatibility;
431*38e8c45fSAndroid Build Coastguard Worker }
432*38e8c45fSAndroid Build Coastguard Worker
433*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate ||
434*38e8c45fSAndroid Build Coastguard Worker requested.what &
435*38e8c45fSAndroid Build Coastguard Worker (layer_state_t::eFlagsChanged | layer_state_t::eBufferChanged |
436*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eSidebandStreamChanged)) {
437*38e8c45fSAndroid Build Coastguard Worker compositionType = requested.getCompositionType();
438*38e8c45fSAndroid Build Coastguard Worker }
439*38e8c45fSAndroid Build Coastguard Worker
440*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eInputInfoChanged) {
441*38e8c45fSAndroid Build Coastguard Worker if (requested.windowInfoHandle) {
442*38e8c45fSAndroid Build Coastguard Worker inputInfo = *requested.windowInfoHandle->getInfo();
443*38e8c45fSAndroid Build Coastguard Worker } else {
444*38e8c45fSAndroid Build Coastguard Worker inputInfo = {};
445*38e8c45fSAndroid Build Coastguard Worker // b/271132344 revisit this and see if we can always use the layers uid/pid
446*38e8c45fSAndroid Build Coastguard Worker inputInfo.name = requested.name;
447*38e8c45fSAndroid Build Coastguard Worker inputInfo.ownerUid = requested.ownerUid;
448*38e8c45fSAndroid Build Coastguard Worker inputInfo.ownerPid = requested.ownerPid;
449*38e8c45fSAndroid Build Coastguard Worker }
450*38e8c45fSAndroid Build Coastguard Worker inputInfo.id = static_cast<int32_t>(uniqueSequence);
451*38e8c45fSAndroid Build Coastguard Worker touchCropId = requested.touchCropId;
452*38e8c45fSAndroid Build Coastguard Worker }
453*38e8c45fSAndroid Build Coastguard Worker
454*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate ||
455*38e8c45fSAndroid Build Coastguard Worker requested.what &
456*38e8c45fSAndroid Build Coastguard Worker (layer_state_t::eColorChanged | layer_state_t::eBufferChanged |
457*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eSidebandStreamChanged)) {
458*38e8c45fSAndroid Build Coastguard Worker color.rgb = requested.getColor().rgb;
459*38e8c45fSAndroid Build Coastguard Worker }
460*38e8c45fSAndroid Build Coastguard Worker
461*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eBufferChanged) {
462*38e8c45fSAndroid Build Coastguard Worker acquireFence =
463*38e8c45fSAndroid Build Coastguard Worker (requested.externalTexture &&
464*38e8c45fSAndroid Build Coastguard Worker requested.bufferData->flags.test(BufferData::BufferDataChange::fenceChanged))
465*38e8c45fSAndroid Build Coastguard Worker ? requested.bufferData->acquireFence
466*38e8c45fSAndroid Build Coastguard Worker : Fence::NO_FENCE;
467*38e8c45fSAndroid Build Coastguard Worker buffer = requested.externalTexture ? requested.externalTexture->getBuffer() : nullptr;
468*38e8c45fSAndroid Build Coastguard Worker externalTexture = requested.externalTexture;
469*38e8c45fSAndroid Build Coastguard Worker frameNumber = (requested.bufferData) ? requested.bufferData->frameNumber : 0;
470*38e8c45fSAndroid Build Coastguard Worker hasProtectedContent = requested.externalTexture &&
471*38e8c45fSAndroid Build Coastguard Worker requested.externalTexture->getUsage() & GRALLOC_USAGE_PROTECTED;
472*38e8c45fSAndroid Build Coastguard Worker geomUsesSourceCrop = hasBufferOrSidebandStream();
473*38e8c45fSAndroid Build Coastguard Worker }
474*38e8c45fSAndroid Build Coastguard Worker
475*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate ||
476*38e8c45fSAndroid Build Coastguard Worker requested.what &
477*38e8c45fSAndroid Build Coastguard Worker (layer_state_t::eCropChanged | layer_state_t::eBufferCropChanged |
478*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eBufferTransformChanged |
479*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eTransformToDisplayInverseChanged) ||
480*38e8c45fSAndroid Build Coastguard Worker requested.changes.test(RequestedLayerState::Changes::BufferSize) || displayChanges) {
481*38e8c45fSAndroid Build Coastguard Worker bufferSize = requested.getBufferSize(displayRotationFlags);
482*38e8c45fSAndroid Build Coastguard Worker geomBufferSize = bufferSize;
483*38e8c45fSAndroid Build Coastguard Worker croppedBufferSize = requested.getCroppedBufferSize(bufferSize);
484*38e8c45fSAndroid Build Coastguard Worker geomContentCrop = requested.getBufferCrop();
485*38e8c45fSAndroid Build Coastguard Worker }
486*38e8c45fSAndroid Build Coastguard Worker
487*38e8c45fSAndroid Build Coastguard Worker if ((forceUpdate ||
488*38e8c45fSAndroid Build Coastguard Worker requested.what &
489*38e8c45fSAndroid Build Coastguard Worker (layer_state_t::eFlagsChanged | layer_state_t::eDestinationFrameChanged |
490*38e8c45fSAndroid Build Coastguard Worker layer_state_t::ePositionChanged | layer_state_t::eMatrixChanged |
491*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eBufferTransformChanged |
492*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eTransformToDisplayInverseChanged) ||
493*38e8c45fSAndroid Build Coastguard Worker requested.changes.test(RequestedLayerState::Changes::BufferSize) || displayChanges) &&
494*38e8c45fSAndroid Build Coastguard Worker !ignoreLocalTransform) {
495*38e8c45fSAndroid Build Coastguard Worker localTransform = requested.getTransform(displayRotationFlags);
496*38e8c45fSAndroid Build Coastguard Worker localTransformInverse = localTransform.inverse();
497*38e8c45fSAndroid Build Coastguard Worker }
498*38e8c45fSAndroid Build Coastguard Worker
499*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & (layer_state_t::eColorChanged) ||
500*38e8c45fSAndroid Build Coastguard Worker requested.changes.test(RequestedLayerState::Changes::BufferSize)) {
501*38e8c45fSAndroid Build Coastguard Worker color.rgb = requested.getColor().rgb;
502*38e8c45fSAndroid Build Coastguard Worker }
503*38e8c45fSAndroid Build Coastguard Worker
504*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate ||
505*38e8c45fSAndroid Build Coastguard Worker requested.what &
506*38e8c45fSAndroid Build Coastguard Worker (layer_state_t::eBufferChanged | layer_state_t::eDataspaceChanged |
507*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eApiChanged | layer_state_t::eShadowRadiusChanged |
508*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eBlurRegionsChanged | layer_state_t::eStretchChanged |
509*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eEdgeExtensionChanged)) {
510*38e8c45fSAndroid Build Coastguard Worker forceClientComposition = shadowSettings.length > 0 || stretchEffect.hasEffect() ||
511*38e8c45fSAndroid Build Coastguard Worker edgeExtensionEffect.hasEffect();
512*38e8c45fSAndroid Build Coastguard Worker }
513*38e8c45fSAndroid Build Coastguard Worker
514*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate ||
515*38e8c45fSAndroid Build Coastguard Worker requested.what &
516*38e8c45fSAndroid Build Coastguard Worker (layer_state_t::eColorChanged | layer_state_t::eShadowRadiusChanged |
517*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eBlurRegionsChanged | layer_state_t::eBackgroundBlurRadiusChanged |
518*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eCornerRadiusChanged | layer_state_t::eAlphaChanged |
519*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eFlagsChanged | layer_state_t::eBufferChanged |
520*38e8c45fSAndroid Build Coastguard Worker layer_state_t::eSidebandStreamChanged)) {
521*38e8c45fSAndroid Build Coastguard Worker contentOpaque = isContentOpaque();
522*38e8c45fSAndroid Build Coastguard Worker isOpaque = contentOpaque && !roundedCorner.hasRoundedCorners() && color.a == 1.f;
523*38e8c45fSAndroid Build Coastguard Worker blendMode = getBlendMode(requested);
524*38e8c45fSAndroid Build Coastguard Worker }
525*38e8c45fSAndroid Build Coastguard Worker
526*38e8c45fSAndroid Build Coastguard Worker if (forceUpdate || requested.what & layer_state_t::eLutsChanged) {
527*38e8c45fSAndroid Build Coastguard Worker luts = requested.luts;
528*38e8c45fSAndroid Build Coastguard Worker }
529*38e8c45fSAndroid Build Coastguard Worker }
530*38e8c45fSAndroid Build Coastguard Worker
531*38e8c45fSAndroid Build Coastguard Worker } // namespace android::surfaceflinger::frontend
532