From 3aaa10d76276cf0c8953ca5da65aeb68725f6b8f Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Thu, 17 Jun 2021 16:11:40 -0400 Subject: [PATCH] Disable Skia reduceOpsTaskSplitting option (flutter/engine#26568) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This option will be the default in Skia soon. Per discussion in #26067, let’s be explicit about disabling it for the time being, and we can revisit the flag in the future if desirable. --- engine/src/flutter/shell/common/shell_io_manager.cc | 4 ++++ .../flutter/shell/common/shell_test_platform_view_vulkan.cc | 1 + engine/src/flutter/shell/gpu/gpu_surface_gl.cc | 3 +++ .../platform/darwin/graphics/FlutterDarwinContextMetal.mm | 1 + .../platform/fuchsia/flutter/vulkan_surface_producer.cc | 4 +++- engine/src/flutter/vulkan/vulkan_window.cc | 5 ++++- 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/shell/common/shell_io_manager.cc b/engine/src/flutter/shell/common/shell_io_manager.cc index e87ae2c15b5..cf90a73bfe1 100644 --- a/engine/src/flutter/shell/common/shell_io_manager.cc +++ b/engine/src/flutter/shell/common/shell_io_manager.cc @@ -39,6 +39,10 @@ sk_sp ShellIOManager::CreateCompatibleResourceLoadingContext( // ES2 shading language when the ES3 external image extension is missing. options.fPreferExternalImagesOverES3 = true; + // Enabling this flag can increase VRAM consumption. Turn it off until + // further notice. + options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; + #if !OS_FUCHSIA if (auto context = GrDirectContext::MakeGL(gl_interface, options)) { // Do not cache textures created by the image decoder. These textures diff --git a/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.cc b/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.cc index 4e98f9ea182..29f6aba2bec 100644 --- a/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.cc +++ b/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.cc @@ -119,6 +119,7 @@ bool ShellTestPlatformViewVulkan::OffScreenSurface::CreateSkiaGrContext() { } PersistentCache::MarkStrategySet(); options.fPersistentCache = PersistentCache::GetCacheForProcess(); + options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; sk_sp context = GrDirectContext::MakeVulkan(backend_context, options); diff --git a/engine/src/flutter/shell/gpu/gpu_surface_gl.cc b/engine/src/flutter/shell/gpu/gpu_surface_gl.cc index b78c0a5bf1d..e04a9a25561 100644 --- a/engine/src/flutter/shell/gpu/gpu_surface_gl.cc +++ b/engine/src/flutter/shell/gpu/gpu_surface_gl.cc @@ -61,6 +61,9 @@ sk_sp GPUSurfaceGL::MakeGLContext( // TODO(goderbauer): remove option when skbug.com/7523 is fixed. // A similar work-around is also used in shell/common/io_manager.cc. options.fDisableGpuYUVConversion = true; + + options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; + auto context = GrDirectContext::MakeGL(delegate->GetGLInterface(), options); if (!context) { diff --git a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetal.mm b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetal.mm index 6e88205db3c..6beab111e2e 100644 --- a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetal.mm +++ b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetal.mm @@ -18,6 +18,7 @@ static GrContextOptions CreateMetalGrContextOptions() { } flutter::PersistentCache::MarkStrategySet(); options.fPersistentCache = flutter::PersistentCache::GetCacheForProcess(); + options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; return options; } diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc index 53a8db78fe1..53bf3b3eae6 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc @@ -137,8 +137,10 @@ bool VulkanSurfaceProducer::Initialize(scenic::Session* scenic_session) { backend_context.fPhysicalDevice, 0, nullptr, countof(device_extensions), device_extensions); backend_context.fVkExtensions = &vk_extensions; + GrContextOptions options; + options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; - context_ = GrDirectContext::MakeVulkan(backend_context); + context_ = GrDirectContext::MakeVulkan(backend_context, options); if (context_ == nullptr) { FML_LOG(ERROR) diff --git a/engine/src/flutter/vulkan/vulkan_window.cc b/engine/src/flutter/vulkan/vulkan_window.cc index d3bd23c9e5e..1cee0820c61 100644 --- a/engine/src/flutter/vulkan/vulkan_window.cc +++ b/engine/src/flutter/vulkan/vulkan_window.cc @@ -119,7 +119,10 @@ bool VulkanWindow::CreateSkiaGrContext() { return false; } - sk_sp context = GrDirectContext::MakeVulkan(backend_context); + GrContextOptions options; + options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; + sk_sp context = + GrDirectContext::MakeVulkan(backend_context, options); if (context == nullptr) { return false;