From 93351f14486cf89db02df954235e70238fa17ac4 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Sat, 17 Jun 2023 20:54:04 -0700 Subject: [PATCH] [Impeller] dont use concurrent runner to decode images on Android. (flutter/engine#42944) Even with separate allocators and queues, I think that using the concurrent runner is just overloading the phone. On Android force it all onto the I/O thread. https://github.com/flutter/flutter/issues/128919 --- .../lib/ui/painting/image_decoder_impeller.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/engine/src/flutter/lib/ui/painting/image_decoder_impeller.cc b/engine/src/flutter/lib/ui/painting/image_decoder_impeller.cc index ecb455c1bda..3902ca762b2 100644 --- a/engine/src/flutter/lib/ui/painting/image_decoder_impeller.cc +++ b/engine/src/flutter/lib/ui/painting/image_decoder_impeller.cc @@ -456,7 +456,11 @@ void ImageDecoderImpeller::Decode(fml::RefPtr descriptor, }); }; +#ifdef FML_OS_ANDROID + runners_.GetIOTaskRunner()->PostTask( +#else concurrent_task_runner_->PostTask( +#endif [raw_descriptor, // context = context_.get(), // target_size = SkISize::Make(target_width, target_height), // @@ -495,12 +499,16 @@ void ImageDecoderImpeller::Decode(fml::RefPtr descriptor, result(image, decode_error); } }; - // TODO(jonahwilliams): - // https://github.com/flutter/flutter/issues/123058 Technically we - // don't need to post tasks to the io runner, but without this - // forced serialization we can end up overloading the GPU and/or - // competing with raster workloads. +// TODO(jonahwilliams): +// https://github.com/flutter/flutter/issues/123058 Technically we +// don't need to post tasks to the io runner, but without this +// forced serialization we can end up overloading the GPU and/or +// competing with raster workloads. +#ifdef FML_OS_ANDROID + upload_texture_and_invoke_result(); +#else io_runner->PostTask(upload_texture_and_invoke_result); +#endif }); }