From 216a78c65736c730947643db40a27e775c52a476 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Thu, 10 Nov 2022 19:56:49 -0800 Subject: [PATCH] Add more raster traces --- flow/surface_frame.cc | 1 + shell/common/rasterizer.cc | 1 + shell/gpu/gpu_surface_metal_impeller.mm | 3 +++ .../darwin/ios/framework/Source/FlutterPlatformViews.mm | 6 ++++-- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/flow/surface_frame.cc b/flow/surface_frame.cc index 44c9f706d4e2c..f9b162f8f98e9 100644 --- a/flow/surface_frame.cc +++ b/flow/surface_frame.cc @@ -35,6 +35,7 @@ SurfaceFrame::SurfaceFrame(sk_sp surface, } bool SurfaceFrame::Submit() { + TRACE_EVENT0("flutter", "SurfaceFrame::Submit"); if (submitted_) { return false; } diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index cf124ad80476e..89b4862a32bdf 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -464,6 +464,7 @@ RasterStatus Rasterizer::DoDraw( RasterStatus Rasterizer::DrawToSurface( FrameTimingsRecorder& frame_timings_recorder, flutter::LayerTree& layer_tree) { + TRACE_EVENT0("flutter", "Rasterizer::DrawToSurface"); FML_DCHECK(surface_); RasterStatus raster_status; diff --git a/shell/gpu/gpu_surface_metal_impeller.mm b/shell/gpu/gpu_surface_metal_impeller.mm index 4f6da625d9521..686c3c5a92562 100644 --- a/shell/gpu/gpu_surface_metal_impeller.mm +++ b/shell/gpu/gpu_surface_metal_impeller.mm @@ -9,6 +9,7 @@ #include "flutter/fml/make_copyable.h" #include "flutter/fml/mapping.h" +#include "flutter/fml/trace_event.h" #include "flutter/impeller/display_list/display_list_dispatcher.h" #include "flutter/impeller/renderer/backend/metal/surface_mtl.h" @@ -42,6 +43,8 @@ // |Surface| std::unique_ptr GPUSurfaceMetalImpeller::AcquireFrame(const SkISize& frame_info) { + TRACE_EVENT0("impeller", "GPUSurfaceMetalImpeller::AcquireFrame"); + if (!IsValid()) { FML_LOG(ERROR) << "Metal surface was invalid."; return nullptr; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index 44f35fc365466..c25e0b0ad61ea 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -586,6 +586,8 @@ - (BOOL)flt_hasFirstResponderInViewHierarchySubtree { bool FlutterPlatformViewsController::SubmitFrame(GrDirectContext* gr_context, std::shared_ptr ios_context, std::unique_ptr frame) { + TRACE_EVENT0("flutter", "FlutterPlatformViewsController::SubmitFrame"); + // Any UIKit related code has to run on main thread. FML_DCHECK([[NSThread currentThread] isMainThread]); if (flutter_view_ == nullptr) { @@ -600,8 +602,8 @@ - (BOOL)flt_hasFirstResponderInViewHierarchySubtree { // Resolve all pending GPU operations before allocating a new surface. background_canvas->flush(); - // Clipping the background canvas before drawing the picture recorders requires to - // save and restore the clip context. + // Clipping the background canvas before drawing the picture recorders requires + // saving and restoring the clip context. SkAutoCanvasRestore save(background_canvas, /*doSave=*/true); // Maps a platform view id to a vector of `FlutterPlatformViewLayer`.