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

Issue 19522006: GLInProcessContext: support async flushes and dedicated GPU thread (Closed)

Created:
7 years, 5 months ago by no sievers
Modified:
7 years, 4 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org, darin-cc_chromium.org, android-webview-reviews_chromium.org, apatrick_chromium, gavinp+memory_chromium.org, benm (inactive), reveman, Wez, aelias_OOO_until_Jul13
Visibility:
Public.

Description

GLInProcessContext: support async flushes and dedicated GPU thread This separates the command buffer client and service portions in GLInProcessContext. It removes the 'big lock', which was used to flush commands instantly and on the calling thread (GL client thread). Instead it now creates a dedicated GPU thread. For Android WebView, it further allows the GPU message loop to be explicitly processed (because a context is only available at given times on a specific thread). BUG=246450, 239760, 234964 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=215144

Patch Set 1 #

Total comments: 27

Patch Set 2 : address comments #

Total comments: 1

Patch Set 3 : build and shutdown fixes #

Patch Set 4 : #

Total comments: 4

Patch Set 5 : Fix client callbacks and linker error #

Patch Set 6 : remove tls #

Total comments: 26

Patch Set 7 : address comments #

Total comments: 2

Patch Set 8 : update weakptr test #

Patch Set 9 : fix linker error w/android component build #

Total comments: 1

Patch Set 10 : remove base changes #

Total comments: 6

Patch Set 11 : address piman's comment #

Patch Set 12 : meh #

Patch Set 13 : joth's comments #

Patch Set 14 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+991 lines, -332 lines) Patch
M android_webview/DEPS View 1 chunk +1 line, -1 line 0 comments Download
M android_webview/android_webview.gyp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M android_webview/browser/in_process_view_renderer.cc View 1 2 3 4 5 6 6 chunks +46 lines, -0 lines 0 comments Download
M android_webview/lib/main/aw_main_delegate.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -1 line 0 comments Download
M gpu/command_buffer/client/gl_in_process_context.h View 1 2 3 4 5 6 1 chunk +0 lines, -4 lines 0 comments Download
M gpu/command_buffer/client/gl_in_process_context.cc View 1 2 3 4 5 6 13 chunks +82 lines, -320 lines 0 comments Download
A gpu/command_buffer/service/in_process_command_buffer.h View 1 2 3 4 5 6 1 chunk +154 lines, -0 lines 0 comments Download
A gpu/command_buffer/service/in_process_command_buffer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +703 lines, -0 lines 1 comment Download
M gpu/command_buffer_service.gypi View 1 chunk +2 lines, -0 lines 0 comments Download
M webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc View 1 2 3 4 2 chunks +0 lines, -6 lines 0 comments Download

Messages

