diff options
author | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-15 00:41:27 +0000 |
---|---|---|
committer | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-15 00:41:27 +0000 |
commit | f34ffdf264480d3d0c2a15d7a24e55837b08e5c6 (patch) | |
tree | d6dd3bf5f03d2e9d9e37eff374331bb4b8eb858b | |
parent | 3c8e1c85d0686125970cda6d6f8e70a6fd256ea7 (diff) | |
download | chromium_src-f34ffdf264480d3d0c2a15d7a24e55837b08e5c6.zip chromium_src-f34ffdf264480d3d0c2a15d7a24e55837b08e5c6.tar.gz chromium_src-f34ffdf264480d3d0c2a15d7a24e55837b08e5c6.tar.bz2 |
Enable virtual context on IMG devices in a different way
Revert "Enable virtual context on IMG devices only."
> Review URL: https://chromiumcodereview.appspot.com/11555010
The flags are only initialized *after* we create the context
and init the decoder (needs a current context for glGetString()).
Instead, append the commandline from gpu_info_collector_android.cc.
BUG=160710,165531
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11564027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173245 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.cc | 6 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector_android.cc | 20 | ||||
-rw-r--r-- | gpu/command_buffer/service/feature_info.cc | 21 | ||||
-rw-r--r-- | gpu/command_buffer/service/feature_info.h | 1 |
4 files changed, 26 insertions, 22 deletions
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 2612db2..e6e1e78 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -405,10 +405,8 @@ void GpuCommandBufferStub::OnInitialize( } scoped_refptr<gfx::GLContext> context; - if ((context_group_->feature_info()->feature_flags().enable_virtual_context || - CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableVirtualGLContexts)) && - channel_->share_group()) { + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableVirtualGLContexts) && channel_->share_group()) { context = channel_->share_group()->GetSharedContext(); if (!context) { context = gfx::GLContext::CreateGLContext( diff --git a/content/gpu/gpu_info_collector_android.cc b/content/gpu/gpu_info_collector_android.cc index 5b6a3f9..df0a7f2 100644 --- a/content/gpu/gpu_info_collector_android.cc +++ b/content/gpu/gpu_info_collector_android.cc @@ -4,10 +4,13 @@ #include "content/gpu/gpu_info_collector.h" +#include "base/command_line.h" #include "base/logging.h" #include "base/string_number_conversions.h" #include "base/string_piece.h" #include "base/string_split.h" +#include "base/string_util.h" +#include "content/public/common/content_switches.h" namespace { @@ -52,7 +55,22 @@ bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) { gpu_info->can_lose_context = false; // Create a short-lived context on the UI thread to collect the GL strings. - return CollectGraphicsInfoGL(gpu_info); + if (!CollectGraphicsInfoGL(gpu_info)) + return false; + + std::string vendor(StringToLowerASCII(gpu_info->gl_vendor)); + std::string renderer(StringToLowerASCII(gpu_info->gl_renderer)); + bool is_img = vendor.find("imagination") != std::string::npos; + bool is_arm = vendor.find("arm") != std::string::npos; + bool is_mali_t604 = is_arm && renderer.find("mali-t604") != std::string::npos; + + // IMG: avoid context switching perf problems, crashes with share groups + // Mali-T604: http://crbug.com/154715 + if (is_img || is_mali_t604) { + CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kEnableVirtualGLContexts); + } + return true; } bool CollectVideoCardInfo(content::GPUInfo* gpu_info) { diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index d447022..2a738b8 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc @@ -82,8 +82,7 @@ FeatureInfo::FeatureFlags::FeatureFlags() use_arb_occlusion_query_for_occlusion_query_boolean(false), native_vertex_array_object(false), disable_workarounds(false), - enable_shader_name_hashing(false), - enable_virtual_context(false) { + enable_shader_name_hashing(false) { } FeatureInfo::Workarounds::Workarounds() @@ -208,12 +207,9 @@ void FeatureInfo::AddFeatures(const char* desired_features) { GL_RENDERER, }; bool is_intel = false; - bool is_nvidia_desktop = false; + bool is_nvidia = false; bool is_amd = false; bool is_mesa = false; - bool is_nvidia_tegra = false; - bool is_img = false; - bool is_arm = false; bool is_qualcomm = false; for (size_t ii = 0; ii < arraysize(string_ids); ++ii) { const char* str = reinterpret_cast<const char*>( @@ -222,15 +218,9 @@ void FeatureInfo::AddFeatures(const char* desired_features) { std::string lstr(StringToLowerASCII(std::string(str))); StringSet string_set(lstr); is_intel |= string_set.Contains("intel"); - is_nvidia_desktop |= string_set.Contains("nvidia"); + is_nvidia |= string_set.Contains("nvidia"); is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); is_mesa |= string_set.Contains("mesa"); - - is_nvidia_tegra |= string_set.Contains("tegra"); - if (is_nvidia_tegra) - is_nvidia_desktop = false; - is_img |= string_set.Contains("imagination"); - is_arm |= string_set.Contains("arm"); is_qualcomm |= string_set.Contains("qualcomm"); } } @@ -243,7 +233,6 @@ void FeatureInfo::AddFeatures(const char* desired_features) { CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableShaderNameHashing); - feature_flags_.enable_virtual_context = is_img; bool npot_ok = false; @@ -677,12 +666,12 @@ void FeatureInfo::AddFeatures(const char* desired_features) { workarounds_.set_texture_filter_before_generating_mipmap = true; workarounds_.clear_alpha_in_readpixels = true; - if (is_nvidia_desktop) { + if (is_nvidia) { workarounds_.use_current_program_after_successful_link = true; } #if defined(OS_MACOSX) - workarounds_.needs_offscreen_buffer_workaround = is_nvidia_desktop; + workarounds_.needs_offscreen_buffer_workaround = is_nvidia; workarounds_.needs_glsl_built_in_function_emulation = is_amd; if ((is_amd || is_intel) && diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h index a9fb832..ec03789 100644 --- a/gpu/command_buffer/service/feature_info.h +++ b/gpu/command_buffer/service/feature_info.h @@ -42,7 +42,6 @@ class GPU_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> { bool native_vertex_array_object; bool disable_workarounds; bool enable_shader_name_hashing; - bool enable_virtual_context; }; struct Workarounds { |