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

Issue 12908004: Lazy initialize WGC3DInProcessCommandBufferImpl (Closed)

Created:
7 years, 9 months ago by boliu
Modified:
7 years, 9 months ago
CC:
chromium-reviews, cc-bugs_chromium.org, darin-cc_chromium.org, apatrick_chromium
Visibility:
Public.

Description

Lazy initialize WGC3DInProcessCommandBufferImpl WGC3DInProcessCommandBufferImpl will be used in Android WebView synchronous draw artchitecture, where directl GL calls can be made only inside the android GL draw functor. This patch moves the Intialize logic of WGC3DInProcessCommandBufferImpl to makeContextCurrent, so the initilization GL calls are delayed until inside the GL draw functor. This also allows WGC3DInProcessCommandBufferImpl to be created on one thread and be used on a different thread where it is made current. This is a requirement for using it in threaded compositor. Exposed problem that DumpRenderTree uses WGC3DInProcessCommandBufferImpl with shared resources on both main and compositor thread. The g_decoders_lock was not adaquately protecting the decoders and WeakPtrs are are used on a single thread only. Fix by expanding operations protected by g_decoders_lock and calling by calling DetachFromThread on all decoders, to maintain the invariant that no decoder are bound to any thread while the lock is not held. Also some clean ups: Remove the parent view context param. NULL is passed in everywhere. Make the attribute param const ref. Folded Initialize into constructor. BUG=179436 First landed in r189820. Reverted in r189975 due to layout test DCHECK failure. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=190837

Patch Set 1 #

Total comments: 4

Patch Set 2 : More cleanups #

Total comments: 2

Patch Set 3 : DoInitialize -> MaybeInitializeGL #

Patch Set 4 : return NULL instead of 0 #

Total comments: 1

Patch Set 5 : typo #

Patch Set 6 : NULL -> 0 (stupid me) #

Patch Set 7 : ContextGroup::decoders_ lock protected raw pointer #

Patch Set 8 : CHECK ContextGroup::Destroy is called #

Patch Set 9 : decoder DetachThread #

Patch Set 10 : cleanups #

Patch Set 11 : Add comment. #

Total comments: 2

Patch Set 12 : GLInProcessContext no longer has WeakPtr #

Total comments: 2

Patch Set 13 : explicit constructor #

Unified diffs Side-by-side diffs Delta from patch set Stats (+161 lines, -153 lines) Patch
M cc/test/layer_tree_pixel_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -2 lines 0 comments Download
M cc/test/pixel_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -2 lines 0 comments Download
M webkit/gpu/context_provider_in_process.cc View 1 1 chunk +2 lines, -3 lines 0 comments Download
M webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +7 lines, -4 lines 0 comments Download
M webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 20 chunks +147 lines, -123 lines 0 comments Download
M webkit/support/test_webkit_platform_support.cc View 1 2 3 4 5 6 1 chunk +1 line, -5 lines 0 comments Download
M webkit/support/webkit_support.h View 1 2 3 4 5 6 1 chunk +0 lines, -4 lines 0 comments Download
M webkit/support/webkit_support.cc View 1 2 3 4 5 6 1 chunk +0 lines, -10 lines 0 comments Download

Messages

