From a218b1cf39da7ac9b7cd2467c775f3ed6d4771e3 Mon Sep 17 00:00:00 2001 From: "milligan@google.com" Date: Mon, 7 Mar 2011 20:57:35 +0000 Subject: 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 --- o3d/plugin/cross/o3d_glue.cc | 23 +++++++++++++++-------- o3d/plugin/idl/idl.gyp | 12 ++---------- 2 files changed, 17 insertions(+), 18 deletions(-) (limited to 'o3d/plugin') 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(); + 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': [ '