Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 1 | /* |
| 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 Pique | f8cf14d | 2019-02-28 16:03:12 -0800 | [diff] [blame] | 17 | #include <thread> |
| 18 | |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 19 | #include <android-base/stringprintf.h> |
| 20 | #include <compositionengine/CompositionEngine.h> |
Lloyd Pique | f8cf14d | 2019-02-28 16:03:12 -0800 | [diff] [blame] | 21 | #include <compositionengine/CompositionRefreshArgs.h> |
Lloyd Pique | 3d0c02e | 2018-10-19 18:38:12 -0700 | [diff] [blame] | 22 | #include <compositionengine/DisplayColorProfile.h> |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 23 | #include <compositionengine/Layer.h> |
Lloyd Pique | cc01a45 | 2018-12-04 17:24:00 -0800 | [diff] [blame] | 24 | #include <compositionengine/LayerFE.h> |
Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 25 | #include <compositionengine/LayerFECompositionState.h> |
Lloyd Pique | 31cb294 | 2018-10-19 17:23:03 -0700 | [diff] [blame] | 26 | #include <compositionengine/RenderSurface.h> |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 27 | #include <compositionengine/impl/Output.h> |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 28 | #include <compositionengine/impl/OutputCompositionState.h> |
Lloyd Pique | cc01a45 | 2018-12-04 17:24:00 -0800 | [diff] [blame] | 29 | #include <compositionengine/impl/OutputLayer.h> |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 30 | #include <compositionengine/impl/OutputLayerCompositionState.h> |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 31 | #include <renderengine/DisplaySettings.h> |
| 32 | #include <renderengine/RenderEngine.h> |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 33 | #include <ui/DebugUtils.h> |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 34 | #include <ui/HdrCapabilities.h> |
Lloyd Pique | 66d6860 | 2019-02-13 14:23:31 -0800 | [diff] [blame] | 35 | #include <utils/Trace.h> |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 36 | |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 37 | #include "TracedOrdinal.h" |
| 38 | |
Lloyd Pique | feb73d7 | 2018-12-04 17:23:44 -0800 | [diff] [blame] | 39 | namespace android::compositionengine { |
| 40 | |
| 41 | Output::~Output() = default; |
| 42 | |
| 43 | namespace impl { |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 44 | |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 45 | namespace { |
| 46 | |
| 47 | template <typename T> |
| 48 | class Reversed { |
| 49 | public: |
| 50 | explicit Reversed(const T& container) : mContainer(container) {} |
| 51 | auto begin() { return mContainer.rbegin(); } |
| 52 | auto end() { return mContainer.rend(); } |
| 53 | |
| 54 | private: |
| 55 | const T& mContainer; |
| 56 | }; |
| 57 | |
| 58 | // Helper for enumerating over a container in reverse order |
| 59 | template <typename T> |
| 60 | Reversed<T> reversed(const T& c) { |
| 61 | return Reversed<T>(c); |
| 62 | } |
| 63 | |
| 64 | } // namespace |
| 65 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 66 | std::shared_ptr<Output> createOutput( |
| 67 | const compositionengine::CompositionEngine& compositionEngine) { |
| 68 | return createOutputTemplated<Output>(compositionEngine); |
| 69 | } |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 70 | |
| 71 | Output::~Output() = default; |
| 72 | |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 73 | bool Output::isValid() const { |
Lloyd Pique | 3d0c02e | 2018-10-19 18:38:12 -0700 | [diff] [blame] | 74 | return mDisplayColorProfile && mDisplayColorProfile->isValid() && mRenderSurface && |
| 75 | mRenderSurface->isValid(); |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | const std::string& Output::getName() const { |
| 79 | return mName; |
| 80 | } |
| 81 | |
| 82 | void Output::setName(const std::string& name) { |
| 83 | mName = name; |
| 84 | } |
| 85 | |
| 86 | void Output::setCompositionEnabled(bool enabled) { |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 87 | auto& outputState = editState(); |
| 88 | if (outputState.isEnabled == enabled) { |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 89 | return; |
| 90 | } |
| 91 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 92 | outputState.isEnabled = enabled; |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 93 | dirtyEntireOutput(); |
| 94 | } |
| 95 | |
| 96 | void Output::setProjection(const ui::Transform& transform, int32_t orientation, const Rect& frame, |
| 97 | const Rect& viewport, const Rect& scissor, bool needsFiltering) { |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 98 | auto& outputState = editState(); |
| 99 | outputState.transform = transform; |
| 100 | outputState.orientation = orientation; |
| 101 | outputState.scissor = scissor; |
| 102 | outputState.frame = frame; |
| 103 | outputState.viewport = viewport; |
| 104 | outputState.needsFiltering = needsFiltering; |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 105 | |
| 106 | dirtyEntireOutput(); |
| 107 | } |
| 108 | |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 109 | // TODO(b/121291683): Rename setSize() once more is moved. |
Lloyd Pique | 31cb294 | 2018-10-19 17:23:03 -0700 | [diff] [blame] | 110 | void Output::setBounds(const ui::Size& size) { |
| 111 | mRenderSurface->setDisplaySize(size); |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 112 | // TODO(b/121291683): Rename outputState.size once more is moved. |
| 113 | editState().bounds = Rect(mRenderSurface->getSize()); |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 114 | |
| 115 | dirtyEntireOutput(); |
| 116 | } |
| 117 | |
Lloyd Pique | ef36b00 | 2019-01-23 17:52:04 -0800 | [diff] [blame] | 118 | void Output::setLayerStackFilter(uint32_t layerStackId, bool isInternal) { |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 119 | auto& outputState = editState(); |
| 120 | outputState.layerStackId = layerStackId; |
| 121 | outputState.layerStackInternal = isInternal; |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 122 | |
| 123 | dirtyEntireOutput(); |
| 124 | } |
| 125 | |
Lloyd Pique | 3eb1b21 | 2019-03-07 21:15:40 -0800 | [diff] [blame] | 126 | void Output::setColorTransform(const compositionengine::CompositionRefreshArgs& args) { |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 127 | auto& colorTransformMatrix = editState().colorTransformMatrix; |
| 128 | if (!args.colorTransformMatrix || colorTransformMatrix == args.colorTransformMatrix) { |
Lloyd Pique | 77f79a2 | 2019-04-29 15:55:40 -0700 | [diff] [blame] | 129 | return; |
| 130 | } |
| 131 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 132 | colorTransformMatrix = *args.colorTransformMatrix; |
Lloyd Pique | ef95812 | 2019-02-05 18:00:12 -0800 | [diff] [blame] | 133 | |
| 134 | dirtyEntireOutput(); |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 135 | } |
| 136 | |
Lloyd Pique | 6a3b446 | 2019-03-07 20:58:12 -0800 | [diff] [blame] | 137 | void Output::setColorProfile(const ColorProfile& colorProfile) { |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 138 | ui::Dataspace targetDataspace = |
Lloyd Pique | 6a3b446 | 2019-03-07 20:58:12 -0800 | [diff] [blame] | 139 | getDisplayColorProfile()->getTargetDataspace(colorProfile.mode, colorProfile.dataspace, |
| 140 | colorProfile.colorSpaceAgnosticDataspace); |
Lloyd Pique | f527548 | 2019-01-29 18:42:42 -0800 | [diff] [blame] | 141 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 142 | auto& outputState = editState(); |
| 143 | if (outputState.colorMode == colorProfile.mode && |
| 144 | outputState.dataspace == colorProfile.dataspace && |
| 145 | outputState.renderIntent == colorProfile.renderIntent && |
| 146 | outputState.targetDataspace == targetDataspace) { |
Lloyd Pique | ef95812 | 2019-02-05 18:00:12 -0800 | [diff] [blame] | 147 | return; |
| 148 | } |
| 149 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 150 | outputState.colorMode = colorProfile.mode; |
| 151 | outputState.dataspace = colorProfile.dataspace; |
| 152 | outputState.renderIntent = colorProfile.renderIntent; |
| 153 | outputState.targetDataspace = targetDataspace; |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 154 | |
Lloyd Pique | 6a3b446 | 2019-03-07 20:58:12 -0800 | [diff] [blame] | 155 | mRenderSurface->setBufferDataspace(colorProfile.dataspace); |
Lloyd Pique | 31cb294 | 2018-10-19 17:23:03 -0700 | [diff] [blame] | 156 | |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 157 | ALOGV("Set active color mode: %s (%d), active render intent: %s (%d)", |
Lloyd Pique | 6a3b446 | 2019-03-07 20:58:12 -0800 | [diff] [blame] | 158 | decodeColorMode(colorProfile.mode).c_str(), colorProfile.mode, |
| 159 | decodeRenderIntent(colorProfile.renderIntent).c_str(), colorProfile.renderIntent); |
Lloyd Pique | ef95812 | 2019-02-05 18:00:12 -0800 | [diff] [blame] | 160 | |
| 161 | dirtyEntireOutput(); |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | void Output::dump(std::string& out) const { |
| 165 | using android::base::StringAppendF; |
| 166 | |
| 167 | StringAppendF(&out, " Composition Output State: [\"%s\"]", mName.c_str()); |
| 168 | |
| 169 | out.append("\n "); |
| 170 | |
| 171 | dumpBase(out); |
| 172 | } |
| 173 | |
| 174 | void Output::dumpBase(std::string& out) const { |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 175 | dumpState(out); |
Lloyd Pique | 31cb294 | 2018-10-19 17:23:03 -0700 | [diff] [blame] | 176 | |
Lloyd Pique | 3d0c02e | 2018-10-19 18:38:12 -0700 | [diff] [blame] | 177 | if (mDisplayColorProfile) { |
| 178 | mDisplayColorProfile->dump(out); |
| 179 | } else { |
| 180 | out.append(" No display color profile!\n"); |
| 181 | } |
| 182 | |
Lloyd Pique | 31cb294 | 2018-10-19 17:23:03 -0700 | [diff] [blame] | 183 | if (mRenderSurface) { |
| 184 | mRenderSurface->dump(out); |
| 185 | } else { |
| 186 | out.append(" No render surface!\n"); |
| 187 | } |
Lloyd Pique | 37c2c9b | 2018-12-04 17:25:10 -0800 | [diff] [blame] | 188 | |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 189 | android::base::StringAppendF(&out, "\n %zu Layers\n", getOutputLayerCount()); |
| 190 | for (const auto* outputLayer : getOutputLayersOrderedByZ()) { |
Lloyd Pique | 37c2c9b | 2018-12-04 17:25:10 -0800 | [diff] [blame] | 191 | if (!outputLayer) { |
| 192 | continue; |
| 193 | } |
| 194 | outputLayer->dump(out); |
| 195 | } |
Lloyd Pique | 31cb294 | 2018-10-19 17:23:03 -0700 | [diff] [blame] | 196 | } |
| 197 | |
Lloyd Pique | 3d0c02e | 2018-10-19 18:38:12 -0700 | [diff] [blame] | 198 | compositionengine::DisplayColorProfile* Output::getDisplayColorProfile() const { |
| 199 | return mDisplayColorProfile.get(); |
| 200 | } |
| 201 | |
| 202 | void Output::setDisplayColorProfile(std::unique_ptr<compositionengine::DisplayColorProfile> mode) { |
| 203 | mDisplayColorProfile = std::move(mode); |
| 204 | } |
| 205 | |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 206 | const Output::ReleasedLayers& Output::getReleasedLayersForTest() const { |
| 207 | return mReleasedLayers; |
| 208 | } |
| 209 | |
Lloyd Pique | 3d0c02e | 2018-10-19 18:38:12 -0700 | [diff] [blame] | 210 | void Output::setDisplayColorProfileForTest( |
| 211 | std::unique_ptr<compositionengine::DisplayColorProfile> mode) { |
| 212 | mDisplayColorProfile = std::move(mode); |
| 213 | } |
| 214 | |
Lloyd Pique | 31cb294 | 2018-10-19 17:23:03 -0700 | [diff] [blame] | 215 | compositionengine::RenderSurface* Output::getRenderSurface() const { |
| 216 | return mRenderSurface.get(); |
| 217 | } |
| 218 | |
| 219 | void Output::setRenderSurface(std::unique_ptr<compositionengine::RenderSurface> surface) { |
| 220 | mRenderSurface = std::move(surface); |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 221 | editState().bounds = Rect(mRenderSurface->getSize()); |
Lloyd Pique | 31cb294 | 2018-10-19 17:23:03 -0700 | [diff] [blame] | 222 | |
| 223 | dirtyEntireOutput(); |
| 224 | } |
| 225 | |
| 226 | void Output::setRenderSurfaceForTest(std::unique_ptr<compositionengine::RenderSurface> surface) { |
| 227 | mRenderSurface = std::move(surface); |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 228 | } |
| 229 | |
Alec Mouri | e7d1d4a | 2019-02-05 01:13:46 +0000 | [diff] [blame] | 230 | Region Output::getDirtyRegion(bool repaintEverything) const { |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 231 | const auto& outputState = getState(); |
| 232 | Region dirty(outputState.viewport); |
Alec Mouri | e7d1d4a | 2019-02-05 01:13:46 +0000 | [diff] [blame] | 233 | if (!repaintEverything) { |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 234 | dirty.andSelf(outputState.dirtyRegion); |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 235 | } |
| 236 | return dirty; |
| 237 | } |
| 238 | |
Lloyd Pique | c668734 | 2019-03-07 21:34:57 -0800 | [diff] [blame] | 239 | bool Output::belongsInOutput(std::optional<uint32_t> layerStackId, bool internalOnly) const { |
Lloyd Pique | ef36b00 | 2019-01-23 17:52:04 -0800 | [diff] [blame] | 240 | // The layerStackId's must match, and also the layer must not be internal |
| 241 | // only when not on an internal output. |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 242 | const auto& outputState = getState(); |
| 243 | return layerStackId && (*layerStackId == outputState.layerStackId) && |
| 244 | (!internalOnly || outputState.layerStackInternal); |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 245 | } |
| 246 | |
Lloyd Pique | 66c20c4 | 2019-03-07 21:44:02 -0800 | [diff] [blame] | 247 | bool Output::belongsInOutput(const compositionengine::Layer* layer) const { |
| 248 | if (!layer) { |
| 249 | return false; |
| 250 | } |
| 251 | |
Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 252 | const auto& layerFEState = layer->getFEState(); |
Lloyd Pique | 66c20c4 | 2019-03-07 21:44:02 -0800 | [diff] [blame] | 253 | return belongsInOutput(layerFEState.layerStackId, layerFEState.internalOnly); |
| 254 | } |
| 255 | |
Lloyd Pique | df336d9 | 2019-03-07 21:38:42 -0800 | [diff] [blame] | 256 | std::unique_ptr<compositionengine::OutputLayer> Output::createOutputLayer( |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 257 | const std::shared_ptr<compositionengine::Layer>& layer, const sp<LayerFE>& layerFE) const { |
Lloyd Pique | df336d9 | 2019-03-07 21:38:42 -0800 | [diff] [blame] | 258 | return impl::createOutputLayer(*this, layer, layerFE); |
Lloyd Pique | cc01a45 | 2018-12-04 17:24:00 -0800 | [diff] [blame] | 259 | } |
| 260 | |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 261 | compositionengine::OutputLayer* Output::getOutputLayerForLayer( |
| 262 | compositionengine::Layer* layer) const { |
| 263 | auto index = findCurrentOutputLayerForLayer(layer); |
| 264 | return index ? getOutputLayerOrderedByZByIndex(*index) : nullptr; |
Lloyd Pique | cc01a45 | 2018-12-04 17:24:00 -0800 | [diff] [blame] | 265 | } |
| 266 | |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 267 | std::optional<size_t> Output::findCurrentOutputLayerForLayer( |
| 268 | compositionengine::Layer* layer) const { |
| 269 | for (size_t i = 0; i < getOutputLayerCount(); i++) { |
| 270 | auto outputLayer = getOutputLayerOrderedByZByIndex(i); |
| 271 | if (outputLayer && &outputLayer->getLayer() == layer) { |
| 272 | return i; |
| 273 | } |
| 274 | } |
| 275 | return std::nullopt; |
Lloyd Pique | cc01a45 | 2018-12-04 17:24:00 -0800 | [diff] [blame] | 276 | } |
| 277 | |
Lloyd Pique | c7ef21b | 2019-01-29 18:43:00 -0800 | [diff] [blame] | 278 | void Output::setReleasedLayers(Output::ReleasedLayers&& layers) { |
| 279 | mReleasedLayers = std::move(layers); |
| 280 | } |
| 281 | |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 282 | void Output::prepare(const compositionengine::CompositionRefreshArgs& refreshArgs, |
| 283 | LayerFESet& geomSnapshots) { |
| 284 | ATRACE_CALL(); |
| 285 | ALOGV(__FUNCTION__); |
Lloyd Pique | 3eb1b21 | 2019-03-07 21:15:40 -0800 | [diff] [blame] | 286 | |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 287 | rebuildLayerStacks(refreshArgs, geomSnapshots); |
Lloyd Pique | 3eb1b21 | 2019-03-07 21:15:40 -0800 | [diff] [blame] | 288 | } |
| 289 | |
Lloyd Pique | d7b429f | 2019-03-07 21:11:02 -0800 | [diff] [blame] | 290 | void Output::present(const compositionengine::CompositionRefreshArgs& refreshArgs) { |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 291 | ATRACE_CALL(); |
| 292 | ALOGV(__FUNCTION__); |
| 293 | |
Lloyd Pique | 3eb1b21 | 2019-03-07 21:15:40 -0800 | [diff] [blame] | 294 | updateColorProfile(refreshArgs); |
| 295 | updateAndWriteCompositionState(refreshArgs); |
| 296 | setColorTransform(refreshArgs); |
Lloyd Pique | d7b429f | 2019-03-07 21:11:02 -0800 | [diff] [blame] | 297 | beginFrame(); |
| 298 | prepareFrame(); |
| 299 | devOptRepaintFlash(refreshArgs); |
| 300 | finishFrame(refreshArgs); |
| 301 | postFramebuffer(); |
| 302 | } |
| 303 | |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 304 | void Output::rebuildLayerStacks(const compositionengine::CompositionRefreshArgs& refreshArgs, |
| 305 | LayerFESet& layerFESet) { |
| 306 | ATRACE_CALL(); |
| 307 | ALOGV(__FUNCTION__); |
| 308 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 309 | auto& outputState = editState(); |
| 310 | |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 311 | // Do nothing if this output is not enabled or there is no need to perform this update |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 312 | if (!outputState.isEnabled || CC_LIKELY(!refreshArgs.updatingOutputGeometryThisFrame)) { |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 313 | return; |
| 314 | } |
| 315 | |
| 316 | // Process the layers to determine visibility and coverage |
| 317 | compositionengine::Output::CoverageState coverage{layerFESet}; |
| 318 | collectVisibleLayers(refreshArgs, coverage); |
| 319 | |
| 320 | // Compute the resulting coverage for this output, and store it for later |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 321 | const ui::Transform& tr = outputState.transform; |
| 322 | Region undefinedRegion{outputState.bounds}; |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 323 | undefinedRegion.subtractSelf(tr.transform(coverage.aboveOpaqueLayers)); |
| 324 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 325 | outputState.undefinedRegion = undefinedRegion; |
| 326 | outputState.dirtyRegion.orSelf(coverage.dirtyRegion); |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | void Output::collectVisibleLayers(const compositionengine::CompositionRefreshArgs& refreshArgs, |
| 330 | compositionengine::Output::CoverageState& coverage) { |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 331 | // Evaluate the layers from front to back to determine what is visible. This |
| 332 | // also incrementally calculates the coverage information for each layer as |
| 333 | // well as the entire output. |
| 334 | for (auto& layer : reversed(refreshArgs.layers)) { |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 335 | // Incrementally process the coverage for each layer |
| 336 | ensureOutputLayerIfVisible(layer, coverage); |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 337 | |
| 338 | // TODO(b/121291683): Stop early if the output is completely covered and |
| 339 | // no more layers could even be visible underneath the ones on top. |
| 340 | } |
| 341 | |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 342 | setReleasedLayers(refreshArgs); |
| 343 | |
| 344 | finalizePendingOutputLayers(); |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 345 | |
| 346 | // Generate a simple Z-order values to each visible output layer |
| 347 | uint32_t zOrder = 0; |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 348 | for (auto* outputLayer : getOutputLayersOrderedByZ()) { |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 349 | outputLayer->editState().z = zOrder++; |
| 350 | } |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 351 | } |
| 352 | |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 353 | void Output::ensureOutputLayerIfVisible(std::shared_ptr<compositionengine::Layer> layer, |
| 354 | compositionengine::Output::CoverageState& coverage) { |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 355 | // Note: Converts a wp<LayerFE> to a sp<LayerFE> |
| 356 | auto layerFE = layer->getLayerFE(); |
| 357 | if (layerFE == nullptr) { |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 358 | return; |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 359 | } |
| 360 | |
| 361 | // Ensure we have a snapshot of the basic geometry layer state. Limit the |
| 362 | // snapshots to once per frame for each candidate layer, as layers may |
| 363 | // appear on multiple outputs. |
| 364 | if (!coverage.latchedLayers.count(layerFE)) { |
| 365 | coverage.latchedLayers.insert(layerFE); |
Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 366 | layerFE->latchCompositionState(layer->editFEState(), |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 367 | compositionengine::LayerFE::StateSubset::BasicGeometry); |
| 368 | } |
| 369 | |
| 370 | // Obtain a read-only reference to the front-end layer state |
Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 371 | const auto& layerFEState = layer->getFEState(); |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 372 | |
| 373 | // Only consider the layers on the given layer stack |
| 374 | if (!belongsInOutput(layer.get())) { |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 375 | return; |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 376 | } |
| 377 | |
| 378 | /* |
| 379 | * opaqueRegion: area of a surface that is fully opaque. |
| 380 | */ |
| 381 | Region opaqueRegion; |
| 382 | |
| 383 | /* |
| 384 | * visibleRegion: area of a surface that is visible on screen and not fully |
| 385 | * transparent. This is essentially the layer's footprint minus the opaque |
| 386 | * regions above it. Areas covered by a translucent surface are considered |
| 387 | * visible. |
| 388 | */ |
| 389 | Region visibleRegion; |
| 390 | |
| 391 | /* |
| 392 | * coveredRegion: area of a surface that is covered by all visible regions |
| 393 | * above it (which includes the translucent areas). |
| 394 | */ |
| 395 | Region coveredRegion; |
| 396 | |
| 397 | /* |
| 398 | * transparentRegion: area of a surface that is hinted to be completely |
| 399 | * transparent. This is only used to tell when the layer has no visible non- |
| 400 | * transparent regions and can be removed from the layer list. It does not |
| 401 | * affect the visibleRegion of this layer or any layers beneath it. The hint |
| 402 | * may not be correct if apps don't respect the SurfaceView restrictions |
| 403 | * (which, sadly, some don't). |
| 404 | */ |
| 405 | Region transparentRegion; |
| 406 | |
| 407 | // handle hidden surfaces by setting the visible region to empty |
| 408 | if (CC_UNLIKELY(!layerFEState.isVisible)) { |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 409 | return; |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | const ui::Transform& tr = layerFEState.geomLayerTransform; |
| 413 | |
| 414 | // Get the visible region |
| 415 | // TODO(b/121291683): Is it worth creating helper methods on LayerFEState |
| 416 | // for computations like this? |
| 417 | visibleRegion.set(Rect(tr.transform(layerFEState.geomLayerBounds))); |
| 418 | |
| 419 | if (visibleRegion.isEmpty()) { |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 420 | return; |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | // Remove the transparent area from the visible region |
| 424 | if (!layerFEState.isOpaque) { |
| 425 | if (tr.preserveRects()) { |
| 426 | // transform the transparent region |
| 427 | transparentRegion = tr.transform(layerFEState.transparentRegionHint); |
| 428 | } else { |
| 429 | // transformation too complex, can't do the |
| 430 | // transparent region optimization. |
| 431 | transparentRegion.clear(); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | // compute the opaque region |
| 436 | const int32_t layerOrientation = tr.getOrientation(); |
| 437 | if (layerFEState.isOpaque && ((layerOrientation & ui::Transform::ROT_INVALID) == 0)) { |
| 438 | // If we one of the simple category of transforms (0/90/180/270 rotation |
| 439 | // + any flip), then the opaque region is the layer's footprint. |
| 440 | // Otherwise we don't try and compute the opaque region since there may |
| 441 | // be errors at the edges, and we treat the entire layer as |
| 442 | // translucent. |
| 443 | opaqueRegion = visibleRegion; |
| 444 | } |
| 445 | |
| 446 | // Clip the covered region to the visible region |
| 447 | coveredRegion = coverage.aboveCoveredLayers.intersect(visibleRegion); |
| 448 | |
| 449 | // Update accumAboveCoveredLayers for next (lower) layer |
| 450 | coverage.aboveCoveredLayers.orSelf(visibleRegion); |
| 451 | |
| 452 | // subtract the opaque region covered by the layers above us |
| 453 | visibleRegion.subtractSelf(coverage.aboveOpaqueLayers); |
| 454 | |
| 455 | if (visibleRegion.isEmpty()) { |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 456 | return; |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 457 | } |
| 458 | |
| 459 | // Get coverage information for the layer as previously displayed, |
| 460 | // also taking over ownership from mOutputLayersorderedByZ. |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 461 | auto prevOutputLayerIndex = findCurrentOutputLayerForLayer(layer.get()); |
| 462 | auto prevOutputLayer = |
| 463 | prevOutputLayerIndex ? getOutputLayerOrderedByZByIndex(*prevOutputLayerIndex) : nullptr; |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 464 | |
| 465 | // Get coverage information for the layer as previously displayed |
| 466 | // TODO(b/121291683): Define kEmptyRegion as a constant in Region.h |
| 467 | const Region kEmptyRegion; |
| 468 | const Region& oldVisibleRegion = |
| 469 | prevOutputLayer ? prevOutputLayer->getState().visibleRegion : kEmptyRegion; |
| 470 | const Region& oldCoveredRegion = |
| 471 | prevOutputLayer ? prevOutputLayer->getState().coveredRegion : kEmptyRegion; |
| 472 | |
| 473 | // compute this layer's dirty region |
| 474 | Region dirty; |
| 475 | if (layerFEState.contentDirty) { |
| 476 | // we need to invalidate the whole region |
| 477 | dirty = visibleRegion; |
| 478 | // as well, as the old visible region |
| 479 | dirty.orSelf(oldVisibleRegion); |
| 480 | } else { |
| 481 | /* compute the exposed region: |
| 482 | * the exposed region consists of two components: |
| 483 | * 1) what's VISIBLE now and was COVERED before |
| 484 | * 2) what's EXPOSED now less what was EXPOSED before |
| 485 | * |
| 486 | * note that (1) is conservative, we start with the whole visible region |
| 487 | * but only keep what used to be covered by something -- which mean it |
| 488 | * may have been exposed. |
| 489 | * |
| 490 | * (2) handles areas that were not covered by anything but got exposed |
| 491 | * because of a resize. |
| 492 | * |
| 493 | */ |
| 494 | const Region newExposed = visibleRegion - coveredRegion; |
| 495 | const Region oldExposed = oldVisibleRegion - oldCoveredRegion; |
| 496 | dirty = (visibleRegion & oldCoveredRegion) | (newExposed - oldExposed); |
| 497 | } |
| 498 | dirty.subtractSelf(coverage.aboveOpaqueLayers); |
| 499 | |
| 500 | // accumulate to the screen dirty region |
| 501 | coverage.dirtyRegion.orSelf(dirty); |
| 502 | |
| 503 | // Update accumAboveOpaqueLayers for next (lower) layer |
| 504 | coverage.aboveOpaqueLayers.orSelf(opaqueRegion); |
| 505 | |
| 506 | // Compute the visible non-transparent region |
| 507 | Region visibleNonTransparentRegion = visibleRegion.subtract(transparentRegion); |
| 508 | |
| 509 | // Peform the final check to see if this layer is visible on this output |
| 510 | // TODO(b/121291683): Why does this not use visibleRegion? (see outputSpaceVisibleRegion below) |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 511 | const auto& outputState = getState(); |
| 512 | Region drawRegion(outputState.transform.transform(visibleNonTransparentRegion)); |
| 513 | drawRegion.andSelf(outputState.bounds); |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 514 | if (drawRegion.isEmpty()) { |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 515 | return; |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 516 | } |
| 517 | |
| 518 | // The layer is visible. Either reuse the existing outputLayer if we have |
| 519 | // one, or create a new one if we do not. |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 520 | auto result = ensureOutputLayer(prevOutputLayerIndex, layer, layerFE); |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 521 | |
| 522 | // Store the layer coverage information into the layer state as some of it |
| 523 | // is useful later. |
| 524 | auto& outputLayerState = result->editState(); |
| 525 | outputLayerState.visibleRegion = visibleRegion; |
| 526 | outputLayerState.visibleNonTransparentRegion = visibleNonTransparentRegion; |
| 527 | outputLayerState.coveredRegion = coveredRegion; |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 528 | outputLayerState.outputSpaceVisibleRegion = outputState.transform.transform( |
| 529 | outputLayerState.visibleRegion.intersect(outputState.viewport)); |
Lloyd Pique | c29e4c6 | 2019-03-07 21:48:19 -0800 | [diff] [blame] | 530 | } |
| 531 | |
| 532 | void Output::setReleasedLayers(const compositionengine::CompositionRefreshArgs&) { |
| 533 | // The base class does nothing with this call. |
| 534 | } |
| 535 | |
Lloyd Pique | 3eb1b21 | 2019-03-07 21:15:40 -0800 | [diff] [blame] | 536 | void Output::updateLayerStateFromFE(const CompositionRefreshArgs& args) const { |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 537 | for (auto* layer : getOutputLayersOrderedByZ()) { |
Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 538 | layer->getLayerFE().latchCompositionState(layer->getLayer().editFEState(), |
Lloyd Pique | c668734 | 2019-03-07 21:34:57 -0800 | [diff] [blame] | 539 | args.updatingGeometryThisFrame |
| 540 | ? LayerFE::StateSubset::GeometryAndContent |
| 541 | : LayerFE::StateSubset::Content); |
Lloyd Pique | 3eb1b21 | 2019-03-07 21:15:40 -0800 | [diff] [blame] | 542 | } |
| 543 | } |
| 544 | |
| 545 | void Output::updateAndWriteCompositionState( |
| 546 | const compositionengine::CompositionRefreshArgs& refreshArgs) { |
| 547 | ATRACE_CALL(); |
| 548 | ALOGV(__FUNCTION__); |
| 549 | |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 550 | for (auto* layer : getOutputLayersOrderedByZ()) { |
Lloyd Pique | 3eb1b21 | 2019-03-07 21:15:40 -0800 | [diff] [blame] | 551 | if (refreshArgs.devOptForceClientComposition) { |
| 552 | layer->editState().forceClientComposition = true; |
| 553 | } |
| 554 | |
| 555 | layer->updateCompositionState(refreshArgs.updatingGeometryThisFrame); |
| 556 | |
| 557 | // Send the updated state to the HWC, if appropriate. |
| 558 | layer->writeStateToHWC(refreshArgs.updatingGeometryThisFrame); |
| 559 | } |
| 560 | } |
| 561 | |
Lloyd Pique | 6a3b446 | 2019-03-07 20:58:12 -0800 | [diff] [blame] | 562 | void Output::updateColorProfile(const compositionengine::CompositionRefreshArgs& refreshArgs) { |
| 563 | setColorProfile(pickColorProfile(refreshArgs)); |
| 564 | } |
| 565 | |
| 566 | // Returns a data space that fits all visible layers. The returned data space |
| 567 | // can only be one of |
| 568 | // - Dataspace::SRGB (use legacy dataspace and let HWC saturate when colors are enhanced) |
| 569 | // - Dataspace::DISPLAY_P3 |
| 570 | // - Dataspace::DISPLAY_BT2020 |
| 571 | // The returned HDR data space is one of |
| 572 | // - Dataspace::UNKNOWN |
| 573 | // - Dataspace::BT2020_HLG |
| 574 | // - Dataspace::BT2020_PQ |
| 575 | ui::Dataspace Output::getBestDataspace(ui::Dataspace* outHdrDataSpace, |
| 576 | bool* outIsHdrClientComposition) const { |
| 577 | ui::Dataspace bestDataSpace = ui::Dataspace::V0_SRGB; |
| 578 | *outHdrDataSpace = ui::Dataspace::UNKNOWN; |
| 579 | |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 580 | for (const auto* layer : getOutputLayersOrderedByZ()) { |
Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 581 | switch (layer->getLayer().getFEState().dataspace) { |
Lloyd Pique | 6a3b446 | 2019-03-07 20:58:12 -0800 | [diff] [blame] | 582 | case ui::Dataspace::V0_SCRGB: |
| 583 | case ui::Dataspace::V0_SCRGB_LINEAR: |
| 584 | case ui::Dataspace::BT2020: |
| 585 | case ui::Dataspace::BT2020_ITU: |
| 586 | case ui::Dataspace::BT2020_LINEAR: |
| 587 | case ui::Dataspace::DISPLAY_BT2020: |
| 588 | bestDataSpace = ui::Dataspace::DISPLAY_BT2020; |
| 589 | break; |
| 590 | case ui::Dataspace::DISPLAY_P3: |
| 591 | bestDataSpace = ui::Dataspace::DISPLAY_P3; |
| 592 | break; |
| 593 | case ui::Dataspace::BT2020_PQ: |
| 594 | case ui::Dataspace::BT2020_ITU_PQ: |
| 595 | bestDataSpace = ui::Dataspace::DISPLAY_P3; |
| 596 | *outHdrDataSpace = ui::Dataspace::BT2020_PQ; |
Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 597 | *outIsHdrClientComposition = layer->getLayer().getFEState().forceClientComposition; |
Lloyd Pique | 6a3b446 | 2019-03-07 20:58:12 -0800 | [diff] [blame] | 598 | break; |
| 599 | case ui::Dataspace::BT2020_HLG: |
| 600 | case ui::Dataspace::BT2020_ITU_HLG: |
| 601 | bestDataSpace = ui::Dataspace::DISPLAY_P3; |
| 602 | // When there's mixed PQ content and HLG content, we set the HDR |
| 603 | // data space to be BT2020_PQ and convert HLG to PQ. |
| 604 | if (*outHdrDataSpace == ui::Dataspace::UNKNOWN) { |
| 605 | *outHdrDataSpace = ui::Dataspace::BT2020_HLG; |
| 606 | } |
| 607 | break; |
| 608 | default: |
| 609 | break; |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | return bestDataSpace; |
| 614 | } |
| 615 | |
| 616 | compositionengine::Output::ColorProfile Output::pickColorProfile( |
| 617 | const compositionengine::CompositionRefreshArgs& refreshArgs) const { |
| 618 | if (refreshArgs.outputColorSetting == OutputColorSetting::kUnmanaged) { |
| 619 | return ColorProfile{ui::ColorMode::NATIVE, ui::Dataspace::UNKNOWN, |
| 620 | ui::RenderIntent::COLORIMETRIC, |
| 621 | refreshArgs.colorSpaceAgnosticDataspace}; |
| 622 | } |
| 623 | |
| 624 | ui::Dataspace hdrDataSpace; |
| 625 | bool isHdrClientComposition = false; |
| 626 | ui::Dataspace bestDataSpace = getBestDataspace(&hdrDataSpace, &isHdrClientComposition); |
| 627 | |
| 628 | switch (refreshArgs.forceOutputColorMode) { |
| 629 | case ui::ColorMode::SRGB: |
| 630 | bestDataSpace = ui::Dataspace::V0_SRGB; |
| 631 | break; |
| 632 | case ui::ColorMode::DISPLAY_P3: |
| 633 | bestDataSpace = ui::Dataspace::DISPLAY_P3; |
| 634 | break; |
| 635 | default: |
| 636 | break; |
| 637 | } |
| 638 | |
| 639 | // respect hdrDataSpace only when there is no legacy HDR support |
| 640 | const bool isHdr = hdrDataSpace != ui::Dataspace::UNKNOWN && |
| 641 | !mDisplayColorProfile->hasLegacyHdrSupport(hdrDataSpace) && !isHdrClientComposition; |
| 642 | if (isHdr) { |
| 643 | bestDataSpace = hdrDataSpace; |
| 644 | } |
| 645 | |
| 646 | ui::RenderIntent intent; |
| 647 | switch (refreshArgs.outputColorSetting) { |
| 648 | case OutputColorSetting::kManaged: |
| 649 | case OutputColorSetting::kUnmanaged: |
| 650 | intent = isHdr ? ui::RenderIntent::TONE_MAP_COLORIMETRIC |
| 651 | : ui::RenderIntent::COLORIMETRIC; |
| 652 | break; |
| 653 | case OutputColorSetting::kEnhanced: |
| 654 | intent = isHdr ? ui::RenderIntent::TONE_MAP_ENHANCE : ui::RenderIntent::ENHANCE; |
| 655 | break; |
| 656 | default: // vendor display color setting |
| 657 | intent = static_cast<ui::RenderIntent>(refreshArgs.outputColorSetting); |
| 658 | break; |
| 659 | } |
| 660 | |
| 661 | ui::ColorMode outMode; |
| 662 | ui::Dataspace outDataSpace; |
| 663 | ui::RenderIntent outRenderIntent; |
| 664 | mDisplayColorProfile->getBestColorMode(bestDataSpace, intent, &outDataSpace, &outMode, |
| 665 | &outRenderIntent); |
| 666 | |
| 667 | return ColorProfile{outMode, outDataSpace, outRenderIntent, |
| 668 | refreshArgs.colorSpaceAgnosticDataspace}; |
| 669 | } |
| 670 | |
Lloyd Pique | d0a92a0 | 2019-02-19 17:47:26 -0800 | [diff] [blame] | 671 | void Output::beginFrame() { |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 672 | auto& outputState = editState(); |
Lloyd Pique | d0a92a0 | 2019-02-19 17:47:26 -0800 | [diff] [blame] | 673 | const bool dirty = !getDirtyRegion(false).isEmpty(); |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 674 | const bool empty = getOutputLayerCount() == 0; |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 675 | const bool wasEmpty = !outputState.lastCompositionHadVisibleLayers; |
Lloyd Pique | d0a92a0 | 2019-02-19 17:47:26 -0800 | [diff] [blame] | 676 | |
| 677 | // If nothing has changed (!dirty), don't recompose. |
| 678 | // If something changed, but we don't currently have any visible layers, |
| 679 | // and didn't when we last did a composition, then skip it this time. |
| 680 | // The second rule does two things: |
| 681 | // - When all layers are removed from a display, we'll emit one black |
| 682 | // frame, then nothing more until we get new layers. |
| 683 | // - When a display is created with a private layer stack, we won't |
| 684 | // emit any black frames until a layer is added to the layer stack. |
| 685 | const bool mustRecompose = dirty && !(empty && wasEmpty); |
| 686 | |
| 687 | const char flagPrefix[] = {'-', '+'}; |
| 688 | static_cast<void>(flagPrefix); |
| 689 | ALOGV_IF("%s: %s composition for %s (%cdirty %cempty %cwasEmpty)", __FUNCTION__, |
| 690 | mustRecompose ? "doing" : "skipping", getName().c_str(), flagPrefix[dirty], |
| 691 | flagPrefix[empty], flagPrefix[wasEmpty]); |
| 692 | |
| 693 | mRenderSurface->beginFrame(mustRecompose); |
| 694 | |
| 695 | if (mustRecompose) { |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 696 | outputState.lastCompositionHadVisibleLayers = !empty; |
Lloyd Pique | d0a92a0 | 2019-02-19 17:47:26 -0800 | [diff] [blame] | 697 | } |
| 698 | } |
| 699 | |
Lloyd Pique | 66d6860 | 2019-02-13 14:23:31 -0800 | [diff] [blame] | 700 | void Output::prepareFrame() { |
| 701 | ATRACE_CALL(); |
| 702 | ALOGV(__FUNCTION__); |
| 703 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 704 | const auto& outputState = getState(); |
| 705 | if (!outputState.isEnabled) { |
Lloyd Pique | 66d6860 | 2019-02-13 14:23:31 -0800 | [diff] [blame] | 706 | return; |
| 707 | } |
| 708 | |
| 709 | chooseCompositionStrategy(); |
| 710 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 711 | mRenderSurface->prepareFrame(outputState.usesClientComposition, |
| 712 | outputState.usesDeviceComposition); |
Lloyd Pique | 66d6860 | 2019-02-13 14:23:31 -0800 | [diff] [blame] | 713 | } |
| 714 | |
Lloyd Pique | f8cf14d | 2019-02-28 16:03:12 -0800 | [diff] [blame] | 715 | void Output::devOptRepaintFlash(const compositionengine::CompositionRefreshArgs& refreshArgs) { |
| 716 | if (CC_LIKELY(!refreshArgs.devOptFlashDirtyRegionsDelay)) { |
| 717 | return; |
| 718 | } |
| 719 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 720 | if (getState().isEnabled) { |
Lloyd Pique | f8cf14d | 2019-02-28 16:03:12 -0800 | [diff] [blame] | 721 | // transform the dirty region into this screen's coordinate space |
| 722 | const Region dirtyRegion = getDirtyRegion(refreshArgs.repaintEverything); |
| 723 | if (!dirtyRegion.isEmpty()) { |
| 724 | base::unique_fd readyFence; |
| 725 | // redraw the whole screen |
Lloyd Pique | d3d6988 | 2019-02-28 16:03:46 -0800 | [diff] [blame] | 726 | static_cast<void>(composeSurfaces(dirtyRegion)); |
Lloyd Pique | f8cf14d | 2019-02-28 16:03:12 -0800 | [diff] [blame] | 727 | |
| 728 | mRenderSurface->queueBuffer(std::move(readyFence)); |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | postFramebuffer(); |
| 733 | |
| 734 | std::this_thread::sleep_for(*refreshArgs.devOptFlashDirtyRegionsDelay); |
| 735 | |
| 736 | prepareFrame(); |
| 737 | } |
| 738 | |
Lloyd Pique | d3d6988 | 2019-02-28 16:03:46 -0800 | [diff] [blame] | 739 | void Output::finishFrame(const compositionengine::CompositionRefreshArgs&) { |
| 740 | ATRACE_CALL(); |
| 741 | ALOGV(__FUNCTION__); |
| 742 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 743 | if (!getState().isEnabled) { |
Lloyd Pique | d3d6988 | 2019-02-28 16:03:46 -0800 | [diff] [blame] | 744 | return; |
| 745 | } |
| 746 | |
| 747 | // Repaint the framebuffer (if needed), getting the optional fence for when |
| 748 | // the composition completes. |
| 749 | auto optReadyFence = composeSurfaces(Region::INVALID_REGION); |
| 750 | if (!optReadyFence) { |
| 751 | return; |
| 752 | } |
| 753 | |
| 754 | // swap buffers (presentation) |
| 755 | mRenderSurface->queueBuffer(std::move(*optReadyFence)); |
| 756 | } |
| 757 | |
| 758 | std::optional<base::unique_fd> Output::composeSurfaces(const Region& debugRegion) { |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 759 | ATRACE_CALL(); |
| 760 | ALOGV(__FUNCTION__); |
| 761 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 762 | const auto& outputState = getState(); |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 763 | const TracedOrdinal<bool> hasClientComposition = {"hasClientComposition", |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 764 | outputState.usesClientComposition}; |
Lloyd Pique | d3d6988 | 2019-02-28 16:03:46 -0800 | [diff] [blame] | 765 | base::unique_fd readyFence; |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 766 | if (!hasClientComposition) { |
Lloyd Pique | d3d6988 | 2019-02-28 16:03:46 -0800 | [diff] [blame] | 767 | return readyFence; |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 768 | } |
| 769 | |
| 770 | ALOGV("hasClientComposition"); |
| 771 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 772 | auto& renderEngine = getCompositionEngine().getRenderEngine(); |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 773 | const bool supportsProtectedContent = renderEngine.supportsProtectedContent(); |
| 774 | |
| 775 | renderengine::DisplaySettings clientCompositionDisplay; |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 776 | clientCompositionDisplay.physicalDisplay = outputState.scissor; |
| 777 | clientCompositionDisplay.clip = outputState.scissor; |
| 778 | clientCompositionDisplay.globalTransform = outputState.transform.asMatrix4(); |
| 779 | clientCompositionDisplay.orientation = outputState.orientation; |
| 780 | clientCompositionDisplay.outputDataspace = mDisplayColorProfile->hasWideColorGamut() |
| 781 | ? outputState.dataspace |
| 782 | : ui::Dataspace::UNKNOWN; |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 783 | clientCompositionDisplay.maxLuminance = |
| 784 | mDisplayColorProfile->getHdrCapabilities().getDesiredMaxLuminance(); |
| 785 | |
| 786 | // Compute the global color transform matrix. |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 787 | if (!outputState.usesDeviceComposition && !getSkipColorTransform()) { |
| 788 | clientCompositionDisplay.colorTransform = outputState.colorTransformMatrix; |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 789 | } |
| 790 | |
| 791 | // Note: Updated by generateClientCompositionRequests |
| 792 | clientCompositionDisplay.clearRegion = Region::INVALID_REGION; |
| 793 | |
| 794 | // Generate the client composition requests for the layers on this output. |
| 795 | std::vector<renderengine::LayerSettings> clientCompositionLayers = |
| 796 | generateClientCompositionRequests(supportsProtectedContent, |
| 797 | clientCompositionDisplay.clearRegion); |
| 798 | appendRegionFlashRequests(debugRegion, clientCompositionLayers); |
| 799 | |
| 800 | // If we the display is secure, protected content support is enabled, and at |
| 801 | // least one layer has protected content, we need to use a secure back |
| 802 | // buffer. |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 803 | if (outputState.isSecure && supportsProtectedContent) { |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 804 | auto layers = getOutputLayersOrderedByZ(); |
| 805 | bool needsProtected = std::any_of(layers.begin(), layers.end(), [](auto* layer) { |
| 806 | return layer->getLayer().getFEState().hasProtectedContent; |
| 807 | }); |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 808 | if (needsProtected != renderEngine.isProtected()) { |
| 809 | renderEngine.useProtectedContext(needsProtected); |
| 810 | } |
| 811 | if (needsProtected != mRenderSurface->isProtected() && |
| 812 | needsProtected == renderEngine.isProtected()) { |
| 813 | mRenderSurface->setProtected(needsProtected); |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | base::unique_fd fd; |
| 818 | sp<GraphicBuffer> buf = mRenderSurface->dequeueBuffer(&fd); |
| 819 | if (buf == nullptr) { |
| 820 | ALOGW("Dequeuing buffer for display [%s] failed, bailing out of " |
| 821 | "client composition for this frame", |
| 822 | mName.c_str()); |
Lloyd Pique | d3d6988 | 2019-02-28 16:03:46 -0800 | [diff] [blame] | 823 | return std::nullopt; |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 824 | } |
| 825 | |
| 826 | // We boost GPU frequency here because there will be color spaces conversion |
| 827 | // and it's expensive. We boost the GPU frequency so that GPU composition can |
| 828 | // finish in time. We must reset GPU frequency afterwards, because high frequency |
| 829 | // consumes extra battery. |
| 830 | const bool expensiveRenderingExpected = |
| 831 | clientCompositionDisplay.outputDataspace == ui::Dataspace::DISPLAY_P3; |
| 832 | if (expensiveRenderingExpected) { |
| 833 | setExpensiveRenderingExpected(true); |
| 834 | } |
| 835 | |
| 836 | renderEngine.drawLayers(clientCompositionDisplay, clientCompositionLayers, |
| 837 | buf->getNativeBuffer(), /*useFramebufferCache=*/true, std::move(fd), |
Lloyd Pique | d3d6988 | 2019-02-28 16:03:46 -0800 | [diff] [blame] | 838 | &readyFence); |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 839 | |
| 840 | if (expensiveRenderingExpected) { |
| 841 | setExpensiveRenderingExpected(false); |
| 842 | } |
| 843 | |
Lloyd Pique | d3d6988 | 2019-02-28 16:03:46 -0800 | [diff] [blame] | 844 | return readyFence; |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 845 | } |
| 846 | |
| 847 | std::vector<renderengine::LayerSettings> Output::generateClientCompositionRequests( |
| 848 | bool supportsProtectedContent, Region& clearRegion) { |
| 849 | std::vector<renderengine::LayerSettings> clientCompositionLayers; |
| 850 | ALOGV("Rendering client layers"); |
| 851 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 852 | const auto& outputState = getState(); |
| 853 | const Region viewportRegion(outputState.viewport); |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 854 | const bool useIdentityTransform = false; |
| 855 | bool firstLayer = true; |
| 856 | // Used when a layer clears part of the buffer. |
| 857 | Region dummyRegion; |
| 858 | |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 859 | for (auto* layer : getOutputLayersOrderedByZ()) { |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 860 | const auto& layerState = layer->getState(); |
Lloyd Pique | 9755fb7 | 2019-03-26 14:44:40 -0700 | [diff] [blame] | 861 | const auto& layerFEState = layer->getLayer().getFEState(); |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 862 | auto& layerFE = layer->getLayerFE(); |
| 863 | |
Lloyd Pique | a246866 | 2019-03-07 21:31:06 -0800 | [diff] [blame] | 864 | const Region clip(viewportRegion.intersect(layerState.visibleRegion)); |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 865 | ALOGV("Layer: %s", layerFE.getDebugName()); |
| 866 | if (clip.isEmpty()) { |
| 867 | ALOGV(" Skipping for empty clip"); |
| 868 | firstLayer = false; |
| 869 | continue; |
| 870 | } |
| 871 | |
| 872 | bool clientComposition = layer->requiresClientComposition(); |
| 873 | |
| 874 | // We clear the client target for non-client composed layers if |
| 875 | // requested by the HWC. We skip this if the layer is not an opaque |
| 876 | // rectangle, as by definition the layer must blend with whatever is |
| 877 | // underneath. We also skip the first layer as the buffer target is |
| 878 | // guaranteed to start out cleared. |
| 879 | bool clearClientComposition = |
| 880 | layerState.clearClientTarget && layerFEState.isOpaque && !firstLayer; |
| 881 | |
| 882 | ALOGV(" Composition type: client %d clear %d", clientComposition, clearClientComposition); |
| 883 | |
| 884 | if (clientComposition || clearClientComposition) { |
| 885 | compositionengine::LayerFE::ClientCompositionTargetSettings targetSettings{ |
| 886 | clip, |
| 887 | useIdentityTransform, |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 888 | layer->needsFiltering() || outputState.needsFiltering, |
| 889 | outputState.isSecure, |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 890 | supportsProtectedContent, |
| 891 | clientComposition ? clearRegion : dummyRegion, |
| 892 | }; |
| 893 | if (auto result = layerFE.prepareClientComposition(targetSettings)) { |
Lloyd Pique | c2d54d4 | 2019-08-28 18:04:21 -0700 | [diff] [blame] | 894 | if (!clientComposition) { |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 895 | auto& layerSettings = *result; |
| 896 | layerSettings.source.buffer.buffer = nullptr; |
| 897 | layerSettings.source.solidColor = half3(0.0, 0.0, 0.0); |
| 898 | layerSettings.alpha = half(0.0); |
| 899 | layerSettings.disableBlending = true; |
| 900 | } |
| 901 | |
| 902 | clientCompositionLayers.push_back(*result); |
| 903 | } |
| 904 | } |
| 905 | |
| 906 | firstLayer = false; |
| 907 | } |
| 908 | |
| 909 | return clientCompositionLayers; |
| 910 | } |
| 911 | |
| 912 | void Output::appendRegionFlashRequests( |
| 913 | const Region& flashRegion, |
| 914 | std::vector<renderengine::LayerSettings>& clientCompositionLayers) { |
| 915 | if (flashRegion.isEmpty()) { |
| 916 | return; |
| 917 | } |
| 918 | |
| 919 | renderengine::LayerSettings layerSettings; |
| 920 | layerSettings.source.buffer.buffer = nullptr; |
| 921 | layerSettings.source.solidColor = half3(1.0, 0.0, 1.0); |
| 922 | layerSettings.alpha = half(1.0); |
| 923 | |
| 924 | for (const auto& rect : flashRegion) { |
| 925 | layerSettings.geometry.boundaries = rect.toFloatRect(); |
| 926 | clientCompositionLayers.push_back(layerSettings); |
| 927 | } |
| 928 | } |
| 929 | |
| 930 | void Output::setExpensiveRenderingExpected(bool) { |
| 931 | // The base class does nothing with this call. |
| 932 | } |
| 933 | |
Lloyd Pique | 35fca9d | 2019-02-13 14:24:11 -0800 | [diff] [blame] | 934 | void Output::postFramebuffer() { |
| 935 | ATRACE_CALL(); |
| 936 | ALOGV(__FUNCTION__); |
| 937 | |
| 938 | if (!getState().isEnabled) { |
| 939 | return; |
| 940 | } |
| 941 | |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 942 | auto& outputState = editState(); |
| 943 | outputState.dirtyRegion.clear(); |
Lloyd Pique | d3d6988 | 2019-02-28 16:03:46 -0800 | [diff] [blame] | 944 | mRenderSurface->flip(); |
| 945 | |
Lloyd Pique | 35fca9d | 2019-02-13 14:24:11 -0800 | [diff] [blame] | 946 | auto frame = presentAndGetFrameFences(); |
| 947 | |
Lloyd Pique | 7d90ba5 | 2019-08-08 11:57:53 -0700 | [diff] [blame] | 948 | mRenderSurface->onPresentDisplayCompleted(); |
| 949 | |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 950 | for (auto* layer : getOutputLayersOrderedByZ()) { |
Lloyd Pique | 35fca9d | 2019-02-13 14:24:11 -0800 | [diff] [blame] | 951 | // The layer buffer from the previous frame (if any) is released |
| 952 | // by HWC only when the release fence from this frame (if any) is |
| 953 | // signaled. Always get the release fence from HWC first. |
| 954 | sp<Fence> releaseFence = Fence::NO_FENCE; |
| 955 | |
| 956 | if (auto hwcLayer = layer->getHwcLayer()) { |
| 957 | if (auto f = frame.layerFences.find(hwcLayer); f != frame.layerFences.end()) { |
| 958 | releaseFence = f->second; |
| 959 | } |
| 960 | } |
| 961 | |
| 962 | // If the layer was client composited in the previous frame, we |
| 963 | // need to merge with the previous client target acquire fence. |
| 964 | // Since we do not track that, always merge with the current |
| 965 | // client target acquire fence when it is available, even though |
| 966 | // this is suboptimal. |
| 967 | // TODO(b/121291683): Track previous frame client target acquire fence. |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 968 | if (outputState.usesClientComposition) { |
Lloyd Pique | 35fca9d | 2019-02-13 14:24:11 -0800 | [diff] [blame] | 969 | releaseFence = |
| 970 | Fence::merge("LayerRelease", releaseFence, frame.clientTargetAcquireFence); |
| 971 | } |
| 972 | |
| 973 | layer->getLayerFE().onLayerDisplayed(releaseFence); |
| 974 | } |
| 975 | |
| 976 | // We've got a list of layers needing fences, that are disjoint with |
Lloyd Pique | 01c77c1 | 2019-04-17 12:48:32 -0700 | [diff] [blame^] | 977 | // OutputLayersOrderedByZ. The best we can do is to |
Lloyd Pique | 35fca9d | 2019-02-13 14:24:11 -0800 | [diff] [blame] | 978 | // supply them with the present fence. |
| 979 | for (auto& weakLayer : mReleasedLayers) { |
| 980 | if (auto layer = weakLayer.promote(); layer != nullptr) { |
| 981 | layer->onLayerDisplayed(frame.presentFence); |
| 982 | } |
| 983 | } |
| 984 | |
| 985 | // Clear out the released layers now that we're done with them. |
| 986 | mReleasedLayers.clear(); |
| 987 | } |
| 988 | |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 989 | void Output::dirtyEntireOutput() { |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 990 | auto& outputState = editState(); |
| 991 | outputState.dirtyRegion.set(outputState.bounds); |
Lloyd Pique | 32cbe28 | 2018-10-19 13:09:22 -0700 | [diff] [blame] | 992 | } |
| 993 | |
Lloyd Pique | 66d6860 | 2019-02-13 14:23:31 -0800 | [diff] [blame] | 994 | void Output::chooseCompositionStrategy() { |
| 995 | // The base output implementation can only do client composition |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 996 | auto& outputState = editState(); |
| 997 | outputState.usesClientComposition = true; |
| 998 | outputState.usesDeviceComposition = false; |
Lloyd Pique | 66d6860 | 2019-02-13 14:23:31 -0800 | [diff] [blame] | 999 | } |
| 1000 | |
Lloyd Pique | 688abd4 | 2019-02-15 15:42:24 -0800 | [diff] [blame] | 1001 | bool Output::getSkipColorTransform() const { |
| 1002 | return true; |
| 1003 | } |
| 1004 | |
Lloyd Pique | 35fca9d | 2019-02-13 14:24:11 -0800 | [diff] [blame] | 1005 | compositionengine::Output::FrameFences Output::presentAndGetFrameFences() { |
| 1006 | compositionengine::Output::FrameFences result; |
Lloyd Pique | a38ea7e | 2019-04-16 18:10:26 -0700 | [diff] [blame] | 1007 | if (getState().usesClientComposition) { |
Lloyd Pique | 35fca9d | 2019-02-13 14:24:11 -0800 | [diff] [blame] | 1008 | result.clientTargetAcquireFence = mRenderSurface->getClientTargetAcquireFence(); |
| 1009 | } |
| 1010 | return result; |
| 1011 | } |
| 1012 | |
Lloyd Pique | feb73d7 | 2018-12-04 17:23:44 -0800 | [diff] [blame] | 1013 | } // namespace impl |
| 1014 | } // namespace android::compositionengine |