diff options
author | milligan@google.com <milligan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 20:57:35 +0000 |
---|---|---|
committer | milligan@google.com <milligan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 20:57:35 +0000 |
commit | a218b1cf39da7ac9b7cd2467c775f3ed6d4771e3 (patch) | |
tree | d92c556ba853c0a59742b4d90f558fd54a6a0024 /o3d | |
parent | 79034696a6c89c3f6dcfd8f0b37965e402fd8b10 (diff) | |
download | chromium_src-a218b1cf39da7ac9b7cd2467c775f3ed6d4771e3.zip chromium_src-a218b1cf39da7ac9b7cd2467c775f3ed6d4771e3.tar.gz chromium_src-a218b1cf39da7ac9b7cd2467c775f3ed6d4771e3.tar.bz2 |
When auto fall-back is enabled, fall back to o2d
if we detect a software renderer is being reported
by o3d. Also add software renderer detection to
o2d keyed off of the GL_RENDERER string
"Software Rasterizer"
Review URL: http://codereview.chromium.org/6592020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77177 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/build/common.gypi | 11 | ||||
-rw-r--r-- | o3d/core/core.gyp | 28 | ||||
-rw-r--r-- | o3d/core/cross/class_manager.cc | 4 | ||||
-rw-r--r-- | o3d/core/cross/features.h | 2 | ||||
-rw-r--r-- | o3d/core/cross/gl/renderer_gl.cc | 10 | ||||
-rw-r--r-- | o3d/core/cross/renderer_platform.h | 2 | ||||
-rw-r--r-- | o3d/plugin/cross/o3d_glue.cc | 23 | ||||
-rw-r--r-- | o3d/plugin/idl/idl.gyp | 12 |
8 files changed, 35 insertions, 57 deletions
diff --git a/o3d/build/common.gypi b/o3d/build/common.gypi index e8369a8..d324dcc 100644 --- a/o3d/build/common.gypi +++ b/o3d/build/common.gypi @@ -43,7 +43,6 @@ 'cgdir': 'third_party/cg/files/win', 'renderer%': 'd3d9', 'swiftshaderdir': 'o3d-internal/third_party/swiftshader/files', - 'support_cairo%' : 1, }, ], ['OS == "mac"', @@ -51,7 +50,6 @@ 'cgdir': 'third_party/cg/files/mac', 'renderer%': 'gl', 'swiftshaderdir': '', - 'support_cairo%' : 1, }, ], ['OS == "linux"', @@ -59,14 +57,12 @@ 'cgdir': 'third_party/cg/files/linux', 'renderer%': 'gl', 'swiftshaderdir': '', - 'support_cairo%' : 1, }, ], ], }, 'o3d_in_chrome%': '<(o3d_in_chrome)', 'renderer%': '<(renderer)', - 'support_cairo%': '<(support_cairo)', 'cgdir%': '<(cgdir)', 'gles2_backend%': '<(gles2_backend)', 'swiftshaderdir%': '<(swiftshaderdir)', @@ -104,13 +100,6 @@ }], ], 'conditions' : [ - ['support_cairo == 1', - { - 'defines': [ - 'SUPPORT_CAIRO', - ], - }, - ], ['renderer == "d3d9"', { 'defines': [ diff --git a/o3d/core/core.gyp b/o3d/core/core.gyp index 5a2c05d..b3e1c9e 100644 --- a/o3d/core/core.gyp +++ b/o3d/core/core.gyp @@ -362,8 +362,18 @@ 'type': 'static_library', 'dependencies': [ '../../skia/skia.gyp:skia', + '../build/libs.gyp:cairo_libs', ], 'sources': [ + 'cross/cairo/install_check.cc', + 'cross/cairo/layer.cc', + 'cross/cairo/layer.h', + 'cross/cairo/pattern.cc', + 'cross/cairo/pattern.h', + 'cross/cairo/renderer_cairo.cc', + 'cross/cairo/renderer_cairo.h', + 'cross/cairo/texture_cairo.cc', + 'cross/cairo/texture_cairo.h', ], 'conditions': [ ['OS == "mac"', @@ -470,24 +480,6 @@ ], }, ], - ['support_cairo == 1', - { - 'sources': [ - 'cross/cairo/install_check.cc', - 'cross/cairo/layer.cc', - 'cross/cairo/layer.h', - 'cross/cairo/pattern.cc', - 'cross/cairo/pattern.h', - 'cross/cairo/renderer_cairo.cc', - 'cross/cairo/renderer_cairo.h', - 'cross/cairo/texture_cairo.cc', - 'cross/cairo/texture_cairo.h', - ], - 'dependencies': [ - '../build/libs.gyp:cairo_libs', - ], - }, - ], ], }, { diff --git a/o3d/core/cross/class_manager.cc b/o3d/core/cross/class_manager.cc index 7751e96..ace172e 100644 --- a/o3d/core/cross/class_manager.cc +++ b/o3d/core/cross/class_manager.cc @@ -66,9 +66,7 @@ #include "core/cross/transform.h" #include "core/cross/tree_traversal.h" #include "core/cross/viewport.h" -#if defined(SUPPORT_CAIRO) #include "core/cross/cairo/layer.h" -#endif namespace o3d { @@ -183,9 +181,7 @@ ClassManager::ClassManager(ServiceLocator* service_locator) AddTypedClass<Viewport>(); // Specific Objects for Cairo -#if defined(SUPPORT_CAIRO) AddTypedClass<o2d::Layer>(); -#endif } void ClassManager::AddClass(const ObjectBase::Class* object_class, diff --git a/o3d/core/cross/features.h b/o3d/core/cross/features.h index 7aed90b..0445e30 100644 --- a/o3d/core/cross/features.h +++ b/o3d/core/cross/features.h @@ -82,7 +82,7 @@ class Features { return init_status_; } - Renderer::RenderModes render_modes() const { + Renderer::RenderModes render_mode() const { return render_mode_; } diff --git a/o3d/core/cross/gl/renderer_gl.cc b/o3d/core/cross/gl/renderer_gl.cc index 3b73cf4..8c42b2a 100644 --- a/o3d/core/cross/gl/renderer_gl.cc +++ b/o3d/core/cross/gl/renderer_gl.cc @@ -37,9 +37,7 @@ #include "core/cross/gl/renderer_gl.h" -#ifdef SUPPORT_CAIRO -#include "core/cross/cairo/renderer_cairo.h" -#endif +#include "core/cross/client_info.h" #include "core/cross/error.h" #include "core/cross/gl/buffer_gl.h" #include "core/cross/gl/draw_element_gl.h" @@ -1058,6 +1056,12 @@ Renderer::InitStatus RendererGL::InitPlatformSpecific( context_ = 0; display_ = NULL; window_ = 0; + } else if (strcmp("Software Rasterizer", + reinterpret_cast<const char*>(::glGetString( + GL_RENDERER))) == 0) { + ClientInfoManager* client_info_manager = + service_locator()->GetService<ClientInfoManager>(); + client_info_manager->SetSoftwareRenderer(true); } return init_status; } diff --git a/o3d/core/cross/renderer_platform.h b/o3d/core/cross/renderer_platform.h index 3a2bd24..ba85fb9 100644 --- a/o3d/core/cross/renderer_platform.h +++ b/o3d/core/cross/renderer_platform.h @@ -67,9 +67,7 @@ #error Platform not recognized. #endif -#if defined(SUPPORT_CAIRO) #include "core/cross/cairo/renderer_cairo.h" -#endif #if defined(RENDERER_D3D9) && defined(OS_WIN) #include "core/win/d3d9/renderer_d3d9.h" diff --git a/o3d/plugin/cross/o3d_glue.cc b/o3d/plugin/cross/o3d_glue.cc index ea64a84..b5d2d58 100644 --- a/o3d/plugin/cross/o3d_glue.cc +++ b/o3d/plugin/cross/o3d_glue.cc @@ -257,12 +257,13 @@ void PluginObject::TearDown() { } void PluginObject::CreateRenderer(const o3d::DisplayWindow& display_window) { + bool software_renderer = false; // In case CreateRenderer is called more than once, reset to the // uninitialized state.. DeleteRenderer(); renderer_init_status_ = o3d::Renderer::UNINITIALIZED; - if (features_->render_modes() != Renderer::RENDER_MODE_2D) { + if (features_->render_mode() != Renderer::RENDER_MODE_2D) { if (!o3d::CheckConfig(npp_)) { renderer_init_status_ = o3d::Renderer::GPU_NOT_UP_TO_SPEC; } else { @@ -273,17 +274,24 @@ void PluginObject::CreateRenderer(const o3d::DisplayWindow& display_window) { renderer_init_status_ = renderer_->Init(display_window, false); if (renderer_init_status_ != o3d::Renderer::SUCCESS) { DeleteRenderer(); + } else { + ClientInfoManager* client_info_manager = + service_locator()->GetService<ClientInfoManager>(); + software_renderer = + client_info_manager->client_info().software_renderer(); } } -#if !defined(SUPPORT_CAIRO) - } else { - // The caller requested 2D only mode, but this platform does not support 2d - renderer_init_status_ = o3d::Renderer::INITIALIZATION_ERROR; } -#else + if (software_renderer && + (features_->render_mode() == Renderer::RENDER_MODE_AUTO)) { + // If the client is OK with 2d mode, we prefer to use cairo instead of a + // software renderer. We don't need the 3D renderer we just created. + DeleteRenderer(); + renderer_init_status_ = o3d::Renderer::GPU_NOT_UP_TO_SPEC; + DLOG(INFO) << "Software renderer detected. Falling back to o2d."; } if ((renderer_init_status_ != o3d::Renderer::SUCCESS) && - (features_->render_modes() != Renderer::RENDER_MODE_3D)) { + (features_->render_mode() != Renderer::RENDER_MODE_3D)) { // Attempt to fall back to o2d renderer renderer_ = o3d::Renderer::Create2DRenderer(&service_locator_); if (renderer_) { @@ -297,7 +305,6 @@ void PluginObject::CreateRenderer(const o3d::DisplayWindow& display_window) { } } } -#endif } void PluginObject::DeleteRenderer() { diff --git a/o3d/plugin/idl/idl.gyp b/o3d/plugin/idl/idl.gyp index c70dbad..81ead55 100644 --- a/o3d/plugin/idl/idl.gyp +++ b/o3d/plugin/idl/idl.gyp @@ -12,16 +12,8 @@ 'static_glue_dir': '../../../<(nixysadir)/static_glue/npapi', 'idl_files': [ '<!@(python get_idl_files.py)', - ], - 'conditions': [ - ['support_cairo == 1', - { - 'idl_files': [ - 'layer.idl', - 'pattern.idl', - ], - }, - ], + 'layer.idl', + 'pattern.idl', ], }, 'target_defaults': { |