blob: f640f85bca46469c7e077e305fba3a4bd34cadf9 [file] [log] [blame]
Lloyd Piquecc01a452018-12-04 17:24:00 -08001/*
2 * Copyright 2019 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
Lloyd Pique37c2c9b2018-12-04 17:25:10 -080017#include <android-base/stringprintf.h>
Lloyd Piquef5275482019-01-29 18:42:42 -080018#include <compositionengine/DisplayColorProfile.h>
Lloyd Pique9755fb72019-03-26 14:44:40 -070019#include <compositionengine/LayerFECompositionState.h>
Lloyd Piquecc01a452018-12-04 17:24:00 -080020#include <compositionengine/Output.h>
Lloyd Piquea83776c2019-01-29 18:42:32 -080021#include <compositionengine/impl/OutputCompositionState.h>
Lloyd Piquecc01a452018-12-04 17:24:00 -080022#include <compositionengine/impl/OutputLayer.h>
Lloyd Piquea83776c2019-01-29 18:42:32 -080023#include <compositionengine/impl/OutputLayerCompositionState.h>
Lloyd Piquecc01a452018-12-04 17:24:00 -080024
Lloyd Pique3b5a69e2020-01-16 17:51:01 -080025// TODO(b/129481165): remove the #pragma below and fix conversion issues
26#pragma clang diagnostic push
27#pragma clang diagnostic ignored "-Wconversion"
28
Lloyd Pique07e33212018-12-18 16:33:37 -080029#include "DisplayHardware/HWComposer.h"
30
Lloyd Pique3b5a69e2020-01-16 17:51:01 -080031// TODO(b/129481165): remove the #pragma below and fix conversion issues
32#pragma clang diagnostic pop // ignored "-Wconversion"
33
Lloyd Piquecc01a452018-12-04 17:24:00 -080034namespace android::compositionengine {
35
36OutputLayer::~OutputLayer() = default;
37
38namespace impl {
39
Lloyd Piquea83776c2019-01-29 18:42:32 -080040namespace {
41
42FloatRect reduce(const FloatRect& win, const Region& exclude) {
43 if (CC_LIKELY(exclude.isEmpty())) {
44 return win;
45 }
46 // Convert through Rect (by rounding) for lack of FloatRegion
47 return Region(Rect{win}).subtract(exclude).getBounds().toFloatRect();
48}
49
50} // namespace
51
Lloyd Piquede196652020-01-22 17:29:58 -080052std::unique_ptr<OutputLayer> createOutputLayer(const compositionengine::Output& output,
53 const sp<compositionengine::LayerFE>& layerFE) {
54 return createOutputLayerTemplated<OutputLayer>(output, layerFE);
Lloyd Piquecc01a452018-12-04 17:24:00 -080055}
56
Lloyd Piquecc01a452018-12-04 17:24:00 -080057OutputLayer::~OutputLayer() = default;
58
Lloyd Piquedf336d92019-03-07 21:38:42 -080059void OutputLayer::setHwcLayer(std::shared_ptr<HWC2::Layer> hwcLayer) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -070060 auto& state = editState();
Lloyd Piquedf336d92019-03-07 21:38:42 -080061 if (hwcLayer) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -070062 state.hwc.emplace(std::move(hwcLayer));
Lloyd Piquedf336d92019-03-07 21:38:42 -080063 } else {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -070064 state.hwc.reset();
Lloyd Pique07e33212018-12-18 16:33:37 -080065 }
Lloyd Pique07e33212018-12-18 16:33:37 -080066}
67
Lloyd Piquea83776c2019-01-29 18:42:32 -080068Rect OutputLayer::calculateInitialCrop() const {
Lloyd Piquede196652020-01-22 17:29:58 -080069 const auto& layerState = *getLayerFE().getCompositionState();
Lloyd Piquea83776c2019-01-29 18:42:32 -080070
71 // apply the projection's clipping to the window crop in
72 // layerstack space, and convert-back to layer space.
73 // if there are no window scaling involved, this operation will map to full
74 // pixels in the buffer.
75
76 FloatRect activeCropFloat =
Lloyd Piquec6687342019-03-07 21:34:57 -080077 reduce(layerState.geomLayerBounds, layerState.transparentRegionHint);
Lloyd Piquea83776c2019-01-29 18:42:32 -080078
Marin Shalamanov6ad317c2020-07-29 23:34:07 +020079 const Rect& viewport = getOutput().getState().layerStackSpace.content;
Lloyd Piquea83776c2019-01-29 18:42:32 -080080 const ui::Transform& layerTransform = layerState.geomLayerTransform;
81 const ui::Transform& inverseLayerTransform = layerState.geomInverseLayerTransform;
82 // Transform to screen space.
83 activeCropFloat = layerTransform.transform(activeCropFloat);
84 activeCropFloat = activeCropFloat.intersect(viewport.toFloatRect());
85 // Back to layer space to work with the content crop.
86 activeCropFloat = inverseLayerTransform.transform(activeCropFloat);
87
88 // This needs to be here as transform.transform(Rect) computes the
89 // transformed rect and then takes the bounding box of the result before
90 // returning. This means
91 // transform.inverse().transform(transform.transform(Rect)) != Rect
92 // in which case we need to make sure the final rect is clipped to the
93 // display bounds.
94 Rect activeCrop{activeCropFloat};
95 if (!activeCrop.intersect(layerState.geomBufferSize, &activeCrop)) {
96 activeCrop.clear();
97 }
98 return activeCrop;
99}
100
101FloatRect OutputLayer::calculateOutputSourceCrop() const {
Lloyd Piquede196652020-01-22 17:29:58 -0800102 const auto& layerState = *getLayerFE().getCompositionState();
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700103 const auto& outputState = getOutput().getState();
Lloyd Piquea83776c2019-01-29 18:42:32 -0800104
105 if (!layerState.geomUsesSourceCrop) {
106 return {};
107 }
108
109 // the content crop is the area of the content that gets scaled to the
110 // layer's size. This is in buffer space.
111 FloatRect crop = layerState.geomContentCrop.toFloatRect();
112
113 // In addition there is a WM-specified crop we pull from our drawing state.
114 Rect activeCrop = calculateInitialCrop();
115 const Rect& bufferSize = layerState.geomBufferSize;
116
117 int winWidth = bufferSize.getWidth();
118 int winHeight = bufferSize.getHeight();
119
120 // The bufferSize for buffer state layers can be unbounded ([0, 0, -1, -1])
121 // if display frame hasn't been set and the parent is an unbounded layer.
122 if (winWidth < 0 && winHeight < 0) {
123 return crop;
124 }
125
126 // Transform the window crop to match the buffer coordinate system,
127 // which means using the inverse of the current transform set on the
128 // SurfaceFlingerConsumer.
129 uint32_t invTransform = layerState.geomBufferTransform;
130 if (layerState.geomBufferUsesDisplayInverseTransform) {
131 /*
132 * the code below applies the primary display's inverse transform to the
133 * buffer
134 */
Marin Shalamanov68933fb2020-09-10 17:58:12 +0200135 uint32_t invTransformOrient =
136 ui::Transform::toRotationFlags(outputState.displaySpace.orientation);
Lloyd Piquea83776c2019-01-29 18:42:32 -0800137 // calculate the inverse transform
138 if (invTransformOrient & HAL_TRANSFORM_ROT_90) {
139 invTransformOrient ^= HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_FLIP_H;
140 }
141 // and apply to the current transform
142 invTransform =
143 (ui::Transform(invTransformOrient) * ui::Transform(invTransform)).getOrientation();
144 }
145
146 if (invTransform & HAL_TRANSFORM_ROT_90) {
147 // If the activeCrop has been rotate the ends are rotated but not
148 // the space itself so when transforming ends back we can't rely on
149 // a modification of the axes of rotation. To account for this we
150 // need to reorient the inverse rotation in terms of the current
151 // axes of rotation.
Marin Shalamanovcfeebd42020-05-15 15:23:49 +0200152 bool isHFlipped = (invTransform & HAL_TRANSFORM_FLIP_H) != 0;
153 bool isVFlipped = (invTransform & HAL_TRANSFORM_FLIP_V) != 0;
154 if (isHFlipped == isVFlipped) {
Lloyd Piquea83776c2019-01-29 18:42:32 -0800155 invTransform ^= HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_FLIP_H;
156 }
157 std::swap(winWidth, winHeight);
158 }
159 const Rect winCrop =
160 activeCrop.transform(invTransform, bufferSize.getWidth(), bufferSize.getHeight());
161
162 // below, crop is intersected with winCrop expressed in crop's coordinate space
Marin Shalamanovcfeebd42020-05-15 15:23:49 +0200163 const float xScale = crop.getWidth() / float(winWidth);
164 const float yScale = crop.getHeight() / float(winHeight);
Lloyd Piquea83776c2019-01-29 18:42:32 -0800165
Marin Shalamanovcfeebd42020-05-15 15:23:49 +0200166 const float insetLeft = winCrop.left * xScale;
167 const float insetTop = winCrop.top * yScale;
168 const float insetRight = (winWidth - winCrop.right) * xScale;
169 const float insetBottom = (winHeight - winCrop.bottom) * yScale;
Lloyd Piquea83776c2019-01-29 18:42:32 -0800170
Marin Shalamanovcfeebd42020-05-15 15:23:49 +0200171 crop.left += insetLeft;
172 crop.top += insetTop;
173 crop.right -= insetRight;
174 crop.bottom -= insetBottom;
Lloyd Piquea83776c2019-01-29 18:42:32 -0800175
176 return crop;
177}
178
179Rect OutputLayer::calculateOutputDisplayFrame() const {
Lloyd Piquede196652020-01-22 17:29:58 -0800180 const auto& layerState = *getLayerFE().getCompositionState();
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700181 const auto& outputState = getOutput().getState();
Lloyd Piquea83776c2019-01-29 18:42:32 -0800182
183 // apply the layer's transform, followed by the display's global transform
184 // here we're guaranteed that the layer's transform preserves rects
Lloyd Piquec6687342019-03-07 21:34:57 -0800185 Region activeTransparentRegion = layerState.transparentRegionHint;
Lloyd Piquea83776c2019-01-29 18:42:32 -0800186 const ui::Transform& layerTransform = layerState.geomLayerTransform;
187 const ui::Transform& inverseLayerTransform = layerState.geomInverseLayerTransform;
188 const Rect& bufferSize = layerState.geomBufferSize;
189 Rect activeCrop = layerState.geomCrop;
190 if (!activeCrop.isEmpty() && bufferSize.isValid()) {
191 activeCrop = layerTransform.transform(activeCrop);
Marin Shalamanov6ad317c2020-07-29 23:34:07 +0200192 if (!activeCrop.intersect(outputState.layerStackSpace.content, &activeCrop)) {
Lloyd Piquea83776c2019-01-29 18:42:32 -0800193 activeCrop.clear();
194 }
195 activeCrop = inverseLayerTransform.transform(activeCrop, true);
196 // This needs to be here as transform.transform(Rect) computes the
197 // transformed rect and then takes the bounding box of the result before
198 // returning. This means
199 // transform.inverse().transform(transform.transform(Rect)) != Rect
200 // in which case we need to make sure the final rect is clipped to the
201 // display bounds.
202 if (!activeCrop.intersect(bufferSize, &activeCrop)) {
203 activeCrop.clear();
204 }
205 // mark regions outside the crop as transparent
206 activeTransparentRegion.orSelf(Rect(0, 0, bufferSize.getWidth(), activeCrop.top));
207 activeTransparentRegion.orSelf(
208 Rect(0, activeCrop.bottom, bufferSize.getWidth(), bufferSize.getHeight()));
209 activeTransparentRegion.orSelf(Rect(0, activeCrop.top, activeCrop.left, activeCrop.bottom));
210 activeTransparentRegion.orSelf(
211 Rect(activeCrop.right, activeCrop.top, bufferSize.getWidth(), activeCrop.bottom));
212 }
213
214 // reduce uses a FloatRect to provide more accuracy during the
215 // transformation. We then round upon constructing 'frame'.
216 Rect frame{
217 layerTransform.transform(reduce(layerState.geomLayerBounds, activeTransparentRegion))};
Marin Shalamanov6ad317c2020-07-29 23:34:07 +0200218 if (!frame.intersect(outputState.layerStackSpace.content, &frame)) {
Lloyd Piquea83776c2019-01-29 18:42:32 -0800219 frame.clear();
220 }
221 const ui::Transform displayTransform{outputState.transform};
222
223 return displayTransform.transform(frame);
224}
225
Snild Dolkow9e217d62020-04-22 15:53:42 +0200226uint32_t OutputLayer::calculateOutputRelativeBufferTransform(
227 uint32_t internalDisplayRotationFlags) const {
Lloyd Piquede196652020-01-22 17:29:58 -0800228 const auto& layerState = *getLayerFE().getCompositionState();
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700229 const auto& outputState = getOutput().getState();
Lloyd Piquea83776c2019-01-29 18:42:32 -0800230
231 /*
232 * Transformations are applied in this order:
233 * 1) buffer orientation/flip/mirror
234 * 2) state transformation (window manager)
235 * 3) layer orientation (screen orientation)
236 * (NOTE: the matrices are multiplied in reverse order)
237 */
238 const ui::Transform& layerTransform = layerState.geomLayerTransform;
Rashed Abdel-Tawab6643cd82019-10-29 10:01:56 -0700239 const ui::Transform displayTransform{outputState.transform};
Lloyd Piquea83776c2019-01-29 18:42:32 -0800240 const ui::Transform bufferTransform{layerState.geomBufferTransform};
241 ui::Transform transform(displayTransform * layerTransform * bufferTransform);
242
243 if (layerState.geomBufferUsesDisplayInverseTransform) {
244 /*
Snild Dolkow9e217d62020-04-22 15:53:42 +0200245 * We must apply the internal display's inverse transform to the buffer
246 * transform, and not the one for the output this layer is on.
Lloyd Piquea83776c2019-01-29 18:42:32 -0800247 */
Snild Dolkow9e217d62020-04-22 15:53:42 +0200248 uint32_t invTransform = internalDisplayRotationFlags;
249
Lloyd Piquea83776c2019-01-29 18:42:32 -0800250 // calculate the inverse transform
251 if (invTransform & HAL_TRANSFORM_ROT_90) {
252 invTransform ^= HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_FLIP_H;
253 }
254
255 /*
256 * Here we cancel out the orientation component of the WM transform.
257 * The scaling and translate components are already included in our bounds
258 * computation so it's enough to just omit it in the composition.
259 * See comment in BufferLayer::prepareClientLayer with ref to b/36727915 for why.
260 */
Lloyd Pique546a2452019-03-18 20:53:27 +0000261 transform = ui::Transform(invTransform) * displayTransform * bufferTransform;
Lloyd Piquea83776c2019-01-29 18:42:32 -0800262 }
263
264 // this gives us only the "orientation" component of the transform
265 return transform.getOrientation();
Snild Dolkow9e217d62020-04-22 15:53:42 +0200266}
Lloyd Piquea83776c2019-01-29 18:42:32 -0800267
Snild Dolkow9e217d62020-04-22 15:53:42 +0200268void OutputLayer::updateCompositionState(
269 bool includeGeometry, bool forceClientComposition,
270 ui::Transform::RotationFlags internalDisplayRotationFlags) {
Lloyd Piquede196652020-01-22 17:29:58 -0800271 const auto* layerFEState = getLayerFE().getCompositionState();
272 if (!layerFEState) {
273 return;
274 }
275
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700276 const auto& outputState = getOutput().getState();
277 const auto& profile = *getOutput().getDisplayColorProfile();
278 auto& state = editState();
Lloyd Piquef5275482019-01-29 18:42:42 -0800279
Lloyd Piquea83776c2019-01-29 18:42:32 -0800280 if (includeGeometry) {
Lloyd Piquefe671022019-09-24 10:43:03 -0700281 // Clear the forceClientComposition flag before it is set for any
282 // reason. Note that since it can be set by some checks below when
283 // updating the geometry state, we only clear it when updating the
284 // geometry since those conditions for forcing client composition won't
285 // go away otherwise.
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700286 state.forceClientComposition = false;
Lloyd Piquefe671022019-09-24 10:43:03 -0700287
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700288 state.displayFrame = calculateOutputDisplayFrame();
289 state.sourceCrop = calculateOutputSourceCrop();
Snild Dolkow9e217d62020-04-22 15:53:42 +0200290 state.bufferTransform = static_cast<Hwc2::Transform>(
291 calculateOutputRelativeBufferTransform(internalDisplayRotationFlags));
Lloyd Piquea83776c2019-01-29 18:42:32 -0800292
Lloyd Piquede196652020-01-22 17:29:58 -0800293 if ((layerFEState->isSecure && !outputState.isSecure) ||
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700294 (state.bufferTransform & ui::Transform::ROT_INVALID)) {
295 state.forceClientComposition = true;
Lloyd Piquea83776c2019-01-29 18:42:32 -0800296 }
297 }
Lloyd Piquef5275482019-01-29 18:42:42 -0800298
299 // Determine the output dependent dataspace for this layer. If it is
300 // colorspace agnostic, it just uses the dataspace chosen for the output to
301 // avoid the need for color conversion.
Lloyd Piquede196652020-01-22 17:29:58 -0800302 state.dataspace = layerFEState->isColorspaceAgnostic &&
Lloyd Piquef5275482019-01-29 18:42:42 -0800303 outputState.targetDataspace != ui::Dataspace::UNKNOWN
304 ? outputState.targetDataspace
Lloyd Piquede196652020-01-22 17:29:58 -0800305 : layerFEState->dataspace;
Lloyd Piquef5275482019-01-29 18:42:42 -0800306
Lloyd Piquef5275482019-01-29 18:42:42 -0800307 // These are evaluated every frame as they can potentially change at any
308 // time.
Lloyd Piquede196652020-01-22 17:29:58 -0800309 if (layerFEState->forceClientComposition || !profile.isDataspaceSupported(state.dataspace) ||
Lloyd Pique7a234912019-10-03 11:54:27 -0700310 forceClientComposition) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700311 state.forceClientComposition = true;
Lloyd Piquef5275482019-01-29 18:42:42 -0800312 }
Lloyd Piquea83776c2019-01-29 18:42:32 -0800313}
314
Dan Stoza6166c312021-01-15 16:34:05 -0800315void OutputLayer::writeStateToHWC(bool includeGeometry, bool skipLayer) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700316 const auto& state = getState();
Lloyd Piquea83776c2019-01-29 18:42:32 -0800317 // Skip doing this if there is no HWC interface
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700318 if (!state.hwc) {
Lloyd Piquea83776c2019-01-29 18:42:32 -0800319 return;
320 }
321
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700322 auto& hwcLayer = (*state.hwc).hwcLayer;
Lloyd Piquea83776c2019-01-29 18:42:32 -0800323 if (!hwcLayer) {
324 ALOGE("[%s] failed to write composition state to HWC -- no hwcLayer for output %s",
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700325 getLayerFE().getDebugName(), getOutput().getName().c_str());
Lloyd Piquea83776c2019-01-29 18:42:32 -0800326 return;
327 }
328
Lloyd Piquede196652020-01-22 17:29:58 -0800329 const auto* outputIndependentState = getLayerFE().getCompositionState();
330 if (!outputIndependentState) {
331 return;
332 }
333
334 auto requestedCompositionType = outputIndependentState->compositionType;
Lloyd Piquef5275482019-01-29 18:42:42 -0800335
Yichi Chen413d46a2021-04-07 21:42:09 +0800336 // TODO(b/181172795): We now update geometry for all flattened layers. We should update it
337 // only when the geometry actually changes
338 const bool isOverridden = state.overrideInfo.buffer != nullptr;
339 const bool prevOverridden = state.hwc->stateOverridden;
340 if (isOverridden || prevOverridden || skipLayer || includeGeometry) {
Lloyd Piquef5275482019-01-29 18:42:42 -0800341 writeOutputDependentGeometryStateToHWC(hwcLayer.get(), requestedCompositionType);
Dan Stoza6166c312021-01-15 16:34:05 -0800342 writeOutputIndependentGeometryStateToHWC(hwcLayer.get(), *outputIndependentState,
343 skipLayer);
Lloyd Piquef5275482019-01-29 18:42:42 -0800344 }
Lloyd Piquea83776c2019-01-29 18:42:32 -0800345
Lloyd Piquef5275482019-01-29 18:42:42 -0800346 writeOutputDependentPerFrameStateToHWC(hwcLayer.get());
Lloyd Piquede196652020-01-22 17:29:58 -0800347 writeOutputIndependentPerFrameStateToHWC(hwcLayer.get(), *outputIndependentState);
Lloyd Piquea83776c2019-01-29 18:42:32 -0800348
Lloyd Piquef5275482019-01-29 18:42:42 -0800349 writeCompositionTypeToHWC(hwcLayer.get(), requestedCompositionType);
Lloyd Pique46b72df2019-10-29 13:19:27 -0700350
351 // Always set the layer color after setting the composition type.
Lloyd Piquede196652020-01-22 17:29:58 -0800352 writeSolidColorStateToHWC(hwcLayer.get(), *outputIndependentState);
Yichi Chen413d46a2021-04-07 21:42:09 +0800353
354 editState().hwc->stateOverridden = isOverridden;
Lloyd Piquef5275482019-01-29 18:42:42 -0800355}
Lloyd Piquea83776c2019-01-29 18:42:32 -0800356
Lloyd Piquef5275482019-01-29 18:42:42 -0800357void OutputLayer::writeOutputDependentGeometryStateToHWC(
Peiyong Line9d809e2020-04-14 13:10:48 -0700358 HWC2::Layer* hwcLayer, hal::Composition requestedCompositionType) {
Lloyd Piquef5275482019-01-29 18:42:42 -0800359 const auto& outputDependentState = getState();
360
Dan Stoza6166c312021-01-15 16:34:05 -0800361 Rect displayFrame = outputDependentState.displayFrame;
362 FloatRect sourceCrop = outputDependentState.sourceCrop;
Huihong Luoa5825112021-03-24 12:28:29 -0700363
Alec Mouri464352b2021-03-24 16:33:21 -0700364 if (outputDependentState.overrideInfo.buffer != nullptr) {
Dan Stoza6166c312021-01-15 16:34:05 -0800365 displayFrame = outputDependentState.overrideInfo.displayFrame;
366 sourceCrop = displayFrame.toFloatRect();
Lloyd Piquef5275482019-01-29 18:42:42 -0800367 }
368
Dan Stoza6166c312021-01-15 16:34:05 -0800369 ALOGV("Writing display frame [%d, %d, %d, %d]", displayFrame.left, displayFrame.top,
370 displayFrame.right, displayFrame.bottom);
371
372 if (auto error = hwcLayer->setDisplayFrame(displayFrame); error != hal::Error::NONE) {
373 ALOGE("[%s] Failed to set display frame [%d, %d, %d, %d]: %s (%d)",
374 getLayerFE().getDebugName(), displayFrame.left, displayFrame.top, displayFrame.right,
375 displayFrame.bottom, to_string(error).c_str(), static_cast<int32_t>(error));
376 }
377
378 if (auto error = hwcLayer->setSourceCrop(sourceCrop); error != hal::Error::NONE) {
Lloyd Piquef5275482019-01-29 18:42:42 -0800379 ALOGE("[%s] Failed to set source crop [%.3f, %.3f, %.3f, %.3f]: "
380 "%s (%d)",
Dan Stoza6166c312021-01-15 16:34:05 -0800381 getLayerFE().getDebugName(), sourceCrop.left, sourceCrop.top, sourceCrop.right,
382 sourceCrop.bottom, to_string(error).c_str(), static_cast<int32_t>(error));
Lloyd Piquef5275482019-01-29 18:42:42 -0800383 }
384
Peiyong Line9d809e2020-04-14 13:10:48 -0700385 if (auto error = hwcLayer->setZOrder(outputDependentState.z); error != hal::Error::NONE) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700386 ALOGE("[%s] Failed to set Z %u: %s (%d)", getLayerFE().getDebugName(),
387 outputDependentState.z, to_string(error).c_str(), static_cast<int32_t>(error));
Lloyd Piquef5275482019-01-29 18:42:42 -0800388 }
389
Alec Mouri7be6c0a2021-03-19 15:22:01 -0700390 // Solid-color layers and overridden buffers should always use an identity transform.
391 const auto bufferTransform = (requestedCompositionType != hal::Composition::SOLID_COLOR &&
392 getState().overrideInfo.buffer == nullptr)
Lloyd Piquef5275482019-01-29 18:42:42 -0800393 ? outputDependentState.bufferTransform
Peiyong Line9d809e2020-04-14 13:10:48 -0700394 : static_cast<hal::Transform>(0);
395 if (auto error = hwcLayer->setTransform(static_cast<hal::Transform>(bufferTransform));
396 error != hal::Error::NONE) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700397 ALOGE("[%s] Failed to set transform %s: %s (%d)", getLayerFE().getDebugName(),
Lloyd Piquef5275482019-01-29 18:42:42 -0800398 toString(outputDependentState.bufferTransform).c_str(), to_string(error).c_str(),
399 static_cast<int32_t>(error));
400 }
401}
402
403void OutputLayer::writeOutputIndependentGeometryStateToHWC(
Dan Stoza6166c312021-01-15 16:34:05 -0800404 HWC2::Layer* hwcLayer, const LayerFECompositionState& outputIndependentState,
405 bool skipLayer) {
Alec Mouriee69a592021-03-23 15:00:45 -0700406 const auto blendMode = getState().overrideInfo.buffer
407 ? hardware::graphics::composer::hal::BlendMode::PREMULTIPLIED
408 : outputIndependentState.blendMode;
409 if (auto error = hwcLayer->setBlendMode(blendMode); error != hal::Error::NONE) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700410 ALOGE("[%s] Failed to set blend mode %s: %s (%d)", getLayerFE().getDebugName(),
Alec Mouriee69a592021-03-23 15:00:45 -0700411 toString(blendMode).c_str(), to_string(error).c_str(), static_cast<int32_t>(error));
Lloyd Piquef5275482019-01-29 18:42:42 -0800412 }
413
Alec Mouriee69a592021-03-23 15:00:45 -0700414 const float alpha = skipLayer
415 ? 0.0f
416 : (getState().overrideInfo.buffer ? 1.0f : outputIndependentState.alpha);
Dan Stoza6166c312021-01-15 16:34:05 -0800417 ALOGV("Writing alpha %f", alpha);
418
419 if (auto error = hwcLayer->setPlaneAlpha(alpha); error != hal::Error::NONE) {
420 ALOGE("[%s] Failed to set plane alpha %.3f: %s (%d)", getLayerFE().getDebugName(), alpha,
421 to_string(error).c_str(), static_cast<int32_t>(error));
Lloyd Piquef5275482019-01-29 18:42:42 -0800422 }
423
Lloyd Pique8d9f8362020-02-11 19:13:09 -0800424 for (const auto& [name, entry] : outputIndependentState.metadata) {
425 if (auto error = hwcLayer->setLayerGenericMetadata(name, entry.mandatory, entry.value);
Peiyong Line9d809e2020-04-14 13:10:48 -0700426 error != hal::Error::NONE) {
Lloyd Pique8d9f8362020-02-11 19:13:09 -0800427 ALOGE("[%s] Failed to set generic metadata %s %s (%d)", getLayerFE().getDebugName(),
428 name.c_str(), to_string(error).c_str(), static_cast<int32_t>(error));
429 }
430 }
Lloyd Piquef5275482019-01-29 18:42:42 -0800431}
432
433void OutputLayer::writeOutputDependentPerFrameStateToHWC(HWC2::Layer* hwcLayer) {
434 const auto& outputDependentState = getState();
435
Lloyd Piquea2468662019-03-07 21:31:06 -0800436 // TODO(lpique): b/121291683 outputSpaceVisibleRegion is output-dependent geometry
Lloyd Piquef5275482019-01-29 18:42:42 -0800437 // state and should not change every frame.
Alec Mouri464352b2021-03-24 16:33:21 -0700438 Region visibleRegion = outputDependentState.overrideInfo.buffer
439 ? Region(outputDependentState.overrideInfo.visibleRegion)
440 : outputDependentState.outputSpaceVisibleRegion;
441 if (auto error = hwcLayer->setVisibleRegion(visibleRegion); error != hal::Error::NONE) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700442 ALOGE("[%s] Failed to set visible region: %s (%d)", getLayerFE().getDebugName(),
Lloyd Piquef5275482019-01-29 18:42:42 -0800443 to_string(error).c_str(), static_cast<int32_t>(error));
Lloyd Piquea2468662019-03-07 21:31:06 -0800444 outputDependentState.outputSpaceVisibleRegion.dump(LOG_TAG);
Lloyd Piquef5275482019-01-29 18:42:42 -0800445 }
446
Alec Mourib7edfc22021-03-17 16:20:26 -0700447 const auto dataspace = outputDependentState.overrideInfo.buffer
448 ? outputDependentState.overrideInfo.dataspace
449 : outputDependentState.dataspace;
450
451 if (auto error = hwcLayer->setDataspace(dataspace); error != hal::Error::NONE) {
452 ALOGE("[%s] Failed to set dataspace %d: %s (%d)", getLayerFE().getDebugName(), dataspace,
453 to_string(error).c_str(), static_cast<int32_t>(error));
Lloyd Piquef5275482019-01-29 18:42:42 -0800454 }
455}
456
457void OutputLayer::writeOutputIndependentPerFrameStateToHWC(
458 HWC2::Layer* hwcLayer, const LayerFECompositionState& outputIndependentState) {
459 switch (auto error = hwcLayer->setColorTransform(outputIndependentState.colorTransform)) {
Peiyong Line9d809e2020-04-14 13:10:48 -0700460 case hal::Error::NONE:
Lloyd Piquef5275482019-01-29 18:42:42 -0800461 break;
Peiyong Line9d809e2020-04-14 13:10:48 -0700462 case hal::Error::UNSUPPORTED:
Lloyd Piquef5275482019-01-29 18:42:42 -0800463 editState().forceClientComposition = true;
464 break;
465 default:
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700466 ALOGE("[%s] Failed to set color transform: %s (%d)", getLayerFE().getDebugName(),
Lloyd Piquea83776c2019-01-29 18:42:32 -0800467 to_string(error).c_str(), static_cast<int32_t>(error));
Lloyd Piquef5275482019-01-29 18:42:42 -0800468 }
Lloyd Piquea83776c2019-01-29 18:42:32 -0800469
Alec Mouri464352b2021-03-24 16:33:21 -0700470 const Region& surfaceDamage = getState().overrideInfo.buffer
471 ? getState().overrideInfo.damageRegion
472 : outputIndependentState.surfaceDamage;
473
474 if (auto error = hwcLayer->setSurfaceDamage(surfaceDamage); error != hal::Error::NONE) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700475 ALOGE("[%s] Failed to set surface damage: %s (%d)", getLayerFE().getDebugName(),
Lloyd Piquef5275482019-01-29 18:42:42 -0800476 to_string(error).c_str(), static_cast<int32_t>(error));
477 outputIndependentState.surfaceDamage.dump(LOG_TAG);
478 }
479
480 // Content-specific per-frame state
481 switch (outputIndependentState.compositionType) {
Peiyong Line9d809e2020-04-14 13:10:48 -0700482 case hal::Composition::SOLID_COLOR:
Lloyd Pique46b72df2019-10-29 13:19:27 -0700483 // For compatibility, should be written AFTER the composition type.
Lloyd Piquef5275482019-01-29 18:42:42 -0800484 break;
Peiyong Line9d809e2020-04-14 13:10:48 -0700485 case hal::Composition::SIDEBAND:
Lloyd Piquef5275482019-01-29 18:42:42 -0800486 writeSidebandStateToHWC(hwcLayer, outputIndependentState);
487 break;
Peiyong Line9d809e2020-04-14 13:10:48 -0700488 case hal::Composition::CURSOR:
489 case hal::Composition::DEVICE:
Lloyd Piquef5275482019-01-29 18:42:42 -0800490 writeBufferStateToHWC(hwcLayer, outputIndependentState);
491 break;
Peiyong Line9d809e2020-04-14 13:10:48 -0700492 case hal::Composition::INVALID:
493 case hal::Composition::CLIENT:
Lloyd Piquef5275482019-01-29 18:42:42 -0800494 // Ignored
495 break;
496 }
497}
498
499void OutputLayer::writeSolidColorStateToHWC(HWC2::Layer* hwcLayer,
500 const LayerFECompositionState& outputIndependentState) {
Peiyong Line9d809e2020-04-14 13:10:48 -0700501 if (outputIndependentState.compositionType != hal::Composition::SOLID_COLOR) {
Lloyd Pique46b72df2019-10-29 13:19:27 -0700502 return;
503 }
504
Peiyong Line9d809e2020-04-14 13:10:48 -0700505 hal::Color color = {static_cast<uint8_t>(std::round(255.0f * outputIndependentState.color.r)),
506 static_cast<uint8_t>(std::round(255.0f * outputIndependentState.color.g)),
507 static_cast<uint8_t>(std::round(255.0f * outputIndependentState.color.b)),
508 255};
Lloyd Piquef5275482019-01-29 18:42:42 -0800509
Peiyong Line9d809e2020-04-14 13:10:48 -0700510 if (auto error = hwcLayer->setColor(color); error != hal::Error::NONE) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700511 ALOGE("[%s] Failed to set color: %s (%d)", getLayerFE().getDebugName(),
Lloyd Piquef5275482019-01-29 18:42:42 -0800512 to_string(error).c_str(), static_cast<int32_t>(error));
513 }
514}
515
516void OutputLayer::writeSidebandStateToHWC(HWC2::Layer* hwcLayer,
517 const LayerFECompositionState& outputIndependentState) {
518 if (auto error = hwcLayer->setSidebandStream(outputIndependentState.sidebandStream->handle());
Peiyong Line9d809e2020-04-14 13:10:48 -0700519 error != hal::Error::NONE) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700520 ALOGE("[%s] Failed to set sideband stream %p: %s (%d)", getLayerFE().getDebugName(),
Lloyd Piquef5275482019-01-29 18:42:42 -0800521 outputIndependentState.sidebandStream->handle(), to_string(error).c_str(),
522 static_cast<int32_t>(error));
523 }
524}
525
526void OutputLayer::writeBufferStateToHWC(HWC2::Layer* hwcLayer,
527 const LayerFECompositionState& outputIndependentState) {
528 auto supportedPerFrameMetadata =
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700529 getOutput().getDisplayColorProfile()->getSupportedPerFrameMetadata();
Lloyd Piquef5275482019-01-29 18:42:42 -0800530 if (auto error = hwcLayer->setPerFrameMetadata(supportedPerFrameMetadata,
531 outputIndependentState.hdrMetadata);
Peiyong Line9d809e2020-04-14 13:10:48 -0700532 error != hal::Error::NONE && error != hal::Error::UNSUPPORTED) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700533 ALOGE("[%s] Failed to set hdrMetadata: %s (%d)", getLayerFE().getDebugName(),
Lloyd Piquef5275482019-01-29 18:42:42 -0800534 to_string(error).c_str(), static_cast<int32_t>(error));
535 }
536
Dan Stoza6166c312021-01-15 16:34:05 -0800537 sp<GraphicBuffer> buffer = outputIndependentState.buffer;
538 sp<Fence> acquireFence = outputIndependentState.acquireFence;
539 if (getState().overrideInfo.buffer != nullptr) {
540 buffer = getState().overrideInfo.buffer;
541 acquireFence = getState().overrideInfo.acquireFence;
542 }
543
544 ALOGV("Writing buffer %p", buffer.get());
545
Lloyd Piquef5275482019-01-29 18:42:42 -0800546 uint32_t hwcSlot = 0;
547 sp<GraphicBuffer> hwcBuffer;
548 // We need access to the output-dependent state for the buffer cache there,
549 // though otherwise the buffer is not output-dependent.
Dan Stoza6166c312021-01-15 16:34:05 -0800550 editState().hwc->hwcBufferCache.getHwcBuffer(outputIndependentState.bufferSlot, buffer,
551 &hwcSlot, &hwcBuffer);
Lloyd Piquef5275482019-01-29 18:42:42 -0800552
Dan Stoza6166c312021-01-15 16:34:05 -0800553 if (auto error = hwcLayer->setBuffer(hwcSlot, hwcBuffer, acquireFence);
Peiyong Line9d809e2020-04-14 13:10:48 -0700554 error != hal::Error::NONE) {
Dan Stoza6166c312021-01-15 16:34:05 -0800555 ALOGE("[%s] Failed to set buffer %p: %s (%d)", getLayerFE().getDebugName(), buffer->handle,
556 to_string(error).c_str(), static_cast<int32_t>(error));
Lloyd Piquef5275482019-01-29 18:42:42 -0800557 }
558}
559
Peiyong Line9d809e2020-04-14 13:10:48 -0700560void OutputLayer::writeCompositionTypeToHWC(HWC2::Layer* hwcLayer,
561 hal::Composition requestedCompositionType) {
Lloyd Piquef5275482019-01-29 18:42:42 -0800562 auto& outputDependentState = editState();
563
564 // If we are forcing client composition, we need to tell the HWC
565 if (outputDependentState.forceClientComposition) {
Peiyong Line9d809e2020-04-14 13:10:48 -0700566 requestedCompositionType = hal::Composition::CLIENT;
Lloyd Piquef5275482019-01-29 18:42:42 -0800567 }
568
569 // Set the requested composition type with the HWC whenever it changes
570 if (outputDependentState.hwc->hwcCompositionType != requestedCompositionType) {
571 outputDependentState.hwc->hwcCompositionType = requestedCompositionType;
572
Peiyong Line9d809e2020-04-14 13:10:48 -0700573 if (auto error = hwcLayer->setCompositionType(requestedCompositionType);
574 error != hal::Error::NONE) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700575 ALOGE("[%s] Failed to set composition type %s: %s (%d)", getLayerFE().getDebugName(),
Lloyd Piquef5275482019-01-29 18:42:42 -0800576 toString(requestedCompositionType).c_str(), to_string(error).c_str(),
Lloyd Piquea83776c2019-01-29 18:42:32 -0800577 static_cast<int32_t>(error));
578 }
Lloyd Piquea83776c2019-01-29 18:42:32 -0800579 }
580}
581
Lloyd Piquec7b0c752019-03-07 20:59:59 -0800582void OutputLayer::writeCursorPositionToHWC() const {
583 // Skip doing this if there is no HWC interface
584 auto hwcLayer = getHwcLayer();
585 if (!hwcLayer) {
586 return;
587 }
588
Lloyd Piquede196652020-01-22 17:29:58 -0800589 const auto* layerFEState = getLayerFE().getCompositionState();
590 if (!layerFEState) {
591 return;
592 }
593
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700594 const auto& outputState = getOutput().getState();
Lloyd Piquec7b0c752019-03-07 20:59:59 -0800595
Lloyd Piquede196652020-01-22 17:29:58 -0800596 Rect frame = layerFEState->cursorFrame;
Marin Shalamanov6ad317c2020-07-29 23:34:07 +0200597 frame.intersect(outputState.layerStackSpace.content, &frame);
Lloyd Piquec7b0c752019-03-07 20:59:59 -0800598 Rect position = outputState.transform.transform(frame);
599
600 if (auto error = hwcLayer->setCursorPosition(position.left, position.top);
Peiyong Line9d809e2020-04-14 13:10:48 -0700601 error != hal::Error::NONE) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700602 ALOGE("[%s] Failed to set cursor position to (%d, %d): %s (%d)",
603 getLayerFE().getDebugName(), position.left, position.top, to_string(error).c_str(),
604 static_cast<int32_t>(error));
Lloyd Piquec7b0c752019-03-07 20:59:59 -0800605 }
606}
607
Lloyd Pique66d68602019-02-13 14:23:31 -0800608HWC2::Layer* OutputLayer::getHwcLayer() const {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700609 const auto& state = getState();
610 return state.hwc ? state.hwc->hwcLayer.get() : nullptr;
Lloyd Pique66d68602019-02-13 14:23:31 -0800611}
612
613bool OutputLayer::requiresClientComposition() const {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700614 const auto& state = getState();
Peiyong Line9d809e2020-04-14 13:10:48 -0700615 return !state.hwc || state.hwc->hwcCompositionType == hal::Composition::CLIENT;
Lloyd Pique66d68602019-02-13 14:23:31 -0800616}
617
Lloyd Piquec7b0c752019-03-07 20:59:59 -0800618bool OutputLayer::isHardwareCursor() const {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700619 const auto& state = getState();
Peiyong Line9d809e2020-04-14 13:10:48 -0700620 return state.hwc && state.hwc->hwcCompositionType == hal::Composition::CURSOR;
Lloyd Piquec7b0c752019-03-07 20:59:59 -0800621}
622
Peiyong Line9d809e2020-04-14 13:10:48 -0700623void OutputLayer::detectDisallowedCompositionTypeChange(hal::Composition from,
624 hal::Composition to) const {
Lloyd Pique66d68602019-02-13 14:23:31 -0800625 bool result = false;
626 switch (from) {
Peiyong Line9d809e2020-04-14 13:10:48 -0700627 case hal::Composition::INVALID:
628 case hal::Composition::CLIENT:
Lloyd Pique66d68602019-02-13 14:23:31 -0800629 result = false;
630 break;
631
Peiyong Line9d809e2020-04-14 13:10:48 -0700632 case hal::Composition::DEVICE:
633 case hal::Composition::SOLID_COLOR:
634 result = (to == hal::Composition::CLIENT);
Lloyd Pique66d68602019-02-13 14:23:31 -0800635 break;
636
Peiyong Line9d809e2020-04-14 13:10:48 -0700637 case hal::Composition::CURSOR:
638 case hal::Composition::SIDEBAND:
639 result = (to == hal::Composition::CLIENT || to == hal::Composition::DEVICE);
Lloyd Pique66d68602019-02-13 14:23:31 -0800640 break;
641 }
642
643 if (!result) {
644 ALOGE("[%s] Invalid device requested composition type change: %s (%d) --> %s (%d)",
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700645 getLayerFE().getDebugName(), toString(from).c_str(), static_cast<int>(from),
Lloyd Pique66d68602019-02-13 14:23:31 -0800646 toString(to).c_str(), static_cast<int>(to));
647 }
648}
649
Peiyong Line9d809e2020-04-14 13:10:48 -0700650void OutputLayer::applyDeviceCompositionTypeChange(hal::Composition compositionType) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700651 auto& state = editState();
652 LOG_FATAL_IF(!state.hwc);
653 auto& hwcState = *state.hwc;
Lloyd Pique66d68602019-02-13 14:23:31 -0800654
655 detectDisallowedCompositionTypeChange(hwcState.hwcCompositionType, compositionType);
656
657 hwcState.hwcCompositionType = compositionType;
658}
659
660void OutputLayer::prepareForDeviceLayerRequests() {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700661 auto& state = editState();
662 state.clearClientTarget = false;
Lloyd Pique66d68602019-02-13 14:23:31 -0800663}
664
Peiyong Line9d809e2020-04-14 13:10:48 -0700665void OutputLayer::applyDeviceLayerRequest(hal::LayerRequest request) {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700666 auto& state = editState();
Lloyd Pique66d68602019-02-13 14:23:31 -0800667 switch (request) {
Peiyong Line9d809e2020-04-14 13:10:48 -0700668 case hal::LayerRequest::CLEAR_CLIENT_TARGET:
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700669 state.clearClientTarget = true;
Lloyd Pique66d68602019-02-13 14:23:31 -0800670 break;
671
672 default:
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700673 ALOGE("[%s] Unknown device layer request %s (%d)", getLayerFE().getDebugName(),
Lloyd Pique66d68602019-02-13 14:23:31 -0800674 toString(request).c_str(), static_cast<int>(request));
675 break;
676 }
677}
678
Lloyd Pique688abd42019-02-15 15:42:24 -0800679bool OutputLayer::needsFiltering() const {
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700680 const auto& state = getState();
681 const auto& displayFrame = state.displayFrame;
682 const auto& sourceCrop = state.sourceCrop;
Lloyd Pique688abd42019-02-15 15:42:24 -0800683 return sourceCrop.getHeight() != displayFrame.getHeight() ||
684 sourceCrop.getWidth() != displayFrame.getWidth();
685}
686
Dan Stoza6166c312021-01-15 16:34:05 -0800687std::vector<LayerFE::LayerSettings> OutputLayer::getOverrideCompositionList() const {
688 if (getState().overrideInfo.buffer == nullptr) {
689 return {};
690 }
691
Alec Mouri7be6c0a2021-03-19 15:22:01 -0700692 // Compute the geometry boundaries in layer stack space: we need to transform from the
693 // framebuffer space of the override buffer to layer space.
694 const ProjectionSpace& layerSpace = getOutput().getState().layerStackSpace;
695 const ui::Transform transform = getState().overrideInfo.displaySpace.getTransform(layerSpace);
696 const Rect boundaries = transform.transform(getState().overrideInfo.displayFrame);
697
Dan Stoza6166c312021-01-15 16:34:05 -0800698 LayerFE::LayerSettings settings;
699 settings.geometry = renderengine::Geometry{
Alec Mouri7be6c0a2021-03-19 15:22:01 -0700700 .boundaries = boundaries.toFloatRect(),
Dan Stoza6166c312021-01-15 16:34:05 -0800701 };
702 settings.bufferId = getState().overrideInfo.buffer->getId();
Alec Mouri7be6c0a2021-03-19 15:22:01 -0700703 settings.source = renderengine::PixelSource{
704 .buffer = renderengine::Buffer{
705 .buffer = getState().overrideInfo.buffer,
706 .fence = getState().overrideInfo.acquireFence,
707 // If the transform from layer space to display space contains a rotation, we
708 // need to undo the rotation in the texture transform
709 .textureTransform =
710 ui::Transform(transform.inverse().getOrientation(), 1, 1).asMatrix4(),
711 }};
Alec Mouri9c8fce02021-03-12 18:30:42 -0800712 settings.sourceDataspace = getState().overrideInfo.dataspace;
Dan Stoza6166c312021-01-15 16:34:05 -0800713 settings.alpha = 1.0f;
714
715 return {static_cast<LayerFE::LayerSettings>(settings)};
716}
717
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800718void OutputLayer::dump(std::string& out) const {
719 using android::base::StringAppendF;
720
Lloyd Piquede196652020-01-22 17:29:58 -0800721 StringAppendF(&out, " - Output Layer %p(%s)\n", this, getLayerFE().getDebugName());
Lloyd Piquea38ea7e2019-04-16 18:10:26 -0700722 dumpState(out);
Lloyd Pique37c2c9b2018-12-04 17:25:10 -0800723}
724
Lloyd Piquecc01a452018-12-04 17:24:00 -0800725} // namespace impl
726} // namespace android::compositionengine