This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add ability to disable the raster thread merger #20800
Merged
blasten
merged 16 commits into
flutter-team-archive:master
from
blasten:raster_thread_merger_disable
Aug 29, 2020
Merged
Changes from 7 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
7481a1f
Add ability to disable the raster thread merger
1fa8467
Enable/Disable from shell delegate
e2082ea
nits
015fd9a
Revert unintended change
a5e146d
Remove tests
3d1528c
Typo
0618d8b
format
58b7838
Tests
1cbbfad
Clean up
1799d42
Fix test
f460e8e
Put check back
f40faeb
Keep logic that unmerges thread in rasterizer tear down
67dfab8
Disable/Enable in shell delegate
e6bd933
Feedback & fix bug
9bf4805
Merge remote-tracking branch 'upstream/master' into raster_thread_mer…
a2d425a
nit
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -619,6 +619,9 @@ void Shell::OnPlatformViewCreated(std::unique_ptr<Surface> surface) { | |
| FML_DCHECK(is_setup_); | ||
| FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); | ||
|
|
||
| // Enables the thread merger which may be used by the external view embedder. | ||
| rasterizer_->EnableThreadMergerIfNeeded(); | ||
|
|
||
| // Note: | ||
| // This is a synchronous operation because certain platforms depend on | ||
| // setup/suspension of all activities that may be interacting with the GPU in | ||
|
|
@@ -708,6 +711,14 @@ void Shell::OnPlatformViewDestroyed() { | |
| FML_DCHECK(is_setup_); | ||
| FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); | ||
|
|
||
| // Prevent any request to merge the raster and platform threads while the | ||
| // platform view is destroyed. | ||
| // | ||
| // This prevents a dead lock where the platform thread is blocked waiting for | ||
| // the latch, but the latch is never released because the raster queue is all | ||
| // the sudden running on the platform thread. | ||
| rasterizer_->DisableThreadMergerIfNeeded(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's move this right before
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
|
||
| // Note: | ||
| // This is a synchronous operation because certain platforms depend on | ||
| // setup/suspension of all activities that may be interacting with the GPU in | ||
|
|
@@ -747,7 +758,6 @@ void Shell::OnPlatformViewDestroyed() { | |
| // surface is about to go away. | ||
| fml::TaskRunner::RunNowOrPostTask(task_runners_.GetUITaskRunner(), ui_task); | ||
| latch.Wait(); | ||
| rasterizer_->EnsureThreadsAreMerged(); | ||
| fml::TaskRunner::RunNowOrPostTask(task_runners_.GetRasterTaskRunner(), | ||
| raster_task); | ||
| latch.Wait(); | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.