blob: 99469d1e36281948b77e6056fa487986f915456d [file] [log] [blame]
Stan Iliev500a0c32016-10-26 10:30:09 -04001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "SkiaPipeline.h"
18
Kevin Lubick6817fc42023-05-12 19:27:20 +000019#include <include/android/SkSurfaceAndroid.h>
20#include <include/gpu/ganesh/SkSurfaceGanesh.h>
Kevin Lubick14d969d2023-09-07 14:28:59 +000021#include <include/encode/SkPngEncoder.h>
Kevin Lubick1175dc02022-02-28 12:41:27 -050022#include <SkCanvas.h>
23#include <SkColor.h>
24#include <SkColorSpace.h>
25#include <SkData.h>
26#include <SkImage.h>
Kevin Lubick93671082023-03-13 18:30:55 +000027#include <SkImageAndroid.h>
Peiyong Lin3bff1352018-12-11 07:56:07 -080028#include <SkImageInfo.h>
Kevin Lubick1175dc02022-02-28 12:41:27 -050029#include <SkMatrix.h>
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -040030#include <SkMultiPictureDocument.h>
Matt Sarettf58cc922016-11-14 18:33:38 -050031#include <SkOverdrawCanvas.h>
32#include <SkOverdrawColorFilter.h>
Stan Iliev500a0c32016-10-26 10:30:09 -040033#include <SkPicture.h>
34#include <SkPictureRecorder.h>
Kevin Lubick1175dc02022-02-28 12:41:27 -050035#include <SkRect.h>
36#include <SkRefCnt.h>
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -040037#include <SkSerialProcs.h>
Kevin Lubick1175dc02022-02-28 12:41:27 -050038#include <SkStream.h>
39#include <SkString.h>
Alec Mouri43fe6fc2019-12-23 07:46:19 -080040#include <SkTypeface.h>
41#include <android-base/properties.h>
John Reck29b1ee02023-04-04 17:44:23 -040042#include <gui/TraceUtils.h>
Alec Mouri43fe6fc2019-12-23 07:46:19 -080043#include <unistd.h>
44
45#include <sstream>
46
Fedor Kudasov90df0562019-06-19 11:41:34 +010047#include "LightingInfo.h"
Stan Iliev23c38a92017-03-23 00:12:50 -040048#include "VectorDrawable.h"
John Reck29b1ee02023-04-04 17:44:23 -040049#include "include/gpu/GpuTypes.h" // from Skia
John Reck322b8ab2019-03-14 13:15:28 -070050#include "thread/CommonPool.h"
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -040051#include "tools/SkSharingProc.h"
John Reckb36bfdd2020-07-23 13:47:49 -070052#include "utils/Color.h"
Nathaniel Nifong2945bff2019-11-25 09:34:21 -050053#include "utils/String8.h"
Jerome Gaillarda02a12d2019-05-28 18:07:56 +010054
Stan Iliev500a0c32016-10-26 10:30:09 -040055using namespace android::uirenderer::renderthread;
56
57namespace android {
58namespace uirenderer {
59namespace skiapipeline {
60
John Reck1bcacfd2017-11-03 10:12:19 -070061SkiaPipeline::SkiaPipeline(RenderThread& thread) : mRenderThread(thread) {
Derek Sollenberger1863d942020-02-05 15:41:51 -050062 setSurfaceColorProperties(mColorMode);
Stan Iliev23c38a92017-03-23 00:12:50 -040063}
Stan Iliev500a0c32016-10-26 10:30:09 -040064
Stan Iliev232f3622017-08-23 17:15:09 -040065SkiaPipeline::~SkiaPipeline() {
66 unpinImages();
67}
68
Stan Iliev500a0c32016-10-26 10:30:09 -040069void SkiaPipeline::onDestroyHardwareResources() {
Derek Sollenberger92a9eb92018-04-12 13:42:19 -040070 unpinImages();
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -040071 mRenderThread.cacheManager().trimStaleResources();
Stan Iliev500a0c32016-10-26 10:30:09 -040072}
73
Derek Sollenbergerb7d34b62016-11-04 10:46:18 -040074bool SkiaPipeline::pinImages(std::vector<SkImage*>& mutableImages) {
Greg Danielf8cb5252021-06-30 10:40:34 -040075 if (!mRenderThread.getGrContext()) {
76 ALOGD("Trying to pin an image with an invalid GrContext");
77 return false;
78 }
Derek Sollenbergerb7d34b62016-11-04 10:46:18 -040079 for (SkImage* image : mutableImages) {
Kevin Lubick93671082023-03-13 18:30:55 +000080 if (skgpu::ganesh::PinAsTexture(mRenderThread.getGrContext(), image)) {
Derek Sollenberger189e8742016-11-16 16:00:17 -050081 mPinnedImages.emplace_back(sk_ref_sp(image));
82 } else {
83 return false;
84 }
Derek Sollenbergerb7d34b62016-11-04 10:46:18 -040085 }
86 return true;
87}
88
89void SkiaPipeline::unpinImages() {
90 for (auto& image : mPinnedImages) {
Kevin Lubick93671082023-03-13 18:30:55 +000091 skgpu::ganesh::UnpinTexture(mRenderThread.getGrContext(), image.get());
Derek Sollenbergerb7d34b62016-11-04 10:46:18 -040092 }
93 mPinnedImages.clear();
94}
95
John Reckd9d7f122018-05-03 14:40:56 -070096void SkiaPipeline::renderLayers(const LightGeometry& lightGeometry,
John Reck1bcacfd2017-11-03 10:12:19 -070097 LayerUpdateQueue* layerUpdateQueue, bool opaque,
Peiyong Lin1f6aa122018-09-10 16:28:08 -070098 const LightInfo& lightInfo) {
Fedor Kudasov90df0562019-06-19 11:41:34 +010099 LightingInfo::updateLighting(lightGeometry, lightInfo);
Stan Iliev500a0c32016-10-26 10:30:09 -0400100 ATRACE_NAME("draw layers");
Peiyong Lin1f6aa122018-09-10 16:28:08 -0700101 renderLayersImpl(*layerUpdateQueue, opaque);
Stan Iliev500a0c32016-10-26 10:30:09 -0400102 layerUpdateQueue->clear();
103}
104
Peiyong Lin1f6aa122018-09-10 16:28:08 -0700105void SkiaPipeline::renderLayersImpl(const LayerUpdateQueue& layers, bool opaque) {
Adlai Hollerab762152020-09-16 10:37:19 -0400106 sk_sp<GrDirectContext> cachedContext;
Derek Sollenbergerf7df1842017-09-05 11:15:58 -0400107
Stan Iliev500a0c32016-10-26 10:30:09 -0400108 // Render all layers that need to be updated, in order.
109 for (size_t i = 0; i < layers.entries().size(); i++) {
John Reckfc29f7acd2017-03-02 13:23:16 -0800110 RenderNode* layerNode = layers.entries()[i].renderNode.get();
Stan Iliev500a0c32016-10-26 10:30:09 -0400111 // only schedule repaint if node still on layer - possible it may have been
112 // removed during a dropped frame, but layers may still remain scheduled so
113 // as not to lose info on what portion is damaged
Nathaniel Nifong2945bff2019-11-25 09:34:21 -0500114 if (CC_UNLIKELY(layerNode->getLayerSurface() == nullptr)) {
115 continue;
116 }
117 SkASSERT(layerNode->getLayerSurface());
John Reckbe671952021-01-13 22:39:32 -0500118 SkiaDisplayList* displayList = layerNode->getDisplayList().asSkiaDl();
Nathaniel Nifong2945bff2019-11-25 09:34:21 -0500119 if (!displayList || displayList->isEmpty()) {
120 ALOGE("%p drawLayers(%s) : missing drawable", layerNode, layerNode->getName());
121 return;
122 }
123
124 const Rect& layerDamage = layers.entries()[i].damage;
125
126 SkCanvas* layerCanvas = layerNode->getLayerSurface()->getCanvas();
127
128 int saveCount = layerCanvas->save();
129 SkASSERT(saveCount == 1);
130
131 layerCanvas->androidFramework_setDeviceClipRestriction(layerDamage.toSkIRect());
132
133 // TODO: put localized light center calculation and storage to a drawable related code.
134 // It does not seem right to store something localized in a global state
135 // fix here and in recordLayers
136 const Vector3 savedLightCenter(LightingInfo::getLightCenterRaw());
137 Vector3 transformedLightCenter(savedLightCenter);
138 // map current light center into RenderNode's coordinate space
139 layerNode->getSkiaLayer()->inverseTransformInWindow.mapPoint3d(transformedLightCenter);
140 LightingInfo::setLightCenterRaw(transformedLightCenter);
141
142 const RenderProperties& properties = layerNode->properties();
143 const SkRect bounds = SkRect::MakeWH(properties.getWidth(), properties.getHeight());
144 if (properties.getClipToBounds() && layerCanvas->quickReject(bounds)) {
145 return;
146 }
147
148 ATRACE_FORMAT("drawLayer [%s] %.1f x %.1f", layerNode->getName(), bounds.width(),
149 bounds.height());
150
151 layerNode->getSkiaLayer()->hasRenderedSinceRepaint = false;
152 layerCanvas->clear(SK_ColorTRANSPARENT);
153
154 RenderNodeDrawable root(layerNode, layerCanvas, false);
155 root.forceDraw(layerCanvas);
156 layerCanvas->restoreToCount(saveCount);
157
158 LightingInfo::setLightCenterRaw(savedLightCenter);
159
160 // cache the current context so that we can defer flushing it until
161 // either all the layers have been rendered or the context changes
Adlai Hollerab762152020-09-16 10:37:19 -0400162 GrDirectContext* currentContext =
163 GrAsDirectContext(layerNode->getLayerSurface()->getCanvas()->recordingContext());
Nathaniel Nifong2945bff2019-11-25 09:34:21 -0500164 if (cachedContext.get() != currentContext) {
165 if (cachedContext.get()) {
166 ATRACE_NAME("flush layers (context changed)");
Greg Danielc7ad4082020-05-14 15:38:26 -0400167 cachedContext->flushAndSubmit();
Stan Iliev500a0c32016-10-26 10:30:09 -0400168 }
Nathaniel Nifong2945bff2019-11-25 09:34:21 -0500169 cachedContext.reset(SkSafeRef(currentContext));
Stan Iliev500a0c32016-10-26 10:30:09 -0400170 }
171 }
Derek Sollenbergerf7df1842017-09-05 11:15:58 -0400172
173 if (cachedContext.get()) {
Derek Sollenbergerbe3876c2018-04-20 16:13:31 -0400174 ATRACE_NAME("flush layers");
Greg Danielc7ad4082020-05-14 15:38:26 -0400175 cachedContext->flushAndSubmit();
Derek Sollenbergerf7df1842017-09-05 11:15:58 -0400176 }
Stan Iliev500a0c32016-10-26 10:30:09 -0400177}
178
John Reck1bcacfd2017-11-03 10:12:19 -0700179bool SkiaPipeline::createOrUpdateLayer(RenderNode* node, const DamageAccumulator& damageAccumulator,
Peiyong Lin1f6aa122018-09-10 16:28:08 -0700180 ErrorHandler* errorHandler) {
Derek Sollenberger03e6cff72017-12-04 15:07:08 -0500181 // compute the size of the surface (i.e. texture) to be allocated for this layer
182 const int surfaceWidth = ceilf(node->getWidth() / float(LAYER_SIZE)) * LAYER_SIZE;
183 const int surfaceHeight = ceilf(node->getHeight() / float(LAYER_SIZE)) * LAYER_SIZE;
184
Stan Iliev500a0c32016-10-26 10:30:09 -0400185 SkSurface* layer = node->getLayerSurface();
Derek Sollenberger03e6cff72017-12-04 15:07:08 -0500186 if (!layer || layer->width() != surfaceWidth || layer->height() != surfaceHeight) {
Stan Iliev08fc19a2017-07-24 10:20:33 -0400187 SkImageInfo info;
Peiyong Lin1f6aa122018-09-10 16:28:08 -0700188 info = SkImageInfo::Make(surfaceWidth, surfaceHeight, getSurfaceColorType(),
Derek Sollenbergerd01b5912018-10-19 15:55:33 -0400189 kPremul_SkAlphaType, getSurfaceColorSpace());
Stan Iliev500a0c32016-10-26 10:30:09 -0400190 SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
191 SkASSERT(mRenderThread.getGrContext() != nullptr);
Kevin Lubick6817fc42023-05-12 19:27:20 +0000192 node->setLayerSurface(SkSurfaces::RenderTarget(mRenderThread.getGrContext(),
193 skgpu::Budgeted::kYes, info, 0,
194 this->getSurfaceOrigin(), &props));
Stan Iliev500a0c32016-10-26 10:30:09 -0400195 if (node->getLayerSurface()) {
196 // update the transform in window of the layer to reset its origin wrt light source
197 // position
198 Matrix4 windowTransform;
199 damageAccumulator.computeCurrentTransform(&windowTransform);
Stan Ilievda7c19c2019-05-22 14:43:44 -0400200 node->getSkiaLayer()->inverseTransformInWindow.loadInverse(windowTransform);
Stan Iliev216b1572018-03-26 14:29:50 -0400201 } else {
202 String8 cachesOutput;
203 mRenderThread.cacheManager().dumpMemoryUsage(cachesOutput,
John Reck283bb462018-12-13 16:40:14 -0800204 &mRenderThread.renderState());
Tomasz Wasilczyk3f9f8632023-08-10 23:54:44 +0000205 ALOGE("%s", cachesOutput.c_str());
Stan Iliev216b1572018-03-26 14:29:50 -0400206 if (errorHandler) {
207 std::ostringstream err;
208 err << "Unable to create layer for " << node->getName();
209 const int maxTextureSize = DeviceInfo::get()->maxTextureSize();
210 err << ", size " << info.width() << "x" << info.height() << " max size "
John Reck283bb462018-12-13 16:40:14 -0800211 << maxTextureSize << " color type " << (int)info.colorType() << " has context "
212 << (int)(mRenderThread.getGrContext() != nullptr);
Stan Iliev216b1572018-03-26 14:29:50 -0400213 errorHandler->onError(err.str());
214 }
Stan Iliev500a0c32016-10-26 10:30:09 -0400215 }
216 return true;
217 }
218 return false;
219}
220
Stan Iliev500a0c32016-10-26 10:30:09 -0400221void SkiaPipeline::prepareToDraw(const RenderThread& thread, Bitmap* bitmap) {
Adlai Hollerab762152020-09-16 10:37:19 -0400222 GrDirectContext* context = thread.getGrContext();
John Reckcf1170f2021-07-14 15:52:19 -0400223 if (context && !bitmap->isHardware()) {
Stan Iliev500a0c32016-10-26 10:30:09 -0400224 ATRACE_FORMAT("Bitmap#prepareToDraw %dx%d", bitmap->width(), bitmap->height());
Derek Sollenbergerd01b5912018-10-19 15:55:33 -0400225 auto image = bitmap->makeImage();
John Reckcf1170f2021-07-14 15:52:19 -0400226 if (image.get()) {
Kevin Lubick93671082023-03-13 18:30:55 +0000227 skgpu::ganesh::PinAsTexture(context, image.get());
228 skgpu::ganesh::UnpinTexture(context, image.get());
John Reckcf1170f2021-07-14 15:52:19 -0400229 // A submit is necessary as there may not be a frame coming soon, so without a call
230 // to submit these texture uploads can just sit in the queue building up until
231 // we run out of RAM
232 context->flushAndSubmit();
Stan Iliev7bc3bc62017-05-24 13:28:36 -0400233 }
Stan Iliev500a0c32016-10-26 10:30:09 -0400234 }
235}
236
John Reck322b8ab2019-03-14 13:15:28 -0700237static void savePictureAsync(const sk_sp<SkData>& data, const std::string& filename) {
238 CommonPool::post([data, filename] {
239 if (0 == access(filename.c_str(), F_OK)) {
Stan Ilieve9d00122017-09-19 12:07:10 -0400240 return;
241 }
242
John Reck322b8ab2019-03-14 13:15:28 -0700243 SkFILEWStream stream(filename.c_str());
Stan Ilieve9d00122017-09-19 12:07:10 -0400244 if (stream.isValid()) {
John Reck322b8ab2019-03-14 13:15:28 -0700245 stream.write(data->data(), data->size());
Stan Ilieve9d00122017-09-19 12:07:10 -0400246 stream.flush();
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400247 ALOGD("SKP Captured Drawing Output (%zu bytes) for frame. %s", stream.bytesWritten(),
John Reck322b8ab2019-03-14 13:15:28 -0700248 filename.c_str());
Stan Ilieve9d00122017-09-19 12:07:10 -0400249 }
John Reck322b8ab2019-03-14 13:15:28 -0700250 });
251}
Stan Ilieve9d00122017-09-19 12:07:10 -0400252
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400253// Note multiple SkiaPipeline instances may be loaded if more than one app is visible.
254// Each instance may observe the filename changing and try to record to a file of the same name.
255// Only the first one will succeed. There is no scope available here where we could coordinate
256// to cause this function to return true for only one of the instances.
257bool SkiaPipeline::shouldStartNewFileCapture() {
258 // Don't start a new file based capture if one is currently ongoing.
259 if (mCaptureMode != CaptureMode::None) { return false; }
260
261 // A new capture is started when the filename property changes.
262 // Read the filename property.
263 std::string prop = base::GetProperty(PROPERTY_CAPTURE_SKP_FILENAME, "0");
264 // if the filename property changed to a valid value
265 if (prop[0] != '0' && mCapturedFile != prop) {
266 // remember this new filename
267 mCapturedFile = prop;
268 // and get a property indicating how many frames to capture.
269 mCaptureSequence = base::GetIntProperty(PROPERTY_CAPTURE_SKP_FRAMES, 1);
John Reck5cca8f22018-12-10 17:06:22 -0800270 if (mCaptureSequence <= 0) {
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400271 return false;
272 } else if (mCaptureSequence == 1) {
273 mCaptureMode = CaptureMode::SingleFrameSKP;
274 } else {
275 mCaptureMode = CaptureMode::MultiFrameSKP;
Stan Ilieve9d00122017-09-19 12:07:10 -0400276 }
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400277 return true;
278 }
279 return false;
280}
281
282// performs the first-frame work of a multi frame SKP capture. Returns true if successful.
283bool SkiaPipeline::setupMultiFrameCapture() {
284 ALOGD("Set up multi-frame capture, frames = %d", mCaptureSequence);
285 // We own this stream and need to hold it until close() finishes.
286 auto stream = std::make_unique<SkFILEWStream>(mCapturedFile.c_str());
287 if (stream->isValid()) {
288 mOpenMultiPicStream = std::move(stream);
289 mSerialContext.reset(new SkSharingSerialContext());
290 SkSerialProcs procs;
291 procs.fImageProc = SkSharingSerialContext::serializeImage;
292 procs.fImageCtx = mSerialContext.get();
Nathaniel Nifong429fff42020-01-30 14:38:21 -0500293 procs.fTypefaceProc = [](SkTypeface* tf, void* ctx){
294 return tf->serialize(SkTypeface::SerializeBehavior::kDoIncludeData);
295 };
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400296 // SkDocuments don't take owership of the streams they write.
297 // we need to keep it until after mMultiPic.close()
298 // procs is passed as a pointer, but just as a method of having an optional default.
299 // procs doesn't need to outlive this Make call.
Nathaniel Nifong7c216772021-01-22 13:23:25 -0500300 mMultiPic = SkMakeMultiPictureDocument(mOpenMultiPicStream.get(), &procs,
301 [sharingCtx = mSerialContext.get()](const SkPicture* pic) {
302 SkSharingSerialContext::collectNonTextureImagesFromPicture(pic, sharingCtx);
303 });
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400304 return true;
305 } else {
306 ALOGE("Could not open \"%s\" for writing.", mCapturedFile.c_str());
307 mCaptureSequence = 0;
308 mCaptureMode = CaptureMode::None;
309 return false;
310 }
311}
312
Nathaniel Nifong2945bff2019-11-25 09:34:21 -0500313// recurse through the rendernode's children, add any nodes which are layers to the queue.
314static void collectLayers(RenderNode* node, LayerUpdateQueue* layers) {
John Reckbe671952021-01-13 22:39:32 -0500315 SkiaDisplayList* dl = node->getDisplayList().asSkiaDl();
Nathaniel Nifong2945bff2019-11-25 09:34:21 -0500316 if (dl) {
317 const auto& prop = node->properties();
318 if (node->hasLayer()) {
319 layers->enqueueLayerWithDamage(node, Rect(prop.getWidth(), prop.getHeight()));
320 }
321 // The way to recurse through rendernodes is to call this with a lambda.
322 dl->updateChildren([&](RenderNode* child) { collectLayers(child, layers); });
323 }
324}
325
326// record the provided layers to the provided canvas as self-contained skpictures.
327static void recordLayers(const LayerUpdateQueue& layers,
328 SkCanvas* mskpCanvas) {
329 const Vector3 savedLightCenter(LightingInfo::getLightCenterRaw());
330 // Record the commands to re-draw each dirty layer into an SkPicture
331 for (size_t i = 0; i < layers.entries().size(); i++) {
332 RenderNode* layerNode = layers.entries()[i].renderNode.get();
333 const Rect& layerDamage = layers.entries()[i].damage;
334 const RenderProperties& properties = layerNode->properties();
335
336 // Temporarily map current light center into RenderNode's coordinate space
337 Vector3 transformedLightCenter(savedLightCenter);
338 layerNode->getSkiaLayer()->inverseTransformInWindow.mapPoint3d(transformedLightCenter);
339 LightingInfo::setLightCenterRaw(transformedLightCenter);
340
341 SkPictureRecorder layerRec;
342 auto* recCanvas = layerRec.beginRecording(properties.getWidth(),
343 properties.getHeight());
344 // This is not recorded but still causes clipping.
345 recCanvas->androidFramework_setDeviceClipRestriction(layerDamage.toSkIRect());
346 RenderNodeDrawable root(layerNode, recCanvas, false);
347 root.forceDraw(recCanvas);
348 // Now write this picture into the SKP canvas with an annotation indicating what it is
349 mskpCanvas->drawAnnotation(layerDamage.toSkRect(), String8::format(
350 "OffscreenLayerDraw|%" PRId64, layerNode->uniqueId()).c_str(), nullptr);
351 mskpCanvas->drawPicture(layerRec.finishRecordingAsPicture());
352 }
353 LightingInfo::setLightCenterRaw(savedLightCenter);
354}
355
356SkCanvas* SkiaPipeline::tryCapture(SkSurface* surface, RenderNode* root,
357 const LayerUpdateQueue& dirtyLayers) {
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400358 if (CC_LIKELY(!Properties::skpCaptureEnabled)) {
359 return surface->getCanvas(); // Bail out early when capture is not turned on.
360 }
361 // Note that shouldStartNewFileCapture tells us if this is the *first* frame of a capture.
Nathaniel Nifong2945bff2019-11-25 09:34:21 -0500362 bool firstFrameOfAnim = false;
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400363 if (shouldStartNewFileCapture() && mCaptureMode == CaptureMode::MultiFrameSKP) {
Nathaniel Nifong2945bff2019-11-25 09:34:21 -0500364 // set a reminder to record every layer near the end of this method, after we have set up
365 // the nway canvas.
366 firstFrameOfAnim = true;
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400367 if (!setupMultiFrameCapture()) {
368 return surface->getCanvas();
Stan Ilieve9d00122017-09-19 12:07:10 -0400369 }
370 }
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400371
372 // Create a canvas pointer, fill it depending on what kind of capture is requested (if any)
373 SkCanvas* pictureCanvas = nullptr;
374 switch (mCaptureMode) {
375 case CaptureMode::CallbackAPI:
376 case CaptureMode::SingleFrameSKP:
377 mRecorder.reset(new SkPictureRecorder());
Nathaniel Nifong31fee3a2019-07-11 16:27:14 -0400378 pictureCanvas = mRecorder->beginRecording(surface->width(), surface->height());
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400379 break;
380 case CaptureMode::MultiFrameSKP:
381 // If a multi frame recording is active, initialize recording for a single frame of a
382 // multi frame file.
383 pictureCanvas = mMultiPic->beginPage(surface->width(), surface->height());
384 break;
385 case CaptureMode::None:
386 // Returning here in the non-capture case means we can count on pictureCanvas being
387 // non-null below.
388 return surface->getCanvas();
389 }
390
391 // Setting up an nway canvas is common to any kind of capture.
392 mNwayCanvas = std::make_unique<SkNWayCanvas>(surface->width(), surface->height());
393 mNwayCanvas->addCanvas(surface->getCanvas());
394 mNwayCanvas->addCanvas(pictureCanvas);
Nathaniel Nifong2945bff2019-11-25 09:34:21 -0500395
396 if (firstFrameOfAnim) {
397 // On the first frame of any mskp capture we want to record any layers that are needed in
398 // frame but may have been rendered offscreen before recording began.
399 // We do not maintain a list of all layers, since it isn't needed outside this rare,
400 // recording use case. Traverse the tree to find them and put them in this LayerUpdateQueue.
401 LayerUpdateQueue luq;
402 collectLayers(root, &luq);
403 recordLayers(luq, mNwayCanvas.get());
404 } else {
405 // on non-first frames, we record any normal layer draws (dirty regions)
406 recordLayers(dirtyLayers, mNwayCanvas.get());
407 }
408
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400409 return mNwayCanvas.get();
Stan Ilieve9d00122017-09-19 12:07:10 -0400410}
411
412void SkiaPipeline::endCapture(SkSurface* surface) {
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400413 if (CC_LIKELY(mCaptureMode == CaptureMode::None)) { return; }
John Reck5cca8f22018-12-10 17:06:22 -0800414 mNwayCanvas.reset();
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400415 ATRACE_CALL();
416 if (mCaptureSequence > 0 && mCaptureMode == CaptureMode::MultiFrameSKP) {
417 mMultiPic->endPage();
418 mCaptureSequence--;
419 if (mCaptureSequence == 0) {
420 mCaptureMode = CaptureMode::None;
421 // Pass mMultiPic and mOpenMultiPicStream to a background thread, which will handle
422 // the heavyweight serialization work and destroy them. mOpenMultiPicStream is released
423 // to a bare pointer because keeping it in a smart pointer makes the lambda
424 // non-copyable. The lambda is only called once, so this is safe.
425 SkFILEWStream* stream = mOpenMultiPicStream.release();
426 CommonPool::post([doc = std::move(mMultiPic), stream]{
427 ALOGD("Finalizing multi frame SKP");
428 doc->close();
429 delete stream;
430 ALOGD("Multi frame SKP complete.");
431 });
432 }
433 } else {
Stan Ilieve9d00122017-09-19 12:07:10 -0400434 sk_sp<SkPicture> picture = mRecorder->finishRecordingAsPicture();
Stan Ilieve9d00122017-09-19 12:07:10 -0400435 if (picture->approximateOpCount() > 0) {
John Reck5cca8f22018-12-10 17:06:22 -0800436 if (mPictureCapturedCallback) {
437 std::invoke(mPictureCapturedCallback, std::move(picture));
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400438 } else {
439 // single frame skp to file
Nathaniel Nifong429fff42020-01-30 14:38:21 -0500440 SkSerialProcs procs;
441 procs.fTypefaceProc = [](SkTypeface* tf, void* ctx){
442 return tf->serialize(SkTypeface::SerializeBehavior::kDoIncludeData);
443 };
Kevin Lubick14d969d2023-09-07 14:28:59 +0000444 procs.fImageProc = [](SkImage* img, void* ctx) -> sk_sp<SkData> {
445 GrDirectContext* dCtx = static_cast<GrDirectContext*>(ctx);
446 return SkPngEncoder::Encode(dCtx,
447 img,
448 SkPngEncoder::Options{});
449 };
450 procs.fImageCtx = mRenderThread.getGrContext();
John Reck76005182021-06-09 22:43:05 -0400451 auto data = picture->serialize(&procs);
Nathaniel Nifongd2e49a22019-06-24 15:07:34 -0400452 savePictureAsync(data, mCapturedFile);
453 mCaptureSequence = 0;
Derek Sollenberger5f9753d2020-04-01 15:59:02 -0400454 mCaptureMode = CaptureMode::None;
Stan Ilieve9d00122017-09-19 12:07:10 -0400455 }
Stan Ilieve9d00122017-09-19 12:07:10 -0400456 }
457 mRecorder.reset();
458 }
459}
460
Stan Iliev500a0c32016-10-26 10:30:09 -0400461void SkiaPipeline::renderFrame(const LayerUpdateQueue& layers, const SkRect& clip,
John Reck1bcacfd2017-11-03 10:12:19 -0700462 const std::vector<sp<RenderNode>>& nodes, bool opaque,
Greg Danielc4076782019-01-08 16:01:18 -0500463 const Rect& contentDrawBounds, sk_sp<SkSurface> surface,
464 const SkMatrix& preTransform) {
John Reck5cca8f22018-12-10 17:06:22 -0800465 bool previousSkpEnabled = Properties::skpCaptureEnabled;
466 if (mPictureCapturedCallback) {
467 Properties::skpCaptureEnabled = true;
468 }
469
Nathaniel Nifong2945bff2019-11-25 09:34:21 -0500470 // Initialize the canvas for the current frame, that might be a recording canvas if SKP
471 // capture is enabled.
472 SkCanvas* canvas = tryCapture(surface.get(), nodes[0].get(), layers);
473
Stan Iliev500a0c32016-10-26 10:30:09 -0400474 // draw all layers up front
Peiyong Lin1f6aa122018-09-10 16:28:08 -0700475 renderLayersImpl(layers, opaque);
Stan Iliev500a0c32016-10-26 10:30:09 -0400476
Nathaniel Nifongdc19a652019-11-11 11:47:50 -0500477 renderFrameImpl(clip, nodes, opaque, contentDrawBounds, canvas, preTransform);
Matt Sarettf58cc922016-11-14 18:33:38 -0500478
Stan Ilieve9d00122017-09-19 12:07:10 -0400479 endCapture(surface.get());
Matt Sarettf58cc922016-11-14 18:33:38 -0500480
481 if (CC_UNLIKELY(Properties::debugOverdraw)) {
Nathaniel Nifongdc19a652019-11-11 11:47:50 -0500482 renderOverdraw(clip, nodes, contentDrawBounds, surface, preTransform);
Matt Sarettf58cc922016-11-14 18:33:38 -0500483 }
484
John Reck5cca8f22018-12-10 17:06:22 -0800485 Properties::skpCaptureEnabled = previousSkpEnabled;
Matt Sarettf58cc922016-11-14 18:33:38 -0500486}
487
Stan Iliev52771272016-11-17 09:54:38 -0500488namespace {
489static Rect nodeBounds(RenderNode& node) {
490 auto& props = node.properties();
John Reck1bcacfd2017-11-03 10:12:19 -0700491 return Rect(props.getLeft(), props.getTop(), props.getRight(), props.getBottom());
Stan Iliev52771272016-11-17 09:54:38 -0500492}
John Reck0fa0cbc2019-04-05 16:57:46 -0700493} // namespace
Stan Iliev52771272016-11-17 09:54:38 -0500494
Nathaniel Nifongdc19a652019-11-11 11:47:50 -0500495void SkiaPipeline::renderFrameImpl(const SkRect& clip,
John Reck1bcacfd2017-11-03 10:12:19 -0700496 const std::vector<sp<RenderNode>>& nodes, bool opaque,
Greg Danielc4076782019-01-08 16:01:18 -0500497 const Rect& contentDrawBounds, SkCanvas* canvas,
498 const SkMatrix& preTransform) {
Stan Ilievb66b8bb2016-12-15 18:17:42 -0500499 SkAutoCanvasRestore saver(canvas, true);
Nathaniel Nifongcff969f2020-01-09 14:03:49 -0500500 auto clipRestriction = preTransform.mapRect(clip).roundOut();
John Reck76005182021-06-09 22:43:05 -0400501 if (CC_UNLIKELY(isCapturingSkp())) {
Nathaniel Nifong89a5dc52020-01-17 15:32:17 -0500502 canvas->drawAnnotation(SkRect::Make(clipRestriction), "AndroidDeviceClipRestriction",
503 nullptr);
504 } else {
505 // clip drawing to dirty region only when not recording SKP files (which should contain all
506 // draw ops on every frame)
507 canvas->androidFramework_setDeviceClipRestriction(clipRestriction);
508 }
Greg Danielc4076782019-01-08 16:01:18 -0500509 canvas->concat(preTransform);
Stan Iliev500a0c32016-10-26 10:30:09 -0400510
Nader Jawadf5ce4522023-03-27 13:02:41 -0700511 if (!opaque) {
Stan Iliev500a0c32016-10-26 10:30:09 -0400512 canvas->clear(SK_ColorTRANSPARENT);
513 }
514
Stan Iliev52771272016-11-17 09:54:38 -0500515 if (1 == nodes.size()) {
516 if (!nodes[0]->nothingToDraw()) {
Stan Iliev52771272016-11-17 09:54:38 -0500517 RenderNodeDrawable root(nodes[0].get(), canvas);
518 root.draw(canvas);
519 }
520 } else if (0 == nodes.size()) {
John Reck1bcacfd2017-11-03 10:12:19 -0700521 // nothing to draw
Stan Iliev52771272016-11-17 09:54:38 -0500522 } else {
523 // It there are multiple render nodes, they are laid out as follows:
524 // #0 - backdrop (content + caption)
525 // #1 - content (local bounds are at (0,0), will be translated and clipped to backdrop)
526 // #2 - additional overlay nodes
John Reck1bcacfd2017-11-03 10:12:19 -0700527 // Usually the backdrop cannot be seen since it will be entirely covered by the content.
528 // While
529 // resizing however it might become partially visible. The following render loop will crop
530 // the
531 // backdrop against the content and draw the remaining part of it. It will then draw the
532 // content
Stan Iliev52771272016-11-17 09:54:38 -0500533 // cropped to the backdrop (since that indicates a shrinking of the window).
534 //
535 // Additional nodes will be drawn on top with no particular clipping semantics.
Stan Iliev500a0c32016-10-26 10:30:09 -0400536
Stan Iliev52771272016-11-17 09:54:38 -0500537 // Usually the contents bounds should be mContentDrawBounds - however - we will
538 // move it towards the fixed edge to give it a more stable appearance (for the moment).
539 // If there is no content bounds we ignore the layering as stated above and start with 2.
Stan Iliev500a0c32016-10-26 10:30:09 -0400540
Stan Iliev52771272016-11-17 09:54:38 -0500541 // Backdrop bounds in render target space
542 const Rect backdrop = nodeBounds(*nodes[0]);
Stan Iliev500a0c32016-10-26 10:30:09 -0400543
John Reck1bcacfd2017-11-03 10:12:19 -0700544 // Bounds that content will fill in render target space (note content node bounds may be
545 // bigger)
Stan Iliev52771272016-11-17 09:54:38 -0500546 Rect content(contentDrawBounds.getWidth(), contentDrawBounds.getHeight());
547 content.translate(backdrop.left, backdrop.top);
548 if (!content.contains(backdrop) && !nodes[0]->nothingToDraw()) {
549 // Content doesn't entirely overlap backdrop, so fill around content (right/bottom)
Stan Iliev500a0c32016-10-26 10:30:09 -0400550
Stan Iliev52771272016-11-17 09:54:38 -0500551 // Note: in the future, if content doesn't snap to backdrop's left/top, this may need to
John Reck1bcacfd2017-11-03 10:12:19 -0700552 // also fill left/top. Currently, both 2up and freeform position content at the top/left
553 // of
Stan Iliev52771272016-11-17 09:54:38 -0500554 // the backdrop, so this isn't necessary.
555 RenderNodeDrawable backdropNode(nodes[0].get(), canvas);
556 if (content.right < backdrop.right) {
557 // draw backdrop to right side of content
558 SkAutoCanvasRestore acr(canvas, true);
John Reck1bcacfd2017-11-03 10:12:19 -0700559 canvas->clipRect(SkRect::MakeLTRB(content.right, backdrop.top, backdrop.right,
560 backdrop.bottom));
Stan Iliev52771272016-11-17 09:54:38 -0500561 backdropNode.draw(canvas);
562 }
563 if (content.bottom < backdrop.bottom) {
564 // draw backdrop to bottom of content
565 // Note: bottom fill uses content left/right, to avoid overdrawing left/right fill
566 SkAutoCanvasRestore acr(canvas, true);
John Reck1bcacfd2017-11-03 10:12:19 -0700567 canvas->clipRect(SkRect::MakeLTRB(content.left, content.bottom, content.right,
568 backdrop.bottom));
Stan Iliev52771272016-11-17 09:54:38 -0500569 backdropNode.draw(canvas);
570 }
Stan Iliev500a0c32016-10-26 10:30:09 -0400571 }
572
Stan Iliev52771272016-11-17 09:54:38 -0500573 RenderNodeDrawable contentNode(nodes[1].get(), canvas);
574 if (!backdrop.isEmpty()) {
575 // content node translation to catch up with backdrop
576 float dx = backdrop.left - contentDrawBounds.left;
577 float dy = backdrop.top - contentDrawBounds.top;
578
579 SkAutoCanvasRestore acr(canvas, true);
580 canvas->translate(dx, dy);
John Reck1bcacfd2017-11-03 10:12:19 -0700581 const SkRect contentLocalClip =
582 SkRect::MakeXYWH(contentDrawBounds.left, contentDrawBounds.top,
583 backdrop.getWidth(), backdrop.getHeight());
Stan Iliev52771272016-11-17 09:54:38 -0500584 canvas->clipRect(contentLocalClip);
585 contentNode.draw(canvas);
586 } else {
587 SkAutoCanvasRestore acr(canvas, true);
588 contentNode.draw(canvas);
589 }
590
591 // remaining overlay nodes, simply defer
592 for (size_t index = 2; index < nodes.size(); index++) {
593 if (!nodes[index]->nothingToDraw()) {
594 SkAutoCanvasRestore acr(canvas, true);
595 RenderNodeDrawable overlayNode(nodes[index].get(), canvas);
596 overlayNode.draw(canvas);
597 }
598 }
Stan Iliev500a0c32016-10-26 10:30:09 -0400599 }
Stan Iliev500a0c32016-10-26 10:30:09 -0400600}
601
Matt Sarett4bda6bf2016-11-07 15:43:41 -0500602void SkiaPipeline::dumpResourceCacheUsage() const {
Robert Phillips57bb0bf2019-09-06 13:18:17 -0400603 int resources;
604 size_t bytes;
Matt Sarett4bda6bf2016-11-07 15:43:41 -0500605 mRenderThread.getGrContext()->getResourceCacheUsage(&resources, &bytes);
Robert Phillips57bb0bf2019-09-06 13:18:17 -0400606 size_t maxBytes = mRenderThread.getGrContext()->getResourceCacheLimit();
Matt Sarett4bda6bf2016-11-07 15:43:41 -0500607
608 SkString log("Resource Cache Usage:\n");
Robert Phillips57bb0bf2019-09-06 13:18:17 -0400609 log.appendf("%8d items\n", resources);
John Reck1bcacfd2017-11-03 10:12:19 -0700610 log.appendf("%8zu bytes (%.2f MB) out of %.2f MB maximum\n", bytes,
611 bytes * (1.0f / (1024.0f * 1024.0f)), maxBytes * (1.0f / (1024.0f * 1024.0f)));
Matt Sarett4bda6bf2016-11-07 15:43:41 -0500612
613 ALOGD("%s", log.c_str());
614}
615
Nader Jawada3521852023-01-30 20:23:46 -0800616void SkiaPipeline::setHardwareBuffer(AHardwareBuffer* buffer) {
617 if (mHardwareBuffer) {
618 AHardwareBuffer_release(mHardwareBuffer);
619 mHardwareBuffer = nullptr;
620 }
621
622 if (buffer) {
623 AHardwareBuffer_acquire(buffer);
624 mHardwareBuffer = buffer;
625 }
626}
627
628sk_sp<SkSurface> SkiaPipeline::getBufferSkSurface(
629 const renderthread::HardwareBufferRenderParams& bufferParams) {
630 auto bufferColorSpace = bufferParams.getColorSpace();
631 if (mBufferSurface == nullptr || mBufferColorSpace == nullptr ||
632 !SkColorSpace::Equals(mBufferColorSpace.get(), bufferColorSpace.get())) {
Kevin Lubick6817fc42023-05-12 19:27:20 +0000633 mBufferSurface = SkSurfaces::WrapAndroidHardwareBuffer(
Nader Jawada3521852023-01-30 20:23:46 -0800634 mRenderThread.getGrContext(), mHardwareBuffer, kTopLeft_GrSurfaceOrigin,
635 bufferColorSpace, nullptr, true);
636 mBufferColorSpace = bufferColorSpace;
637 }
638 return mBufferSurface;
639}
640
Peiyong Lin3bff1352018-12-11 07:56:07 -0800641void SkiaPipeline::setSurfaceColorProperties(ColorMode colorMode) {
Derek Sollenberger1863d942020-02-05 15:41:51 -0500642 mColorMode = colorMode;
John Reckb36bfdd2020-07-23 13:47:49 -0700643 switch (colorMode) {
644 case ColorMode::Default:
645 mSurfaceColorType = SkColorType::kN32_SkColorType;
646 mSurfaceColorSpace = SkColorSpace::MakeSRGB();
647 break;
648 case ColorMode::WideColorGamut:
649 mSurfaceColorType = DeviceInfo::get()->getWideColorType();
650 mSurfaceColorSpace = DeviceInfo::get()->getWideColorSpace();
651 break;
652 case ColorMode::Hdr:
Alec Mouri4a3035e2024-03-04 23:12:42 +0000653 if (DeviceInfo::get()->isSupportRgba10101010ForHdr()) {
654 mSurfaceColorType = SkColorType::kRGBA_10x6_SkColorType;
655 mSurfaceColorSpace = SkColorSpace::MakeRGB(
656 GetExtendedTransferFunction(mTargetSdrHdrRatio), SkNamedGamut::kDisplayP3);
657 } else if (DeviceInfo::get()->isSupportFp16ForHdr()) {
Alec Mouri22ab7f32023-09-06 02:11:56 +0000658 mSurfaceColorType = SkColorType::kRGBA_F16_SkColorType;
659 mSurfaceColorSpace = SkColorSpace::MakeSRGB();
660 } else {
661 mSurfaceColorType = SkColorType::kN32_SkColorType;
662 mSurfaceColorSpace = SkColorSpace::MakeRGB(
663 GetExtendedTransferFunction(mTargetSdrHdrRatio), SkNamedGamut::kDisplayP3);
664 }
John Reckb36bfdd2020-07-23 13:47:49 -0700665 break;
John Reck0b3f3312023-01-31 16:21:28 -0500666 case ColorMode::Hdr10:
667 mSurfaceColorType = SkColorType::kRGBA_1010102_SkColorType;
668 mSurfaceColorSpace = SkColorSpace::MakeRGB(
669 GetExtendedTransferFunction(mTargetSdrHdrRatio), SkNamedGamut::kDisplayP3);
670 break;
Leon Scroggins IIIcbdbb662021-11-30 13:59:00 -0500671 case ColorMode::A8:
672 mSurfaceColorType = SkColorType::kAlpha_8_SkColorType;
673 mSurfaceColorSpace = nullptr;
674 break;
Peiyong Lin3bff1352018-12-11 07:56:07 -0800675 }
676}
677
John Reck55887762023-01-25 16:51:18 -0500678void SkiaPipeline::setTargetSdrHdrRatio(float ratio) {
John Reck0b3f3312023-01-31 16:21:28 -0500679 if (mColorMode == ColorMode::Hdr || mColorMode == ColorMode::Hdr10) {
John Reck55887762023-01-25 16:51:18 -0500680 mTargetSdrHdrRatio = ratio;
Alec Mouri22ab7f32023-09-06 02:11:56 +0000681
Alec Mouri4a3035e2024-03-04 23:12:42 +0000682 if (mColorMode == ColorMode::Hdr && DeviceInfo::get()->isSupportFp16ForHdr() &&
683 !DeviceInfo::get()->isSupportRgba10101010ForHdr()) {
Alec Mouri22ab7f32023-09-06 02:11:56 +0000684 mSurfaceColorSpace = SkColorSpace::MakeSRGB();
685 } else {
686 mSurfaceColorSpace = SkColorSpace::MakeRGB(
687 GetExtendedTransferFunction(mTargetSdrHdrRatio), SkNamedGamut::kDisplayP3);
688 }
John Reck55887762023-01-25 16:51:18 -0500689 } else {
690 mTargetSdrHdrRatio = 1.f;
691 }
692}
693
Matt Sarettf58cc922016-11-14 18:33:38 -0500694// Overdraw debugging
695
696// These colors should be kept in sync with Caches::getOverdrawColor() with a few differences.
Mike Reed331c4e12020-02-13 10:21:54 -0500697// This implementation requires transparent entries for "no overdraw" and "single draws".
698static const SkColor kOverdrawColors[2][6] = {
699 {
700 0x00000000,
701 0x00000000,
702 0x2f0000ff,
703 0x2f00ff00,
704 0x3fff0000,
705 0x7fff0000,
706 },
707 {
708 0x00000000,
709 0x00000000,
710 0x2f0000ff,
711 0x4fffff00,
712 0x5fff89d7,
713 0x7fff0000,
714 },
Matt Sarettf58cc922016-11-14 18:33:38 -0500715};
716
Nathaniel Nifongdc19a652019-11-11 11:47:50 -0500717void SkiaPipeline::renderOverdraw(const SkRect& clip,
John Reck1bcacfd2017-11-03 10:12:19 -0700718 const std::vector<sp<RenderNode>>& nodes,
Greg Danielc4076782019-01-08 16:01:18 -0500719 const Rect& contentDrawBounds, sk_sp<SkSurface> surface,
720 const SkMatrix& preTransform) {
Matt Sarettf58cc922016-11-14 18:33:38 -0500721 // Set up the overdraw canvas.
722 SkImageInfo offscreenInfo = SkImageInfo::MakeA8(surface->width(), surface->height());
723 sk_sp<SkSurface> offscreen = surface->makeSurface(offscreenInfo);
Nathaniel Nifongfe05b7c2019-09-17 12:52:52 -0400724 LOG_ALWAYS_FATAL_IF(!offscreen, "Failed to create offscreen SkSurface for overdraw viz.");
Matt Sarettf58cc922016-11-14 18:33:38 -0500725 SkOverdrawCanvas overdrawCanvas(offscreen->getCanvas());
726
727 // Fake a redraw to replay the draw commands. This will increment the alpha channel
728 // each time a pixel would have been drawn.
729 // Pass true for opaque so we skip the clear - the overdrawCanvas is already zero
730 // initialized.
Nathaniel Nifongdc19a652019-11-11 11:47:50 -0500731 renderFrameImpl(clip, nodes, true, contentDrawBounds, &overdrawCanvas, preTransform);
Matt Sarettf58cc922016-11-14 18:33:38 -0500732 sk_sp<SkImage> counts = offscreen->makeImageSnapshot();
733
734 // Draw overdraw colors to the canvas. The color filter will convert counts to colors.
735 SkPaint paint;
Mike Reed331c4e12020-02-13 10:21:54 -0500736 const SkColor* colors = kOverdrawColors[static_cast<int>(Properties::overdrawColorSet)];
737 paint.setColorFilter(SkOverdrawColorFilter::MakeWithSkColors(colors));
Mike Reed7994a312021-01-28 18:06:26 -0500738 surface->getCanvas()->drawImage(counts.get(), 0.0f, 0.0f, SkSamplingOptions(), &paint);
Matt Sarettf58cc922016-11-14 18:33:38 -0500739}
740
Stan Iliev500a0c32016-10-26 10:30:09 -0400741} /* namespace skiapipeline */
742} /* namespace uirenderer */
743} /* namespace android */