gpu: GPU service scheduler

Desktop / Chromium - sunnyps [chromium.org] - 11 May 2017 22:26 UTC

The GPU service scheduler runs tasks (closures) containing command buffer work. Tasks are enqueued in sequences which represent indepdent streams of execution. A task in one sequence may wait on a sync token fence that's released on another sequence. Tasks can specify their sync token fences beforehand so that the scheduler won't run a sequence only to disable it due to a sync token wait. Tasks can check if they should yield so that a higher priority task may run. If a task decides to yield, it can continue execution by supplying a new closure which will run before any other scheduled tasks in that sequence.

The scheduler maintains a priority queue of sequences ordered by sequence priority and then order number. Priority inversion because of sync token dependencies is handled by a simple priority ceiling scheme. Sequences which are expected to release sync tokens dependencies are assigned a priority (HIGH) that's higher than any client specified priorities. However, browser view context sequences can have an even higher priority (REAL_TIME).

GPU channel IPC messages are run as tasks in the scheduler. Each client side stream is mapped to a sequence. The client is expected to use a small number of streams to partition its command buffers so there is no tracking of stream lifetimes in the service. The message filter posts messages as tasks. AsyncFlush is the only message for which sync token dependencies are given to the scheduler.

The initial implementation uses the GPU main thread to run scheduled tasks. Future implementations, for example, could use a worker pool with task traits to specify which thread a task should run on.

R=piman@chromium.org BUG=514813 CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2814843002 Cr-Commit-Position: refs/heads/master@{#471187}

e7e36cc gpu: GPU service scheduler.
.../compositor/gpu_process_transport_factory.cc | 13 +-
content/browser/gpu/compositor_util.cc | 7 +-
content/browser/gpu/gpu_ipc_browsertests.cc | 5 +-
.../renderer_host/compositor_impl_android.cc | 17 +-
.../render_widget_host_view_android.cc | 10 +-
content/common/gpu_stream_constants.h | 26 ++
content/public/browser/gpu_utils.cc | 3 +
content/public/common/content_switches.cc | 6 +
content/public/common/content_switches.h | 2 +
.../renderer/pepper/pepper_video_encoder_host.cc | 8 +-
content/renderer/pepper/ppb_graphics_3d_impl.cc | 3 +-
content/renderer/render_thread_impl.cc | 22 +-
content/renderer/renderer_blink_platform_impl.cc | 6 +-
content/test/layouttest_support.cc | 5 +-
gpu/BUILD.gn | 1 +
gpu/command_buffer/common/BUILD.gn | 2 +
gpu/command_buffer/common/scheduling_priority.cc | 28 ++
gpu/command_buffer/common/scheduling_priority.h | 32 ++
gpu/command_buffer/service/BUILD.gn | 2 +
gpu/command_buffer/service/gles2_cmd_decoder.cc | 3 +
gpu/command_buffer/service/gpu_preferences.h | 3 +
gpu/command_buffer/service/scheduler.cc | 499 +++++++++++++++++++++
gpu/command_buffer/service/scheduler.h | 138 ++++++
gpu/command_buffer/service/scheduler_unittest.cc | 335 ++++++++++++++
gpu/ipc/client/command_buffer_proxy_impl.cc | 6 +-
gpu/ipc/client/command_buffer_proxy_impl.h | 4 +-
gpu/ipc/client/gpu_channel_host.cc | 8 -
gpu/ipc/client/gpu_channel_host.h | 8 -
gpu/ipc/common/BUILD.gn | 1 -
gpu/ipc/common/gpu_messages.h | 2 +-
gpu/ipc/common/gpu_param_traits_macros.h | 5 +-
gpu/ipc/common/gpu_preferences.mojom | 1 +
gpu/ipc/common/gpu_preferences_struct_traits.h | 4 +
gpu/ipc/common/gpu_stream_constants.h | 16 -
gpu/ipc/common/struct_traits_unittest.cc | 2 +
gpu/ipc/service/gpu_channel.cc | 147 ++++--
gpu/ipc/service/gpu_channel.h | 61 ++-
gpu/ipc/service/gpu_channel_manager.cc | 27 +-
gpu/ipc/service/gpu_channel_manager.h | 9 +-
gpu/ipc/service/gpu_channel_test_common.cc | 5 +-
gpu/ipc/service/gpu_channel_unittest.cc | 60 ++-
gpu/ipc/service/gpu_command_buffer_stub.cc | 8 +-
services/ui/gpu/gpu_service.cc | 11 +-
services/ui/gpu/gpu_service.h | 3 +
.../cpp/gpu/context_provider_command_buffer.cc | 2 +-
.../cpp/gpu/context_provider_command_buffer.h | 6 +-
services/ui/public/cpp/gpu/gpu.cc | 14 +-
47 files changed, 1390 insertions(+), 196 deletions(-)

Upstream: git.chromium.org


  • Share