diff options
author | sievers@google.com <sievers@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-30 12:52:51 +0000 |
---|---|---|
committer | sievers@google.com <sievers@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-30 12:52:51 +0000 |
commit | 77342e5144f1cc3eefe1e05a3538dc10b960e62e (patch) | |
tree | 237afe9ac80d68cb74a24d3f1464140f5c899f4d | |
parent | 80fae1ef974518320a0c16cd25c510a5abcfcbb5 (diff) | |
download | chromium_src-77342e5144f1cc3eefe1e05a3538dc10b960e62e.zip chromium_src-77342e5144f1cc3eefe1e05a3538dc10b960e62e.tar.gz chromium_src-77342e5144f1cc3eefe1e05a3538dc10b960e62e.tar.bz2 |
Android WebView: Fall back to idle uploads if draw functor table not set
Disable map_image if draw functor table is not set,
and disallow EGL async uploads if MailboxSync is on (doesn't work).
R=boliu@chromium.org
Review URL: https://codereview.chromium.org/413103002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286501 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 19 insertions, 6 deletions
diff --git a/android_webview/browser/gpu_memory_buffer_factory_impl.cc b/android_webview/browser/gpu_memory_buffer_factory_impl.cc index 14d1ae4..63771c6 100644 --- a/android_webview/browser/gpu_memory_buffer_factory_impl.cc +++ b/android_webview/browser/gpu_memory_buffer_factory_impl.cc @@ -6,6 +6,7 @@ #include "android_webview/public/browser/draw_gl.h" #include "base/logging.h" +#include "gpu/command_buffer/service/in_process_command_buffer.h" #include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/size.h" #include "ui/gl/gl_bindings.h" @@ -112,4 +113,12 @@ void GpuMemoryBufferFactoryImpl::SetAwDrawGLFunctionTable( g_gl_draw_functions = table; } +bool GpuMemoryBufferFactoryImpl::Initialize() { + if (!g_gl_draw_functions) + return false; + + gpu::InProcessCommandBuffer::SetGpuMemoryBufferFactory(this); + return true; +} + } // namespace android_webview diff --git a/android_webview/browser/gpu_memory_buffer_factory_impl.h b/android_webview/browser/gpu_memory_buffer_factory_impl.h index 929ba29..16c8ffa 100644 --- a/android_webview/browser/gpu_memory_buffer_factory_impl.h +++ b/android_webview/browser/gpu_memory_buffer_factory_impl.h @@ -19,6 +19,7 @@ class GpuMemoryBufferFactoryImpl : public gpu::InProcessGpuMemoryBufferFactory { virtual ~GpuMemoryBufferFactoryImpl(); static void SetAwDrawGLFunctionTable(AwDrawGLFunctionTable* table); + bool Initialize(); // Overridden from gpu::InProcessGpuMemoryBufferFactory: virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( diff --git a/android_webview/lib/main/aw_main_delegate.cc b/android_webview/lib/main/aw_main_delegate.cc index 1102806..c6b089b 100644 --- a/android_webview/lib/main/aw_main_delegate.cc +++ b/android_webview/lib/main/aw_main_delegate.cc @@ -24,7 +24,6 @@ #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" #include "gpu/command_buffer/client/gl_in_process_context.h" -#include "gpu/command_buffer/service/in_process_command_buffer.h" #include "media/base/media_switches.h" #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" @@ -49,14 +48,16 @@ AwMainDelegate::~AwMainDelegate() { bool AwMainDelegate::BasicStartupComplete(int* exit_code) { content::SetContentClient(&content_client_); - gpu::InProcessCommandBuffer::SetGpuMemoryBufferFactory( - gpu_memory_buffer_factory_.get()); + CommandLine* cl = CommandLine::ForCurrentProcess(); + if (gpu_memory_buffer_factory_.get()->Initialize()) { + cl->AppendSwitch(switches::kEnableZeroCopy); + } else { + LOG(WARNING) << "Failed to initialize GpuMemoryBuffer factory"; + } BrowserViewRenderer::CalculateTileMemoryPolicy(); - CommandLine* cl = CommandLine::ForCurrentProcess(); cl->AppendSwitch(switches::kEnableBeginFrameScheduling); - cl->AppendSwitch(switches::kEnableZeroCopy); cl->AppendSwitch(switches::kEnableImplSidePainting); // WebView uses the Android system's scrollbars and overscroll glow. diff --git a/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc b/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc index ba1ad2e..618bd0e 100644 --- a/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc +++ b/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc @@ -10,6 +10,7 @@ #include "gpu/command_buffer/service/async_pixel_transfer_manager_idle.h" #include "gpu/command_buffer/service/async_pixel_transfer_manager_stub.h" #include "gpu/command_buffer/service/async_pixel_transfer_manager_sync.h" +#include "gpu/command_buffer/service/mailbox_synchronizer.h" #include "ui/gl/gl_context.h" #include "ui/gl/gl_implementation.h" @@ -63,7 +64,8 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create( !IsBroadcom() && !IsImagination() && !IsNvidia31() && - !base::SysInfo::IsLowEndDevice()) { + !base::SysInfo::IsLowEndDevice() && + !gles2::MailboxSynchronizer::GetInstance()) { return new AsyncPixelTransferManagerEGL; } return new AsyncPixelTransferManagerIdle; |