Total messages: 46 (0 generated)
boliu
Hey James, could you take a look. Still a few TODOs but I figure it's ...
7 years, 9 months ago (2013-03-21 21:05:56 UTC) #1
danakj
This seems like it could be problematic, because creating a context happens on the main ...
7 years, 9 months ago (2013-03-21 21:40:09 UTC) #2
boliu
On 2013/03/21 21:40:09, danakj wrote: > Does the Initialize() not need to run on the ...
7 years, 9 months ago (2013-03-21 22:02:54 UTC) #3
piman
WGC3DCommandBufferImpl has to be created/initialized on the main thread, but that's because of the need ...
7 years, 9 months ago (2013-03-21 22:18:56 UTC) #4
piman
https://codereview.chromium.org/12908004/diff/1/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc File webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc (right): https://codereview.chromium.org/12908004/diff/1/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc#newcode567 webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc:567: return true; If Initialize doesn't do anything any more ...
7 years, 9 months ago (2013-03-21 22:29:11 UTC) #5
boliu
So I'm doing this sort of the brute force way, git grep "\<g_" inside gpu/command_buffer ...
7 years, 9 months ago (2013-03-21 22:36:14 UTC) #6
jamesr
It should be fine to use a WGC3DInProcessCommandBufferImpl from another thread - the compositor thread ...
7 years, 9 months ago (2013-03-21 22:51:37 UTC) #7
boliu
Ha, was asking if I should do these clean ups in my first comment. Done. ...
7 years, 9 months ago (2013-03-21 22:53:23 UTC) #8
jamesr
This seems reasonable. The pattern of WebGraphicsContext3DCommandBufferImpl is to have a MaybeInitializeGL() function that's called ...
7 years, 9 months ago (2013-03-21 22:56:39 UTC) #9
boliu
Also copied initialized_ and initialize_failed_ pattern. PTAL https://codereview.chromium.org/12908004/diff/9001/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc File webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc (right): https://codereview.chromium.org/12908004/diff/9001/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc#newcode221 webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc:221: scoped_ptr<GLInProcessContext> context(new ...
7 years, 9 months ago (2013-03-21 23:14:47 UTC) #10
boliu
Gah...keep making mistakes in a rush.
7 years, 9 months ago (2013-03-21 23:17:55 UTC) #11
jamesr
Ah we found the same typo :) lgtm https://codereview.chromium.org/12908004/diff/18001/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc File webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc (right): https://codereview.chromium.org/12908004/diff/18001/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc#newcode616 webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc:616: initialized_ ...
7 years, 9 months ago (2013-03-21 23:19:18 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/boliu@chromium.org/12908004/5002
7 years, 9 months ago (2013-03-21 23:23:37 UTC) #13
jamesr
Send this to the layout trybots before landing, please. All layout tests use the WGC3DInProcessCommandBufferImpl
7 years, 9 months ago (2013-03-21 23:36:19 UTC) #14
boliu
Weird...red win and linux layout bot runs in code review, but they just link back ...
7 years, 9 months ago (2013-03-22 00:45:59 UTC) #15
jamesr
On 2013/03/22 00:45:59, boliu wrote: > Weird...red win and linux layout bot runs in code ...
7 years, 9 months ago (2013-03-22 00:48:06 UTC) #16
boliu
Hmm, now I see the links too. Anyway, looks like failures on win_gpu are real, ...
7 years, 9 months ago (2013-03-22 01:05:59 UTC) #17
jamesr
On 2013/03/22 01:05:59, boliu wrote: > Hmm, now I see the links too. > > ...
7 years, 9 months ago (2013-03-22 01:08:29 UTC) #18
boliu
Alright...found another win_gpu run with the exact same failures from another patch: http://build.chromium.org/p/tryserver.chromium/builders/win_gpu/builds/1310 I'll take ...
7 years, 9 months ago (2013-03-22 02:10:21 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/boliu@chromium.org/12908004/34001
7 years, 9 months ago (2013-03-22 03:12:47 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/boliu@chromium.org/12908004/34001
7 years, 9 months ago (2013-03-22 14:05:21 UTC) #21
boliu
Committed patchset #6 manually as r189820 (presubmit successful).
7 years, 9 months ago (2013-03-22 16:09:13 UTC) #22
boliu
Re-opening since this was reverted in r189975 due to threading DCHECK failure. The issue is ...
7 years, 9 months ago (2013-03-25 17:51:50 UTC) #23
jamesr
On 2013/03/25 17:51:50, boliu wrote: > Re-opening since this was reverted in r189975 due to ...
7 years, 9 months ago (2013-03-25 17:59:37 UTC) #24
boliu
Oops GroupContext->ContextGroup https://code.google.com/p/chromium/codesearch#chromium/src/gpu/command_buffer/service/context_group.cc&q=ContextGroup::HaveContexts&sq=package:chromium&l=233
7 years, 9 months ago (2013-03-25 18:01:53 UTC) #25
piman
On Mon, Mar 25, 2013 at 10:51 AM, <boliu@chromium.org> wrote: > Re-opening since this was ...
7 years, 9 months ago (2013-03-25 18:15:16 UTC) #26
boliu
+gman Hi Gregg, you implemented LoseContextCHROMIUM, could you give me some advice on this? Context ...
7 years, 9 months ago (2013-03-25 20:17:05 UTC) #27
jamesr
It does look like that functionality is racy. In normal production, the command buffer code ...
7 years, 9 months ago (2013-03-25 20:19:34 UTC) #28
no sievers
On 2013/03/25 18:15:16, piman wrote: > On Mon, Mar 25, 2013 at 10:51 AM, <mailto:boliu@chromium.org> ...
7 years, 9 months ago (2013-03-25 20:54:30 UTC) #29
jamesr
canvas/webgl should already be using WGC3DInProcessCommandBufferImpl which is async in the sense that it buffers ...
7 years, 9 months ago (2013-03-25 20:58:23 UTC) #30
boliu
On 2013/03/25 20:19:34, jamesr wrote: > It does look like that functionality is racy. In ...
7 years, 9 months ago (2013-03-25 21:30:52 UTC) #31
piman
On Mon, Mar 25, 2013 at 2:30 PM, <boliu@chromium.org> wrote: > On 2013/03/25 20:19:34, jamesr ...
7 years, 9 months ago (2013-03-25 21:43:13 UTC) #32
no sievers
On 2013/03/25 21:43:13, piman wrote: > On Mon, Mar 25, 2013 at 2:30 PM, <mailto:boliu@chromium.org> ...
7 years, 9 months ago (2013-03-25 23:11:21 UTC) #33
no sievers
On 2013/03/25 23:11:21, Daniel Sievers wrote: > On 2013/03/25 21:43:13, piman wrote: > > On ...
7 years, 9 months ago (2013-03-25 23:13:03 UTC) #34
jamesr
On 2013/03/25 23:11:21, Daniel Sievers wrote: > On 2013/03/25 21:43:13, piman wrote: > > On ...
7 years, 9 months ago (2013-03-25 23:13:56 UTC) #35
no sievers
On 2013/03/25 23:13:56, jamesr wrote: > On 2013/03/25 23:11:21, Daniel Sievers wrote: > > On ...
7 years, 9 months ago (2013-03-25 23:36:35 UTC) #36
no sievers
The changes to ContextGroup seem a bit arbitrary given that the class is totally not ...
7 years, 9 months ago (2013-03-26 00:22:20 UTC) #37
no sievers
On 2013/03/26 00:22:20, Daniel Sievers wrote: > The changes to ContextGroup seem a bit arbitrary ...
7 years, 9 months ago (2013-03-26 00:46:39 UTC) #38
boliu
So taking Daniel's suggestion of containing the hacks inside webgraphicscontext3d_in_process_command_buffer_impl.cc for DumpRenderTree. First need to ...
7 years, 9 months ago (2013-03-26 15:51:49 UTC) #39
no sievers
https://codereview.chromium.org/12908004/diff/56001/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc File webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc (right): https://codereview.chromium.org/12908004/diff/56001/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc#newcode54 webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc:54: class GLInProcessContext : public base::SupportsWeakPtr<GLInProcessContext> { Is SupportsWeakPtr not ...
7 years, 9 months ago (2013-03-26 17:33:59 UTC) #40
boliu
https://codereview.chromium.org/12908004/diff/56001/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc File webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc (right): https://codereview.chromium.org/12908004/diff/56001/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc#newcode54 webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc:54: class GLInProcessContext : public base::SupportsWeakPtr<GLInProcessContext> { On 2013/03/26 17:34:00, ...
7 years, 9 months ago (2013-03-26 17:58:33 UTC) #41
boliu
On 2013/03/26 15:51:49, boliu wrote: > So taking Daniel's suggestion of containing the hacks inside ...
7 years, 9 months ago (2013-03-27 00:06:45 UTC) #42
jamesr
lgtm https://codereview.chromium.org/12908004/diff/41002/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h File webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h (right): https://codereview.chromium.org/12908004/diff/41002/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h#newcode49 webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h:49: WebGraphicsContext3DInProcessCommandBufferImpl( needs explicit since this is a one-argument ...
7 years, 9 months ago (2013-03-27 00:24:34 UTC) #43
boliu
https://codereview.chromium.org/12908004/diff/41002/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h File webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h (right): https://codereview.chromium.org/12908004/diff/41002/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h#newcode49 webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h:49: WebGraphicsContext3DInProcessCommandBufferImpl( On 2013/03/27 00:24:35, jamesr wrote: > needs explicit ...
7 years, 9 months ago (2013-03-27 00:35:20 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/boliu@chromium.org/12908004/68001
7 years, 9 months ago (2013-03-27 00:36:19 UTC) #45
commit-bot: I haz the power
7 years, 9 months ago (2013-03-27 06:54:09 UTC) #46
Message was sent while issue was closed.
Change committed as 190837

Powered by Google App Engine
This is Rietveld 408576698