diff options
-rw-r--r-- | content/content_shell.gypi | 2 | ||||
-rw-r--r-- | content/shell/app/shell_main_delegate.cc | 12 | ||||
-rw-r--r-- | gpu/command_buffer/service/async_pixel_transfer_manager_android.cc | 2 | ||||
-rw-r--r-- | third_party/mesa/mesa.gyp | 29 | ||||
-rw-r--r-- | ui/gl/gl.gyp | 9 | ||||
-rw-r--r-- | ui/gl/gl_context_android.cc | 23 | ||||
-rw-r--r-- | ui/gl/gl_implementation_android.cc | 25 | ||||
-rw-r--r-- | ui/gl/gl_implementation_osmesa.cc (renamed from ui/gl/gl_implementation_linux.cc) | 4 | ||||
-rw-r--r-- | ui/gl/gl_implementation_osmesa.h (renamed from ui/gl/gl_implementation_linux.h) | 7 | ||||
-rw-r--r-- | ui/gl/gl_implementation_ozone.cc | 2 | ||||
-rw-r--r-- | ui/gl/gl_implementation_x11.cc | 2 |
11 files changed, 79 insertions, 38 deletions
diff --git a/content/content_shell.gypi b/content/content_shell.gypi index 9a9537f..548a2b3 100644 --- a/content/content_shell.gypi +++ b/content/content_shell.gypi @@ -1049,6 +1049,7 @@ '../base/base.gyp:base_java', '../media/media.gyp:media_java', '../net/net.gyp:net_java', + '../third_party/mesa/mesa.gyp:osmesa_in_lib_dir', '../tools/android/forwarder/forwarder.gyp:forwarder', '../ui/android/ui_android.gyp:ui_java', ], @@ -1060,6 +1061,7 @@ 'native_lib_target': 'libcontent_shell_content_view', 'additional_input_paths': ['<(PRODUCT_DIR)/content_shell/assets/content_shell.pak'], 'asset_location': '<(PRODUCT_DIR)/content_shell/assets', + 'extra_native_libs': ['<(SHARED_LIB_DIR)/libosmesa.so'], }, 'conditions': [ ['android_webview_build==0', { diff --git a/content/shell/app/shell_main_delegate.cc b/content/shell/app/shell_main_delegate.cc index ab8bd8e..ad2b4b8 100644 --- a/content/shell/app/shell_main_delegate.cc +++ b/content/shell/app/shell_main_delegate.cc @@ -136,11 +136,8 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { command_line.AppendSwitch(switches::kProcessPerTab); command_line.AppendSwitch(switches::kEnableLogging); command_line.AppendSwitch(switches::kAllowFileAccessFromFiles); -#if !defined(OS_ANDROID) - // OSMesa is not yet available for Android. http://crbug.com/248925 - command_line.AppendSwitchASCII( - switches::kUseGL, gfx::kGLImplementationOSMesaName); -#endif + command_line.AppendSwitchASCII(switches::kUseGL, + gfx::kGLImplementationOSMesaName); command_line.AppendSwitch(switches::kSkipGpuDataLoading); command_line.AppendSwitchASCII(switches::kTouchEvents, switches::kTouchEventsEnabled); @@ -149,9 +146,6 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { #if defined(OS_ANDROID) command_line.AppendSwitch( switches::kDisableGestureRequirementForMediaPlayback); - // Capturing pixel results does not yet work when implementation-side - // painting is enabled. See http://crbug.com/250777 - command_line.AppendSwitch(cc::switches::kDisableImplSidePainting); #endif if (!command_line.HasSwitch(switches::kStableReleaseMode)) { @@ -167,7 +161,7 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { command_line.AppendSwitch(switches::kEnableInbandTextTracks); command_line.AppendSwitch(switches::kMuteAudio); -#if defined(USE_AURA) +#if defined(USE_AURA) || defined(OS_ANDROID) // TODO: crbug.com/311404 Make layout tests work w/ delegated renderer. command_line.AppendSwitch(switches::kDisableDelegatedRenderer); #endif 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 ac589d4..5795106 100644 --- a/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc +++ b/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc @@ -58,6 +58,8 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create( return new AsyncPixelTransferManagerEGL; } return new AsyncPixelTransferManagerIdle; + case gfx::kGLImplementationOSMesaGL: + return new AsyncPixelTransferManagerIdle; case gfx::kGLImplementationMockGL: return new AsyncPixelTransferManagerStub; default: diff --git a/third_party/mesa/mesa.gyp b/third_party/mesa/mesa.gyp index da12643..25423d4 100644 --- a/third_party/mesa/mesa.gyp +++ b/third_party/mesa/mesa.gyp @@ -811,4 +811,33 @@ ], }, ], + 'conditions': [ + ['OS=="android"', { + 'targets': [ + { + # Copies libosmesa.so to the out/$BUILDTYPE/lib/ directory so that + # the write_ordered_libraries.py script won't assume it to be a + # system library. This will cause the library to be stripped allowing + # targets to embed it in the to-be-generated APK. + 'target_name': 'osmesa_in_lib_dir', + 'type': 'none', + 'dependencies': [ + 'osmesa', + ], + 'actions': [ + { + 'action_name': 'copy_libosmesa', + 'inputs': ['<(PRODUCT_DIR)/libosmesa.so'], + 'outputs': ['<(SHARED_LIB_DIR)/libosmesa.so'], + 'action': [ + 'cp', + '<(PRODUCT_DIR)/libosmesa.so', + '<(SHARED_LIB_DIR)/libosmesa.so', + ], + }, + ], + }, + ], + }], + ], } diff --git a/ui/gl/gl.gyp b/ui/gl/gl.gyp index 702f4cc..527c5c4 100644 --- a/ui/gl/gl.gyp +++ b/ui/gl/gl.gyp @@ -84,8 +84,6 @@ 'gl_implementation.cc', 'gl_implementation.h', 'gl_implementation_android.cc', - 'gl_implementation_linux.cc', - 'gl_implementation_linux.h', 'gl_implementation_ozone.cc', 'gl_implementation_mac.cc', 'gl_implementation_win.cc', @@ -187,6 +185,12 @@ '<(DEPTH)/third_party/khronos', ], }], + ['OS in ("android", "linux")', { + 'sources': [ + 'gl_implementation_osmesa.cc', + 'gl_implementation_osmesa.h', + ], + }], ['use_x11 == 1', { 'sources': [ 'gl_context_glx.cc', @@ -277,7 +281,6 @@ ], }, 'sources!': [ - 'gl_context_osmesa.cc', 'system_monitor_posix.cc', ], 'defines': [ diff --git a/ui/gl/gl_context_android.cc b/ui/gl/gl_context_android.cc index f4555a2..2b91892 100644 --- a/ui/gl/gl_context_android.cc +++ b/ui/gl/gl_context_android.cc @@ -10,6 +10,7 @@ #include "base/sys_info.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context_egl.h" +#include "ui/gl/gl_context_osmesa.h" #include "ui/gl/gl_context_stub.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_surface.h" @@ -75,16 +76,24 @@ scoped_refptr<GLContext> GLContext::CreateGLContext( GLShareGroup* share_group, GLSurface* compatible_surface, GpuPreference gpu_preference) { - if (GetGLImplementation() == kGLImplementationMockGL) - return scoped_refptr<GLContext>(new GLContextStub()); - scoped_refptr<GLContext> context; - if (compatible_surface->GetHandle()) - context = new GLContextEGL(share_group); - else - context = new GLNonOwnedContext(share_group); + switch (GetGLImplementation()) { + case kGLImplementationMockGL: + return scoped_refptr<GLContext>(new GLContextStub()); + case kGLImplementationOSMesaGL: + context = new GLContextOSMesa(share_group); + break; + default: + if (compatible_surface->GetHandle()) + context = new GLContextEGL(share_group); + else + context = new GLNonOwnedContext(share_group); + break; + } + if (!context->Initialize(compatible_surface, gpu_preference)) return NULL; + return context; } diff --git a/ui/gl/gl_implementation_android.cc b/ui/gl/gl_implementation_android.cc index 22d5ec6..3fae1ee 100644 --- a/ui/gl/gl_implementation_android.cc +++ b/ui/gl/gl_implementation_android.cc @@ -13,6 +13,7 @@ #include "ui/gl/gl_egl_api_implementation.h" #include "ui/gl/gl_gl_api_implementation.h" #include "ui/gl/gl_implementation.h" +#include "ui/gl/gl_implementation_osmesa.h" #include "ui/gl/gl_osmesa_api_implementation.h" namespace gfx { @@ -28,24 +29,11 @@ void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far)); } -base::NativeLibrary LoadLibrary(const base::FilePath& filename) { - std::string error; - base::NativeLibrary library = base::LoadNativeLibrary(filename, &error); - if (!library) { - DVLOG(1) << "Failed to load " << filename.MaybeAsASCII() << ": " << error; - return NULL; - } - return library; -} - -base::NativeLibrary LoadLibrary(const char* filename) { - return LoadLibrary(base::FilePath(filename)); -} - } // namespace void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { impls->push_back(kGLImplementationEGLGLES2); + impls->push_back(kGLImplementationOSMesaGL); } bool InitializeStaticGLBindings(GLImplementation implementation) { @@ -93,6 +81,9 @@ bool InitializeStaticGLBindings(GLImplementation implementation) { ::gfx::g_driver_gl.fn.glDepthRangeFn = MarshalDepthRangeToDepthRangef; break; } + case kGLImplementationOSMesaGL: + InitializeStaticGLBindingsOSMesaGL(); + break; case kGLImplementationMockGL: { SetGLImplementation(kGLImplementationMockGL); InitializeStaticGLBindingsGL(); @@ -113,6 +104,10 @@ bool InitializeDynamicGLBindings(GLImplementation implementation, InitializeDynamicGLBindingsGL(context); InitializeDynamicGLBindingsEGL(context); break; + case kGLImplementationOSMesaGL: + InitializeDynamicGLBindingsGL(context); + InitializeDynamicGLBindingsOSMESA(context); + break; case kGLImplementationMockGL: if (!context) { scoped_refptr<GLContextStubWithExtensions> mock_context( @@ -133,11 +128,13 @@ bool InitializeDynamicGLBindings(GLImplementation implementation, void InitializeDebugGLBindings() { InitializeDebugGLBindingsEGL(); InitializeDebugGLBindingsGL(); + InitializeDebugGLBindingsOSMESA(); } void ClearGLBindings() { ClearGLBindingsEGL(); ClearGLBindingsGL(); + ClearGLBindingsOSMESA(); SetGLImplementation(kGLImplementationNone); UnloadGLNativeLibraries(); diff --git a/ui/gl/gl_implementation_linux.cc b/ui/gl/gl_implementation_osmesa.cc index 0968dfe..79d506f 100644 --- a/ui/gl/gl_implementation_linux.cc +++ b/ui/gl/gl_implementation_osmesa.cc @@ -1,8 +1,8 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gl/gl_implementation_linux.h" +#include "ui/gl/gl_implementation_osmesa.h" #include "base/files/file_path.h" #include "base/logging.h" diff --git a/ui/gl/gl_implementation_linux.h b/ui/gl/gl_implementation_osmesa.h index 1c32d4c..16180b7 100644 --- a/ui/gl/gl_implementation_linux.h +++ b/ui/gl/gl_implementation_osmesa.h @@ -1,7 +1,10 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef UI_GL_GL_IMPLEMENTATION_OSMESA_ +#define UI_GL_GL_IMPLEMENTATION_OSMESA_ + #include "base/files/file_path.h" #include "base/native_library.h" @@ -12,3 +15,5 @@ base::NativeLibrary LoadLibrary(const char* filename); base::NativeLibrary LoadLibrary(const base::FilePath& filename); } // namespace gfx + +#endif // UI_GL_GL_IMPLEMENTATION_OSMESA_
\ No newline at end of file diff --git a/ui/gl/gl_implementation_ozone.cc b/ui/gl/gl_implementation_ozone.cc index b8dd2c4..cb08036 100644 --- a/ui/gl/gl_implementation_ozone.cc +++ b/ui/gl/gl_implementation_ozone.cc @@ -9,7 +9,7 @@ #include "ui/gl/gl_egl_api_implementation.h" #include "ui/gl/gl_gl_api_implementation.h" #include "ui/gl/gl_implementation.h" -#include "ui/gl/gl_implementation_linux.h" +#include "ui/gl/gl_implementation_osmesa.h" #include "ui/gl/gl_osmesa_api_implementation.h" #include "ui/ozone/ozone_platform.h" diff --git a/ui/gl/gl_implementation_x11.cc b/ui/gl/gl_implementation_x11.cc index c19b39e..e70dbde 100644 --- a/ui/gl/gl_implementation_x11.cc +++ b/ui/gl/gl_implementation_x11.cc @@ -13,7 +13,7 @@ #include "ui/gl/gl_gl_api_implementation.h" #include "ui/gl/gl_glx_api_implementation.h" #include "ui/gl/gl_implementation.h" -#include "ui/gl/gl_implementation_linux.h" +#include "ui/gl/gl_implementation_osmesa.h" #include "ui/gl/gl_osmesa_api_implementation.h" #include "ui/gl/gl_switches.h" |