forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 2
[Impeller] Use the IO context for OpenGL program setup #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xiaowei-guan
wants to merge
19
commits into
flutter-tizen:flutter-3.41.9
Choose a base branch
from
xiaowei-guan:flutter-3.41.9
base: flutter-3.41.9
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1ab4750
Re-prioritize pipeline compile jobs and perform them eagerly instead …
chinmaygarde f4efdc4
Add io task runner to pipeline library gles.
xiaowei-guan 1986ea4
Implement pipeline compile queue for gles
xiaowei-guan 95d6d8b
Fix build error
xiaowei-guan efbbef4
Add pipeline_compile_queue_vulkan.h
xiaowei-guan 9d6b92a
Update GetPipeline method when sync == true
xiaowei-guan 0f55c1e
Make link program after schedule frame on IO thread
xiaowei-guan a6b3245
Fix codereview issues
xiaowei-guan 91820f3
Execute the compile job one by one; do not push all the tasks into th…
xiaowei-guan 5c339ba
When executing an OpenGL job, you must wait for the previous job to f…
xiaowei-guan 1755b06
Remove empty line
xiaowei-guan 84cbe84
Add a robust mutex-based synchronization pattern
xiaowei-guan edc184c
Fix code review issues
xiaowei-guan 13d3be6
Fix code review issues
xiaowei-guan 1765732
Fix code review issues
xiaowei-guan 96d3473
Add check when creating PipelineCompileQueueGLES
xiaowei-guan e7a28a9
Fix format issue
xiaowei-guan f55d4bc
Add UT test
xiaowei-guan 8a970fc
Fix unit test issue
xiaowei-guan 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
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
61 changes: 61 additions & 0 deletions
61
engine/src/flutter/impeller/renderer/backend/gles/pipeline_compile_queue_gles.cc
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 |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #include "impeller/renderer/backend/gles/pipeline_compile_queue_gles.h" | ||
|
|
||
| #include "flutter/fml/logging.h" | ||
| #include "flutter/fml/trace_event.h" | ||
| #include "impeller/base/validation.h" | ||
|
|
||
| namespace impeller { | ||
|
|
||
| std::shared_ptr<PipelineCompileQueueGLES> PipelineCompileQueueGLES::Create( | ||
| fml::RefPtr<fml::TaskRunner> worker_task_runner) { | ||
| if (!worker_task_runner) { | ||
| return nullptr; | ||
| } | ||
| return std::shared_ptr<PipelineCompileQueueGLES>( | ||
| new PipelineCompileQueueGLES(std::move(worker_task_runner))); | ||
| } | ||
|
|
||
| PipelineCompileQueueGLES::PipelineCompileQueueGLES( | ||
| fml::RefPtr<fml::TaskRunner> worker_task_runner) | ||
| : worker_task_runner_(std::move(worker_task_runner)) {} | ||
|
|
||
| PipelineCompileQueueGLES::~PipelineCompileQueueGLES() = default; | ||
|
|
||
| void PipelineCompileQueueGLES::OnJobAdded() { | ||
| Lock lock(processing_mutex_); | ||
| if (!is_processing_) { | ||
| is_processing_ = true; | ||
| DrainPendingJobs(); | ||
| } | ||
| } | ||
|
|
||
| void PipelineCompileQueueGLES::PostJob(const fml::closure& job) { | ||
| if (!job) { | ||
| return; | ||
| } | ||
|
|
||
| worker_task_runner_->PostTask(job); | ||
| } | ||
|
|
||
| void PipelineCompileQueueGLES::DrainPendingJobs() { | ||
| PostJob([weak_queue = weak_from_this()]() { | ||
| if (auto queue = std::static_pointer_cast<PipelineCompileQueueGLES>( | ||
| weak_queue.lock())) { | ||
| queue->DoOneJob(); | ||
| { | ||
| Lock lock(queue->processing_mutex_); | ||
| if (!queue->HasPendingJobs()) { | ||
| queue->is_processing_ = false; | ||
| return; | ||
| } | ||
| } | ||
| queue->DrainPendingJobs(); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| } // namespace impeller | ||
52 changes: 52 additions & 0 deletions
52
engine/src/flutter/impeller/renderer/backend/gles/pipeline_compile_queue_gles.h
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 |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PIPELINE_COMPILE_QUEUE_GLES_H_ | ||
| #define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PIPELINE_COMPILE_QUEUE_GLES_H_ | ||
|
|
||
| #include "flutter/fml/closure.h" | ||
| #include "flutter/fml/task_runner.h" | ||
| #include "impeller/base/thread.h" | ||
| #include "impeller/renderer/pipeline_compile_queue.h" | ||
|
|
||
| namespace impeller { | ||
|
|
||
| class PipelineCompileQueueGLES : public PipelineCompileQueue { | ||
| public: | ||
| static std::shared_ptr<PipelineCompileQueueGLES> Create( | ||
| fml::RefPtr<fml::TaskRunner> worker_task_runner); | ||
|
|
||
| explicit PipelineCompileQueueGLES( | ||
| fml::RefPtr<fml::TaskRunner> worker_task_runner); | ||
|
|
||
| ~PipelineCompileQueueGLES() override; | ||
|
|
||
| PipelineCompileQueueGLES(const PipelineCompileQueueGLES&) = delete; | ||
|
|
||
| PipelineCompileQueueGLES& operator=(const PipelineCompileQueueGLES&) = delete; | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| /// @brief Post a job to the worker task runner. | ||
| /// | ||
| /// @param[in] job The job | ||
| /// | ||
| void PostJob(const fml::closure& job) override; | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| /// @brief Called after a job has been added to the queue. Implements | ||
| /// the sequential scheduling strategy for GLES. | ||
| /// | ||
| void OnJobAdded() override; | ||
|
|
||
| private: | ||
| void DrainPendingJobs(); | ||
|
|
||
| fml::RefPtr<fml::TaskRunner> worker_task_runner_; | ||
| Mutex processing_mutex_; | ||
| bool is_processing_ IPLR_GUARDED_BY(processing_mutex_) = false; | ||
| }; | ||
|
|
||
| } // namespace impeller | ||
|
|
||
| #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PIPELINE_COMPILE_QUEUE_GLES_H_ |
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
Oops, something went wrong.
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.