diff options
author | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-15 21:59:24 +0000 |
---|---|---|
committer | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-15 21:59:24 +0000 |
commit | 9cf895b669bc8f28b173816f3b3332f33c64d771 (patch) | |
tree | 72cf41418451a56da58d253fa6fb4ad7f863ce9e /content/browser/renderer_host/compositor_impl_android.cc | |
parent | c8fafab0cc74036e8c8b7c59615a4d3ab0bd1018 (diff) | |
download | chromium_src-9cf895b669bc8f28b173816f3b3332f33c64d771.zip chromium_src-9cf895b669bc8f28b173816f3b3332f33c64d771.tar.gz chromium_src-9cf895b669bc8f28b173816f3b3332f33c64d771.tar.bz2 |
Allow asynchronous GPU context creation for browser clients
This moves the call to establish a GPU channel out of WGC3D.
It adds an asynchronous method to BrowserGpuChannelHostFactory
that registers callbacks that are run on the main thread once
the channel is established.
This is prerequisite work for asynchronous OutputSurface creation.
BUG=270179,125248,235300
R=piman@chromium.org
Review URL: https://codereview.chromium.org/26959002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/compositor_impl_android.cc')
-rw-r--r-- | content/browser/renderer_host/compositor_impl_android.cc | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index da0c00f..f0d1ed9 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -358,34 +358,35 @@ CreateGpuProcessViewContext( const WebKit::WebGraphicsContext3D::Attributes attributes, int surface_id, base::WeakPtr<CompositorImpl> compositor_impl) { - GpuChannelHostFactory* factory = BrowserGpuChannelHostFactory::instance(); + BrowserGpuChannelHostFactory* factory = + BrowserGpuChannelHostFactory::instance(); + scoped_refptr<GpuChannelHost> gpu_channel_host(factory->EstablishGpuChannelSync( + CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); + if (!gpu_channel_host) + return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); + GURL url("chrome://gpu/Compositor::createContext3D"); - scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( - new WebGraphicsContext3DCommandBufferImpl(surface_id, - url, - factory, - compositor_impl)); static const size_t kBytesPerPixel = 4; gfx::DeviceDisplayInfo display_info; size_t full_screen_texture_size_in_bytes = display_info.GetDisplayHeight() * display_info.GetDisplayWidth() * kBytesPerPixel; - if (!context->Initialize( - attributes, - false, - CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE, - 64 * 1024, // command buffer size - 64 * 1024, // start transfer buffer size - 64 * 1024, // min transfer buffer size - std::min(3 * full_screen_texture_size_in_bytes, - kDefaultMaxTransferBufferSize), - 2 * 1024 * 1024 // mapped memory limit - )) { - LOG(ERROR) << "Failed to create 3D context for compositor."; - return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); - } - return context.Pass(); + WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; + limits.command_buffer_size = 64 * 1024; + limits.start_transfer_buffer_size = 64 * 1024; + limits.min_transfer_buffer_size = 64 * 1024; + limits.max_transfer_buffer_size = std::min( + 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); + limits.mapped_memory_reclaim_limit = 2 * 1024 * 1024; + return make_scoped_ptr( + new WebGraphicsContext3DCommandBufferImpl(surface_id, + url, + gpu_channel_host.get(), + compositor_impl, + attributes, + false, + limits)); } scoped_ptr<cc::OutputSurface> CompositorImpl::CreateOutputSurface( |