[Impeller] Reorder pipeline construction in content context. (flutter/engine#54373)

Fixes the regression to the first-frame time on the Mokey.

Also add a trace that should allow for easier identification of problematic pipelines.

A more involved job-queue that allows construction jobs to skip the queue was written in https://github.com/flutter/engine/pull/54355. But the Mokey case is not important enough for the additional complexity. See the context in the linked patch.

<img width="2137" alt="Screenshot 2024-08-06 at 1 20 26 PM" src="https://github.com/user-attachments/assets/aed671c1-b7f7-4c9f-8553-485f8c0dd35e">

[start_up_timeline.json.zip](https://github.com/user-attachments/files/16515389/start_up_timeline.json.zip)
This commit is contained in:
Chinmay Garde
2024-08-06 14:51:46 -07:00
committed by GitHub
parent 54bfbb4509
commit 29bfaddaeb
2 changed files with 25 additions and 19 deletions

View File

@@ -292,7 +292,15 @@ ContentContext::ContentContext(
const auto supports_decal = static_cast<Scalar>(
context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
// Futures for the following pipelines may block in case the first frame is
// rendered without the pipelines being ready. Put pipelines that are more
// likely to be used first.
{
glyph_atlas_pipelines_.CreateDefault(
*context_, options,
{static_cast<Scalar>(
GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
PixelFormat::kA8UNormInt)});
solid_fill_pipelines_.CreateDefault(*context_, options);
texture_pipelines_.CreateDefault(*context_, options);
fast_gradient_pipelines_.CreateDefault(*context_, options);
@@ -310,7 +318,6 @@ ContentContext::ContentContext(
}
/// Setup default clip pipeline.
auto clip_pipeline_descriptor =
ClipPipeline::Builder::MakeDefaultPipelineDescriptor(*context_);
if (!clip_pipeline_descriptor.has_value()) {
@@ -332,6 +339,20 @@ ContentContext::ContentContext(
clip_pipelines_.SetDefault(
options,
std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
texture_downsample_pipelines_.CreateDefault(*context_,
options_trianglestrip);
rrect_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
texture_strict_src_pipelines_.CreateDefault(*context_, options);
tiled_texture_pipelines_.CreateDefault(*context_, options,
{supports_decal});
gaussian_blur_pipelines_.CreateDefault(*context_, options_trianglestrip,
{supports_decal});
border_mask_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
color_matrix_color_filter_pipelines_.CreateDefault(*context_,
options_trianglestrip);
porter_duff_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
{supports_decal});
vertices_uber_shader_.CreateDefault(*context_, options, {supports_decal});
}
if (context_->GetCapabilities()->SupportsFramebufferFetch()) {
@@ -428,30 +449,14 @@ ContentContext::ContentContext(
{static_cast<Scalar>(BlendSelectValues::kSoftLight), supports_decal});
}
texture_downsample_pipelines_.CreateDefault(*context_, options_trianglestrip);
rrect_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
texture_strict_src_pipelines_.CreateDefault(*context_, options);
tiled_texture_pipelines_.CreateDefault(*context_, options, {supports_decal});
gaussian_blur_pipelines_.CreateDefault(*context_, options_trianglestrip,
{supports_decal});
border_mask_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
morphology_filter_pipelines_.CreateDefault(*context_, options_trianglestrip,
{supports_decal});
color_matrix_color_filter_pipelines_.CreateDefault(*context_,
options_trianglestrip);
linear_to_srgb_filter_pipelines_.CreateDefault(*context_,
options_trianglestrip);
srgb_to_linear_filter_pipelines_.CreateDefault(*context_,
options_trianglestrip);
glyph_atlas_pipelines_.CreateDefault(
*context_, options,
{static_cast<Scalar>(
GetContext()->GetCapabilities()->GetDefaultGlyphAtlasFormat() ==
PixelFormat::kA8UNormInt)});
yuv_to_rgb_filter_pipelines_.CreateDefault(*context_, options_trianglestrip);
porter_duff_blend_pipelines_.CreateDefault(*context_, options_trianglestrip,
{supports_decal});
vertices_uber_shader_.CreateDefault(*context_, options, {supports_decal});
// GLES only shader that is unsupported on macOS.
#if defined(IMPELLER_ENABLE_OPENGLES) && !defined(FML_OS_MACOSX)
if (GetContext()->GetBackendType() == Context::BackendType::kOpenGLES) {

View File

@@ -451,7 +451,8 @@ std::unique_ptr<PipelineVK> PipelineVK::Create(
const std::shared_ptr<DeviceHolderVK>& device_holder,
const std::weak_ptr<PipelineLibrary>& weak_library,
std::shared_ptr<SamplerVK> immutable_sampler) {
TRACE_EVENT0("flutter", "PipelineVK::Create");
TRACE_EVENT1("flutter", "PipelineVK::Create", "Name",
desc.GetLabel().c_str());
auto library = weak_library.lock();