GPU to raster rename, patch 2 (#17428)
diff --git a/fml/raster_thread_merger.cc b/fml/raster_thread_merger.cc index e81eebb..718b41c 100644 --- a/fml/raster_thread_merger.cc +++ b/fml/raster_thread_merger.cc
@@ -63,7 +63,7 @@ lease_term_--; if (lease_term_ == 0) { bool success = task_queues_->Unmerge(platform_queue_id_); - FML_CHECK(success) << "Unable to un-merge the GPU and platform threads."; + FML_CHECK(success) << "Unable to un-merge the raster and platform threads."; is_merged_ = false; return RasterThreadStatus::kUnmergedNow; }
diff --git a/fml/raster_thread_merger.h b/fml/raster_thread_merger.h index 847f7e3..1e12e3c 100644 --- a/fml/raster_thread_merger.h +++ b/fml/raster_thread_merger.h
@@ -33,7 +33,7 @@ void ExtendLeaseTo(size_t lease_term); // Returns |RasterThreadStatus::kUnmergedNow| if this call resulted in - // splitting the GPU and platform threads. Reduces the lease term by 1. + // splitting the raster and platform threads. Reduces the lease term by 1. RasterThreadStatus DecrementLease(); bool IsMerged() const;
diff --git a/lib/ui/compositing/scene_host.cc b/lib/ui/compositing/scene_host.cc index 83d0f56..8eb0ff5 100644 --- a/lib/ui/compositing/scene_host.cc +++ b/lib/ui/compositing/scene_host.cc
@@ -188,8 +188,8 @@ scene_host_bindings.emplace(std::make_pair(key, scene_host)); }; - // Pass the raw handle to the GPU thead; destroying a |zircon::dart::Handle| - // on that thread can cause a race condition. + // Pass the raw handle to the raster thread; destroying a + // |zircon::dart::Handle| on that thread can cause a race condition. raster_task_runner_->PostTask( [id = koid_, ui_task_runner =
diff --git a/lib/ui/painting/picture.cc b/lib/ui/painting/picture.cc index e20f687..511e369 100644 --- a/lib/ui/painting/picture.cc +++ b/lib/ui/painting/picture.cc
@@ -115,7 +115,7 @@ delete image_callback; }); - // Kick things off on the GPU. + // Kick things off on the raster rask runner. fml::TaskRunner::RunNowOrPostTask( raster_task_runner, [ui_task_runner, snapshot_delegate, picture, picture_bounds, ui_task] {
diff --git a/shell/common/shell.cc b/shell/common/shell.cc index e660c54..9125f88 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc
@@ -605,7 +605,7 @@ // setup/suspension of all activities that may be interacting with the GPU in // a synchronous fashion. fml::AutoResetWaitableEvent latch; - auto gpu_task = + auto raster_task = fml::MakeCopyable([& waiting_for_first_frame = waiting_for_first_frame_, rasterizer = rasterizer_->GetWeakPtr(), // surface = std::move(surface), // @@ -623,19 +623,20 @@ // The normal flow executed by this method is that the platform thread is // starting the sequence and waiting on the latch. Later the UI thread posts - // gpu_task to the raster thread which signals the latch. If the GPU the and - // platform threads are the same this results in a deadlock as the gpu_task - // will never be posted to the plaform/raster thread that is blocked on a - // latch. To avoid the described deadlock, if the raster and the platform - // threads are the same, should_post_gpu_task will be false, and then instead - // of posting a task to the raster thread, the ui thread just signals the - // latch and the platform/raster thread follows with executing gpu_task. - bool should_post_gpu_task = task_runners_.GetRasterTaskRunner() != - task_runners_.GetPlatformTaskRunner(); + // raster_task to the raster thread which signals the latch. If the raster and + // the platform threads are the same this results in a deadlock as the + // raster_task will never be posted to the plaform/raster thread that is + // blocked on a latch. To avoid the described deadlock, if the raster and the + // platform threads are the same, should_post_raster_task will be false, and + // then instead of posting a task to the raster thread, the ui thread just + // signals the latch and the platform/raster thread follows with executing + // raster_task. + bool should_post_raster_task = task_runners_.GetRasterTaskRunner() != + task_runners_.GetPlatformTaskRunner(); auto ui_task = [engine = engine_->GetWeakPtr(), // raster_task_runner = task_runners_.GetRasterTaskRunner(), // - gpu_task, should_post_gpu_task, + raster_task, should_post_raster_task, &latch // ] { if (engine) { @@ -643,10 +644,10 @@ } // Step 2: Next, tell the raster thread that it should create a surface for // its rasterizer. - if (should_post_gpu_task) { - fml::TaskRunner::RunNowOrPostTask(raster_task_runner, gpu_task); + if (should_post_raster_task) { + fml::TaskRunner::RunNowOrPostTask(raster_task_runner, raster_task); } else { - // See comment on should_post_gpu_task, in this case we just unblock + // See comment on should_post_raster_task, in this case we just unblock // the platform thread. latch.Signal(); } @@ -674,11 +675,11 @@ fml::TaskRunner::RunNowOrPostTask(task_runners_.GetIOTaskRunner(), io_task); latch.Wait(); - if (!should_post_gpu_task) { - // See comment on should_post_gpu_task, in this case the gpu_task + if (!should_post_raster_task) { + // See comment on should_post_raster_task, in this case the raster_task // wasn't executed, and we just run it here as the platform thread // is the raster thread. - gpu_task(); + raster_task(); } } @@ -706,9 +707,9 @@ latch.Signal(); }; - auto gpu_task = [rasterizer = rasterizer_->GetWeakPtr(), - io_task_runner = task_runners_.GetIOTaskRunner(), - io_task]() { + auto raster_task = [rasterizer = rasterizer_->GetWeakPtr(), + io_task_runner = task_runners_.GetIOTaskRunner(), + io_task]() { if (rasterizer) { rasterizer->Teardown(); } @@ -718,29 +719,29 @@ // The normal flow executed by this method is that the platform thread is // starting the sequence and waiting on the latch. Later the UI thread posts - // gpu_task to the raster thread triggers signaling the latch(on the IO - // thread). If the GPU the and platform threads are the same this results in a - // deadlock as the gpu_task will never be posted to the plaform/raster thread - // that is blocked on a latch. To avoid the described deadlock, if the raster - // and the platform threads are the same, should_post_gpu_task will be false, - // and then instead of posting a task to the raster thread, the ui thread just - // signals the latch and the platform/raster thread follows with executing - // gpu_task. - bool should_post_gpu_task = task_runners_.GetRasterTaskRunner() != - task_runners_.GetPlatformTaskRunner(); + // raster_task to the raster thread triggers signaling the latch(on the IO + // thread). If the raster and the platform threads are the same this results + // in a deadlock as the raster_task will never be posted to the plaform/raster + // thread that is blocked on a latch. To avoid the described deadlock, if the + // raster and the platform threads are the same, should_post_raster_task will + // be false, and then instead of posting a task to the raster thread, the ui + // thread just signals the latch and the platform/raster thread follows with + // executing raster_task. + bool should_post_raster_task = task_runners_.GetRasterTaskRunner() != + task_runners_.GetPlatformTaskRunner(); auto ui_task = [engine = engine_->GetWeakPtr(), raster_task_runner = task_runners_.GetRasterTaskRunner(), - gpu_task, should_post_gpu_task, &latch]() { + raster_task, should_post_raster_task, &latch]() { if (engine) { engine->OnOutputSurfaceDestroyed(); } // Step 1: Next, tell the raster thread that its rasterizer should suspend // access to the underlying surface. - if (should_post_gpu_task) { - fml::TaskRunner::RunNowOrPostTask(raster_task_runner, gpu_task); + if (should_post_raster_task) { + fml::TaskRunner::RunNowOrPostTask(raster_task_runner, raster_task); } else { - // See comment on should_post_gpu_task, in this case we just unblock + // See comment on should_post_raster_task, in this case we just unblock // the platform thread. latch.Signal(); } @@ -750,11 +751,11 @@ // surface is about to go away. fml::TaskRunner::RunNowOrPostTask(task_runners_.GetUITaskRunner(), ui_task); latch.Wait(); - if (!should_post_gpu_task) { - // See comment on should_post_gpu_task, in this case the gpu_task + if (!should_post_raster_task) { + // See comment on should_post_raster_task, in this case the raster_task // wasn't executed, and we just run it here as the platform thread // is the raster thread. - gpu_task(); + raster_task(); latch.Wait(); } }