summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/browser/gpu/gpu_control_list.cc2
-rw-r--r--content/browser/gpu/gpu_data_manager_impl.cc20
-rw-r--r--content/browser/gpu/gpu_data_manager_impl.h2
-rw-r--r--content/browser/gpu/gpu_data_manager_impl_unittest.cc31
-rw-r--r--content/browser/gpu/gpu_driver_bug_list.cc54
-rw-r--r--content/browser/gpu/gpu_driver_bug_list.json240
-rw-r--r--content/browser/gpu/gpu_driver_bug_list_unittest.cc73
7 files changed, 400 insertions, 22 deletions
diff --git a/content/browser/gpu/gpu_control_list.cc b/content/browser/gpu/gpu_control_list.cc
index d9aa910..3592505 100644
--- a/content/browser/gpu/gpu_control_list.cc
+++ b/content/browser/gpu/gpu_control_list.cc
@@ -7,8 +7,8 @@
#include "base/cpu.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
-#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/sys_info.h"
#include "content/browser/gpu/gpu_util.h"
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc
index 15ea9fd..675222b 100644
--- a/content/browser/gpu/gpu_data_manager_impl.cc
+++ b/content/browser/gpu/gpu_data_manager_impl.cc
@@ -14,8 +14,9 @@
#include "base/file_util.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
-#include "base/string_piece.h"
#include "base/stringprintf.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_piece.h"
#include "base/sys_info.h"
#include "base/values.h"
#include "base/version.h"
@@ -60,6 +61,18 @@ std::string ProcessVersionString(const std::string& raw_string) {
return version_string;
}
+// Combine the integers into a string, seperated by ','.
+std::string IntSetToString(const std::set<int>& list) {
+ std::string rt;
+ for (std::set<int>::const_iterator it = list.begin();
+ it != list.end(); ++it) {
+ if (!rt.empty())
+ rt += ",";
+ rt += base::IntToString(*it);
+ }
+ return rt;
+}
+
#if defined(OS_MACOSX)
void DisplayReconfigCallback(CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags,
@@ -446,6 +459,11 @@ void GpuDataManagerImpl::AppendGpuCommandLine(
command_line->AppendSwitchPath(switches::kSwiftShaderPath,
swiftshader_path);
+ if (!gpu_driver_bugs_.empty()) {
+ command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds,
+ IntSetToString(gpu_driver_bugs_));
+ }
+
#if defined(OS_WIN)
// DisplayLink 7.1 and earlier can cause the GPU process to crash on startup.
// http://crbug.com/177611
diff --git a/content/browser/gpu/gpu_data_manager_impl.h b/content/browser/gpu/gpu_data_manager_impl.h
index 59aa98e..ef3ade3 100644
--- a/content/browser/gpu/gpu_data_manager_impl.h
+++ b/content/browser/gpu/gpu_data_manager_impl.h
@@ -201,6 +201,8 @@ class CONTENT_EXPORT GpuDataManagerImpl
UnblockOtherDomainFrom3DAPIs);
FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest,
UnblockThisDomainFrom3DAPIs);
+ FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuDriverBugListSingle);
+ FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuDriverBugListMultiple);
GpuDataManagerImpl();
virtual ~GpuDataManagerImpl();
diff --git a/content/browser/gpu/gpu_data_manager_impl_unittest.cc b/content/browser/gpu/gpu_data_manager_impl_unittest.cc
index bc15a0b..64795c5 100644
--- a/content/browser/gpu/gpu_data_manager_impl_unittest.cc
+++ b/content/browser/gpu/gpu_data_manager_impl_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/run_loop.h"
#include "base/time.h"
@@ -10,6 +11,7 @@
#include "content/public/common/gpu_feature_type.h"
#include "content/public/common/gpu_info.h"
#include "googleurl/src/gurl.h"
+#include "gpu/command_buffer/service/gpu_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
#define LONG_STRING_CONST(...) #__VA_ARGS__
@@ -574,4 +576,33 @@ TEST_F(GpuDataManagerImplTest, SetGLStringsNoEffects) {
}
#endif // OS_LINUX
+TEST_F(GpuDataManagerImplTest, GpuDriverBugListSingle) {
+ ScopedGpuDataManagerImpl manager;
+ ASSERT_TRUE(manager.get());
+ manager->gpu_driver_bugs_.insert(5);
+
+ CommandLine command_line(0, NULL);
+ manager->AppendGpuCommandLine(&command_line);
+
+ EXPECT_TRUE(command_line.HasSwitch(switches::kGpuDriverBugWorkarounds));
+ std::string args = command_line.GetSwitchValueASCII(
+ switches::kGpuDriverBugWorkarounds);
+ EXPECT_STREQ("5", args.c_str());
+}
+
+TEST_F(GpuDataManagerImplTest, GpuDriverBugListMultiple) {
+ ScopedGpuDataManagerImpl manager;
+ ASSERT_TRUE(manager.get());
+ manager->gpu_driver_bugs_.insert(5);
+ manager->gpu_driver_bugs_.insert(7);
+
+ CommandLine command_line(0, NULL);
+ manager->AppendGpuCommandLine(&command_line);
+
+ EXPECT_TRUE(command_line.HasSwitch(switches::kGpuDriverBugWorkarounds));
+ std::string args = command_line.GetSwitchValueASCII(
+ switches::kGpuDriverBugWorkarounds);
+ EXPECT_STREQ("5,7", args.c_str());
+}
+
} // namespace content
diff --git a/content/browser/gpu/gpu_driver_bug_list.cc b/content/browser/gpu/gpu_driver_bug_list.cc
index 2ffad72..d8ed706 100644
--- a/content/browser/gpu/gpu_driver_bug_list.cc
+++ b/content/browser/gpu/gpu_driver_bug_list.cc
@@ -4,10 +4,21 @@
#include "content/browser/gpu/gpu_driver_bug_list.h"
-#include "content/public/common/gpu_feature_type.h"
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "gpu/command_buffer/service/gpu_driver_bug_workaround_type.h"
namespace content {
+namespace {
+
+struct DriverBugInfo {
+ int feature_type;
+ std::string feature_name;
+};
+
+} // namespace anonymous
+
GpuDriverBugList::GpuDriverBugList()
: GpuControlList() {
}
@@ -18,6 +29,47 @@ GpuDriverBugList::~GpuDriverBugList() {
// static
GpuDriverBugList* GpuDriverBugList::Create() {
GpuDriverBugList* list = new GpuDriverBugList();
+
+ const DriverBugInfo kFeatureList[] = {
+ { gpu::CLEAR_ALPHA_IN_READPIXELS, "clear_alpha_in_readpixels" },
+ { gpu::CLEAR_UNIFORMS_BEFORE_PROGRAM_USE,
+ "clear_uniforms_before_program_use" },
+ { gpu::DELETE_INSTEAD_OF_RESIZE_FBO, "delete_instead_of_resize_fbo" },
+ { gpu::DISABLE_ANGLE_FRAMEBUFFER_MULTISAMPLE,
+ "disable_angle_framebuffer_multisample" },
+ { gpu::DISABLE_DEPTH_TEXTURE, "disable_depth_texture" },
+ { gpu::DISABLE_EXT_OCCLUSION_QUERY, "disable_ext_occlusion_query" },
+ { gpu::ENABLE_CHROMIUM_FAST_NPOT_MO8_TEXTURES,
+ "enable_chromium_fast_npot_mo8_textures" },
+ { gpu::EXIT_ON_CONTEXT_LOST, "exit_on_context_lost" },
+ { gpu::FLUSH_ON_CONTEXT_SWITCH, "flush_on_context_switch" },
+ { gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024,
+ "max_cube_map_texture_size_limit_1024" },
+ { gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_4096,
+ "max_cube_map_texture_size_limit_4096" },
+ { gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_512,
+ "max_cube_map_texture_size_limit_512" },
+ { gpu::MAX_TEXTURE_SIZE_LIMIT_4096, "max_texture_size_limit_4096" },
+ { gpu::NEEDS_GLSL_BUILT_IN_FUNCTION_EMULATION,
+ "needs_glsl_built_in_function_emulation" },
+ { gpu::NEEDS_OFFSCREEN_BUFFER_WORKAROUND,
+ "needs_offscreen_buffer_workaround" },
+ { gpu::RESTORE_SCISSOR_ON_FBO_CHANGE, "restore_scissor_on_fbo_change" },
+ { gpu::REVERSE_POINT_SPRITE_COORD_ORIGIN,
+ "reverse_point_sprite_coord_origin" },
+ { gpu::SET_TEXTURE_FILTER_BEFORE_GENERATING_MIPMAP,
+ "set_texture_filter_before_generating_mipmap" },
+ { gpu::USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS,
+ "use_client_side_arrays_for_stream_buffers" },
+ { gpu::USE_CURRENT_PROGRAM_AFTER_SUCCESSFUL_LINK,
+ "use_current_program_after_successful_link" }
+ };
+ DCHECK_EQ(static_cast<int>(arraysize(kFeatureList)),
+ gpu::NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES);
+ for (int i = 0; i < gpu::NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES; ++i) {
+ list->AddSupportedFeature(kFeatureList[i].feature_name,
+ kFeatureList[i].feature_type);
+ }
return list;
}
diff --git a/content/browser/gpu/gpu_driver_bug_list.json b/content/browser/gpu/gpu_driver_bug_list.json
index 9ee21df..c8d948f 100644
--- a/content/browser/gpu/gpu_driver_bug_list.json
+++ b/content/browser/gpu/gpu_driver_bug_list.json
@@ -38,11 +38,31 @@
// 16. "gpu_count" is a INT structure (defined below).
// 17 "cpu_info" is a STRING structure (defined below).
// 18. "exceptions" is a list of entries.
-// 19. "features" is a list of gpu switching options.
+// 19. "features" is a list of driver bug types, including
+// "clear_alpha_in_readpixels",
+// "clear_uniforms_before_program_use",
+// "delete_instead_of_resize_fbo",
+// "disable_angle_framebuffer_multisample",
+// "disable_depth_texture",
+// "disable_ext_occlusion_query",
+// "enable_chromium_fast_npot_mo8_textures",
+// "exit_on_context_lost",
+// "flush_on_context_switch",
+// "max_cube_map_texture_size_limit_1024",
+// "max_cube_map_texture_size_limit_4096",
+// "max_cube_map_texture_size_limit_512",
+// "max_texture_size_limit_4096",
+// "needs_glsl_built_in_function_emulation",
+// "needs_offscreen_buffer_workaround",
+// "restore_scissor_on_fbo_change",
+// "reverse_point_sprite_coord_origin",
+// "set_texture_filter_before_generating_mipmap",
+// "use_client_side_arrays_for_stream_buffers",
+// "use_current_program_after_successful_link".
// This field is mandatory.
// 20. "description" has the description of the entry.
// 21. "webkit_bugs" is an array of associated webkit bug numbers.
-// 22. "cr_bugs" is an array of associated webkit bug numbers.
+// 22. "cr_bugs" is an array of associated chromium bug numbers.
// 23. "browser_version" is a VERSION structure (defined below). If this
// condition is not satisfied, the entry will be ignored. If it is not
// present, then the entry applies to all versions of the browser.
@@ -71,7 +91,221 @@
{
"name": "gpu driver bug list",
// Please update the version number whenever you change this file.
- "version": "1.0",
+ "version": "1.1",
"entries": [
+ {
+ "id": 1,
+ "description": "Imagination driver doesn't like uploading lots of buffer data constantly",
+ "os": {
+ "type": "android"
+ },
+ "gl_vendor": {
+ "op": "beginwith",
+ "value": "Imagination"
+ },
+ "features": [
+ "use_client_side_arrays_for_stream_buffers"
+ ]
+ },
+ {
+ "id": 2,
+ "description": "ARM driver doesn't like uploading lots of buffer data constantly",
+ "os": {
+ "type": "android"
+ },
+ "gl_vendor": {
+ "op": "beginwith",
+ "value": "ARM"
+ },
+ "features": [
+ "use_client_side_arrays_for_stream_buffers"
+ ]
+ },
+ {
+ "id": 3,
+ "features": [
+ "set_texture_filter_before_generating_mipmap"
+ ]
+ },
+ {
+ "id": 4,
+ "description": "Need to set the alpha to 255",
+ "features": [
+ "clear_alpha_in_readpixels"
+ ]
+ },
+ {
+ "id": 5,
+ "vendor_id": "0x10de",
+ "features": [
+ "use_current_program_after_successful_link"
+ ]
+ },
+ {
+ "id": 6,
+ "os": {
+ "type": "android"
+ },
+ "gl_vendor": {
+ "op": "beginwith",
+ "value": "Qualcomm"
+ },
+ "features": [
+ "restore_scissor_on_fbo_change",
+ "flush_on_context_switch",
+ "delete_instead_of_resize_fbo" // Only need this on the ICS driver.
+ ]
+ },
+ {
+ "id": 7,
+ "cr_bugs": [89557],
+ "os": {
+ "type": "macosx"
+ },
+ "vendor_id": "0x10de",
+ "features": [
+ "needs_offscreen_buffer_workaround"
+ ]
+ },
+ {
+ "id": 8,
+ "os": {
+ "type": "macosx"
+ },
+ "vendor_id": "0x1002",
+ "features": [
+ "needs_glsl_built_in_function_emulation"
+ ]
+ },
+ {
+ "id": 9,
+ "description": "Mac AMD drivers get gl_PointCoord backward, rdar://problem/11883495",
+ "os": {
+ "type": "macosx"
+ },
+ "vendor_id": "0x1002",
+ "features": [
+ "reverse_point_sprite_coord_origin"
+ ]
+ },
+ {
+ "id": 10,
+ "description": "Mac Intel drivers get gl_PointCoord backward, rdar://problem/11883495",
+ "os": {
+ "type": "macosx"
+ },
+ "vendor_id": "0x8086",
+ "features": [
+ "reverse_point_sprite_coord_origin"
+ ]
+ },
+ {
+ "id": 11,
+ "os": {
+ "type": "macosx"
+ },
+ "vendor_id": "0x8086",
+ "features": [
+ "max_texture_size_limit_4096"
+ ]
+ },
+ {
+ "id": 12,
+ "os": {
+ "type": "macosx"
+ },
+ "vendor_id": "0x8086",
+ "features": [
+ "max_cube_map_texture_size_limit_1024"
+ ]
+ },
+ {
+ "id": 12,
+ "os": {
+ "type": "macosx",
+ "version": {
+ "op": "<",
+ "number": "10.7.3"
+ }
+ },
+ "vendor_id": "0x8086",
+ "features": [
+ "max_cube_map_texture_size_limit_512"
+ ]
+ },
+ {
+ "id": 13,
+ "os": {
+ "type": "macosx"
+ },
+ "vendor_id": "0x1002",
+ "features": [
+ "max_texture_size_limit_4096",
+ "max_cube_map_texture_size_limit_4096"
+ ]
+ },
+ {
+ "id": 14,
+ "description": "Some Android Qualcomm drivers falsely report GL_ANGLE_framebuffer_multisample",
+ "cr_bugs": [165736],
+ "os": {
+ "type": "android"
+ },
+ "gl_vendor": {
+ "op": "beginwith",
+ "value": "Qualcomm"
+ },
+ "features": [
+ "disable_angle_framebuffer_multisample"
+ ]
+ },
+ {
+ "id": 15,
+ "description": "Intel drivers on Linux appear to be buggy",
+ "os": {
+ "type": "linux"
+ },
+ "vendor_id": "0x8086",
+ "features": [
+ "disable_ext_occlusion_query"
+ ]
+ },
+ {
+ "id": 16,
+ "description": "Some drivers are unable to reset the D3D device in the GPU process sandbox",
+ "os": {
+ "type": "win"
+ },
+ "features": [
+ "exit_on_context_lost"
+ ]
+ },
+ {
+ "id": 17,
+ "description": "Everything except async + NPOT + multiple-of-8 textures are brutally slow for Imagination drivers",
+ "os": {
+ "type": "android"
+ },
+ "gl_vendor": {
+ "op": "beginwith",
+ "value": "Imagination"
+ },
+ "features": [
+ "enable_chromium_fast_npot_mo8_textures"
+ ]
+ },
+ {
+ "id": 17,
+ "os": {
+ "type": "android"
+ },
+ "gl_vendor": {
+ "op": "beginwith",
+ "value": "Qualcomm"
+ },
+ "features": [
+ "disable_depth_texture"
+ ]
+ }
]
}
diff --git a/content/browser/gpu/gpu_driver_bug_list_unittest.cc b/content/browser/gpu/gpu_driver_bug_list_unittest.cc
index 4eb6009..b0322a3 100644
--- a/content/browser/gpu/gpu_driver_bug_list_unittest.cc
+++ b/content/browser/gpu/gpu_driver_bug_list_unittest.cc
@@ -5,10 +5,12 @@
#include "base/base_paths.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "content/browser/gpu/gpu_driver_bug_list.h"
#include "content/public/common/gpu_info.h"
+#include "gpu/command_buffer/service/gpu_driver_bug_workaround_type.h"
#include "testing/gtest/include/gtest/gtest.h"
const char kOsVersion[] = "10.6.4";
@@ -25,6 +27,30 @@ class GpuDriverBugListTest : public testing::Test {
return gpu_info_;
}
+ bool GetCurrentDriverBugList(std::string* json) {
+ DCHECK(json);
+ base::FilePath data_file;
+ if (!PathService::Get(base::DIR_SOURCE_ROOT, &data_file))
+ return false;
+ data_file =
+ data_file.Append(FILE_PATH_LITERAL("content"))
+ .Append(FILE_PATH_LITERAL("browser"))
+ .Append(FILE_PATH_LITERAL("gpu"))
+ .Append(FILE_PATH_LITERAL("gpu_driver_bug_list.json"));
+ if (!file_util::PathExists(data_file))
+ return false;
+ int64 data_file_size64 = 0;
+ if (!file_util::GetFileSize(data_file, &data_file_size64))
+ return false;
+ int data_file_size = static_cast<int>(data_file_size64);
+ scoped_array<char> data(new char[data_file_size]);
+ if (file_util::ReadFile(data_file, data.get(), data_file_size) !=
+ data_file_size)
+ return false;
+ *json = std::string(data.get(), data_file_size);
+ return true;
+ }
+
protected:
virtual void SetUp() {
gpu_info_.gpu.vendor_id = 0x10de;
@@ -49,25 +75,40 @@ class GpuDriverBugListTest : public testing::Test {
#if !defined(OS_ANDROID)
TEST_F(GpuDriverBugListTest, CurrentDriverBugListValidation) {
- base::FilePath data_file;
- ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_file));
- data_file =
- data_file.Append(FILE_PATH_LITERAL("content"))
- .Append(FILE_PATH_LITERAL("browser"))
- .Append(FILE_PATH_LITERAL("gpu"))
- .Append(FILE_PATH_LITERAL("gpu_driver_bug_list.json"));
- ASSERT_TRUE(file_util::PathExists(data_file));
- int64 data_file_size64 = 0;
- ASSERT_TRUE(file_util::GetFileSize(data_file, &data_file_size64));
- int data_file_size = static_cast<int>(data_file_size64);
- scoped_array<char> data(new char[data_file_size]);
- ASSERT_EQ(data_file_size,
- file_util::ReadFile(data_file, data.get(), data_file_size));
- std::string json_string(data.get(), data_file_size);
scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
- EXPECT_TRUE(list->LoadList(json_string, GpuControlList::kAllOs));
+ std::string json;
+ EXPECT_TRUE(GetCurrentDriverBugList(&json));
+ EXPECT_TRUE(list->LoadList(json, GpuControlList::kAllOs));
EXPECT_FALSE(list->contains_unknown_fields());
}
+
+TEST_F(GpuDriverBugListTest, CurrentListForARM) {
+ scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
+ std::string json;
+ EXPECT_TRUE(GetCurrentDriverBugList(&json));
+ EXPECT_TRUE(list->LoadList(json, GpuControlList::kAllOs));
+
+ GPUInfo gpu_info;
+ gpu_info.gl_vendor = "ARM";
+ gpu_info.gl_renderer = "MALi_T604";
+ std::set<int> bugs = list->MakeDecision(
+ GpuControlList::kOsAndroid, "4.1", gpu_info);
+ EXPECT_EQ(1u, bugs.count(gpu::USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS));
+}
+
+TEST_F(GpuDriverBugListTest, CurrentListForImagination) {
+ scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
+ std::string json;
+ EXPECT_TRUE(GetCurrentDriverBugList(&json));
+ EXPECT_TRUE(list->LoadList(json, GpuControlList::kAllOs));
+
+ GPUInfo gpu_info;
+ gpu_info.gl_vendor = "Imagination Technologies";
+ gpu_info.gl_renderer = "PowerVR SGX 540";
+ std::set<int> bugs = list->MakeDecision(
+ GpuControlList::kOsAndroid, "4.1", gpu_info);
+ EXPECT_EQ(1u, bugs.count(gpu::USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS));
+}
#endif
} // namespace content