Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Issue 118203002: During virtual context switches only restore texture units that have changed from the previous cont… (Closed)

Created:
7 years ago by kaanb
Modified:
6 years, 11 months ago
CC:
chromium-reviews, piman+watch_chromium.org, Tom Hudson, boliu, klobag.chromium
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

During virtual context switches only restore texture units that have changed from the previous context. The most CPU consuming operations on the GPU thread for Android are virtual context switches. We attempt to reduce the CPU usage by context switches with this patch. BUG=244701 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=245109

Patch Set 1 #

Patch Set 2 : Cleanup #

Patch Set 3 : Remove TODO #

Patch Set 4 : Add a comment #

Total comments: 7

Patch Set 5 : Use the delta between the ContextStates to decide if we should bind a texture or not #

Total comments: 13

Patch Set 6 : Code review feedback #

Total comments: 6

Patch Set 7 : Incorporate comments and add unit tests #

Total comments: 2

Patch Set 8 : More unittests #

Total comments: 2

Patch Set 9 : Refactor unittests #

Total comments: 11

Patch Set 10 : Change GLStateRestorer API #

Patch Set 11 : Incorporate sievers' feedback on unittests #

Total comments: 6

Patch Set 12 : Code review feedback, pass const GLStateRestorer* in the API, make GLStateRestorerImpl::GetContextS… #

Patch Set 13 : Rebase #

Patch Set 14 : s/class ContextState/struct ContextState/ #

Patch Set 15 : s/class ContextState/struct ContextState/ #

Patch Set 16 : Change mock GetContextState to return const ContextState* instead of non-const #

