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

Issue 110583008: Enable Canvas2D hardware acceleration for Android WebView

Created:
6 years, 11 months ago by changjun.yang
Modified:
6 years, 11 months ago
Reviewers:
boliu
CC:
chromium-reviews, cc-bugs_chromium.org, darin-cc_chromium.org, android-webview-reviews_chromium.org
Base URL:
https://src.chromium.org/chrome/trunk/src/
Visibility:
Public.

Description

Enable Canvas2D hardware acceleration for Android WebView This patch is verified under stock browser which based on the recent Chrome M30 WebView, while verification under the latest trunk build seems unavailable from my side currently.

Patch Set 1 #

Patch Set 2 : #

Total comments: 2

Patch Set 3 : #

Patch Set 4 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -2 lines) Patch
M android_webview/lib/main/aw_main_delegate.cc View 1 chunk +1 line, -1 line 0 comments Download
M cc/resources/resource_provider.cc View 1 chunk +1 line, -1 line 0 comments Download
M cc/trees/layer_tree_host_impl.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M cc/trees/layer_tree_host_impl.cc View 1 2 2 chunks +2 lines, -0 lines 0 comments Download
M cc/trees/single_thread_proxy.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M cc/trees/thread_proxy.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M cc/trees/thread_proxy.cc View 1 2 1 chunk +5 lines, -0 lines 1 comment Download

Messages

Total messages: 3 (0 generated)
boliu
https://codereview.chromium.org/110583008/diff/50001/cc/resources/resource_provider.cc File cc/resources/resource_provider.cc (right): https://codereview.chromium.org/110583008/diff/50001/cc/resources/resource_provider.cc#newcode548 cc/resources/resource_provider.cc:548: if (resource->mailbox.IsTexture() && ContextGL() != NULL) { I know ...
6 years, 11 months ago (2014-01-06 18:16:13 UTC) #1
changjun.yang
On 2014/01/06 18:16:13, boliu wrote: > https://codereview.chromium.org/110583008/diff/50001/cc/resources/resource_provider.cc > File cc/resources/resource_provider.cc (right): > > https://codereview.chromium.org/110583008/diff/50001/cc/resources/resource_provider.cc#newcode548 > ...
6 years, 11 months ago (2014-01-08 09:09:49 UTC) #2
boliu
6 years, 11 months ago (2014-01-08 17:55:04 UTC) #3
On 2014/01/08 09:09:49, changjun.yang wrote:
> On 2014/01/06 18:16:13, boliu wrote:
> >
>
https://codereview.chromium.org/110583008/diff/50001/cc/resources/resource_pr...
> > File cc/resources/resource_provider.cc (right):
> > 
> >
>
https://codereview.chromium.org/110583008/diff/50001/cc/resources/resource_pr...
> > cc/resources/resource_provider.cc:548: if (resource->mailbox.IsTexture() &&
> > ContextGL() != NULL) {
> > I know I did the same thing in my hack patch, but it is just a hack. We are
> > leaking resource handles if the context is destroyed but there are still gl
> > resources left.
> 
> Looks https://code.google.com/p/chromium/issues/detail?id=331967 is related to
> this issue, have you guys planned further solutions?

They are not related. crbug.com/331967 is about the command buffer service side
of things. This issue is in the compositor which only deals with the command
buffer client. Command buffer docs:
http://dev.chromium.org/developers/design-documents/gpu-command-buffer

I think the fix here should probably be in
TextureLayerImpl::DidLoseOutputSurface (which should really be renamed to
TextureLayerImpl::ReleaseResources), but I haven't looked closely at how
TextureLayerImpl and mailboxes interact though.

https://codereview.chromium.org/110583008/diff/230001/cc/trees/thread_proxy.cc
File cc/trees/thread_proxy.cc (right):

https://codereview.chromium.org/110583008/diff/230001/cc/trees/thread_proxy.c...
cc/trees/thread_proxy.cc:1443: layer_tree_host_impl_->GetRendererCapabilities();
Much less hacky, still has some problems though.

renderer_capabilities_main_thread_copy_ lives on the main thread (ie the blink
thread). This function is called by LayerTreeHostImpl on the "impl" thread (also
known as the compositor thread). Documentation for this is
http://dev.chromium.org/developers/design-documents/compositor-thread-archite...

So this assignment is not thread safe. The right way would be to post a task to
main thread.

I think this is the right way to go, but this opens up a larger issue that that
main thread copy of the capabilities can get out of sync with the impl thread
copy. So we should do an audit of every renderer capability.

If a cap is not used on main thread at all, then we should not make it
accessible on main thread.
Maybe it's used on the main thread, but never used by webview, in which case we
need to add DCHECKs.
If it is used by webview, then need to make sure that either the inconsistency
is harmless or can be handled in some fashion.

Sounds like something you want to take? I can file a bug and cc you and
compositor owner (who might have different opinion than me)

Powered by Google App Engine
This is Rietveld 408576698