Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
f003d9b4
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f003d9b4
编写于
3月 31, 2020
作者:
L
liyuqian
提交者:
GitHub
3月 31, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
GPU to raster rename, patch 2 (#17428)
上级
6bdbe167
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
43 addition
and
42 deletion
+43
-42
fml/raster_thread_merger.cc
fml/raster_thread_merger.cc
+1
-1
fml/raster_thread_merger.h
fml/raster_thread_merger.h
+1
-1
lib/ui/compositing/scene_host.cc
lib/ui/compositing/scene_host.cc
+2
-2
lib/ui/painting/picture.cc
lib/ui/painting/picture.cc
+1
-1
shell/common/shell.cc
shell/common/shell.cc
+38
-37
未找到文件。
fml/raster_thread_merger.cc
浏览文件 @
f003d9b4
...
@@ -63,7 +63,7 @@ RasterThreadStatus RasterThreadMerger::DecrementLease() {
...
@@ -63,7 +63,7 @@ RasterThreadStatus RasterThreadMerger::DecrementLease() {
lease_term_
--
;
lease_term_
--
;
if
(
lease_term_
==
0
)
{
if
(
lease_term_
==
0
)
{
bool
success
=
task_queues_
->
Unmerge
(
platform_queue_id_
);
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
;
is_merged_
=
false
;
return
RasterThreadStatus
::
kUnmergedNow
;
return
RasterThreadStatus
::
kUnmergedNow
;
}
}
...
...
fml/raster_thread_merger.h
浏览文件 @
f003d9b4
...
@@ -33,7 +33,7 @@ class RasterThreadMerger
...
@@ -33,7 +33,7 @@ class RasterThreadMerger
void
ExtendLeaseTo
(
size_t
lease_term
);
void
ExtendLeaseTo
(
size_t
lease_term
);
// Returns |RasterThreadStatus::kUnmergedNow| if this call resulted in
// 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
();
RasterThreadStatus
DecrementLease
();
bool
IsMerged
()
const
;
bool
IsMerged
()
const
;
...
...
lib/ui/compositing/scene_host.cc
浏览文件 @
f003d9b4
...
@@ -188,8 +188,8 @@ SceneHost::SceneHost(fml::RefPtr<zircon::dart::Handle> viewHolderToken,
...
@@ -188,8 +188,8 @@ SceneHost::SceneHost(fml::RefPtr<zircon::dart::Handle> viewHolderToken,
scene_host_bindings
.
emplace
(
std
::
make_pair
(
key
,
scene_host
));
scene_host_bindings
.
emplace
(
std
::
make_pair
(
key
,
scene_host
));
};
};
// Pass the raw handle to the
GPU thead; destroying a |zircon::dart::Handle|
// Pass the raw handle to the
raster thread; destroying a
// on that thread can cause a race condition.
//
|zircon::dart::Handle|
on that thread can cause a race condition.
raster_task_runner_
->
PostTask
(
raster_task_runner_
->
PostTask
(
[
id
=
koid_
,
[
id
=
koid_
,
ui_task_runner
=
ui_task_runner
=
...
...
lib/ui/painting/picture.cc
浏览文件 @
f003d9b4
...
@@ -115,7 +115,7 @@ Dart_Handle Picture::RasterizeToImage(sk_sp<SkPicture> picture,
...
@@ -115,7 +115,7 @@ Dart_Handle Picture::RasterizeToImage(sk_sp<SkPicture> picture,
delete
image_callback
;
delete
image_callback
;
});
});
// Kick things off on the
GPU
.
// Kick things off on the
raster rask runner
.
fml
::
TaskRunner
::
RunNowOrPostTask
(
fml
::
TaskRunner
::
RunNowOrPostTask
(
raster_task_runner
,
raster_task_runner
,
[
ui_task_runner
,
snapshot_delegate
,
picture
,
picture_bounds
,
ui_task
]
{
[
ui_task_runner
,
snapshot_delegate
,
picture
,
picture_bounds
,
ui_task
]
{
...
...
shell/common/shell.cc
浏览文件 @
f003d9b4
...
@@ -605,7 +605,7 @@ void Shell::OnPlatformViewCreated(std::unique_ptr<Surface> surface) {
...
@@ -605,7 +605,7 @@ void Shell::OnPlatformViewCreated(std::unique_ptr<Surface> surface) {
// setup/suspension of all activities that may be interacting with the GPU in
// setup/suspension of all activities that may be interacting with the GPU in
// a synchronous fashion.
// a synchronous fashion.
fml
::
AutoResetWaitableEvent
latch
;
fml
::
AutoResetWaitableEvent
latch
;
auto
gpu
_task
=
auto
raster
_task
=
fml
::
MakeCopyable
([
&
waiting_for_first_frame
=
waiting_for_first_frame_
,
fml
::
MakeCopyable
([
&
waiting_for_first_frame
=
waiting_for_first_frame_
,
rasterizer
=
rasterizer_
->
GetWeakPtr
(),
//
rasterizer
=
rasterizer_
->
GetWeakPtr
(),
//
surface
=
std
::
move
(
surface
),
//
surface
=
std
::
move
(
surface
),
//
...
@@ -623,19 +623,20 @@ void Shell::OnPlatformViewCreated(std::unique_ptr<Surface> surface) {
...
@@ -623,19 +623,20 @@ void Shell::OnPlatformViewCreated(std::unique_ptr<Surface> surface) {
// The normal flow executed by this method is that the platform thread is
// 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
// 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
// raster_task to the raster thread which signals the latch. If the raster and
// platform threads are the same this results in a deadlock as the gpu_task
// the platform threads are the same this results in a deadlock as the
// will never be posted to the plaform/raster thread that is blocked on a
// raster_task will never be posted to the plaform/raster thread that is
// latch. To avoid the described deadlock, if the raster and the platform
// blocked on a latch. To avoid the described deadlock, if the raster and the
// threads are the same, should_post_gpu_task will be false, and then instead
// platform threads are the same, should_post_raster_task will be false, and
// of posting a task to the raster thread, the ui thread just signals the
// then instead of posting a task to the raster thread, the ui thread just
// latch and the platform/raster thread follows with executing gpu_task.
// signals the latch and the platform/raster thread follows with executing
bool
should_post_gpu_task
=
task_runners_
.
GetRasterTaskRunner
()
!=
// raster_task.
bool
should_post_raster_task
=
task_runners_
.
GetRasterTaskRunner
()
!=
task_runners_
.
GetPlatformTaskRunner
();
task_runners_
.
GetPlatformTaskRunner
();
auto
ui_task
=
[
engine
=
engine_
->
GetWeakPtr
(),
//
auto
ui_task
=
[
engine
=
engine_
->
GetWeakPtr
(),
//
raster_task_runner
=
task_runners_
.
GetRasterTaskRunner
(),
//
raster_task_runner
=
task_runners_
.
GetRasterTaskRunner
(),
//
gpu_task
,
should_post_gpu
_task
,
raster_task
,
should_post_raster
_task
,
&
latch
//
&
latch
//
]
{
]
{
if
(
engine
)
{
if
(
engine
)
{
...
@@ -643,10 +644,10 @@ void Shell::OnPlatformViewCreated(std::unique_ptr<Surface> surface) {
...
@@ -643,10 +644,10 @@ void Shell::OnPlatformViewCreated(std::unique_ptr<Surface> surface) {
}
}
// Step 2: Next, tell the raster thread that it should create a surface for
// Step 2: Next, tell the raster thread that it should create a surface for
// its rasterizer.
// its rasterizer.
if
(
should_post_
gpu
_task
)
{
if
(
should_post_
raster
_task
)
{
fml
::
TaskRunner
::
RunNowOrPostTask
(
raster_task_runner
,
gpu
_task
);
fml
::
TaskRunner
::
RunNowOrPostTask
(
raster_task_runner
,
raster
_task
);
}
else
{
}
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.
// the platform thread.
latch
.
Signal
();
latch
.
Signal
();
}
}
...
@@ -674,11 +675,11 @@ void Shell::OnPlatformViewCreated(std::unique_ptr<Surface> surface) {
...
@@ -674,11 +675,11 @@ void Shell::OnPlatformViewCreated(std::unique_ptr<Surface> surface) {
fml
::
TaskRunner
::
RunNowOrPostTask
(
task_runners_
.
GetIOTaskRunner
(),
io_task
);
fml
::
TaskRunner
::
RunNowOrPostTask
(
task_runners_
.
GetIOTaskRunner
(),
io_task
);
latch
.
Wait
();
latch
.
Wait
();
if
(
!
should_post_
gpu
_task
)
{
if
(
!
should_post_
raster
_task
)
{
// See comment on should_post_
gpu_task, in this case the gpu
_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
// wasn't executed, and we just run it here as the platform thread
// is the raster thread.
// is the raster thread.
gpu
_task
();
raster
_task
();
}
}
}
}
...
@@ -706,7 +707,7 @@ void Shell::OnPlatformViewDestroyed() {
...
@@ -706,7 +707,7 @@ void Shell::OnPlatformViewDestroyed() {
latch
.
Signal
();
latch
.
Signal
();
};
};
auto
gpu
_task
=
[
rasterizer
=
rasterizer_
->
GetWeakPtr
(),
auto
raster
_task
=
[
rasterizer
=
rasterizer_
->
GetWeakPtr
(),
io_task_runner
=
task_runners_
.
GetIOTaskRunner
(),
io_task_runner
=
task_runners_
.
GetIOTaskRunner
(),
io_task
]()
{
io_task
]()
{
if
(
rasterizer
)
{
if
(
rasterizer
)
{
...
@@ -718,29 +719,29 @@ void Shell::OnPlatformViewDestroyed() {
...
@@ -718,29 +719,29 @@ void Shell::OnPlatformViewDestroyed() {
// The normal flow executed by this method is that the platform thread is
// 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
// 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
//
raster
_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
// thread). If the
raster and the platform threads are the same this results
//
deadlock as the gpu_task will never be posted to the plaform/raster thread
//
in a deadlock as the raster_task will never be posted to the plaform/raster
// th
at is blocked on a latch. To avoid the described deadlock, if the raster
// th
read that is blocked on a latch. To avoid the described deadlock, if the
//
and the platform threads are the same, should_post_gpu_task will be false,
//
raster and the platform threads are the same, should_post_raster_task will
//
and then instead of posting a task to the raster thread, the ui thread just
//
be false, and then instead of posting a task to the raster thread, the ui
//
signals the latch and the platform/raster thread follows with executing
//
thread just signals the latch and the platform/raster thread follows with
//
gpu
_task.
//
executing raster
_task.
bool
should_post_
gpu
_task
=
task_runners_
.
GetRasterTaskRunner
()
!=
bool
should_post_
raster
_task
=
task_runners_
.
GetRasterTaskRunner
()
!=
task_runners_
.
GetPlatformTaskRunner
();
task_runners_
.
GetPlatformTaskRunner
();
auto
ui_task
=
[
engine
=
engine_
->
GetWeakPtr
(),
auto
ui_task
=
[
engine
=
engine_
->
GetWeakPtr
(),
raster_task_runner
=
task_runners_
.
GetRasterTaskRunner
(),
raster_task_runner
=
task_runners_
.
GetRasterTaskRunner
(),
gpu_task
,
should_post_gpu
_task
,
&
latch
]()
{
raster_task
,
should_post_raster
_task
,
&
latch
]()
{
if
(
engine
)
{
if
(
engine
)
{
engine
->
OnOutputSurfaceDestroyed
();
engine
->
OnOutputSurfaceDestroyed
();
}
}
// Step 1: Next, tell the raster thread that its rasterizer should suspend
// Step 1: Next, tell the raster thread that its rasterizer should suspend
// access to the underlying surface.
// access to the underlying surface.
if
(
should_post_
gpu
_task
)
{
if
(
should_post_
raster
_task
)
{
fml
::
TaskRunner
::
RunNowOrPostTask
(
raster_task_runner
,
gpu
_task
);
fml
::
TaskRunner
::
RunNowOrPostTask
(
raster_task_runner
,
raster
_task
);
}
else
{
}
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.
// the platform thread.
latch
.
Signal
();
latch
.
Signal
();
}
}
...
@@ -750,11 +751,11 @@ void Shell::OnPlatformViewDestroyed() {
...
@@ -750,11 +751,11 @@ void Shell::OnPlatformViewDestroyed() {
// surface is about to go away.
// surface is about to go away.
fml
::
TaskRunner
::
RunNowOrPostTask
(
task_runners_
.
GetUITaskRunner
(),
ui_task
);
fml
::
TaskRunner
::
RunNowOrPostTask
(
task_runners_
.
GetUITaskRunner
(),
ui_task
);
latch
.
Wait
();
latch
.
Wait
();
if
(
!
should_post_
gpu
_task
)
{
if
(
!
should_post_
raster
_task
)
{
// See comment on should_post_
gpu_task, in this case the gpu
_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
// wasn't executed, and we just run it here as the platform thread
// is the raster thread.
// is the raster thread.
gpu
_task
();
raster
_task
();
latch
.
Wait
();
latch
.
Wait
();
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录