Total messages: 39 (0 generated)
no sievers
ptal
7 years, 5 months ago (2013-07-23 00:29:34 UTC) #1
piman
https://codereview.chromium.org/19522006/diff/1/android_webview/browser/in_process_view_renderer.cc File android_webview/browser/in_process_view_renderer.cc (right): https://codereview.chromium.org/19522006/diff/1/android_webview/browser/in_process_view_renderer.cc#newcode136 android_webview/browser/in_process_view_renderer.cc:136: gpu::InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread(); Should this DCHECK if GL is allowed? I'm ...
7 years, 5 months ago (2013-07-23 01:57:14 UTC) #2
no sievers
Apologies that this is getting a bit messy. Am still trying to figure out a ...
7 years, 5 months ago (2013-07-25 00:41:23 UTC) #3
joth
small comment, we can clean this in follow-ups if needed. https://codereview.chromium.org/19522006/diff/24001/android_webview/browser/in_process_view_renderer.cc File android_webview/browser/in_process_view_renderer.cc (right): https://codereview.chromium.org/19522006/diff/24001/android_webview/browser/in_process_view_renderer.cc#newcode130 ...
7 years, 5 months ago (2013-07-27 02:24:32 UTC) #4
no sievers
Antoine, I think the latest patch should pass the bots (and I *should* have addressed ...
7 years, 4 months ago (2013-07-30 00:55:33 UTC) #5
joth
lgtm w/ some nits https://codereview.chromium.org/19522006/diff/34002/android_webview/browser/in_process_view_renderer.cc File android_webview/browser/in_process_view_renderer.cc (right): https://codereview.chromium.org/19522006/diff/34002/android_webview/browser/in_process_view_renderer.cc#newcode132 android_webview/browser/in_process_view_renderer.cc:132: class ScopedAllowGL : public base::NonThreadSafe ...
7 years, 4 months ago (2013-07-30 01:13:06 UTC) #6
piman
https://codereview.chromium.org/19522006/diff/34002/gpu/command_buffer/service/in_process_command_buffer.cc File gpu/command_buffer/service/in_process_command_buffer.cc (right): https://codereview.chromium.org/19522006/diff/34002/gpu/command_buffer/service/in_process_command_buffer.cc#newcode87 gpu/command_buffer/service/in_process_command_buffer.cc:87: base::LazyInstance<GpuInProcessThread>::Leaky thread_; Can we avoid leaking the thread? E.g. ...
7 years, 4 months ago (2013-07-30 03:51:44 UTC) #7
no sievers
Addressed comments. (Excuse the small rebase in gl_in_process_context.cc.) https://codereview.chromium.org/19522006/diff/34002/android_webview/browser/in_process_view_renderer.cc File android_webview/browser/in_process_view_renderer.cc (right): https://codereview.chromium.org/19522006/diff/34002/android_webview/browser/in_process_view_renderer.cc#newcode132 android_webview/browser/in_process_view_renderer.cc:132: class ...
7 years, 4 months ago (2013-07-31 18:19:28 UTC) #8
no sievers
+wez, ajwong for base/weak_ptr* The one test looked superfluous now, but for the other one ...
7 years, 4 months ago (2013-07-31 18:24:49 UTC) #9
benm (inactive)
https://codereview.chromium.org/19522006/diff/50001/android_webview/lib/main/aw_main_delegate.cc File android_webview/lib/main/aw_main_delegate.cc (right): https://codereview.chromium.org/19522006/diff/50001/android_webview/lib/main/aw_main_delegate.cc#newcode24 android_webview/lib/main/aw_main_delegate.cc:24: #include "gpu/command_buffer/service/in_process_command_buffer.h" We are missing #include for gpu/command_buffer/client/gl_in_process_context.h I ...
7 years, 4 months ago (2013-07-31 18:31:06 UTC) #10
joth
android_webview/ lgtm if needed, could you put base/ clean up in a separate CL? Or ...
7 years, 4 months ago (2013-07-31 18:31:16 UTC) #11
awong
weak_ptr LGTM however, I'm not a base owner.
7 years, 4 months ago (2013-07-31 18:33:58 UTC) #12
no sievers
On 2013/07/31 18:31:16, joth wrote: > android_webview/ lgtm > > if needed, could you put ...
7 years, 4 months ago (2013-07-31 18:37:11 UTC) #13
Wez
Thanks for cleaning this up. :D https://codereview.chromium.org/19522006/diff/50001/base/memory/weak_ptr_unittest.cc File base/memory/weak_ptr_unittest.cc (left): https://codereview.chromium.org/19522006/diff/50001/base/memory/weak_ptr_unittest.cc#oldcode354 base/memory/weak_ptr_unittest.cc:354: TEST(WeakPtrTest, MoveOwnershipExplicitly) { ...
7 years, 4 months ago (2013-07-31 19:06:25 UTC) #14
no sievers
On 2013/07/31 19:06:25, Wez wrote: > Thanks for cleaning this up. :D > > https://codereview.chromium.org/19522006/diff/50001/base/memory/weak_ptr_unittest.cc ...
7 years, 4 months ago (2013-07-31 20:29:14 UTC) #15
Wez
On 2013/07/31 20:29:14, sievers wrote: > On 2013/07/31 19:06:25, Wez wrote: > > Thanks for ...
7 years, 4 months ago (2013-07-31 22:43:39 UTC) #16
Wez
https://codereview.chromium.org/19522006/diff/75001/base/memory/weak_ptr_unittest.cc File base/memory/weak_ptr_unittest.cc (right): https://codereview.chromium.org/19522006/diff/75001/base/memory/weak_ptr_unittest.cc#newcode353 base/memory/weak_ptr_unittest.cc:353: arrow->target.reset(); This should crash, since you're invalidating from the ...
7 years, 4 months ago (2013-07-31 22:46:43 UTC) #17
no sievers
On 2013/07/31 22:43:39, Wez wrote: > On 2013/07/31 20:29:14, sievers wrote: > > On 2013/07/31 ...
7 years, 4 months ago (2013-07-31 22:47:23 UTC) #18
no sievers
On 2013/07/31 22:46:43, Wez wrote: > https://codereview.chromium.org/19522006/diff/75001/base/memory/weak_ptr_unittest.cc > File base/memory/weak_ptr_unittest.cc (right): > > https://codereview.chromium.org/19522006/diff/75001/base/memory/weak_ptr_unittest.cc#newcode353 > ...
7 years, 4 months ago (2013-07-31 22:49:19 UTC) #19
Wez
On 2013/07/31 22:49:19, sievers wrote: > Sorry, I meant do we care for the test ...
7 years, 4 months ago (2013-07-31 22:55:50 UTC) #20
no sievers
On 2013/07/31 22:55:50, Wez wrote: > On 2013/07/31 22:49:19, sievers wrote: > > Sorry, I ...
7 years, 4 months ago (2013-07-31 22:59:16 UTC) #21
Wez
On 2013/07/31 22:59:16, sievers wrote: > On 2013/07/31 22:55:50, Wez wrote: > > On 2013/07/31 ...
7 years, 4 months ago (2013-07-31 23:19:39 UTC) #22
Daniel Sievers (Google)
Ok here is why it allows you to delete WeakPtrs on a thread other then ...
7 years, 4 months ago (2013-07-31 23:51:13 UTC) #23
no sievers
I'm also thinking nowo that you want to allow that maybe? Or at least I ...
7 years, 4 months ago (2013-07-31 23:55:16 UTC) #24
no sievers
Reposting why this works (the mail bounced earlier, not sure if it made it through): ...
7 years, 4 months ago (2013-07-31 23:57:20 UTC) #25
no sievers
Also note that it's thread safe, because the Flag itself is RefCountedThreadSafe. In other words, ...
7 years, 4 months ago (2013-08-01 00:00:34 UTC) #26
Wez
On 31 July 2013 16:55, Daniel Sievers <sievers@chromium.org> wrote: > I'm also thinking nowo that ...
7 years, 4 months ago (2013-08-01 00:04:42 UTC) #27
no sievers
I separated the WeakPtr cleanup and tests into this issue: https://codereview.chromium.org/20777008/
7 years, 4 months ago (2013-08-01 01:08:51 UTC) #28
piman
1 last thing, otherwise I think we're good to go. https://codereview.chromium.org/19522006/diff/100001/gpu/command_buffer/service/in_process_command_buffer.cc File gpu/command_buffer/service/in_process_command_buffer.cc (right): https://codereview.chromium.org/19522006/diff/100001/gpu/command_buffer/service/in_process_command_buffer.cc#newcode677 ...
7 years, 4 months ago (2013-08-01 19:18:38 UTC) #29
joth
https://codereview.chromium.org/19522006/diff/100001/gpu/command_buffer/service/in_process_command_buffer.cc File gpu/command_buffer/service/in_process_command_buffer.cc (right): https://codereview.chromium.org/19522006/diff/100001/gpu/command_buffer/service/in_process_command_buffer.cc#newcode653 gpu/command_buffer/service/in_process_command_buffer.cc:653: static void PostCallback(const scoped_refptr<base::MessageLoopProxy>& loop, (ignorable nits -- static ...
7 years, 4 months ago (2013-08-01 19:25:29 UTC) #30
no sievers
https://codereview.chromium.org/19522006/diff/100001/gpu/command_buffer/service/in_process_command_buffer.cc File gpu/command_buffer/service/in_process_command_buffer.cc (right): https://codereview.chromium.org/19522006/diff/100001/gpu/command_buffer/service/in_process_command_buffer.cc#newcode677 gpu/command_buffer/service/in_process_command_buffer.cc:677: callback); On 2013/08/01 19:18:38, piman wrote: > I think ...
7 years, 4 months ago (2013-08-01 19:35:40 UTC) #31
piman
lgtm
7 years, 4 months ago (2013-08-01 19:38:12 UTC) #32
no sievers
https://codereview.chromium.org/19522006/diff/100001/gpu/command_buffer/service/in_process_command_buffer.cc File gpu/command_buffer/service/in_process_command_buffer.cc (right): https://codereview.chromium.org/19522006/diff/100001/gpu/command_buffer/service/in_process_command_buffer.cc#newcode653 gpu/command_buffer/service/in_process_command_buffer.cc:653: static void PostCallback(const scoped_refptr<base::MessageLoopProxy>& loop, On 2013/08/01 19:25:30, joth ...
7 years, 4 months ago (2013-08-01 19:44:35 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/sievers@chromium.org/19522006/107002
7 years, 4 months ago (2013-08-01 19:45:57 UTC) #34
commit-bot: I haz the power
Change committed as 215144
7 years, 4 months ago (2013-08-01 23:58:02 UTC) #35
vignatti (out of this project)
https://chromiumcodereview.appspot.com/19522006/diff/107002/gpu/command_buffer/service/in_process_command_buffer.cc File gpu/command_buffer/service/in_process_command_buffer.cc (right): https://chromiumcodereview.appspot.com/19522006/diff/107002/gpu/command_buffer/service/in_process_command_buffer.cc#newcode317 gpu/command_buffer/service/in_process_command_buffer.cc:317: completion.Wait(); Hi. I'm not sure if content_shell through the ...
7 years, 4 months ago (2013-08-05 13:54:09 UTC) #36
boliu
On 2013/08/05 13:54:09, vignatti wrote: > https://chromiumcodereview.appspot.com/19522006/diff/107002/gpu/command_buffer/service/in_process_command_buffer.cc > File gpu/command_buffer/service/in_process_command_buffer.cc (right): > > https://chromiumcodereview.appspot.com/19522006/diff/107002/gpu/command_buffer/service/in_process_command_buffer.cc#newcode317 > ...
7 years, 4 months ago (2013-08-05 16:20:55 UTC) #37
no sievers
On 2013/08/05 16:20:55, boliu wrote: > On 2013/08/05 13:54:09, vignatti wrote: > > > https://chromiumcodereview.appspot.com/19522006/diff/107002/gpu/command_buffer/service/in_process_command_buffer.cc ...
7 years, 4 months ago (2013-08-05 20:31:19 UTC) #38
vignatti (out of this project)
7 years, 4 months ago (2013-08-06 13:26:59 UTC) #39
Message was sent while issue was closed.
On 2013/08/05 20:31:19, sievers wrote:
> On 2013/08/05 16:20:55, boliu wrote:
> > On 2013/08/05 13:54:09, vignatti wrote:
> > >
> >
>
https://chromiumcodereview.appspot.com/19522006/diff/107002/gpu/command_buffe...
> > > File gpu/command_buffer/service/in_process_command_buffer.cc (right):
> > > 
> > >
> >
>
https://chromiumcodereview.appspot.com/19522006/diff/107002/gpu/command_buffe...
> > > gpu/command_buffer/service/in_process_command_buffer.cc:317:
> > completion.Wait();
> > > Hi. I'm not sure if content_shell through the use of in-process command
> buffer
> > > is in your mind, but Wait() is not allowed on such context;
> DisallowWaiting()
> > is
> > > being called during BrowserMainLoop::PreMainMessageLoopRun. I haven't
> thought
> > > either about another way to wait the end of the InitializeOnGpuThread()
> > > execution...
> > 
> > AFAIK, content shell shouldn't use in-process command buffer even if running
> > in-process. Is this not upstream chromium code?
> > 
> > I think the cross-process cb sends sync ipc to the gpu process/thread, so
this
> > is no worse. Can you workaround it with ScopedAllowWait?
> 
> Yes, agreed. If you use GL from the UI thread, then these calls can be
> synchronous (explicitly or implicitly). Also see the spin loops for example in
> CommandBufferHelper::WaitForToken() (which just happen not to be detected as
> some sort of waiting on another thread).

yeah, what I have here locally it's not upstream indeed. And ScopedAllowWait
seems to work fine on my solution. Thanks for the help guys!

Powered by Google App Engine
This is Rietveld 408576698