Unified diffs Side-by-side diffs Delta from patch set Stats (+334 lines, -50 lines) Patch
M gpu/command_buffer/service/context_state.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +4 lines, -3 lines 0 comments Download
M gpu/command_buffer/service/context_state.cc View 1 2 3 4 5 6 4 chunks +63 lines, -25 lines 0 comments Download
M gpu/command_buffer/service/gl_state_restorer_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +3 lines, -1 line 0 comments Download
M gpu/command_buffer/service/gl_state_restorer_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +11 lines, -3 lines 0 comments Download
M gpu/command_buffer/service/gles2_cmd_decoder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +7 lines, -2 lines 0 comments Download
M gpu/command_buffer/service/gles2_cmd_decoder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +8 lines, -6 lines 0 comments Download
M gpu/command_buffer/service/gles2_cmd_decoder_mock.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +5 lines, -2 lines 0 comments Download
M gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +225 lines, -0 lines 0 comments Download
M ui/gl/gl_gl_api_implementation.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +7 lines, -7 lines 0 comments Download
M ui/gl/gl_state_restorer.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 54 (0 generated)
kaanb
7 years ago (2013-12-18 14:20:17 UTC) #1
Sami
Thanks, this looks much cleaner than the earlier patch. It would be interesting to know ...
7 years ago (2013-12-18 16:04:07 UTC) #2
kaanb
https://codereview.chromium.org/118203002/diff/60001/ui/gl/gl_gl_api_implementation.cc File ui/gl/gl_gl_api_implementation.cc (right): https://codereview.chromium.org/118203002/diff/60001/ui/gl/gl_gl_api_implementation.cc#newcode313 ui/gl/gl_gl_api_implementation.cc:313: (current_context_) On 2013/12/18 16:04:07, Sami wrote: > It might ...
7 years ago (2013-12-18 17:24:54 UTC) #3
no sievers
https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc File gpu/command_buffer/service/context_state.cc (right): https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc#newcode111 gpu/command_buffer/service/context_state.cc:111: max_active_texture_unit_) + 1; Do we really need |max_active_texture_unit_| which ...
7 years ago (2013-12-18 19:36:19 UTC) #4
kaanb
https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc File gpu/command_buffer/service/context_state.cc (right): https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc#newcode111 gpu/command_buffer/service/context_state.cc:111: max_active_texture_unit_) + 1; On 2013/12/18 19:36:20, sievers wrote: > ...
7 years ago (2013-12-18 19:43:56 UTC) #5
no sievers
On 2013/12/18 19:36:19, sievers wrote: > https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc > File gpu/command_buffer/service/context_state.cc (right): > > https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc#newcode111 > ...
7 years ago (2013-12-18 19:44:55 UTC) #6
kaanb
On 2013/12/18 19:44:55, sievers wrote: > On 2013/12/18 19:36:19, sievers wrote: > > > https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc ...
7 years ago (2013-12-18 19:47:47 UTC) #7
boliu
https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc File gpu/command_buffer/service/context_state.cc (right): https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc#newcode107 gpu/command_buffer/service/context_state.cc:107: size_t units_to_restore = texture_units.size(); Should this be max_active_texture_unit_? https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc#newcode111 ...
7 years ago (2013-12-18 19:55:11 UTC) #8
no sievers
On 2013/12/18 19:43:56, kaanb wrote: > https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc > File gpu/command_buffer/service/context_state.cc (right): > > https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc#newcode111 > ...
7 years ago (2013-12-18 20:07:47 UTC) #9
Ken Russell (switch to Gerrit)
Please add a unit test to gles2_cmd_decoder_unittest.cc. https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc File gpu/command_buffer/service/context_state.cc (right): https://codereview.chromium.org/118203002/diff/60001/gpu/command_buffer/service/context_state.cc#newcode111 gpu/command_buffer/service/context_state.cc:111: max_active_texture_unit_) + ...
7 years ago (2013-12-18 20:09:44 UTC) #10
kaanb
Unit tests are still work-in-progress but the rest of the patch is ready for another ...
7 years ago (2013-12-19 17:38:28 UTC) #11
no sievers
https://codereview.chromium.org/118203002/diff/80001/gpu/command_buffer/service/context_state.cc File gpu/command_buffer/service/context_state.cc (right): https://codereview.chromium.org/118203002/diff/80001/gpu/command_buffer/service/context_state.cc#newcode78 gpu/command_buffer/service/context_state.cc:78: Can you just put 'if (prev_state)' around the whole ...
7 years ago (2013-12-19 19:35:37 UTC) #12
no sievers
I think there's another problem: In GLES2DecoderImpl::Initialize() we set all texture units (up to max.) ...
7 years ago (2013-12-19 21:11:11 UTC) #13
no sievers
https://codereview.chromium.org/118203002/diff/80001/ui/gl/gl_gl_api_implementation.cc File ui/gl/gl_gl_api_implementation.cc (right): https://codereview.chromium.org/118203002/diff/80001/ui/gl/gl_gl_api_implementation.cc#newcode316 ui/gl/gl_gl_api_implementation.cc:316: (current_context_) && !switched_contexts I.e. only if we are using ...
7 years ago (2013-12-19 21:13:50 UTC) #14
Ken Russell (switch to Gerrit)
https://codereview.chromium.org/118203002/diff/80001/gpu/command_buffer/service/context_state.cc File gpu/command_buffer/service/context_state.cc (right): https://codereview.chromium.org/118203002/diff/80001/gpu/command_buffer/service/context_state.cc#newcode90 gpu/command_buffer/service/context_state.cc:90: bool binding_2d_changed = prev_service_id_2d != service_id_2d; On 2013/12/19 19:35:38, ...
7 years ago (2013-12-19 21:39:32 UTC) #15
no sievers
https://codereview.chromium.org/118203002/diff/80001/gpu/command_buffer/service/context_state.cc File gpu/command_buffer/service/context_state.cc (right): https://codereview.chromium.org/118203002/diff/80001/gpu/command_buffer/service/context_state.cc#newcode90 gpu/command_buffer/service/context_state.cc:90: bool binding_2d_changed = prev_service_id_2d != service_id_2d; On 2013/12/19 21:39:33, ...
7 years ago (2013-12-19 21:44:18 UTC) #16
Ken Russell (switch to Gerrit)
https://codereview.chromium.org/118203002/diff/80001/gpu/command_buffer/service/context_state.cc File gpu/command_buffer/service/context_state.cc (right): https://codereview.chromium.org/118203002/diff/80001/gpu/command_buffer/service/context_state.cc#newcode90 gpu/command_buffer/service/context_state.cc:90: bool binding_2d_changed = prev_service_id_2d != service_id_2d; On 2013/12/19 21:44:18, ...
7 years ago (2013-12-19 22:13:15 UTC) #17
kaanb
Unittests need more work but the rest is ready for another round https://codereview.chromium.org/118203002/diff/80001/gpu/command_buffer/service/context_state.cc File gpu/command_buffer/service/context_state.cc ...
7 years ago (2013-12-20 13:20:30 UTC) #18
no sievers
Thanks, looks good. If you get a chance you might want to try if the ...
7 years ago (2013-12-20 17:37:06 UTC) #19
kaanb
On 2013/12/20 17:37:06, sievers wrote: > Thanks, looks good. > > If you get a ...
6 years, 11 months ago (2014-01-07 23:32:39 UTC) #20
kaanb
I fixed up the unit tests and everything is ready for another look. https://codereview.chromium.org/118203002/diff/100001/gpu/command_buffer/service/context_state.cc File ...
6 years, 11 months ago (2014-01-07 23:33:41 UTC) #21
boliu
https://codereview.chromium.org/118203002/diff/180001/ui/gl/gl_gl_api_implementation.cc File ui/gl/gl_gl_api_implementation.cc (right): https://codereview.chromium.org/118203002/diff/180001/ui/gl/gl_gl_api_implementation.cc#newcode313 ui/gl/gl_gl_api_implementation.cc:313: (current_context_ && !switched_contexts) This patch is currently a no-op ...
6 years, 11 months ago (2014-01-08 01:42:29 UTC) #22
Ken Russell (switch to Gerrit)
https://codereview.chromium.org/118203002/diff/180001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc File gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc (right): https://codereview.chromium.org/118203002/diff/180001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc#newcode8872 gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc:8872: TEST_F(GLES2DecoderManualInitTest, RestoreStateWithPreviousState) { Could you please add a couple ...
6 years, 11 months ago (2014-01-08 02:56:27 UTC) #23
kaanb
On 2014/01/08 02:56:27, Ken Russell wrote: > https://codereview.chromium.org/118203002/diff/180001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc > File gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc (right): > > https://codereview.chromium.org/118203002/diff/180001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc#newcode8872 ...
6 years, 11 months ago (2014-01-08 23:57:39 UTC) #24
Ken Russell (switch to Gerrit)
https://codereview.chromium.org/118203002/diff/330001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc File gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc (right): https://codereview.chromium.org/118203002/diff/330001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc#newcode8914 gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc:8914: GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); These tests look good but there's a lot ...
6 years, 11 months ago (2014-01-09 00:09:07 UTC) #25
Ken Russell (switch to Gerrit)
https://codereview.chromium.org/118203002/diff/330001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc File gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc (right): https://codereview.chromium.org/118203002/diff/330001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc#newcode8914 gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc:8914: GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); On 2014/01/09 00:09:08, Ken Russell wrote: > These ...
6 years, 11 months ago (2014-01-09 00:11:02 UTC) #26
no sievers
On 2014/01/07 23:32:39, kaanb wrote: > On 2013/12/20 17:37:06, sievers wrote: > > Thanks, looks ...
6 years, 11 months ago (2014-01-09 14:05:29 UTC) #27
kaanb
On 2014/01/09 00:09:07, Ken Russell wrote: > https://codereview.chromium.org/118203002/diff/330001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc > File gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc (right): > > https://codereview.chromium.org/118203002/diff/330001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc#newcode8914 ...
6 years, 11 months ago (2014-01-09 22:49:37 UTC) #28
kaanb
On 2014/01/09 00:11:02, Ken Russell wrote: > https://codereview.chromium.org/118203002/diff/330001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc > File gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc (right): > > https://codereview.chromium.org/118203002/diff/330001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc#newcode8914 ...
6 years, 11 months ago (2014-01-09 22:51:37 UTC) #29
kaanb
On 2014/01/09 14:05:29, sievers wrote: > On 2014/01/07 23:32:39, kaanb wrote: > > On 2013/12/20 ...
6 years, 11 months ago (2014-01-09 22:52:12 UTC) #30
Ken Russell (switch to Gerrit)
Thanks for persisting. The new patch LGTM.
6 years, 11 months ago (2014-01-10 22:44:01 UTC) #31
kaanb
+piman for gpu/ OWNERS
6 years, 11 months ago (2014-01-10 22:55:36 UTC) #32
no sievers
just a few nits. https://codereview.chromium.org/118203002/diff/400001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc File gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc (right): https://codereview.chromium.org/118203002/diff/400001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc#newcode8901 gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc:8901: SpecializedSetup<ActiveTexture, 0>(true); I don't see ...
6 years, 11 months ago (2014-01-13 22:06:28 UTC) #33
piman
https://codereview.chromium.org/118203002/diff/400001/ui/gl/gl_state_restorer.h File ui/gl/gl_state_restorer.h (right): https://codereview.chromium.org/118203002/diff/400001/ui/gl/gl_state_restorer.h#newcode30 ui/gl/gl_state_restorer.h:30: virtual const gpu::gles2::ContextState* GetContextState() = 0; Mmh, this causes ...
6 years, 11 months ago (2014-01-13 22:12:45 UTC) #34
kaanb
https://codereview.chromium.org/118203002/diff/400001/ui/gl/gl_state_restorer.h File ui/gl/gl_state_restorer.h (right): https://codereview.chromium.org/118203002/diff/400001/ui/gl/gl_state_restorer.h#newcode30 ui/gl/gl_state_restorer.h:30: virtual const gpu::gles2::ContextState* GetContextState() = 0; On 2014/01/13 22:12:46, ...
6 years, 11 months ago (2014-01-13 22:17:00 UTC) #35
piman
https://codereview.chromium.org/118203002/diff/400001/ui/gl/gl_state_restorer.h File ui/gl/gl_state_restorer.h (right): https://codereview.chromium.org/118203002/diff/400001/ui/gl/gl_state_restorer.h#newcode30 ui/gl/gl_state_restorer.h:30: virtual const gpu::gles2::ContextState* GetContextState() = 0; On 2014/01/13 22:17:00, ...
6 years, 11 months ago (2014-01-13 22:37:46 UTC) #36
kaanb
On 2014/01/13 22:37:46, piman wrote: > https://codereview.chromium.org/118203002/diff/400001/ui/gl/gl_state_restorer.h > File ui/gl/gl_state_restorer.h (right): > > https://codereview.chromium.org/118203002/diff/400001/ui/gl/gl_state_restorer.h#newcode30 > ...
6 years, 11 months ago (2014-01-14 00:14:27 UTC) #37
piman
On Mon, Jan 13, 2014 at 4:14 PM, <kaanb@chromium.org> wrote: > On 2014/01/13 22:37:46, piman ...
6 years, 11 months ago (2014-01-14 00:32:57 UTC) #38
kaanb
When I use static_cast<> like this, the DCHECK in GetContextState fails. Is the decoder_ field ...
6 years, 11 months ago (2014-01-14 01:29:41 UTC) #39
piman
On Mon, Jan 13, 2014 at 5:29 PM, Kaan Baloglu <kaanb@chromium.org> wrote: > When I ...
6 years, 11 months ago (2014-01-14 01:49:52 UTC) #40
kaanb
Checking for GLStateRestorer* being NULL fixed the crash I was seeing. PTAL. https://codereview.chromium.org/118203002/diff/400001/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc File gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc ...
6 years, 11 months ago (2014-01-14 22:04:21 UTC) #41
no sievers
lgtm with nits https://codereview.chromium.org/118203002/diff/620001/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc File gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc (right): https://codereview.chromium.org/118203002/diff/620001/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc#newcode17 gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc:17: #include "gpu/command_buffer/service/context_state.h" not needed https://codereview.chromium.org/118203002/diff/620001/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h File ...
6 years, 11 months ago (2014-01-14 22:19:27 UTC) #42
piman
LGTM % Daniel's comments.
6 years, 11 months ago (2014-01-14 22:38:49 UTC) #43
kaanb
I also made two minor modifications in addition to the code review feedback. I pass ...
6 years, 11 months ago (2014-01-14 23:51:09 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kaanb@chromium.org/118203002/840001
6 years, 11 months ago (2014-01-15 05:49:44 UTC) #45
commit-bot: I haz the power
Failed to trigger a try job on win_x64_rel HTTP Error 400: Bad Request
6 years, 11 months ago (2014-01-15 16:43:37 UTC) #46
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kaanb@chromium.org/118203002/1080001
6 years, 11 months ago (2014-01-15 16:45:03 UTC) #47
kaanb
I had to change 3 fwd-declaration from class ContextState to struct ContextState. On Wed, Jan ...
6 years, 11 months ago (2014-01-15 17:05:24 UTC) #48
commit-bot: I haz the power
Failed to trigger a try job on mac_rel HTTP Error 400: Bad Request
6 years, 11 months ago (2014-01-15 18:21:37 UTC) #49
kaanb
I made another change to return const ContextState* instead of non-const from the mock GetContextState ...
6 years, 11 months ago (2014-01-15 18:23:31 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kaanb@chromium.org/118203002/1310001
6 years, 11 months ago (2014-01-15 18:25:42 UTC) #51
commit-bot: I haz the power
Retried try job too often on mac_rel for step(s) browser_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=mac_rel&number=212141
6 years, 11 months ago (2014-01-16 01:24:56 UTC) #52
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kaanb@chromium.org/118203002/1310001
6 years, 11 months ago (2014-01-16 02:07:50 UTC) #53
commit-bot: I haz the power
6 years, 11 months ago (2014-01-16 04:33:21 UTC) #54
Message was sent while issue was closed.
Change committed as 245109

Powered by Google App Engine
This is Rietveld 408576698