New issue
Advanced search Search tips

Issue 723770 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature



Sign in to add a comment

Simplify/refactor command buffer service implementation

Project Member Reported by piman@chromium.org, May 17 2017

Issue description

The origins of the command buffer service implementation are arcane and overly complex. Many classes are involved, with curious dependencies between them, and duplication of responsibility.
Some examples:
- CommandParser, CommmandExecutor and CommandBufferService are always 1:1 with each other, but duplicate a lot of information (e.g. the "get" pointer is in at least 4 different places, and updated via callbacks and virtual functions)
- layering between those as well as CommonDecoder/GLES2Decoder and GpuCommandBufferStub/InProcessCommandBuffer is unclear/broken, with (over-)use of callbacks and ill-defined interfaces, and results in inconsistencies between out-of-process vs in-process implementations
- CommandExecutor is strongly coupled to GLES2Decoder for no good reason
- setting up a command buffer service for e.g. tests is complicated, and essentially cargo-culted all over the place, making maintenance harder
- CommandBufferService does both too much and too little. It wants to implement CommandBuffer (the client interface for GLES2Implementation), but at the same time provide a common implementation of the service-side. However, just by itself, calling CommandBufferService::Flush does nothing at all, since it needs a CommmandExecutor/CommandParser to be hooked up to it via callbacks.


All this makes it even harder to build different command-buffer backends (e.g. dedicated skia).


My proposal (so far):
- eliminate CommandParser, merging into CommandExecutor
- eliminate CommandBufferEngine (replace with CommandBufferServiceBase as the client interface in CommonDecoder)
- make CommandBufferService focus on the service-side, and move all the client-side logic (used for tests) into a CommandBufferDirect, that would set everything up together into a usable CommandBuffer. Tests migrate to use CommandBufferDirect. Merge CommandBufferService and CommandExecutor to remove unnecessary callback-based logic
- provide a client interface for GLES2Decoder instead of the multitude of callbacks


I started on all this, and so far this leads to significant code reduction/de-duplication.
 
Project Member

Comment 1 by bugdroid1@chromium.org, May 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e0990c1c488c5e92c27d73f54308346158dd6494

commit e0990c1c488c5e92c27d73f54308346158dd6494
Author: Antoine Labour <piman@chromium.org>
Date: Thu May 18 05:04:30 2017

Merge CommandParser into CommandExecutor

Those classes are 1:1 and CommandParser is sufficiently simple that it
doesn't make a lot of sense to keep it separate.

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: I51bf99eb4946f9d9d6e414027a86c6de2d9e7bdc
Reviewed-on: https://chromium-review.googlesource.com/508169
Commit-Queue: Antoine Labour <piman@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#472673}
[modify] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/BUILD.gn
[modify] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/command_buffer/client/client_test_helper.cc
[modify] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/command_buffer/client/client_test_helper.h
[modify] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/command_buffer/client/cmd_buffer_helper_test.cc
[delete] https://crrev.com/9c3d5f7e6f7c35d6f32af29a1c5e081afe6b9475/gpu/command_buffer/common/command_buffer_mock.cc
[delete] https://crrev.com/9c3d5f7e6f7c35d6f32af29a1c5e081afe6b9475/gpu/command_buffer/common/command_buffer_mock.h
[modify] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/command_buffer/service/BUILD.gn
[add] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/command_buffer/service/async_api_interface.cc
[add] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/command_buffer/service/async_api_interface.h
[delete] https://crrev.com/9c3d5f7e6f7c35d6f32af29a1c5e081afe6b9475/gpu/command_buffer/service/cmd_parser.cc
[delete] https://crrev.com/9c3d5f7e6f7c35d6f32af29a1c5e081afe6b9475/gpu/command_buffer/service/cmd_parser.h
[delete] https://crrev.com/9c3d5f7e6f7c35d6f32af29a1c5e081afe6b9475/gpu/command_buffer/service/cmd_parser_test.cc
[modify] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/command_buffer/service/command_executor.cc
[modify] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/command_buffer/service/command_executor.h
[modify] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/command_buffer/service/command_executor_unittest.cc
[modify] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/command_buffer/service/common_decoder.h
[modify] https://crrev.com/e0990c1c488c5e92c27d73f54308346158dd6494/gpu/command_buffer/service/mocks.h

Project Member

Comment 2 by bugdroid1@chromium.org, May 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/06b3dd177f562f342eac5c4bf3e541b231afeda2

