Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

More rename from GPU thread to raster thread #22819

Merged
merged 1 commit into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ui/ui_benchmarks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Fixture : public testing::FixtureTest {
static void BM_PlatformMessageResponseDartComplete(
benchmark::State& state) { // NOLINT
ThreadHost thread_host("test",
ThreadHost::Type::Platform | ThreadHost::Type::GPU |
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
Expand Down
12 changes: 6 additions & 6 deletions lib/ui/window/platform_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ class PlatformConfiguration final {
/// The frame time given as the argument indicates the point at
/// which the current frame interval began. It is very slightly
/// (because of scheduling overhead) in the past. If a new layer
/// tree is not produced and given to the GPU task runner within
/// one frame interval from this point, the Flutter application
/// will jank.
/// tree is not produced and given to the raster task runner
/// within one frame interval from this point, the Flutter
/// application will jank.
///
/// This method calls the `::_beginFrame` method in `hooks.dart`.
///
Expand All @@ -328,13 +328,13 @@ class PlatformConfiguration final {
/// @brief Dart code cannot fully measure the time it takes for a
/// specific frame to be rendered. This is because Dart code only
/// runs on the UI task runner. That is only a small part of the
/// overall frame workload. The GPU task runner frame workload is
/// executed on a thread where Dart code cannot run (and hence
/// overall frame workload. The raster task runner frame workload
/// is executed on a thread where Dart code cannot run (and hence
/// instrument). Besides, due to the pipelined nature of rendering
/// in Flutter, there may be multiple frame workloads being
/// processed at any given time. However, for non-Timeline based
/// profiling, it is useful for trace collection and processing to
/// happen in Dart. To do this, the GPU task runner frame
/// happen in Dart. To do this, the raster task runner frame
/// workloads need to be instrumented separately. After a set
/// number of these profiles have been gathered, they need to be
/// reported back to Dart code. The engine reports this extra
Expand Down
6 changes: 3 additions & 3 deletions runtime/runtime_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ class RuntimeController : public PlatformConfigurationClient {
/// @brief Dart code cannot fully measure the time it takes for a
/// specific frame to be rendered. This is because Dart code only
/// runs on the UI task runner. That is only a small part of the
/// overall frame workload. The GPU task runner frame workload is
/// executed on a thread where Dart code cannot run (and hence
/// overall frame workload. The raster task runner frame workload
/// is executed on a thread where Dart code cannot run (and hence
/// instrument). Besides, due to the pipelined nature of rendering
/// in Flutter, there may be multiple frame workloads being
/// processed at any given time. However, for non-Timeline based
/// profiling, it is useful for trace collection and processing to
/// happen in Dart. To do this, the GPU task runner frame
/// happen in Dart. To do this, the raster task runner frame
/// workloads need to be instrumented separately. After a set
/// number of these profiles have been gathered, they need to be
/// reported back to Dart code. The engine reports this extra
Expand Down
12 changes: 6 additions & 6 deletions shell/common/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,9 @@ class Engine final : public RuntimeDelegate,
/// The frame time given as the argument indicates the point at
/// which the current frame interval began. It is very slightly
/// (because of scheduling overhead) in the past. If a new layer
/// tree is not produced and given to the GPU task runner within
/// one frame interval from this point, the Flutter application
/// will jank.
/// tree is not produced and given to the raster task runner
/// within one frame interval from this point, the Flutter
/// application will jank.
///
/// If a root isolate is running, this method calls the
/// `::_beginFrame` method in `hooks.dart`. If a root isolate is
Expand Down Expand Up @@ -520,13 +520,13 @@ class Engine final : public RuntimeDelegate,
/// @brief Dart code cannot fully measure the time it takes for a
/// specific frame to be rendered. This is because Dart code only
/// runs on the UI task runner. That is only a small part of the
/// overall frame workload. The GPU task runner frame workload is
/// executed on a thread where Dart code cannot run (and hence
/// overall frame workload. The raster task runner frame workload
/// is executed on a thread where Dart code cannot run (and hence
/// instrument). Besides, due to the pipelined nature of rendering
/// in Flutter, there may be multiple frame workloads being
/// processed at any given time. However, for non-Timeline based
/// profiling, it is useful for trace collection and processing to
/// happen in Dart. To do this, the GPU task runner frame
/// happen in Dart. To do this, the raster task runner frame
/// workloads need to be instrumented separately. After a set
/// number of these profiles have been gathered, they need to be
/// reported back to Dart code. The shell reports this extra
Expand Down
2 changes: 1 addition & 1 deletion shell/common/engine_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class EngineTest : public ::testing::Test {
EngineTest()
: thread_host_("EngineTest",
ThreadHost::Type::Platform | ThreadHost::Type::IO |
ThreadHost::Type::UI | ThreadHost::Type::GPU),
ThreadHost::Type::UI | ThreadHost::Type::RASTER),
task_runners_({
"EngineTest",
thread_host_.platform_thread->GetTaskRunner(), // platform
Expand Down
2 changes: 1 addition & 1 deletion shell/common/platform_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ class PlatformView {
fml::WeakPtrFactory<PlatformView> weak_factory_;

// Unlike all other methods on the platform view, this is called on the
// GPU task runner.
// raster task runner.
virtual std::unique_ptr<Surface> CreateRenderingSurface();

private:
Expand Down
25 changes: 13 additions & 12 deletions shell/common/rasterizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
namespace flutter {

//------------------------------------------------------------------------------
/// The rasterizer is a component owned by the shell that resides on the GPU
/// The rasterizer is a component owned by the shell that resides on the raster
/// task runner. Each shell owns exactly one instance of a rasterizer. The
/// rasterizer may only be created, used and collected on the GPU task runner.
/// rasterizer may only be created, used and collected on the raster task
/// runner.
///
/// The rasterizer owns the instance of the currently active on-screen render
/// surface. On this surface, it renders the contents of layer trees submitted
Expand All @@ -48,8 +49,8 @@ class Rasterizer final : public SnapshotDelegate {
/// It can then forward these events to the engine.
///
/// Like all rasterizer operation, the rasterizer delegate call
/// are made on the GPU task runner. Any delegate must ensure that
/// they can handle the threading implications.
/// are made on the raster task runner. Any delegate must ensure
/// that they can handle the threading implications.
///
class Delegate {
public:
Expand Down Expand Up @@ -92,9 +93,9 @@ class Rasterizer final : public SnapshotDelegate {

//----------------------------------------------------------------------------
/// @brief Creates a new instance of a rasterizer. Rasterizers may only
/// be created on the GPU task runner. Rasterizers are currently
/// only created by the shell (which also sets itself up as the
/// rasterizer delegate).
/// be created on the raster task runner. Rasterizers are
/// currently only created by the shell (which also sets itself up
/// as the rasterizer delegate).
///
/// @param[in] delegate The rasterizer delegate.
///
Expand All @@ -103,9 +104,9 @@ class Rasterizer final : public SnapshotDelegate {
#if defined(LEGACY_FUCHSIA_EMBEDDER)
//----------------------------------------------------------------------------
/// @brief Creates a new instance of a rasterizer. Rasterizers may only
/// be created on the GPU task runner. Rasterizers are currently
/// only created by the shell (which also sets itself up as the
/// rasterizer delegate).
/// be created on the raster task runner. Rasterizers are
/// currently only created by the shell (which also sets itself up
/// as the rasterizer delegate).
///
/// @param[in] delegate The rasterizer delegate.
/// @param[in] compositor_context The compositor context used to hold all
Expand All @@ -116,7 +117,7 @@ class Rasterizer final : public SnapshotDelegate {
#endif

//----------------------------------------------------------------------------
/// @brief Destroys the rasterizer. This must happen on the GPU task
/// @brief Destroys the rasterizer. This must happen on the raster task
/// runner. All GPU resources are collected before this call
/// returns. Any context setup by the embedder to hold these
/// resources can be immediately collected as well.
Expand Down Expand Up @@ -158,7 +159,7 @@ class Rasterizer final : public SnapshotDelegate {

//----------------------------------------------------------------------------
/// @brief Gets a weak pointer to the rasterizer. The rasterizer may only
/// be accessed on the GPU task runner.
/// be accessed on the raster task runner.
///
/// @return The weak pointer to the rasterizer.
///
Expand Down
10 changes: 5 additions & 5 deletions shell/common/rasterizer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ TEST(RasterizerTest, drawEmptyPipeline) {
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::GPU |
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
Expand All @@ -102,7 +102,7 @@ TEST(RasterizerTest,
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::GPU |
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
Expand Down Expand Up @@ -160,7 +160,7 @@ TEST(
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::GPU |
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
Expand Down Expand Up @@ -214,7 +214,7 @@ TEST(
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::GPU |
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
fml::MessageLoop::EnsureInitializedForCurrentThread();
TaskRunners task_runners("test",
Expand Down Expand Up @@ -268,7 +268,7 @@ TEST(RasterizerTest, externalViewEmbedderDoesntEndFrameWhenNoSurfaceIsSet) {
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::GPU |
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
Expand Down
4 changes: 2 additions & 2 deletions shell/common/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class Shell final : public PlatformView::Delegate,
const TaskRunners& GetTaskRunners() const override;

//----------------------------------------------------------------------------
/// @brief Rasterizers may only be accessed on the GPU task runner.
/// @brief Rasterizers may only be accessed on the raster task runner.
///
/// @return A weak pointer to the rasterizer.
///
Expand Down Expand Up @@ -394,7 +394,7 @@ class Shell final : public PlatformView::Delegate,
std::optional<fml::TimePoint> latest_frame_target_time_;
std::unique_ptr<PlatformView> platform_view_; // on platform task runner
std::unique_ptr<Engine> engine_; // on UI task runner
std::unique_ptr<Rasterizer> rasterizer_; // on GPU task runner
std::unique_ptr<Rasterizer> rasterizer_; // on raster task runner
std::unique_ptr<ShellIOManager> io_manager_; // on IO task runner
std::shared_ptr<fml::SyncSwitch> is_gpu_disabled_sync_switch_;

Expand Down
4 changes: 2 additions & 2 deletions shell/common/shell_benchmarks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ static void StartupAndShutdownShell(benchmark::State& state,

thread_host = std::make_unique<ThreadHost>(
"io.flutter.bench.", ThreadHost::Type::Platform |
ThreadHost::Type::GPU | ThreadHost::Type::IO |
ThreadHost::Type::UI);
ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);

TaskRunners task_runners("test",
thread_host->platform_thread->GetTaskRunner(),
Expand Down
2 changes: 1 addition & 1 deletion shell/common/shell_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace testing {
ShellTest::ShellTest()
: thread_host_("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform | ThreadHost::Type::IO |
ThreadHost::Type::UI | ThreadHost::Type::GPU) {}
ThreadHost::Type::UI | ThreadHost::Type::RASTER) {}

void ShellTest::SendEnginePlatformMessage(
Shell* shell,
Expand Down
4 changes: 2 additions & 2 deletions shell/common/shell_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ TEST_F(ShellTest, InitializeWithDifferentThreads) {
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform | ThreadHost::Type::GPU |
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
Expand Down Expand Up @@ -178,7 +178,7 @@ TEST_F(ShellTest,
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host(
"io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::GPU | ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::RASTER | ThreadHost::Type::IO | ThreadHost::Type::UI);
fml::MessageLoop::EnsureInitializedForCurrentThread();
TaskRunners task_runners("test",
fml::MessageLoop::GetCurrent().GetTaskRunner(),
Expand Down
2 changes: 1 addition & 1 deletion shell/common/thread_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ThreadHost::ThreadHost(std::string name_prefix_arg, uint64_t mask)
ui_thread = std::make_unique<fml::Thread>(name_prefix + ".ui");
}

if (mask & ThreadHost::Type::GPU) {
if (mask & ThreadHost::Type::RASTER) {
raster_thread = std::make_unique<fml::Thread>(name_prefix + ".raster");
}

Expand Down
2 changes: 1 addition & 1 deletion shell/common/thread_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct ThreadHost {
enum Type {
Platform = 1 << 0,
UI = 1 << 1,
GPU = 1 << 2,
RASTER = 1 << 2,
IO = 1 << 3,
Profiler = 1 << 4,
};
Expand Down
13 changes: 7 additions & 6 deletions shell/platform/android/android_shell_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ AndroidShellHolder::AndroidShellHolder(
if (is_background_view) {
thread_host_ = {thread_label, ThreadHost::Type::UI};
} else {
thread_host_ = {thread_label, ThreadHost::Type::UI | ThreadHost::Type::GPU |
thread_host_ = {thread_label, ThreadHost::Type::UI |
ThreadHost::Type::RASTER |
ThreadHost::Type::IO};
}

Expand Down Expand Up @@ -87,25 +88,25 @@ AndroidShellHolder::AndroidShellHolder(
// The current thread will be used as the platform thread. Ensure that the
// message loop is initialized.
fml::MessageLoop::EnsureInitializedForCurrentThread();
fml::RefPtr<fml::TaskRunner> gpu_runner;
fml::RefPtr<fml::TaskRunner> raster_runner;
fml::RefPtr<fml::TaskRunner> ui_runner;
fml::RefPtr<fml::TaskRunner> io_runner;
fml::RefPtr<fml::TaskRunner> platform_runner =
fml::MessageLoop::GetCurrent().GetTaskRunner();
if (is_background_view) {
auto single_task_runner = thread_host_.ui_thread->GetTaskRunner();
gpu_runner = single_task_runner;
raster_runner = single_task_runner;
ui_runner = single_task_runner;
io_runner = single_task_runner;
} else {
gpu_runner = thread_host_.raster_thread->GetTaskRunner();
raster_runner = thread_host_.raster_thread->GetTaskRunner();
ui_runner = thread_host_.ui_thread->GetTaskRunner();
io_runner = thread_host_.io_thread->GetTaskRunner();
}

flutter::TaskRunners task_runners(thread_label, // label
platform_runner, // platform
gpu_runner, // raster
raster_runner, // raster
ui_runner, // ui
io_runner // io
);
Expand All @@ -117,7 +118,7 @@ AndroidShellHolder::AndroidShellHolder(
// Defensive fallback. Depending on the OEM, it may not be possible
// to set priority to -5.
if (::setpriority(PRIO_PROCESS, gettid(), -2) != 0) {
FML_LOG(ERROR) << "Failed to set GPU task runner priority";
FML_LOG(ERROR) << "Failed to set raster task runner priority";
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ + (NSString*)generateThreadLabel:(NSString*)labelPrefix {
// initialized.
fml::MessageLoop::EnsureInitializedForCurrentThread();

uint32_t threadHostType = flutter::ThreadHost::Type::UI | flutter::ThreadHost::Type::GPU |
uint32_t threadHostType = flutter::ThreadHost::Type::UI | flutter::ThreadHost::Type::RASTER |
flutter::ThreadHost::Type::IO;
if ([FlutterEngine isProfilerEnabled]) {
threadHostType = threadHostType | flutter::ThreadHost::Type::Profiler;
Expand Down
Loading