commit 06b3dd177f562f342eac5c4bf3e541b231afeda2
Author: Antoine Labour <piman@chromium.org>
Date: Fri May 19 03:18:56 2017

Remove CommandBufferEngine

The only non-test implementation of CommandBufferEngine
(CommandExecutor) directly forwards to CommandBufferServiceBase, so
eliminate CommandBufferEngine and have CommonDecoder use
CommandBufferServiceBase directly.

Make CommandBufferServiceBase not derive from CommandBuffer (since
neither CommonDecoder nor CommandExecutor need it), and instead make the
relevant implementations (e.g. CommandBufferService) explicitly
implement CommandBuffer.

Rename the test class MockCommandBufferBase into
FakeCommandBufferServiceBase (since it's a fake, not a mock), and move
the CommandBuffer part of its implementation onto
MockClientCommandBuffer. Use it instead of various CommandBufferEngine
mocks/fakes.

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: Ia1386fa7f8617962739a36a397d508e61e4514e2
Reviewed-on: https://chromium-review.googlesource.com/508114
Commit-Queue: Antoine Labour <piman@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#473056}
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/client/client_test_helper.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/client/client_test_helper.h
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/client/cmd_buffer_helper_test.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/client/fenced_allocator_test.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/client/mapped_memory_unittest.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/client/ring_buffer_test.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/client/transfer_buffer_unittest.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/BUILD.gn
[delete] https://crrev.com/1aa2783638e90007c9e1b0a67beafc2080780faa/gpu/command_buffer/service/cmd_buffer_engine.h
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/command_buffer_service.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/command_buffer_service.h
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/command_executor.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/command_executor.h
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/command_executor_unittest.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/common_decoder.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/common_decoder.h
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/common_decoder_unittest.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest.h
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_attribs.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_buffers.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_context_lost.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_context_state.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/mocks.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/mocks.h
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/service/query_manager_unittest.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/tests/fuzzer_main.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/command_buffer/tests/gl_manager.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/gles2_conform_support/egl/context.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/ipc/in_process_command_buffer.h
[modify] https://crrev.com/06b3dd177f562f342eac5c4bf3e541b231afeda2/gpu/ipc/service/gpu_command_buffer_stub.cc

Project Member

Comment 3 by bugdroid1@chromium.org, May 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7a77178ed92f7630565c29bfae80df24f89e4ab0

commit 7a77178ed92f7630565c29bfae80df24f89e4ab0
Author: Tim Sergeant <tsergeant@chromium.org>
Date: Fri May 19 03:35:17 2017

Revert "Remove CommandBufferEngine"

This reverts commit 06b3dd177f562f342eac5c4bf3e541b231afeda2.

Reason for revert: Causes compile to fail on Linux x64:
https://build.chromium.org/p/chromium/builders/Linux%20x64/builds/40052

Original change's description:
> Remove CommandBufferEngine
> 
> The only non-test implementation of CommandBufferEngine
> (CommandExecutor) directly forwards to CommandBufferServiceBase, so
> eliminate CommandBufferEngine and have CommonDecoder use
> CommandBufferServiceBase directly.
> 
> Make CommandBufferServiceBase not derive from CommandBuffer (since
> neither CommonDecoder nor CommandExecutor need it), and instead make the
> relevant implementations (e.g. CommandBufferService) explicitly
> implement CommandBuffer.
> 
> Rename the test class MockCommandBufferBase into
> FakeCommandBufferServiceBase (since it's a fake, not a mock), and move
> the CommandBuffer part of its implementation onto
> MockClientCommandBuffer. Use it instead of various CommandBufferEngine
> mocks/fakes.
> 
> Bug:  723770 
> Cq-Include-Trybots: 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
> Change-Id: Ia1386fa7f8617962739a36a397d508e61e4514e2
> Reviewed-on: https://chromium-review.googlesource.com/508114
> Commit-Queue: Antoine Labour <piman@chromium.org>
> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#473056}

TBR=zmo@chromium.org,piman@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Bug:  723770 

Change-Id: Ie7345f57f90bc8a3bdf43936a6ef6e655c613ae2
Reviewed-on: https://chromium-review.googlesource.com/509329
Reviewed-by: Tim Sergeant <tsergeant@chromium.org>
Commit-Queue: Tim Sergeant <tsergeant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#473060}
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/client/client_test_helper.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/client/client_test_helper.h
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/client/cmd_buffer_helper_test.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/client/fenced_allocator_test.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/client/mapped_memory_unittest.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/client/ring_buffer_test.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/client/transfer_buffer_unittest.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/BUILD.gn
[add] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/cmd_buffer_engine.h
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/command_buffer_service.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/command_buffer_service.h
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/command_executor.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/command_executor.h
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/command_executor_unittest.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/common_decoder.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/common_decoder.h
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/common_decoder_unittest.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest.h
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_attribs.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_buffers.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_context_lost.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_context_state.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/mocks.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/mocks.h
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/service/query_manager_unittest.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/tests/fuzzer_main.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/command_buffer/tests/gl_manager.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/gles2_conform_support/egl/context.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/ipc/in_process_command_buffer.h
[modify] https://crrev.com/7a77178ed92f7630565c29bfae80df24f89e4ab0/gpu/ipc/service/gpu_command_buffer_stub.cc

Project Member

Comment 4 by bugdroid1@chromium.org, May 23 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/33555ecca59105463ef54770a335ec09f8bfc813

commit 33555ecca59105463ef54770a335ec09f8bfc813
Author: Antoine Labour <piman@chromium.org>
Date: Tue May 23 21:16:58 2017

Reland: Remove CommandBufferEngine

The only non-test implementation of CommandBufferEngine
(CommandExecutor) directly forwards to CommandBufferServiceBase, so
eliminate CommandBufferEngine and have CommonDecoder use
CommandBufferServiceBase directly.

Make CommandBufferServiceBase not derive from CommandBuffer (since
neither CommonDecoder nor CommandExecutor need it), and instead make the
relevant implementations (e.g. CommandBufferService) explicitly
implement CommandBuffer.

Rename the test class MockCommandBufferBase into
FakeCommandBufferServiceBase (since it's a fake, not a mock), and move
the CommandBuffer part of its implementation onto
MockClientCommandBuffer. Use it instead of various CommandBufferEngine
mocks/fakes.

Bug:  723770 
TBR: zmo@chromium.org
Cq-Include-Trybots: 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
Change-Id: I2baff556dec3b84e06b1b943b37a0d1ce5398bb4
Reviewed-on: https://chromium-review.googlesource.com/510785
Commit-Queue: Antoine Labour <piman@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#474056}
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/client/client_test_helper.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/client/client_test_helper.h
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/client/cmd_buffer_helper_test.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/client/fenced_allocator_test.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/client/mapped_memory_unittest.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/client/ring_buffer_test.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/client/transfer_buffer_unittest.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/BUILD.gn
[delete] https://crrev.com/2ea7908fea095d9644122e8391ed2fb87fd2e621/gpu/command_buffer/service/cmd_buffer_engine.h
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/command_buffer_service.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/command_buffer_service.h
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/command_executor.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/command_executor.h
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/command_executor_unittest.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/common_decoder.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/common_decoder.h
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/common_decoder_unittest.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest.h
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_attribs.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_buffers.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_context_lost.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_context_state.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/mocks.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/mocks.h
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/service/query_manager_unittest.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/tests/fuzzer_main.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/command_buffer/tests/gl_manager.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/gles2_conform_support/egl/context.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/ipc/in_process_command_buffer.h
[modify] https://crrev.com/33555ecca59105463ef54770a335ec09f8bfc813/gpu/ipc/service/gpu_command_buffer_stub.cc

Project Member

Comment 5 by bugdroid1@chromium.org, May 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3617b0eea7ec74b8e731a23fed2f4070cbc284c4

commit 3617b0eea7ec74b8e731a23fed2f4070cbc284c4
Author: Antoine Labour <piman@chromium.org>
Date: Wed May 24 00:08:05 2017

Have GLES2DecoderImpl tell CommandBufferService directly about the lost context reason

This is a step to decouple CommandExecutor from GLES2Decoder.
Complex logic to track and update the lost context reason is not
necessary any more since GLES2DecoderImpl can directly set it on the
CommandBufferService.

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: I781aba5b884855b07ea2d7d4c88344b7e6dd8b3f
Reviewed-on: https://chromium-review.googlesource.com/508447
Commit-Queue: Antoine Labour <piman@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#474114}
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/command_buffer/service/command_executor.cc
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/command_buffer/service/gles2_cmd_decoder.h
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/command_buffer/service/gles2_cmd_decoder_unittest_context_lost.cc
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/command_buffer/tests/fuzzer_main.cc
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/command_buffer/tests/gl_manager.cc
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/3617b0eea7ec74b8e731a23fed2f4070cbc284c4/gpu/ipc/service/gpu_command_buffer_stub.cc

Project Member

Comment 6 by bugdroid1@chromium.org, May 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3aaa590fd055d8bd568b03b03419240a7cb56f10

commit 3aaa590fd055d8bd568b03b03419240a7cb56f10
Author: Antoine Labour <piman@chromium.org>
Date: Wed May 24 17:06:33 2017

Decouple CommandExecutor from GLES2Decoder

This would allow other types of handlers (e.g. minimal resource management,
skia). This eliminates some complexity (unnecessary hops) as well as some
duplication.

1- move BeginDecoding, EndDecoding and GetLogPrefix to AsyncAPIInterface
2- have InProcessCommandBuffer/GpuCommandBufferStub/GLManager/... directly call
into the decoder for PerformIdleWork/ProcessPendingQueries/PerformPollingWork,
instead of using the CommandExecutor (which just forwards it to the decoder
prior to this patch)

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: Iffe451f6a0a3973b9c11e42bdb01972c9466acc4
Reviewed-on: https://chromium-review.googlesource.com/513522
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#474332}
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/client/cmd_buffer_helper_test.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/client/fenced_allocator_test.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/client/mapped_memory_unittest.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/client/ring_buffer_test.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/service/async_api_interface.h
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/service/command_executor.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/service/command_executor.h
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/service/command_executor_unittest.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/service/common_decoder_unittest.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/service/gles2_cmd_decoder.h
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/service/mocks.h
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/tests/fuzzer_main.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/command_buffer/tests/gl_manager.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/gles2_conform_support/egl/context.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/3aaa590fd055d8bd568b03b03419240a7cb56f10/gpu/ipc/service/gpu_command_buffer_stub.cc

Project Member

Comment 7 by bugdroid1@chromium.org, May 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ac648292e89cd0818b908e46f35c2456864778c5

commit ac648292e89cd0818b908e46f35c2456864778c5
Author: Antoine Labour <piman@chromium.org>
Date: Thu May 25 02:04:29 2017

Simplify AsyncAPIInterface

1- Remove DoCommand, and make DoCommands pure virtual
   The default implementation of DoCommands is only used in tests, so move it
   (after simplification) to AsyncAPIMock::FakeDoCommands
2- Remove GetCommandName, it's not used publicly.

It turns out that CommonDecoder then doesn't implement any AsyncAPIInterface, so
make it concrete and make GLES2Decoder derive from it instead.

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: Ib993af97336c2bae3ac30db15663926e5157452a
Reviewed-on: https://chromium-review.googlesource.com/514483
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#474522}
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/BUILD.gn
[delete] https://crrev.com/4e98ce65239c3022133064637835602cb3d458c2/gpu/command_buffer/service/async_api_interface.cc
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/async_api_interface.h
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/common_decoder.h
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/common_decoder_unittest.cc
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/gles2_cmd_decoder.h
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/gles2_cmd_decoder_mock.cc
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/mocks.cc
[modify] https://crrev.com/ac648292e89cd0818b908e46f35c2456864778c5/gpu/command_buffer/service/mocks.h

Project Member

Comment 8 by bugdroid1@chromium.org, May 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e7e2da67f4d4193974751e59ab69325bb72195aa

commit e7e2da67f4d4193974751e59ab69325bb72195aa
Author: Antoine Labour <piman@chromium.org>
Date: Thu May 25 18:12:35 2017

Introduce CommandBufferDirect

CommandBufferService does both too much and too little, trying to provide the
service-side implementation as well as providing the client-side CommandBuffer
interface, but doing both in an awkward way.
This CL separates the concerns:
1- CommandBufferService doesn't implement CommandBuffer any more. Its only
   concerns is providing the service-side functionality: tracking state,
   tracking transfer buffers, executing commands (via callback).
2- CommandBufferDirect is an implementation of CommandBuffer which direclty uses
   CommandBufferService (flushes immediately). This is used for tests. It
   swallows the CommandExecutor and SyncPoint logic to factor a lot of the logic
   across tests.

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: I49ed3f460569caae10b1c5edb08dc0c232ffec0f
Reviewed-on: https://chromium-review.googlesource.com/514663
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#474707}
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/client/cmd_buffer_helper_test.cc
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/client/fenced_allocator_test.cc
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/client/mapped_memory_unittest.cc
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/client/ring_buffer_test.cc
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/service/BUILD.gn
[add] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/service/command_buffer_direct.cc
[add] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/service/command_buffer_direct.h
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/service/command_buffer_service.cc
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/service/command_buffer_service.h
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/service/command_buffer_service_unittest.cc
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/tests/fuzzer_main.cc
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/tests/gl_manager.cc
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/command_buffer/tests/gl_manager.h
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/gles2_conform_support/egl/context.cc
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/gles2_conform_support/egl/context.h
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/e7e2da67f4d4193974751e59ab69325bb72195aa/gpu/ipc/service/gpu_command_buffer_stub.cc

Project Member

Comment 9 by bugdroid1@chromium.org, May 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/689c26a5f99f6e3f991ddfe4e194a93aab97b4de

commit 689c26a5f99f6e3f991ddfe4e194a93aab97b4de
Author: Antoine Labour <piman@chromium.org>
Date: Thu May 25 21:01:43 2017

Skip trampoline PutOffsetChange callbacks

In both InProcessCommandBuffer and GpuCommandBufferStub we install a
callback that sets up some state before calling
CommandExecutor::PutChanged. Since the callback is only called from
CommandBufferService::Flush, we can instead set this state before
calling it, leading to a small simplification, but more importantly
makes all PutOffsetChange callbacks identical (call into
CommandExecutor::PutChanged directly), which will allow further
simplification.

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: I515d87eac976093dc3009961b7f16806be6255d5
Reviewed-on: https://chromium-review.googlesource.com/516022
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#474800}
[modify] https://crrev.com/689c26a5f99f6e3f991ddfe4e194a93aab97b4de/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/689c26a5f99f6e3f991ddfe4e194a93aab97b4de/gpu/ipc/service/gpu_command_buffer_stub.cc
[modify] https://crrev.com/689c26a5f99f6e3f991ddfe4e194a93aab97b4de/gpu/ipc/service/gpu_command_buffer_stub.h

Project Member

Comment 10 by bugdroid1@chromium.org, May 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/be0c1281af4417e8b27b967cc067ad388e577bf8

commit be0c1281af4417e8b27b967cc067ad388e577bf8
Author: Antoine Labour <piman@chromium.org>
Date: Fri May 26 01:17:08 2017

Merge CommmandExecutor with CommandBufferService

CommandExecutor and CommandBufferService are always 1:1 and at this
point they're always hooked the same way via callbacks. Since they track
some of the same state, it simplifies a lot to merge them together.

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: I4b3b2372d53114472bf945fcfabd4c102678799b
Reviewed-on: https://chromium-review.googlesource.com/516422
Commit-Queue: Antoine Labour <piman@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#474863}
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/BUILD.gn
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/client/client_test_helper.cc
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/client/client_test_helper.h
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/client/cmd_buffer_helper_test.cc
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/client/gles2_implementation_unittest.cc
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/service/BUILD.gn
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/service/command_buffer_direct.cc
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/service/command_buffer_direct.h
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/service/command_buffer_service.cc
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/service/command_buffer_service.h
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/service/command_buffer_service_unittest.cc
[delete] https://crrev.com/dc76416e2ba1b9669cf7240ca693b8d38c8ba989/gpu/command_buffer/service/command_executor.cc
[delete] https://crrev.com/dc76416e2ba1b9669cf7240ca693b8d38c8ba989/gpu/command_buffer/service/command_executor.h
[delete] https://crrev.com/dc76416e2ba1b9669cf7240ca693b8d38c8ba989/gpu/command_buffer/service/command_executor_unittest.cc
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/service/mocks.cc
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/tests/fuzzer_main.cc
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/command_buffer/tests/gl_manager.cc
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/ipc/in_process_command_buffer.h
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/ipc/service/gpu_command_buffer_stub.cc
[modify] https://crrev.com/be0c1281af4417e8b27b967cc067ad388e577bf8/gpu/ipc/service/gpu_command_buffer_stub.h

Project Member

Comment 11 by bugdroid1@chromium.org, May 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/293e93eb3bcfbcc23fc6a1c644a624a1ca0d4bdc

commit 293e93eb3bcfbcc23fc6a1c644a624a1ca0d4bdc
Author: Antoine Labour <piman@chromium.org>
Date: Fri May 26 22:21:21 2017

CommandBufferService: replace callbacks with interface

This makes the interaction with the client a bit more straightforward
(and efficient?).

This also merges the PauseExecution and CommandProcessed callbacks,
since they are both called once per command batch.

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: Ie23c37ac2a61cf48bf8888b00ac1036719adcb73
Reviewed-on: https://chromium-review.googlesource.com/516525
Commit-Queue: Antoine Labour <piman@chromium.org>
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#475163}
[modify] https://crrev.com/293e93eb3bcfbcc23fc6a1c644a624a1ca0d4bdc/gpu/command_buffer/service/command_buffer_direct.cc
[modify] https://crrev.com/293e93eb3bcfbcc23fc6a1c644a624a1ca0d4bdc/gpu/command_buffer/service/command_buffer_direct.h
[modify] https://crrev.com/293e93eb3bcfbcc23fc6a1c644a624a1ca0d4bdc/gpu/command_buffer/service/command_buffer_service.cc
[modify] https://crrev.com/293e93eb3bcfbcc23fc6a1c644a624a1ca0d4bdc/gpu/command_buffer/service/command_buffer_service.h
[modify] https://crrev.com/293e93eb3bcfbcc23fc6a1c644a624a1ca0d4bdc/gpu/command_buffer/service/command_buffer_service_unittest.cc
[modify] https://crrev.com/293e93eb3bcfbcc23fc6a1c644a624a1ca0d4bdc/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/293e93eb3bcfbcc23fc6a1c644a624a1ca0d4bdc/gpu/ipc/in_process_command_buffer.h
[modify] https://crrev.com/293e93eb3bcfbcc23fc6a1c644a624a1ca0d4bdc/gpu/ipc/service/gpu_command_buffer_stub.cc
[modify] https://crrev.com/293e93eb3bcfbcc23fc6a1c644a624a1ca0d4bdc/gpu/ipc/service/gpu_command_buffer_stub.h

Project Member

Comment 12 by bugdroid1@chromium.org, Jun 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1bec107da00dbd9dccb047655806d0d03f26ba8f

commit 1bec107da00dbd9dccb047655806d0d03f26ba8f
Author: Antoine Labour <piman@chromium.org>
Date: Wed Jun 07 00:24:14 2017

Clarify lifetime relationship between GLES2Decoder and CommandBufferService

Currently the lifetime of both classes is confusing, because the
CommandBufferService needs the GLES2Decoder to be constructed, but it is
supposed to outlive the GLES2Decoder.

This CL clarifies the relationship: since the decoder is only used in
CommandBufferService::Flush, pass it explicitly there, and that allows making
the GLES2Decoder lifetime to be a strict subset of the CommandBufferService,
without invalid temporary states.

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: I24c20da70510c2fbab73e69d4dc2a8a1a157366c
Reviewed-on: https://chromium-review.googlesource.com/523036
Commit-Queue: Antoine Labour <piman@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#477484}
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/BUILD.gn
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/client/client_test_helper.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/client/cmd_buffer_helper_test.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/client/fenced_allocator_test.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/client/mapped_memory_unittest.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/client/ring_buffer_test.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/command_buffer_direct.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/command_buffer_direct.h
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/command_buffer_service.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/command_buffer_service.h
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/command_buffer_service_unittest.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/common_decoder.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/common_decoder.h
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/common_decoder_unittest.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/context_group_unittest.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/framebuffer_manager_unittest.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/gl_context_virtual_unittest.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/gles2_cmd_decoder.h
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/gles2_cmd_decoder_mock.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/gpu_tracer_unittest.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/mocks.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/mocks.h
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/query_manager_unittest.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/service_discardable_manager_unittest.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/service/texture_manager_unittest.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/tests/fuzzer_main.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/command_buffer/tests/gl_manager.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/gles2_conform_support/egl/context.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/gpu/ipc/service/gpu_command_buffer_stub.cc
[modify] https://crrev.com/1bec107da00dbd9dccb047655806d0d03f26ba8f/media/gpu/android_video_decode_accelerator_unittest.cc

Project Member

Comment 13 by bugdroid1@chromium.org, Jun 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f679fa4452d67336adf21057e72205f491b70f61

commit f679fa4452d67336adf21057e72205f491b70f61
Author: Antoine Labour <piman@chromium.org>
Date: Wed Jun 07 00:37:12 2017

Replace GLES2Decoder callbacks by a GLES2DecoderClient interface

This reduces the need to test for callbacks (always set in production) and
significantly simplifies initialization code.

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: I8d702171a28748d5bd27a5cb228b1589c7575298
Reviewed-on: https://chromium-review.googlesource.com/524895
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#477488}
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/command_buffer_direct.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/command_buffer_direct.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/gles2_cmd_decoder.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/logger.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/logger.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/memory_program_cache.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/memory_program_cache.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/memory_program_cache_unittest.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/mocks.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/program_cache.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/program_cache_unittest.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/program_manager.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/program_manager.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/service/program_manager_unittest.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/tests/fuzzer_main.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/tests/gl_deschedule_unittest.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/tests/gl_manager.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/command_buffer/tests/gl_manager.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/gles2_conform_support/egl/context.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/ipc/client/command_buffer_proxy_impl.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/ipc/in_process_command_buffer.h
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/ipc/service/gpu_command_buffer_stub.cc
[modify] https://crrev.com/f679fa4452d67336adf21057e72205f491b70f61/gpu/ipc/service/gpu_command_buffer_stub.h

Android Release (NVIDIA Shield TV) started failing GLSurfaceTextureTest.SimpleTest reliably, starting with:
https://build.chromium.org/p/chromium.gpu.fyi/builders/Android%20Release%20%28NVIDIA%20Shield%20TV%29/builds/1530

Suspecting
1bec107da00dbd9dccb047655806d0d03f26ba8f (#12 above)
or
f679fa4452d67336adf21057e72205f491b70f61 (#13 above)
from the blamelist in that build.

C   57.439s Main  [FAIL] GLSurfaceTextureTest.SimpleTest:
C   57.439s Main  [ RUN      ] GLSurfaceTextureTest.SimpleTest
C   57.439s Main  [ERROR:gles2_cmd_decoder.cc(4284)]   GLES2DecoderImpl: Context lost during MakeCurrent.
C   57.439s Main  ../../gpu/command_buffer/tests/gl_manager.cc:190: Failure
C   57.439s Main        Expected: ::gpu::error::kNoError
C   57.439s Main        Which is: 0
C   57.439s Main  To be equal to: state.error
C   57.439s Main        Which is: 5
C   57.439s Main  ../../gpu/command_buffer/tests/gl_manager.cc:190: Failure
C   57.439s Main        Expected: ::gpu::error::kNoError
C   57.440s Main        Which is: 0
C   57.440s Main  To be equal to: state.error
C   57.440s Main        Which is: 5
C   57.440s Main  ../../gpu/command_buffer/tests/gl_manager.cc:190: Failure
C   57.440s Main        Expected: ::gpu::error::kNoError
C   57.440s Main        Which is: 0
C   57.440s Main  To be equal to: state.error
C   57.440s Main        Which is: 5
C   57.440s Main  [  FAILED  ] GLSurfaceTextureTest.SimpleTest (53 ms)

-wrangler
Probably #12, I think I have an idea what's going on.
Cc: cwallez@chromium.org
Project Member

Comment 18 by bugdroid1@chromium.org, Jun 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/db6f4d799bca3afa95c5a560f337639c87b6f2be

commit db6f4d799bca3afa95c5a560f337639c87b6f2be
Author: Antoine Labour <piman@chromium.org>
Date: Fri Jun 09 20:40:45 2017

Call MakeCurrent in GLManager::SetSurface

Prior to https://chromium-review.googlesource.com/523036 , in gl_tests,
GLES2Decoder::MakeCurrent was called before every Flush, but after it, it was
called on GLManager::MakeCurrent. GLSurfaceTextureTest relied on it being called
after GLManager::SetSurface, so restore it there too. Rationale is, SetSurface
changes the current surface, so MakeCurrent needs to be called to update it at
the driver level.

Bug:  723770 
Cq-Include-Trybots: 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
Change-Id: I75360745959cbaec8db39df449f7192f3d44bfc6
Reviewed-on: https://chromium-review.googlesource.com/529611
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#478402}
[modify] https://crrev.com/db6f4d799bca3afa95c5a560f337639c87b6f2be/gpu/command_buffer/tests/gl_manager.cc

Comment 19 by piman@chromium.org, Jun 13 2017

+3747
-6240

Going to call this fixed, the problems identified in the summary are addressed. We can always do more.

Comment 20 by piman@chromium.org, Jun 27 2017

Status: Fixed (was: Started)

Sign in to add a comment