diff options
Diffstat (limited to 'gpu')
39 files changed, 5 insertions, 6530 deletions
diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h index ed0ec25..3605976 100644 --- a/gpu/command_buffer/service/feature_info.h +++ b/gpu/command_buffer/service/feature_info.h @@ -12,7 +12,7 @@ #include "base/sys_info.h" #include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "gpu/command_buffer/service/gles2_cmd_validation.h" -#include "gpu/config/gpu_driver_bug_workaround_type.h" +#include "gpu/command_buffer/service/gpu_driver_bug_workaround_type.h" #include "gpu/gpu_export.h" class CommandLine; diff --git a/gpu/command_buffer/service/feature_info_unittest.cc b/gpu/command_buffer/service/feature_info_unittest.cc index ac10e8d..0fcc3a7 100644 --- a/gpu/command_buffer/service/feature_info_unittest.cc +++ b/gpu/command_buffer/service/feature_info_unittest.cc @@ -7,10 +7,10 @@ #include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_number_conversions.h" +#include "gpu/command_buffer/service/gpu_driver_bug_workaround_type.h" #include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/command_buffer/service/test_helper.h" #include "gpu/command_buffer/service/texture_manager.h" -#include "gpu/config/gpu_driver_bug_workaround_type.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_mock.h" diff --git a/gpu/config/gpu_driver_bug_workaround_type.h b/gpu/command_buffer/service/gpu_driver_bug_workaround_type.h index bb21425..5580453 100644 --- a/gpu/config/gpu_driver_bug_workaround_type.h +++ b/gpu/command_buffer/service/gpu_driver_bug_workaround_type.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef GPU_CONFIG_GPU_DRIVER_BUG_WORKAROUND_TYPE_H_ -#define GPU_CONFIG_GPU_DRIVER_BUG_WORKAROUND_TYPE_H_ +#ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_DRIVER_BUG_WORDAROUND_TYPE_H_ +#define GPU_COMMAND_BUFFER_SERVICE_GPU_DRIVER_BUG_WORDAROUND_TYPE_H_ #include "gpu/gpu_export.h" @@ -65,5 +65,5 @@ enum GPU_EXPORT GpuDriverBugWorkaroundType { } // namespace gpu -#endif // GPU_CONFIG_GPU_DRIVER_BUG_WORKAROUND_TYPE_H_ +#endif // GPU_COMMAND_BUFFER_SERVICE_GPU_DRIVER_BUG_WORDAROUND_TYPE_H_ diff --git a/gpu/config/OWNERS b/gpu/config/OWNERS deleted file mode 100644 index fed3782..0000000 --- a/gpu/config/OWNERS +++ /dev/null @@ -1,5 +0,0 @@ -apatrick@chromium.org -kbr@chromium.org -gman@chromium.org -piman@chromium.org -zmo@chromium.org diff --git a/gpu/config/dx_diag_node.cc b/gpu/config/dx_diag_node.cc deleted file mode 100644 index e0902ca..0000000 --- a/gpu/config/dx_diag_node.cc +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2010 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 "gpu/config/dx_diag_node.h" - -namespace gpu { - -DxDiagNode::DxDiagNode() {} - -DxDiagNode::~DxDiagNode() {} - -} // namespace gpu diff --git a/gpu/config/dx_diag_node.h b/gpu/config/dx_diag_node.h deleted file mode 100644 index 33d29b3..0000000 --- a/gpu/config/dx_diag_node.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2010 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. -// -// A tree of name value pairs that report contain DirectX diagnostic -// information. - -#ifndef GPU_CONFIG_DX_DIAG_NODE_H_ -#define GPU_CONFIG_DX_DIAG_NODE_H_ - -#include <map> -#include <string> - -#include "gpu/gpu_export.h" - -namespace gpu { - -struct GPU_EXPORT DxDiagNode { - DxDiagNode(); - ~DxDiagNode(); - std::map<std::string, std::string> values; - std::map<std::string, DxDiagNode> children; -}; - -} // namespace gpu - -#endif // GPU_CONFIG_DX_DIAG_NODE_H_ diff --git a/gpu/config/gpu_blacklist.cc b/gpu/config/gpu_blacklist.cc deleted file mode 100644 index 39946b0..0000000 --- a/gpu/config/gpu_blacklist.cc +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2013 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 "gpu/config/gpu_blacklist.h" - -#include "gpu/config/gpu_feature_type.h" - -namespace gpu { - -GpuBlacklist::GpuBlacklist() - : GpuControlList() { -} - -GpuBlacklist::~GpuBlacklist() { -} - -// static -GpuBlacklist* GpuBlacklist::Create() { - GpuBlacklist* list = new GpuBlacklist(); - list->AddSupportedFeature("accelerated_2d_canvas", - GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS); - list->AddSupportedFeature("accelerated_compositing", - GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); - list->AddSupportedFeature("webgl", - GPU_FEATURE_TYPE_WEBGL); - list->AddSupportedFeature("multisampling", - GPU_FEATURE_TYPE_MULTISAMPLING); - list->AddSupportedFeature("flash_3d", - GPU_FEATURE_TYPE_FLASH3D); - list->AddSupportedFeature("flash_stage3d", - GPU_FEATURE_TYPE_FLASH_STAGE3D); - list->AddSupportedFeature("flash_stage3d_baseline", - GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE); - list->AddSupportedFeature("texture_sharing", - GPU_FEATURE_TYPE_TEXTURE_SHARING); - list->AddSupportedFeature("accelerated_video_decode", - GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE); - list->AddSupportedFeature("3d_css", - GPU_FEATURE_TYPE_3D_CSS); - list->AddSupportedFeature("accelerated_video", - GPU_FEATURE_TYPE_ACCELERATED_VIDEO); - list->AddSupportedFeature("panel_fitting", - GPU_FEATURE_TYPE_PANEL_FITTING); - list->AddSupportedFeature("force_compositing_mode", - GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE); - list->set_supports_feature_type_all(true); - return list; -} - -} // namespace gpu diff --git a/gpu/config/gpu_blacklist.h b/gpu/config/gpu_blacklist.h deleted file mode 100644 index 4311212..0000000 --- a/gpu/config/gpu_blacklist.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2013 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 GPU_CONFIG_GPU_BLACKLIST_H_ -#define GPU_CONFIG_GPU_BLACKLIST_H_ - -#include <string> - -#include "gpu/config/gpu_control_list.h" - -namespace gpu { - -class GPU_EXPORT GpuBlacklist : public GpuControlList { - public: - virtual ~GpuBlacklist(); - - static GpuBlacklist* Create(); - - private: - GpuBlacklist(); - - DISALLOW_COPY_AND_ASSIGN(GpuBlacklist); -}; - -} // namespace gpu - -#endif // GPU_CONFIG_GPU_BLACKLIST_H_ diff --git a/gpu/config/gpu_blacklist_unittest.cc b/gpu/config/gpu_blacklist_unittest.cc deleted file mode 100644 index 3282437..0000000 --- a/gpu/config/gpu_blacklist_unittest.cc +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2013 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 "base/memory/scoped_ptr.h" -#include "gpu/config/gpu_blacklist.h" -#include "gpu/config/gpu_control_list_jsons.h" -#include "gpu/config/gpu_feature_type.h" -#include "gpu/config/gpu_info.h" -#include "testing/gtest/include/gtest/gtest.h" - -const char kOsVersion[] = "10.6.4"; - -namespace gpu { - -class GpuBlacklistTest : public testing::Test { - public: - GpuBlacklistTest() { } - - virtual ~GpuBlacklistTest() { } - - const GPUInfo& gpu_info() const { - return gpu_info_; - } - - void RunFeatureTest( - const std::string feature_name, GpuFeatureType feature_type) { - const std::string json = - "{\n" - " \"name\": \"gpu blacklist\",\n" - " \"version\": \"0.1\",\n" - " \"entries\": [\n" - " {\n" - " \"id\": 1,\n" - " \"os\": {\n" - " \"type\": \"macosx\"\n" - " },\n" - " \"vendor_id\": \"0x10de\",\n" - " \"device_id\": [\"0x0640\"],\n" - " \"features\": [\n" - " \"" + - feature_name + - "\"\n" - " ]\n" - " }\n" - " ]\n" - "}"; - - scoped_ptr<GpuBlacklist> blacklist(GpuBlacklist::Create()); - EXPECT_TRUE(blacklist->LoadList(json, GpuBlacklist::kAllOs)); - std::set<int> type = blacklist->MakeDecision( - GpuBlacklist::kOsMacosx, kOsVersion, gpu_info()); - EXPECT_EQ(1u, type.size()); - EXPECT_EQ(1u, type.count(feature_type)); - } - - protected: - virtual void SetUp() { - gpu_info_.gpu.vendor_id = 0x10de; - gpu_info_.gpu.device_id = 0x0640; - gpu_info_.driver_vendor = "NVIDIA"; - gpu_info_.driver_version = "1.6.18"; - gpu_info_.driver_date = "7-14-2009"; - gpu_info_.machine_model = "MacBookPro 7.1"; - gpu_info_.gl_vendor = "NVIDIA Corporation"; - gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; - gpu_info_.performance_stats.graphics = 5.0; - gpu_info_.performance_stats.gaming = 5.0; - gpu_info_.performance_stats.overall = 5.0; - } - - virtual void TearDown() { - } - - private: - GPUInfo gpu_info_; -}; - -TEST_F(GpuBlacklistTest, CurrentBlacklistValidation) { - scoped_ptr<GpuBlacklist> blacklist(GpuBlacklist::Create()); - EXPECT_TRUE(blacklist->LoadList( - kSoftwareRenderingListJson, GpuBlacklist::kAllOs)); - EXPECT_FALSE(blacklist->contains_unknown_fields()); -} - -#define GPU_BLACKLIST_FEATURE_TEST(test_name, feature_name, feature_type) \ -TEST_F(GpuBlacklistTest, test_name) { \ - RunFeatureTest(feature_name, feature_type); \ -} - -GPU_BLACKLIST_FEATURE_TEST(Accelerated2DCanvas, - "accelerated_2d_canvas", - GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) - -GPU_BLACKLIST_FEATURE_TEST(AcceleratedCompositing, - "accelerated_compositing", - GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) - -GPU_BLACKLIST_FEATURE_TEST(WebGL, - "webgl", - GPU_FEATURE_TYPE_WEBGL) - -GPU_BLACKLIST_FEATURE_TEST(Multisampling, - "multisampling", - GPU_FEATURE_TYPE_MULTISAMPLING) - -GPU_BLACKLIST_FEATURE_TEST(Flash3D, - "flash_3d", - GPU_FEATURE_TYPE_FLASH3D) - -GPU_BLACKLIST_FEATURE_TEST(FlashStage3D, - "flash_stage3d", - GPU_FEATURE_TYPE_FLASH_STAGE3D) - -GPU_BLACKLIST_FEATURE_TEST(FlashStage3DBaseline, - "flash_stage3d_baseline", - GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE) - -GPU_BLACKLIST_FEATURE_TEST(TextureSharing, - "texture_sharing", - GPU_FEATURE_TYPE_TEXTURE_SHARING) - -GPU_BLACKLIST_FEATURE_TEST(AcceleratedVideoDecode, - "accelerated_video_decode", - GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) - -GPU_BLACKLIST_FEATURE_TEST(Css3D, - "3d_css", - GPU_FEATURE_TYPE_3D_CSS) - -GPU_BLACKLIST_FEATURE_TEST(AcceleratedVideo, - "accelerated_video", - GPU_FEATURE_TYPE_ACCELERATED_VIDEO) - -GPU_BLACKLIST_FEATURE_TEST(PanelFitting, - "panel_fitting", - GPU_FEATURE_TYPE_PANEL_FITTING) - -GPU_BLACKLIST_FEATURE_TEST(ForceCompositingMode, - "force_compositing_mode", - GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE) - -} // namespace gpu diff --git a/gpu/config/gpu_control_list.cc b/gpu/config/gpu_control_list.cc deleted file mode 100644 index 670ccff..0000000 --- a/gpu/config/gpu_control_list.cc +++ /dev/null @@ -1,1415 +0,0 @@ -// Copyright (c) 2013 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 "gpu/config/gpu_control_list.h" - -#include "base/cpu.h" -#include "base/json/json_reader.h" -#include "base/logging.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 "gpu/config/gpu_info.h" -#include "gpu/config/gpu_util.h" - -namespace gpu { -namespace { - -// Break a version string into segments. Return true if each segment is -// a valid number. -bool ProcessVersionString(const std::string& version_string, - char splitter, - std::vector<std::string>* version) { - DCHECK(version); - base::SplitString(version_string, splitter, version); - if (version->size() == 0) - return false; - // If the splitter is '-', we assume it's a date with format "mm-dd-yyyy"; - // we split it into the order of "yyyy", "mm", "dd". - if (splitter == '-') { - std::string year = (*version)[version->size() - 1]; - for (int i = version->size() - 1; i > 0; --i) { - (*version)[i] = (*version)[i - 1]; - } - (*version)[0] = year; - } - for (size_t i = 0; i < version->size(); ++i) { - unsigned num = 0; - if (!base::StringToUint((*version)[i], &num)) - return false; - } - return true; -} - -// Compare two number strings using numerical ordering. -// Return 0 if number = number_ref, -// 1 if number > number_ref, -// -1 if number < number_ref. -int CompareNumericalNumberStrings( - const std::string& number, const std::string& number_ref) { - unsigned value1 = 0; - unsigned value2 = 0; - bool valid = base::StringToUint(number, &value1); - DCHECK(valid); - valid = base::StringToUint(number_ref, &value2); - DCHECK(valid); - if (value1 == value2) - return 0; - if (value1 > value2) - return 1; - return -1; -} - -// Compare two number strings using lexical ordering. -// Return 0 if number = number_ref, -// 1 if number > number_ref, -// -1 if number < number_ref. -// We only compare as many digits as number_ref contains. -// If number_ref is xxx, it's considered as xxx* -// For example: CompareLexicalNumberStrings("121", "12") returns 0, -// CompareLexicalNumberStrings("12", "121") returns -1. -int CompareLexicalNumberStrings( - const std::string& number, const std::string& number_ref) { - for (size_t i = 0; i < number_ref.length(); ++i) { - unsigned value1 = 0; - if (i < number.length()) - value1 = number[i] - '0'; - unsigned value2 = number_ref[i] - '0'; - if (value1 > value2) - return 1; - if (value1 < value2) - return -1; - } - return 0; -} - -bool GpuUnmatched(uint32 vendor_id, const std::vector<uint32>& device_id_list, - const GPUInfo::GPUDevice& gpu) { - if (vendor_id == 0) - return false; - if (vendor_id != gpu.vendor_id) - return true; - bool device_specified = false; - for (size_t i = 0; i < device_id_list.size(); ++i) { - if (device_id_list[i] == 0) - continue; - if (device_id_list[i] == gpu.device_id) - return false; - device_specified = true; - } - return device_specified; -} - -const char kMultiGpuStyleStringAMDSwitchable[] = "amd_switchable"; -const char kMultiGpuStyleStringOptimus[] = "optimus"; - -const char kMultiGpuCategoryStringPrimary[] = "primary"; -const char kMultiGpuCategoryStringSecondary[] = "secondary"; -const char kMultiGpuCategoryStringAny[] = "any"; - -const char kVersionStyleStringNumerical[] = "numerical"; -const char kVersionStyleStringLexical[] = "lexical"; - -const char kOp[] = "op"; - -} // namespace anonymous - -GpuControlList::VersionInfo::VersionInfo( - const std::string& version_op, - const std::string& version_style, - const std::string& version_string, - const std::string& version_string2) - : version_style_(kVersionStyleNumerical) { - op_ = StringToNumericOp(version_op); - if (op_ == kUnknown || op_ == kAny) - return; - version_style_ = StringToVersionStyle(version_style); - if (!ProcessVersionString(version_string, '.', &version_)) { - op_ = kUnknown; - return; - } - if (op_ == kBetween) { - if (!ProcessVersionString(version_string2, '.', &version2_)) - op_ = kUnknown; - } -} - -GpuControlList::VersionInfo::~VersionInfo() { -} - -bool GpuControlList::VersionInfo::Contains( - const std::string& version_string) const { - return Contains(version_string, '.'); -} - -bool GpuControlList::VersionInfo::Contains( - const std::string& version_string, char splitter) const { - if (op_ == kUnknown) - return false; - if (op_ == kAny) - return true; - std::vector<std::string> version; - if (!ProcessVersionString(version_string, splitter, &version)) - return false; - int relation = Compare(version, version_, version_style_); - if (op_ == kEQ) - return (relation == 0); - else if (op_ == kLT) - return (relation < 0); - else if (op_ == kLE) - return (relation <= 0); - else if (op_ == kGT) - return (relation > 0); - else if (op_ == kGE) - return (relation >= 0); - // op_ == kBetween - if (relation < 0) - return false; - return Compare(version, version2_, version_style_) <= 0; -} - -bool GpuControlList::VersionInfo::IsValid() const { - return (op_ != kUnknown && version_style_ != kVersionStyleUnknown); -} - -bool GpuControlList::VersionInfo::IsLexical() const { - return version_style_ == kVersionStyleLexical; -} - -// static -int GpuControlList::VersionInfo::Compare( - const std::vector<std::string>& version, - const std::vector<std::string>& version_ref, - VersionStyle version_style) { - DCHECK(version.size() > 0 && version_ref.size() > 0); - DCHECK(version_style != kVersionStyleUnknown); - for (size_t i = 0; i < version_ref.size(); ++i) { - if (i >= version.size()) - return 0; - int ret = 0; - // We assume both versions are checked by ProcessVersionString(). - if (i > 0 && version_style == kVersionStyleLexical) - ret = CompareLexicalNumberStrings(version[i], version_ref[i]); - else - ret = CompareNumericalNumberStrings(version[i], version_ref[i]); - if (ret != 0) - return ret; - } - return 0; -} - -// static -GpuControlList::VersionInfo::VersionStyle -GpuControlList::VersionInfo::StringToVersionStyle( - const std::string& version_style) { - if (version_style.empty() || version_style == kVersionStyleStringNumerical) - return kVersionStyleNumerical; - if (version_style == kVersionStyleStringLexical) - return kVersionStyleLexical; - return kVersionStyleUnknown; -} - -GpuControlList::OsInfo::OsInfo(const std::string& os, - const std::string& version_op, - const std::string& version_string, - const std::string& version_string2) { - type_ = StringToOsType(os); - if (type_ != kOsUnknown) { - version_info_.reset(new VersionInfo( - version_op, std::string(), version_string, version_string2)); - } -} - -GpuControlList::OsInfo::~OsInfo() {} - -bool GpuControlList::OsInfo::Contains(OsType type, - const std::string& version) const { - if (!IsValid()) - return false; - if (type_ != type && type_ != kOsAny) - return false; - return version_info_->Contains(version); -} - -bool GpuControlList::OsInfo::IsValid() const { - return type_ != kOsUnknown && version_info_->IsValid(); -} - -GpuControlList::OsType GpuControlList::OsInfo::type() const { - return type_; -} - -GpuControlList::OsType GpuControlList::OsInfo::StringToOsType( - const std::string& os) { - if (os == "win") - return kOsWin; - else if (os == "macosx") - return kOsMacosx; - else if (os == "android") - return kOsAndroid; - else if (os == "linux") - return kOsLinux; - else if (os == "chromeos") - return kOsChromeOS; - else if (os == "any") - return kOsAny; - return kOsUnknown; -} - -GpuControlList::MachineModelInfo::MachineModelInfo( - const std::string& name_op, - const std::string& name_value, - const std::string& version_op, - const std::string& version_string, - const std::string& version_string2) { - name_info_.reset(new StringInfo(name_op, name_value)); - version_info_.reset(new VersionInfo( - version_op, std::string(), version_string, version_string2)); -} - -GpuControlList::MachineModelInfo::~MachineModelInfo() {} - -bool GpuControlList::MachineModelInfo::Contains( - const std::string& name, const std::string& version) const { - if (!IsValid()) - return false; - if (!name_info_->Contains(name)) - return false; - return version_info_->Contains(version); -} - -bool GpuControlList::MachineModelInfo::IsValid() const { - return name_info_->IsValid() && version_info_->IsValid(); -} - -GpuControlList::StringInfo::StringInfo(const std::string& string_op, - const std::string& string_value) { - op_ = StringToOp(string_op); - value_ = StringToLowerASCII(string_value); -} - -bool GpuControlList::StringInfo::Contains(const std::string& value) const { - std::string my_value = StringToLowerASCII(value); - switch (op_) { - case kContains: - return strstr(my_value.c_str(), value_.c_str()) != NULL; - case kBeginWith: - return StartsWithASCII(my_value, value_, false); - case kEndWith: - return EndsWith(my_value, value_, false); - case kEQ: - return value_ == my_value; - default: - return false; - } -} - -bool GpuControlList::StringInfo::IsValid() const { - return op_ != kUnknown; -} - -GpuControlList::StringInfo::Op GpuControlList::StringInfo::StringToOp( - const std::string& string_op) { - if (string_op == "=") - return kEQ; - else if (string_op == "contains") - return kContains; - else if (string_op == "beginwith") - return kBeginWith; - else if (string_op == "endwith") - return kEndWith; - return kUnknown; -} - -GpuControlList::FloatInfo::FloatInfo(const std::string& float_op, - const std::string& float_value, - const std::string& float_value2) - : op_(kUnknown), - value_(0.f), - value2_(0.f) { - op_ = StringToNumericOp(float_op); - if (op_ == kAny) - return; - double dvalue = 0; - if (!base::StringToDouble(float_value, &dvalue)) { - op_ = kUnknown; - return; - } - value_ = static_cast<float>(dvalue); - if (op_ == kBetween) { - if (!base::StringToDouble(float_value2, &dvalue)) { - op_ = kUnknown; - return; - } - value2_ = static_cast<float>(dvalue); - } -} - -bool GpuControlList::FloatInfo::Contains(float value) const { - if (op_ == kUnknown) - return false; - if (op_ == kAny) - return true; - if (op_ == kEQ) - return (value == value_); - if (op_ == kLT) - return (value < value_); - if (op_ == kLE) - return (value <= value_); - if (op_ == kGT) - return (value > value_); - if (op_ == kGE) - return (value >= value_); - DCHECK(op_ == kBetween); - return ((value_ <= value && value <= value2_) || - (value2_ <= value && value <= value_)); -} - -bool GpuControlList::FloatInfo::IsValid() const { - return op_ != kUnknown; -} - -GpuControlList::IntInfo::IntInfo(const std::string& int_op, - const std::string& int_value, - const std::string& int_value2) - : op_(kUnknown), - value_(0), - value2_(0) { - op_ = StringToNumericOp(int_op); - if (op_ == kAny) - return; - if (!base::StringToInt(int_value, &value_)) { - op_ = kUnknown; - return; - } - if (op_ == kBetween && - !base::StringToInt(int_value2, &value2_)) - op_ = kUnknown; -} - -bool GpuControlList::IntInfo::Contains(int value) const { - if (op_ == kUnknown) - return false; - if (op_ == kAny) - return true; - if (op_ == kEQ) - return (value == value_); - if (op_ == kLT) - return (value < value_); - if (op_ == kLE) - return (value <= value_); - if (op_ == kGT) - return (value > value_); - if (op_ == kGE) - return (value >= value_); - DCHECK(op_ == kBetween); - return ((value_ <= value && value <= value2_) || - (value2_ <= value && value <= value_)); -} - -bool GpuControlList::IntInfo::IsValid() const { - return op_ != kUnknown; -} - -// static -GpuControlList::ScopedGpuControlListEntry -GpuControlList::GpuControlListEntry::GetEntryFromValue( - const base::DictionaryValue* value, bool top_level, - const FeatureMap& feature_map, - bool supports_feature_type_all) { - DCHECK(value); - ScopedGpuControlListEntry entry(new GpuControlListEntry()); - - size_t dictionary_entry_count = 0; - - if (top_level) { - uint32 id; - if (!value->GetInteger("id", reinterpret_cast<int*>(&id)) || - !entry->SetId(id)) { - LOG(WARNING) << "Malformed id entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - - bool disabled; - if (value->GetBoolean("disabled", &disabled)) { - entry->SetDisabled(disabled); - dictionary_entry_count++; - } - } - - std::string description; - if (value->GetString("description", &description)) { - entry->description_ = description; - dictionary_entry_count++; - } else { - entry->description_ = "The GPU is unavailable for an unexplained reason."; - } - - const base::ListValue* cr_bugs; - if (value->GetList("cr_bugs", &cr_bugs)) { - for (size_t i = 0; i < cr_bugs->GetSize(); ++i) { - int bug_id; - if (cr_bugs->GetInteger(i, &bug_id)) { - entry->cr_bugs_.push_back(bug_id); - } else { - LOG(WARNING) << "Malformed cr_bugs entry " << entry->id(); - return NULL; - } - } - dictionary_entry_count++; - } - - const base::ListValue* webkit_bugs; - if (value->GetList("webkit_bugs", &webkit_bugs)) { - for (size_t i = 0; i < webkit_bugs->GetSize(); ++i) { - int bug_id; - if (webkit_bugs->GetInteger(i, &bug_id)) { - entry->webkit_bugs_.push_back(bug_id); - } else { - LOG(WARNING) << "Malformed webkit_bugs entry " << entry->id(); - return NULL; - } - } - dictionary_entry_count++; - } - - const base::DictionaryValue* os_value = NULL; - if (value->GetDictionary("os", &os_value)) { - std::string os_type; - std::string os_version_op = "any"; - std::string os_version_string; - std::string os_version_string2; - os_value->GetString("type", &os_type); - const base::DictionaryValue* os_version_value = NULL; - if (os_value->GetDictionary("version", &os_version_value)) { - os_version_value->GetString(kOp, &os_version_op); - os_version_value->GetString("number", &os_version_string); - os_version_value->GetString("number2", &os_version_string2); - } - if (!entry->SetOsInfo(os_type, os_version_op, os_version_string, - os_version_string2)) { - LOG(WARNING) << "Malformed os entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - std::string vendor_id; - if (value->GetString("vendor_id", &vendor_id)) { - if (!entry->SetVendorId(vendor_id)) { - LOG(WARNING) << "Malformed vendor_id entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::ListValue* device_id_list; - if (value->GetList("device_id", &device_id_list)) { - for (size_t i = 0; i < device_id_list->GetSize(); ++i) { - std::string device_id; - if (!device_id_list->GetString(i, &device_id) || - !entry->AddDeviceId(device_id)) { - LOG(WARNING) << "Malformed device_id entry " << entry->id(); - return NULL; - } - } - dictionary_entry_count++; - } - - std::string multi_gpu_style; - if (value->GetString("multi_gpu_style", &multi_gpu_style)) { - if (!entry->SetMultiGpuStyle(multi_gpu_style)) { - LOG(WARNING) << "Malformed multi_gpu_style entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - std::string multi_gpu_category; - if (value->GetString("multi_gpu_category", &multi_gpu_category)) { - if (!entry->SetMultiGpuCategory(multi_gpu_category)) { - LOG(WARNING) << "Malformed multi_gpu_category entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* driver_vendor_value = NULL; - if (value->GetDictionary("driver_vendor", &driver_vendor_value)) { - std::string vendor_op; - std::string vendor_value; - driver_vendor_value->GetString(kOp, &vendor_op); - driver_vendor_value->GetString("value", &vendor_value); - if (!entry->SetDriverVendorInfo(vendor_op, vendor_value)) { - LOG(WARNING) << "Malformed driver_vendor entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* driver_version_value = NULL; - if (value->GetDictionary("driver_version", &driver_version_value)) { - std::string driver_version_op = "any"; - std::string driver_version_style; - std::string driver_version_string; - std::string driver_version_string2; - driver_version_value->GetString(kOp, &driver_version_op); - driver_version_value->GetString("style", &driver_version_style); - driver_version_value->GetString("number", &driver_version_string); - driver_version_value->GetString("number2", &driver_version_string2); - if (!entry->SetDriverVersionInfo(driver_version_op, - driver_version_style, - driver_version_string, - driver_version_string2)) { - LOG(WARNING) << "Malformed driver_version entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* driver_date_value = NULL; - if (value->GetDictionary("driver_date", &driver_date_value)) { - std::string driver_date_op = "any"; - std::string driver_date_string; - std::string driver_date_string2; - driver_date_value->GetString(kOp, &driver_date_op); - driver_date_value->GetString("number", &driver_date_string); - driver_date_value->GetString("number2", &driver_date_string2); - if (!entry->SetDriverDateInfo(driver_date_op, driver_date_string, - driver_date_string2)) { - LOG(WARNING) << "Malformed driver_date entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* gl_vendor_value = NULL; - if (value->GetDictionary("gl_vendor", &gl_vendor_value)) { - std::string vendor_op; - std::string vendor_value; - gl_vendor_value->GetString(kOp, &vendor_op); - gl_vendor_value->GetString("value", &vendor_value); - if (!entry->SetGLVendorInfo(vendor_op, vendor_value)) { - LOG(WARNING) << "Malformed gl_vendor entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* gl_renderer_value = NULL; - if (value->GetDictionary("gl_renderer", &gl_renderer_value)) { - std::string renderer_op; - std::string renderer_value; - gl_renderer_value->GetString(kOp, &renderer_op); - gl_renderer_value->GetString("value", &renderer_value); - if (!entry->SetGLRendererInfo(renderer_op, renderer_value)) { - LOG(WARNING) << "Malformed gl_renderer entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* gl_extensions_value = NULL; - if (value->GetDictionary("gl_extensions", &gl_extensions_value)) { - std::string extensions_op; - std::string extensions_value; - gl_extensions_value->GetString(kOp, &extensions_op); - gl_extensions_value->GetString("value", &extensions_value); - if (!entry->SetGLExtensionsInfo(extensions_op, extensions_value)) { - LOG(WARNING) << "Malformed gl_extensions entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* cpu_brand_value = NULL; - if (value->GetDictionary("cpu_info", &cpu_brand_value)) { - std::string cpu_op; - std::string cpu_value; - cpu_brand_value->GetString(kOp, &cpu_op); - cpu_brand_value->GetString("value", &cpu_value); - if (!entry->SetCpuBrand(cpu_op, cpu_value)) { - LOG(WARNING) << "Malformed cpu_brand entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* perf_graphics_value = NULL; - if (value->GetDictionary("perf_graphics", &perf_graphics_value)) { - std::string op; - std::string float_value; - std::string float_value2; - perf_graphics_value->GetString(kOp, &op); - perf_graphics_value->GetString("value", &float_value); - perf_graphics_value->GetString("value2", &float_value2); - if (!entry->SetPerfGraphicsInfo(op, float_value, float_value2)) { - LOG(WARNING) << "Malformed perf_graphics entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* perf_gaming_value = NULL; - if (value->GetDictionary("perf_gaming", &perf_gaming_value)) { - std::string op; - std::string float_value; - std::string float_value2; - perf_gaming_value->GetString(kOp, &op); - perf_gaming_value->GetString("value", &float_value); - perf_gaming_value->GetString("value2", &float_value2); - if (!entry->SetPerfGamingInfo(op, float_value, float_value2)) { - LOG(WARNING) << "Malformed perf_gaming entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* perf_overall_value = NULL; - if (value->GetDictionary("perf_overall", &perf_overall_value)) { - std::string op; - std::string float_value; - std::string float_value2; - perf_overall_value->GetString(kOp, &op); - perf_overall_value->GetString("value", &float_value); - perf_overall_value->GetString("value2", &float_value2); - if (!entry->SetPerfOverallInfo(op, float_value, float_value2)) { - LOG(WARNING) << "Malformed perf_overall entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* machine_model_value = NULL; - if (value->GetDictionary("machine_model", &machine_model_value)) { - std::string name_op; - std::string name_value; - const base::DictionaryValue* name = NULL; - if (machine_model_value->GetDictionary("name", &name)) { - name->GetString(kOp, &name_op); - name->GetString("value", &name_value); - } - - std::string version_op = "any"; - std::string version_string; - std::string version_string2; - const base::DictionaryValue* version_value = NULL; - if (machine_model_value->GetDictionary("version", &version_value)) { - version_value->GetString(kOp, &version_op); - version_value->GetString("number", &version_string); - version_value->GetString("number2", &version_string2); - } - if (!entry->SetMachineModelInfo( - name_op, name_value, version_op, version_string, version_string2)) { - LOG(WARNING) << "Malformed machine_model entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - const base::DictionaryValue* gpu_count_value = NULL; - if (value->GetDictionary("gpu_count", &gpu_count_value)) { - std::string op; - std::string int_value; - std::string int_value2; - gpu_count_value->GetString(kOp, &op); - gpu_count_value->GetString("value", &int_value); - gpu_count_value->GetString("value2", &int_value2); - if (!entry->SetGpuCountInfo(op, int_value, int_value2)) { - LOG(WARNING) << "Malformed gpu_count entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - - if (top_level) { - const base::ListValue* feature_value = NULL; - if (value->GetList("features", &feature_value)) { - std::vector<std::string> feature_list; - for (size_t i = 0; i < feature_value->GetSize(); ++i) { - std::string feature; - if (feature_value->GetString(i, &feature)) { - feature_list.push_back(feature); - } else { - LOG(WARNING) << "Malformed feature entry " << entry->id(); - return NULL; - } - } - if (!entry->SetFeatures( - feature_list, feature_map, supports_feature_type_all)) { - LOG(WARNING) << "Malformed feature entry " << entry->id(); - return NULL; - } - dictionary_entry_count++; - } - } - - if (top_level) { - const base::ListValue* exception_list_value = NULL; - if (value->GetList("exceptions", &exception_list_value)) { - for (size_t i = 0; i < exception_list_value->GetSize(); ++i) { - const base::DictionaryValue* exception_value = NULL; - if (!exception_list_value->GetDictionary(i, &exception_value)) { - LOG(WARNING) << "Malformed exceptions entry " << entry->id(); - return NULL; - } - ScopedGpuControlListEntry exception(GetEntryFromValue( - exception_value, false, feature_map, supports_feature_type_all)); - if (exception == NULL) { - LOG(WARNING) << "Malformed exceptions entry " << entry->id(); - return NULL; - } - if (exception->contains_unknown_fields_) { - LOG(WARNING) << "Exception with unknown fields " << entry->id(); - entry->contains_unknown_fields_ = true; - } else { - entry->AddException(exception); - } - } - dictionary_entry_count++; - } - - const base::DictionaryValue* browser_version_value = NULL; - // browser_version is processed in LoadGpuControlList(). - if (value->GetDictionary("browser_version", &browser_version_value)) - dictionary_entry_count++; - } - - if (value->size() != dictionary_entry_count) { - LOG(WARNING) << "Entry with unknown fields " << entry->id(); - entry->contains_unknown_fields_ = true; - } - return entry; -} - -GpuControlList::GpuControlListEntry::GpuControlListEntry() - : id_(0), - disabled_(false), - vendor_id_(0), - multi_gpu_style_(kMultiGpuStyleNone), - multi_gpu_category_(kMultiGpuCategoryPrimary), - contains_unknown_fields_(false), - contains_unknown_features_(false) { -} - -GpuControlList::GpuControlListEntry::~GpuControlListEntry() { } - -bool GpuControlList::GpuControlListEntry::SetId(uint32 id) { - if (id != 0) { - id_ = id; - return true; - } - return false; -} - -void GpuControlList::GpuControlListEntry::SetDisabled(bool disabled) { - disabled_ = disabled; -} - -bool GpuControlList::GpuControlListEntry::SetOsInfo( - const std::string& os, - const std::string& version_op, - const std::string& version_string, - const std::string& version_string2) { - os_info_.reset(new OsInfo(os, version_op, version_string, version_string2)); - return os_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetVendorId( - const std::string& vendor_id_string) { - vendor_id_ = 0; - return base::HexStringToInt(vendor_id_string, - reinterpret_cast<int*>(&vendor_id_)); -} - -bool GpuControlList::GpuControlListEntry::AddDeviceId( - const std::string& device_id_string) { - uint32 device_id = 0; - if (base::HexStringToInt(device_id_string, - reinterpret_cast<int*>(&device_id))) { - device_id_list_.push_back(device_id); - return true; - } - return false; -} - -bool GpuControlList::GpuControlListEntry::SetMultiGpuStyle( - const std::string& multi_gpu_style_string) { - MultiGpuStyle style = StringToMultiGpuStyle(multi_gpu_style_string); - if (style == kMultiGpuStyleNone) - return false; - multi_gpu_style_ = style; - return true; -} - -bool GpuControlList::GpuControlListEntry::SetMultiGpuCategory( - const std::string& multi_gpu_category_string) { - MultiGpuCategory category = - StringToMultiGpuCategory(multi_gpu_category_string); - if (category == kMultiGpuCategoryNone) - return false; - multi_gpu_category_ = category; - return true; -} - -bool GpuControlList::GpuControlListEntry::SetDriverVendorInfo( - const std::string& vendor_op, - const std::string& vendor_value) { - driver_vendor_info_.reset(new StringInfo(vendor_op, vendor_value)); - return driver_vendor_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetDriverVersionInfo( - const std::string& version_op, - const std::string& version_style, - const std::string& version_string, - const std::string& version_string2) { - driver_version_info_.reset(new VersionInfo( - version_op, version_style, version_string, version_string2)); - return driver_version_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetDriverDateInfo( - const std::string& date_op, - const std::string& date_string, - const std::string& date_string2) { - driver_date_info_.reset( - new VersionInfo(date_op, std::string(), date_string, date_string2)); - return driver_date_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetGLVendorInfo( - const std::string& vendor_op, - const std::string& vendor_value) { - gl_vendor_info_.reset(new StringInfo(vendor_op, vendor_value)); - return gl_vendor_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetGLRendererInfo( - const std::string& renderer_op, - const std::string& renderer_value) { - gl_renderer_info_.reset(new StringInfo(renderer_op, renderer_value)); - return gl_renderer_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetGLExtensionsInfo( - const std::string& extensions_op, - const std::string& extensions_value) { - gl_extensions_info_.reset(new StringInfo(extensions_op, extensions_value)); - return gl_extensions_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetCpuBrand( - const std::string& cpu_op, - const std::string& cpu_value) { - cpu_brand_.reset(new StringInfo(cpu_op, cpu_value)); - return cpu_brand_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetPerfGraphicsInfo( - const std::string& op, - const std::string& float_string, - const std::string& float_string2) { - perf_graphics_info_.reset(new FloatInfo(op, float_string, float_string2)); - return perf_graphics_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetPerfGamingInfo( - const std::string& op, - const std::string& float_string, - const std::string& float_string2) { - perf_gaming_info_.reset(new FloatInfo(op, float_string, float_string2)); - return perf_gaming_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetPerfOverallInfo( - const std::string& op, - const std::string& float_string, - const std::string& float_string2) { - perf_overall_info_.reset(new FloatInfo(op, float_string, float_string2)); - return perf_overall_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetMachineModelInfo( - const std::string& name_op, - const std::string& name_value, - const std::string& version_op, - const std::string& version_string, - const std::string& version_string2) { - machine_model_info_.reset(new MachineModelInfo( - name_op, name_value, version_op, version_string, version_string2)); - return machine_model_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetGpuCountInfo( - const std::string& op, - const std::string& int_string, - const std::string& int_string2) { - gpu_count_info_.reset(new IntInfo(op, int_string, int_string2)); - return gpu_count_info_->IsValid(); -} - -bool GpuControlList::GpuControlListEntry::SetFeatures( - const std::vector<std::string>& feature_strings, - const FeatureMap& feature_map, - bool supports_feature_type_all) { - size_t size = feature_strings.size(); - if (size == 0) - return false; - features_.clear(); - for (size_t i = 0; i < size; ++i) { - int feature = 0; - if (supports_feature_type_all && feature_strings[i] == "all") { - for (FeatureMap::const_iterator iter = feature_map.begin(); - iter != feature_map.end(); ++iter) - features_.insert(iter->second); - continue; - } - if (StringToFeature(feature_strings[i], &feature, feature_map)) - features_.insert(feature); - else - contains_unknown_features_ = true; - } - return true; -} - -void GpuControlList::GpuControlListEntry::AddException( - ScopedGpuControlListEntry exception) { - exceptions_.push_back(exception); -} - -// static -GpuControlList::GpuControlListEntry::MultiGpuStyle -GpuControlList::GpuControlListEntry::StringToMultiGpuStyle( - const std::string& style) { - if (style == kMultiGpuStyleStringOptimus) - return kMultiGpuStyleOptimus; - if (style == kMultiGpuStyleStringAMDSwitchable) - return kMultiGpuStyleAMDSwitchable; - return kMultiGpuStyleNone; -} - -// static -GpuControlList::GpuControlListEntry::MultiGpuCategory -GpuControlList::GpuControlListEntry::StringToMultiGpuCategory( - const std::string& category) { - if (category == kMultiGpuCategoryStringPrimary) - return kMultiGpuCategoryPrimary; - if (category == kMultiGpuCategoryStringSecondary) - return kMultiGpuCategorySecondary; - if (category == kMultiGpuCategoryStringAny) - return kMultiGpuCategoryAny; - return kMultiGpuCategoryNone; -} - -bool GpuControlList::GpuControlListEntry::Contains( - OsType os_type, const std::string& os_version, - const GPUInfo& gpu_info) const { - DCHECK(os_type != kOsAny); - if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version)) - return false; - bool is_not_primary_gpu = - GpuUnmatched(vendor_id_, device_id_list_, gpu_info.gpu); - bool is_not_secondary_gpu = true; - for (size_t i = 0; i < gpu_info.secondary_gpus.size(); ++i) { - is_not_secondary_gpu = is_not_secondary_gpu && - GpuUnmatched(vendor_id_, device_id_list_, gpu_info.secondary_gpus[i]); - } - switch (multi_gpu_category_) { - case kMultiGpuCategoryPrimary: - if (is_not_primary_gpu) - return false; - break; - case kMultiGpuCategorySecondary: - if (is_not_secondary_gpu) - return false; - break; - case kMultiGpuCategoryAny: - if (is_not_primary_gpu && is_not_secondary_gpu) - return false; - break; - case kMultiGpuCategoryNone: - break; - } - switch (multi_gpu_style_) { - case kMultiGpuStyleOptimus: - if (!gpu_info.optimus) - return false; - break; - case kMultiGpuStyleAMDSwitchable: - if (!gpu_info.amd_switchable) - return false; - break; - case kMultiGpuStyleNone: - break; - } - if (driver_vendor_info_.get() != NULL && !gpu_info.driver_vendor.empty() && - !driver_vendor_info_->Contains(gpu_info.driver_vendor)) - return false; - if (driver_version_info_.get() != NULL && !gpu_info.driver_version.empty()) { - if (!driver_version_info_->Contains(gpu_info.driver_version)) - return false; - } - if (driver_date_info_.get() != NULL && !gpu_info.driver_date.empty()) { - if (!driver_date_info_->Contains(gpu_info.driver_date, '-')) - return false; - } - if (gl_vendor_info_.get() != NULL && !gpu_info.gl_vendor.empty() && - !gl_vendor_info_->Contains(gpu_info.gl_vendor)) - return false; - if (gl_renderer_info_.get() != NULL && !gpu_info.gl_renderer.empty() && - !gl_renderer_info_->Contains(gpu_info.gl_renderer)) - return false; - if (gl_extensions_info_.get() != NULL && !gpu_info.gl_extensions.empty() && - !gl_extensions_info_->Contains(gpu_info.gl_extensions)) - return false; - if (perf_graphics_info_.get() != NULL && - (gpu_info.performance_stats.graphics == 0.0 || - !perf_graphics_info_->Contains(gpu_info.performance_stats.graphics))) - return false; - if (perf_gaming_info_.get() != NULL && - (gpu_info.performance_stats.gaming == 0.0 || - !perf_gaming_info_->Contains(gpu_info.performance_stats.gaming))) - return false; - if (perf_overall_info_.get() != NULL && - (gpu_info.performance_stats.overall == 0.0 || - !perf_overall_info_->Contains(gpu_info.performance_stats.overall))) - return false; - if (machine_model_info_.get() != NULL) { - std::vector<std::string> name_version; - base::SplitString(gpu_info.machine_model, ' ', &name_version); - if (name_version.size() == 2 && - !machine_model_info_->Contains(name_version[0], name_version[1])) - return false; - } - if (gpu_count_info_.get() != NULL && - !gpu_count_info_->Contains(gpu_info.secondary_gpus.size() + 1)) - return false; - if (cpu_brand_.get() != NULL) { - base::CPU cpu_info; - if (!cpu_brand_->Contains(cpu_info.cpu_brand())) - return false; - } - - for (size_t i = 0; i < exceptions_.size(); ++i) { - if (exceptions_[i]->Contains(os_type, os_version, gpu_info) && - !exceptions_[i]->NeedsMoreInfo(gpu_info)) - return false; - } - return true; -} - -bool GpuControlList::GpuControlListEntry::NeedsMoreInfo( - const GPUInfo& gpu_info) const { - // We only check for missing info that might be collected with a gl context. - // If certain info is missing due to some error, say, we fail to collect - // vendor_id/device_id, then even if we launch GPU process and create a gl - // context, we won't gather such missing info, so we still return false. - if (driver_vendor_info_.get() && gpu_info.driver_vendor.empty()) - return true; - if (driver_version_info_.get() && gpu_info.driver_version.empty()) - return true; - if (gl_vendor_info_.get() && gpu_info.gl_vendor.empty()) - return true; - if (gl_renderer_info_.get() && gpu_info.gl_renderer.empty()) - return true; - for (size_t i = 0; i < exceptions_.size(); ++i) { - if (exceptions_[i]->NeedsMoreInfo(gpu_info)) - return true; - } - return false; -} - -GpuControlList::OsType GpuControlList::GpuControlListEntry::GetOsType() const { - if (os_info_.get() == NULL) - return kOsAny; - return os_info_->type(); -} - -uint32 GpuControlList::GpuControlListEntry::id() const { - return id_; -} - -bool GpuControlList::GpuControlListEntry::disabled() const { - return disabled_; -} - -const std::set<int>& GpuControlList::GpuControlListEntry::features() const { - return features_; -} - -// static -bool GpuControlList::GpuControlListEntry::StringToFeature( - const std::string& feature_name, int* feature_id, - const FeatureMap& feature_map) { - FeatureMap::const_iterator iter = feature_map.find(feature_name); - if (iter != feature_map.end()) { - *feature_id = iter->second; - return true; - } - return false; -} - -GpuControlList::GpuControlList() - : max_entry_id_(0), - contains_unknown_fields_(false), - needs_more_info_(false), - supports_feature_type_all_(false) { -} - -GpuControlList::~GpuControlList() { - Clear(); -} - -bool GpuControlList::LoadList( - const std::string& json_context, GpuControlList::OsFilter os_filter) { - const std::string browser_version_string = "0"; - return LoadList(browser_version_string, json_context, os_filter); -} - -bool GpuControlList::LoadList( - const std::string& browser_version_string, - const std::string& json_context, - GpuControlList::OsFilter os_filter) { - std::vector<std::string> pieces; - if (!ProcessVersionString(browser_version_string, '.', &pieces)) - return false; - browser_version_ = browser_version_string; - - scoped_ptr<base::Value> root; - root.reset(base::JSONReader::Read(json_context)); - if (root.get() == NULL || !root->IsType(base::Value::TYPE_DICTIONARY)) - return false; - - base::DictionaryValue* root_dictionary = - static_cast<DictionaryValue*>(root.get()); - DCHECK(root_dictionary); - return LoadList(*root_dictionary, os_filter); -} - -bool GpuControlList::LoadList(const base::DictionaryValue& parsed_json, - GpuControlList::OsFilter os_filter) { - std::vector<ScopedGpuControlListEntry> entries; - - parsed_json.GetString("version", &version_); - std::vector<std::string> pieces; - if (!ProcessVersionString(version_, '.', &pieces)) - return false; - - const base::ListValue* list = NULL; - if (!parsed_json.GetList("entries", &list)) - return false; - - uint32 max_entry_id = 0; - bool contains_unknown_fields = false; - for (size_t i = 0; i < list->GetSize(); ++i) { - const base::DictionaryValue* list_item = NULL; - bool valid = list->GetDictionary(i, &list_item); - if (!valid || list_item == NULL) - return false; - // Check browser version compatibility: if the entry is not for the - // current browser version, don't process it. - BrowserVersionSupport browser_version_support = - IsEntrySupportedByCurrentBrowserVersion(list_item); - if (browser_version_support == kMalformed) - return false; - if (browser_version_support == kUnsupported) - continue; - DCHECK(browser_version_support == kSupported); - ScopedGpuControlListEntry entry(GpuControlListEntry::GetEntryFromValue( - list_item, true, feature_map_, supports_feature_type_all_)); - if (entry == NULL) - return false; - if (entry->id() > max_entry_id) - max_entry_id = entry->id(); - // If an unknown field is encountered, skip the entry; if an unknown - // feature is encountered, ignore the feature, but keep the entry. - if (entry->contains_unknown_fields()) { - contains_unknown_fields = true; - continue; - } - if (entry->contains_unknown_features()) - contains_unknown_fields = true; - entries.push_back(entry); - } - - Clear(); - OsType my_os = GetOsType(); - for (size_t i = 0; i < entries.size(); ++i) { - OsType entry_os = entries[i]->GetOsType(); - if (os_filter == GpuControlList::kAllOs || - entry_os == kOsAny || entry_os == my_os) - entries_.push_back(entries[i]); - } - max_entry_id_ = max_entry_id; - contains_unknown_fields_ = contains_unknown_fields; - return true; -} - -std::set<int> GpuControlList::MakeDecision( - GpuControlList::OsType os, - std::string os_version, - const GPUInfo& gpu_info) { - active_entries_.clear(); - std::set<int> features; - - needs_more_info_ = false; - std::set<int> possible_features; - - if (os == kOsAny) - os = GetOsType(); - if (os_version.empty()) { - os_version = base::SysInfo::OperatingSystemVersion(); - size_t pos = os_version.find_first_not_of("0123456789."); - if (pos != std::string::npos) - os_version = os_version.substr(0, pos); - } - std::vector<std::string> pieces; - if (!ProcessVersionString(os_version, '.', &pieces)) - os_version = "0"; - - for (size_t i = 0; i < entries_.size(); ++i) { - if (entries_[i]->Contains(os, os_version, gpu_info)) { - if (!entries_[i]->disabled()) { - MergeFeatureSets(&possible_features, entries_[i]->features()); - if (!entries_[i]->NeedsMoreInfo(gpu_info)) - MergeFeatureSets(&features, entries_[i]->features()); - } - active_entries_.push_back(entries_[i]); - } - } - - if (possible_features.size() > features.size()) - needs_more_info_ = true; - - return features; -} - -void GpuControlList::GetDecisionEntries( - std::vector<uint32>* entry_ids, bool disabled) const { - DCHECK(entry_ids); - entry_ids->clear(); - for (size_t i = 0; i < active_entries_.size(); ++i) { - if (disabled == active_entries_[i]->disabled()) - entry_ids->push_back(active_entries_[i]->id()); - } -} - -void GpuControlList::GetReasons(base::ListValue* problem_list) const { - DCHECK(problem_list); - for (size_t i = 0; i < active_entries_.size(); ++i) { - GpuControlListEntry* entry = active_entries_[i]; - if (entry->disabled()) - continue; - base::DictionaryValue* problem = new base::DictionaryValue(); - - problem->SetString("description", entry->description()); - - base::ListValue* cr_bugs = new base::ListValue(); - for (size_t j = 0; j < entry->cr_bugs().size(); ++j) - cr_bugs->Append(new base::FundamentalValue(entry->cr_bugs()[j])); - problem->Set("crBugs", cr_bugs); - - base::ListValue* webkit_bugs = new base::ListValue(); - for (size_t j = 0; j < entry->webkit_bugs().size(); ++j) { - webkit_bugs->Append(new base::FundamentalValue(entry->webkit_bugs()[j])); - } - problem->Set("webkitBugs", webkit_bugs); - - problem_list->Append(problem); - } -} - -size_t GpuControlList::num_entries() const { - return entries_.size(); -} - -uint32 GpuControlList::max_entry_id() const { - return max_entry_id_; -} - -std::string GpuControlList::version() const { - return version_; -} - -GpuControlList::OsType GpuControlList::GetOsType() { -#if defined(OS_CHROMEOS) - return kOsChromeOS; -#elif defined(OS_WIN) - return kOsWin; -#elif defined(OS_ANDROID) - return kOsAndroid; -#elif defined(OS_LINUX) || defined(OS_OPENBSD) - return kOsLinux; -#elif defined(OS_MACOSX) - return kOsMacosx; -#else - return kOsUnknown; -#endif -} - -void GpuControlList::Clear() { - entries_.clear(); - active_entries_.clear(); - max_entry_id_ = 0; - contains_unknown_fields_ = false; -} - -GpuControlList::BrowserVersionSupport -GpuControlList::IsEntrySupportedByCurrentBrowserVersion( - const base::DictionaryValue* value) { - DCHECK(value); - const base::DictionaryValue* browser_version_value = NULL; - if (value->GetDictionary("browser_version", &browser_version_value)) { - std::string version_op = "any"; - std::string version_string; - std::string version_string2; - browser_version_value->GetString(kOp, &version_op); - browser_version_value->GetString("number", &version_string); - browser_version_value->GetString("number2", &version_string2); - scoped_ptr<VersionInfo> browser_version_info; - browser_version_info.reset(new VersionInfo( - version_op, std::string(), version_string, version_string2)); - if (!browser_version_info->IsValid()) - return kMalformed; - if (browser_version_info->Contains(browser_version_)) - return kSupported; - return kUnsupported; - } - return kSupported; -} - -// static -GpuControlList::NumericOp GpuControlList::StringToNumericOp( - const std::string& op) { - if (op == "=") - return kEQ; - if (op == "<") - return kLT; - if (op == "<=") - return kLE; - if (op == ">") - return kGT; - if (op == ">=") - return kGE; - if (op == "any") - return kAny; - if (op == "between") - return kBetween; - return kUnknown; -} - -void GpuControlList::AddSupportedFeature( - const std::string& feature_name, int feature_id) { - feature_map_[feature_name] = feature_id; -} - -void GpuControlList::set_supports_feature_type_all(bool supported) { - supports_feature_type_all_ = supported; -} - -} // namespace gpu - diff --git a/gpu/config/gpu_control_list.h b/gpu/config/gpu_control_list.h deleted file mode 100644 index eaf7024..0000000 --- a/gpu/config/gpu_control_list.h +++ /dev/null @@ -1,498 +0,0 @@ -// Copyright (c) 2013 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 GPU_CONFIG_GPU_CONTROL_LIST_H_ -#define GPU_CONFIG_GPU_CONTROL_LIST_H_ - -#include <set> -#include <string> -#include <vector> - -#include "base/basictypes.h" -#include "base/gtest_prod_util.h" -#include "base/hash_tables.h" -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "base/values.h" -#include "build/build_config.h" -#include "gpu/gpu_export.h" - -namespace gpu { -struct GPUInfo; - -class GPU_EXPORT GpuControlList { - public: - enum OsType { - kOsLinux, - kOsMacosx, - kOsWin, - kOsChromeOS, - kOsAndroid, - kOsAny, - kOsUnknown - }; - - enum OsFilter { - // In loading, ignore all entries that belong to other OS. - kCurrentOsOnly, - // In loading, keep all entries. This is for testing only. - kAllOs - }; - - GpuControlList(); - virtual ~GpuControlList(); - - // Loads control list information from a json file. - // If failed, the current GpuControlList is un-touched. - bool LoadList(const std::string& json_context, OsFilter os_filter); - bool LoadList(const std::string& browser_version_string, - const std::string& json_context, OsFilter os_filter); - - // Collects system information and combines them with gpu_info and control - // list information to decide which entries are applied to the current - // system and returns the union of features specified in each entry. - // If os is kOsAny, use the current OS; if os_version is empty, use the - // current OS version. - std::set<int> MakeDecision( - OsType os, std::string os_version, const GPUInfo& gpu_info); - - // Collects the active entries from the last MakeDecision() call. - // If disabled set to true, return entries that are disabled; otherwise, - // return enabled entries. - void GetDecisionEntries(std::vector<uint32>* entry_ids, - bool disabled) const; - - // Returns the description and bugs from active entries from the last - // MakeDecision() call. - // - // Each problems has: - // { - // "description": "Your GPU is too old", - // "crBugs": [1234], - // "webkitBugs": [] - // } - void GetReasons(base::ListValue* problem_list) const; - - // Return the largest entry id. This is used for histogramming. - uint32 max_entry_id() const; - - // Returns the version of the control list. - std::string version() const; - - // Check if we need more gpu info to make the decisions. - // This is computed from the last MakeDecision() call. - // If yes, we should create a gl context and do a full gpu info collection. - bool needs_more_info() const { return needs_more_info_; } - - // Check if any entries contain unknown fields. This is only for tests. - bool contains_unknown_fields() const { return contains_unknown_fields_; } - - // Returns the number of entries. This is only for tests. - size_t num_entries() const; - - // Register a feature to FeatureMap - used to construct a GpuControlList. - void AddSupportedFeature(const std::string& feature_name, int feature_id); - // Register whether "all" is recognized as all features. - void set_supports_feature_type_all(bool supported); - - private: - friend class GpuControlListEntryTest; - friend class MachineModelInfoTest; - friend class NumberInfoTest; - friend class OsInfoTest; - friend class StringInfoTest; - friend class VersionInfoTest; - - enum BrowserVersionSupport { - kSupported, - kUnsupported, - kMalformed - }; - - enum NumericOp { - kBetween, // <= * <= - kEQ, // = - kLT, // < - kLE, // <= - kGT, // > - kGE, // >= - kAny, - kUnknown // Indicates the data is invalid. - }; - - class GPU_EXPORT VersionInfo { - public: - // If version_style is empty, it defaults to kNumerical. - VersionInfo(const std::string& version_op, - const std::string& version_style, - const std::string& version_string, - const std::string& version_string2); - ~VersionInfo(); - - // Determines if a given version is included in the VersionInfo range. - // "splitter" divides version string into segments. - bool Contains(const std::string& version, char splitter) const; - // Same as above, using '.' as splitter. - bool Contains(const std::string& version) const; - - // Determine if the version_style is lexical. - bool IsLexical() const; - - // Determines if the VersionInfo contains valid information. - bool IsValid() const; - - private: - enum VersionStyle { - kVersionStyleNumerical, - kVersionStyleLexical, - kVersionStyleUnknown - }; - - static VersionStyle StringToVersionStyle(const std::string& version_style); - - // Compare two version strings. - // Return 1 if version > version_ref, - // 0 if version = version_ref, - // -1 if version < version_ref. - // Note that we only compare as many segments as both versions contain. - // For example: Compare("10.3.1", "10.3") returns 0, - // Compare("10.3", "10.3.1") returns 0. - // If "version_style" is Lexical, the first segment is compared - // numerically, all other segments are compared lexically. - // Lexical is used for AMD Linux driver versions only. - static int Compare(const std::vector<std::string>& version, - const std::vector<std::string>& version_ref, - VersionStyle version_style); - - NumericOp op_; - VersionStyle version_style_; - std::vector<std::string> version_; - std::vector<std::string> version2_; - }; - - class GPU_EXPORT OsInfo { - public: - OsInfo(const std::string& os, - const std::string& version_op, - const std::string& version_string, - const std::string& version_string2); - ~OsInfo(); - - // Determines if a given os/version is included in the OsInfo set. - bool Contains(OsType type, const std::string& version) const; - - // Determines if the VersionInfo contains valid information. - bool IsValid() const; - - OsType type() const; - - // Maps string to OsType; returns kOsUnknown if it's not a valid os. - static OsType StringToOsType(const std::string& os); - - private: - OsType type_; - scoped_ptr<VersionInfo> version_info_; - }; - - class GPU_EXPORT StringInfo { - public: - StringInfo(const std::string& string_op, const std::string& string_value); - - // Determines if a given string is included in the StringInfo. - bool Contains(const std::string& value) const; - - // Determines if the StringInfo contains valid information. - bool IsValid() const; - - private: - enum Op { - kContains, - kBeginWith, - kEndWith, - kEQ, // = - kUnknown // Indicates StringInfo data is invalid. - }; - - // Maps string to Op; returns kUnknown if it's not a valid Op. - static Op StringToOp(const std::string& string_op); - - Op op_; - std::string value_; - }; - - class GPU_EXPORT FloatInfo { - public: - FloatInfo(const std::string& float_op, - const std::string& float_value, - const std::string& float_value2); - - // Determines if a given float is included in the FloatInfo. - bool Contains(float value) const; - - // Determines if the FloatInfo contains valid information. - bool IsValid() const; - - private: - NumericOp op_; - float value_; - float value2_; - }; - - class GPU_EXPORT IntInfo { - public: - IntInfo(const std::string& int_op, - const std::string& int_value, - const std::string& int_value2); - - // Determines if a given int is included in the IntInfo. - bool Contains(int value) const; - - // Determines if the IntInfo contains valid information. - bool IsValid() const; - - private: - NumericOp op_; - int value_; - int value2_; - }; - - class GPU_EXPORT MachineModelInfo { - public: - MachineModelInfo(const std::string& name_op, - const std::string& name_value, - const std::string& version_op, - const std::string& version_string, - const std::string& version_string2); - ~MachineModelInfo(); - - // Determines if a given name/version is included in the MachineModelInfo. - bool Contains(const std::string& name, const std::string& version) const; - - // Determines if the MachineModelInfo contains valid information. - bool IsValid() const; - - private: - scoped_ptr<StringInfo> name_info_; - scoped_ptr<VersionInfo> version_info_; - }; - - class GpuControlListEntry; - typedef scoped_refptr<GpuControlListEntry> ScopedGpuControlListEntry; - - typedef base::hash_map<std::string, int> FeatureMap; - - class GPU_EXPORT GpuControlListEntry - : public base::RefCounted<GpuControlListEntry> { - public: - // Constructs GpuControlListEntry from DictionaryValue loaded from json. - // Top-level entry must have an id number. Others are exceptions. - static ScopedGpuControlListEntry GetEntryFromValue( - const base::DictionaryValue* value, bool top_level, - const FeatureMap& feature_map, - bool supports_feature_type_all); - - // Determines if a given os/gc/machine_model/driver is included in the - // Entry set. - bool Contains(OsType os_type, const std::string& os_version, - const GPUInfo& gpu_info) const; - - // Determines whether we needs more gpu info to make the blacklisting - // decision. It should only be checked if Contains() returns true. - bool NeedsMoreInfo(const GPUInfo& gpu_info) const; - - // Returns the OsType. - OsType GetOsType() const; - - // Returns the entry's unique id. 0 is reserved. - uint32 id() const; - - // Returns whether the entry is disabled. - bool disabled() const; - - // Returns the description of the entry - const std::string& description() const { return description_; } - - // Returns a list of Chromium and Webkit bugs applicable to this entry - const std::vector<int>& cr_bugs() const { return cr_bugs_; } - const std::vector<int>& webkit_bugs() const { return webkit_bugs_; } - - // Returns the blacklisted features in this entry. - const std::set<int>& features() const; - - // Returns true if an unknown field is encountered. - bool contains_unknown_fields() const { - return contains_unknown_fields_; - } - // Returns true if an unknown blacklist feature is encountered. - bool contains_unknown_features() const { - return contains_unknown_features_; - } - - private: - friend class base::RefCounted<GpuControlListEntry>; - - enum MultiGpuStyle { - kMultiGpuStyleOptimus, - kMultiGpuStyleAMDSwitchable, - kMultiGpuStyleNone - }; - - enum MultiGpuCategory { - kMultiGpuCategoryPrimary, - kMultiGpuCategorySecondary, - kMultiGpuCategoryAny, - kMultiGpuCategoryNone - }; - - GpuControlListEntry(); - ~GpuControlListEntry(); - - bool SetId(uint32 id); - - void SetDisabled(bool disabled); - - bool SetOsInfo(const std::string& os, - const std::string& version_op, - const std::string& version_string, - const std::string& version_string2); - - bool SetVendorId(const std::string& vendor_id_string); - - bool AddDeviceId(const std::string& device_id_string); - - bool SetMultiGpuStyle(const std::string& multi_gpu_style_string); - - bool SetMultiGpuCategory(const std::string& multi_gpu_category_string); - - bool SetDriverVendorInfo(const std::string& vendor_op, - const std::string& vendor_value); - - bool SetDriverVersionInfo(const std::string& version_op, - const std::string& version_style, - const std::string& version_string, - const std::string& version_string2); - - bool SetDriverDateInfo(const std::string& date_op, - const std::string& date_string, - const std::string& date_string2); - - bool SetGLVendorInfo(const std::string& vendor_op, - const std::string& vendor_value); - - bool SetGLRendererInfo(const std::string& renderer_op, - const std::string& renderer_value); - - bool SetGLExtensionsInfo(const std::string& extensions_op, - const std::string& extensions_value); - - bool SetCpuBrand(const std::string& cpu_op, - const std::string& cpu_value); - - bool SetPerfGraphicsInfo(const std::string& op, - const std::string& float_string, - const std::string& float_string2); - - bool SetPerfGamingInfo(const std::string& op, - const std::string& float_string, - const std::string& float_string2); - - bool SetPerfOverallInfo(const std::string& op, - const std::string& float_string, - const std::string& float_string2); - - bool SetMachineModelInfo(const std::string& name_op, - const std::string& name_value, - const std::string& version_op, - const std::string& version_string, - const std::string& version_string2); - - bool SetGpuCountInfo(const std::string& op, - const std::string& int_string, - const std::string& int_string2); - - bool SetFeatures(const std::vector<std::string>& features, - const FeatureMap& feature_map, - bool supports_feature_type_all); - - void AddException(ScopedGpuControlListEntry exception); - - static MultiGpuStyle StringToMultiGpuStyle(const std::string& style); - - static MultiGpuCategory StringToMultiGpuCategory( - const std::string& category); - - // map a feature_name to feature_id. If the string is not a registered - // feature name, return false. - static bool StringToFeature(const std::string& feature_name, - int* feature_id, - const FeatureMap& feature_map); - - uint32 id_; - bool disabled_; - std::string description_; - std::vector<int> cr_bugs_; - std::vector<int> webkit_bugs_; - scoped_ptr<OsInfo> os_info_; - uint32 vendor_id_; - std::vector<uint32> device_id_list_; - MultiGpuStyle multi_gpu_style_; - MultiGpuCategory multi_gpu_category_; - scoped_ptr<StringInfo> driver_vendor_info_; - scoped_ptr<VersionInfo> driver_version_info_; - scoped_ptr<VersionInfo> driver_date_info_; - scoped_ptr<StringInfo> gl_vendor_info_; - scoped_ptr<StringInfo> gl_renderer_info_; - scoped_ptr<StringInfo> gl_extensions_info_; - scoped_ptr<StringInfo> cpu_brand_; - scoped_ptr<FloatInfo> perf_graphics_info_; - scoped_ptr<FloatInfo> perf_gaming_info_; - scoped_ptr<FloatInfo> perf_overall_info_; - scoped_ptr<MachineModelInfo> machine_model_info_; - scoped_ptr<IntInfo> gpu_count_info_; - std::set<int> features_; - std::vector<ScopedGpuControlListEntry> exceptions_; - bool contains_unknown_fields_; - bool contains_unknown_features_; - }; - - // Gets the current OS type. - static OsType GetOsType(); - - bool LoadList(const base::DictionaryValue& parsed_json, OsFilter os_filter); - - void Clear(); - - // Check if the entry is supported by the current version of browser. - // By default, if there is no browser version information in the entry, - // return kSupported; - BrowserVersionSupport IsEntrySupportedByCurrentBrowserVersion( - const base::DictionaryValue* value); - - static NumericOp StringToNumericOp(const std::string& op); - - std::string version_; - std::vector<ScopedGpuControlListEntry> entries_; - - std::string browser_version_; - - // This records all the blacklist entries that are appliable to the current - // user machine. It is updated everytime MakeDecision() is called and is - // used later by GetDecisionEntries(). - std::vector<ScopedGpuControlListEntry> active_entries_; - - uint32 max_entry_id_; - - bool contains_unknown_fields_; - - bool needs_more_info_; - - // The features a GpuControlList recognizes and handles. - FeatureMap feature_map_; - bool supports_feature_type_all_; -}; - -} // namespace gpu - -#endif // GPU_CONFIG_GPU_CONTROL_LIST_H_ - diff --git a/gpu/config/gpu_control_list_entry_unittest.cc b/gpu/config/gpu_control_list_entry_unittest.cc deleted file mode 100644 index b4505bc..0000000 --- a/gpu/config/gpu_control_list_entry_unittest.cc +++ /dev/null @@ -1,748 +0,0 @@ -// Copyright (c) 2013 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 "base/json/json_reader.h" -#include "gpu/config/gpu_control_list.h" -#include "gpu/config/gpu_info.h" -#include "testing/gtest/include/gtest/gtest.h" - -#define LONG_STRING_CONST(...) #__VA_ARGS__ - -namespace gpu { - -enum TestFeatureType { - TEST_FEATURE_0 = 0, - TEST_FEATURE_1, - TEST_FEATURE_2 -}; - -class GpuControlListEntryTest : public testing::Test { - public: - GpuControlListEntryTest() { } - virtual ~GpuControlListEntryTest() { } - - const GPUInfo& gpu_info() const { - return gpu_info_; - } - - typedef GpuControlList::ScopedGpuControlListEntry ScopedEntry; - - static ScopedEntry GetEntryFromString( - const std::string& json, bool supports_feature_type_all) { - scoped_ptr<base::Value> root; - root.reset(base::JSONReader::Read(json)); - DictionaryValue* value = NULL; - if (root.get() == NULL || !root->GetAsDictionary(&value)) - return NULL; - - GpuControlList::FeatureMap feature_map; - feature_map["test_feature_0"] = TEST_FEATURE_0; - feature_map["test_feature_1"] = TEST_FEATURE_1; - feature_map["test_feature_2"] = TEST_FEATURE_2; - - return GpuControlList::GpuControlListEntry::GetEntryFromValue( - value, true, feature_map, supports_feature_type_all); - } - - static ScopedEntry GetEntryFromString(const std::string& json) { - return GetEntryFromString(json, false); - } - - virtual void SetUp() { - gpu_info_.gpu.vendor_id = 0x10de; - gpu_info_.gpu.device_id = 0x0640; - gpu_info_.driver_vendor = "NVIDIA"; - gpu_info_.driver_version = "1.6.18"; - gpu_info_.driver_date = "7-14-2009"; - gpu_info_.machine_model = "MacBookPro 7.1"; - gpu_info_.gl_vendor = "NVIDIA Corporation"; - gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; - gpu_info_.performance_stats.graphics = 5.0; - gpu_info_.performance_stats.gaming = 5.0; - gpu_info_.performance_stats.overall = 5.0; - } - - private: - GPUInfo gpu_info_; -}; - -TEST_F(GpuControlListEntryTest, DetailedEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 5, - "description": "test entry", - "cr_bugs": [1024, 678], - "webkit_bugs": [1950], - "os": { - "type": "macosx", - "version": { - "op": "=", - "number": "10.6.4" - } - }, - "vendor_id": "0x10de", - "device_id": ["0x0640"], - "driver_version": { - "op": "=", - "number": "1.6.18" - }, - "features": [ - "test_feature_0" - ] - } - ); - - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType()); - EXPECT_FALSE(entry->disabled()); - EXPECT_EQ(5u, entry->id()); - EXPECT_STREQ("test entry", entry->description().c_str()); - EXPECT_EQ(2u, entry->cr_bugs().size()); - EXPECT_EQ(1024, entry->cr_bugs()[0]); - EXPECT_EQ(678, entry->cr_bugs()[1]); - EXPECT_EQ(1u, entry->webkit_bugs().size()); - EXPECT_EQ(1950, entry->webkit_bugs()[0]); - EXPECT_EQ(1u, entry->features().size()); - EXPECT_EQ(1u, entry->features().count(TEST_FEATURE_0)); - EXPECT_FALSE(entry->contains_unknown_fields()); - EXPECT_FALSE(entry->contains_unknown_features()); - EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info())); - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsMacosx, "10.6.4", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, VendorOnAllOsEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "vendor_id": "0x10de", - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsAny, entry->GetOsType()); - - const GpuControlList::OsType os_type[] = { - GpuControlList::kOsMacosx, - GpuControlList::kOsWin, - GpuControlList::kOsLinux, - GpuControlList::kOsChromeOS, - GpuControlList::kOsAndroid - }; - for (size_t i = 0; i < arraysize(os_type); ++i) - EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, VendorOnLinuxEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "os": { - "type": "linux" - }, - "vendor_id": "0x10de", - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsLinux, entry->GetOsType()); - - const GpuControlList::OsType os_type[] = { - GpuControlList::kOsMacosx, - GpuControlList::kOsWin, - GpuControlList::kOsChromeOS, - GpuControlList::kOsAndroid - }; - for (size_t i = 0; i < arraysize(os_type); ++i) - EXPECT_FALSE(entry->Contains(os_type[i], "10.6", gpu_info())); - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsLinux, "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, AllExceptNVidiaOnLinuxEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "os": { - "type": "linux" - }, - "exceptions": [ - { - "vendor_id": "0x10de" - } - ], - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsLinux, entry->GetOsType()); - - const GpuControlList::OsType os_type[] = { - GpuControlList::kOsMacosx, - GpuControlList::kOsWin, - GpuControlList::kOsLinux, - GpuControlList::kOsChromeOS, - GpuControlList::kOsAndroid - }; - for (size_t i = 0; i < arraysize(os_type); ++i) - EXPECT_FALSE(entry->Contains(os_type[i], "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, AllExceptIntelOnLinuxEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "os": { - "type": "linux" - }, - "exceptions": [ - { - "vendor_id": "0x8086" - } - ], - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsLinux, entry->GetOsType()); - - const GpuControlList::OsType os_type[] = { - GpuControlList::kOsMacosx, - GpuControlList::kOsWin, - GpuControlList::kOsChromeOS, - GpuControlList::kOsAndroid - }; - for (size_t i = 0; i < arraysize(os_type); ++i) - EXPECT_FALSE(entry->Contains(os_type[i], "10.6", gpu_info())); - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsLinux, "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, DateOnWindowsEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "os": { - "type": "win" - }, - "driver_date": { - "op": "<", - "number": "2010.5.8" - }, - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsWin, entry->GetOsType()); - - GPUInfo gpu_info; - gpu_info.driver_date = "4-12-2010"; - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsWin, "10.6", gpu_info)); - gpu_info.driver_date = "5-8-2010"; - EXPECT_FALSE(entry->Contains( - GpuControlList::kOsWin, "10.6", gpu_info)); - gpu_info.driver_date = "5-9-2010"; - EXPECT_FALSE(entry->Contains( - GpuControlList::kOsWin, "10.6", gpu_info)); -} - -TEST_F(GpuControlListEntryTest, MultipleDevicesEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "vendor_id": "0x10de", - "device_id": ["0x1023", "0x0640"], - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsAny, entry->GetOsType()); - - const GpuControlList::OsType os_type[] = { - GpuControlList::kOsMacosx, - GpuControlList::kOsWin, - GpuControlList::kOsLinux, - GpuControlList::kOsChromeOS, - GpuControlList::kOsAndroid - }; - for (size_t i = 0; i < arraysize(os_type); ++i) - EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, ChromeOSEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "os": { - "type": "chromeos" - }, - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsChromeOS, entry->GetOsType()); - - const GpuControlList::OsType os_type[] = { - GpuControlList::kOsMacosx, - GpuControlList::kOsWin, - GpuControlList::kOsLinux, - GpuControlList::kOsAndroid - }; - for (size_t i = 0; i < arraysize(os_type); ++i) - EXPECT_FALSE(entry->Contains(os_type[i], "10.6", gpu_info())); - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsChromeOS, "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, MalformedVendor) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "vendor_id": "[0x10de]", - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry == NULL); -} - -TEST_F(GpuControlListEntryTest, UnknownFieldEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "unknown_field": 0, - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_TRUE(entry->contains_unknown_fields()); - EXPECT_FALSE(entry->contains_unknown_features()); -} - -TEST_F(GpuControlListEntryTest, UnknownExceptionFieldEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 2, - "exceptions": [ - { - "unknown_field": 0 - } - ], - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_TRUE(entry->contains_unknown_fields()); - EXPECT_FALSE(entry->contains_unknown_features()); -} - -TEST_F(GpuControlListEntryTest, UnknownFeatureEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "features": [ - "some_unknown_feature", - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_FALSE(entry->contains_unknown_fields()); - EXPECT_TRUE(entry->contains_unknown_features()); - EXPECT_EQ(1u, entry->features().size()); - EXPECT_EQ(1u, entry->features().count(TEST_FEATURE_0)); - - const GpuControlList::OsType os_type[] = { - GpuControlList::kOsMacosx, - GpuControlList::kOsWin, - GpuControlList::kOsLinux, - GpuControlList::kOsChromeOS, - GpuControlList::kOsAndroid - }; - for (size_t i = 0; i < arraysize(os_type); ++i) - EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, GlVendorEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "gl_vendor": { - "op": "beginwith", - "value": "NVIDIA" - }, - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - - const GpuControlList::OsType os_type[] = { - GpuControlList::kOsMacosx, - GpuControlList::kOsWin, - GpuControlList::kOsLinux, - GpuControlList::kOsChromeOS, - GpuControlList::kOsAndroid - }; - for (size_t i = 0; i < arraysize(os_type); ++i) - EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, GlRendererEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "gl_renderer": { - "op": "contains", - "value": "GeForce" - }, - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - - const GpuControlList::OsType os_type[] = { - GpuControlList::kOsMacosx, - GpuControlList::kOsWin, - GpuControlList::kOsLinux, - GpuControlList::kOsChromeOS, - GpuControlList::kOsAndroid - }; - for (size_t i = 0; i < arraysize(os_type); ++i) - EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, PerfGraphicsEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "perf_graphics": { - "op": "<", - "value": "6.0" - }, - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsWin, "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, PerfGamingEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "perf_graphics": { - "op": "<=", - "value": "4.0" - }, - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_FALSE(entry->Contains( - GpuControlList::kOsWin, "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, PerfOverallEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "perf_overall": { - "op": "between", - "value": "1.0", - "value2": "9.0" - }, - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsWin, "10.6", gpu_info())); -} - -TEST_F(GpuControlListEntryTest, DisabledEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "disabled": true, - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_TRUE(entry->disabled()); -} - -TEST_F(GpuControlListEntryTest, OptimusEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "os": { - "type": "linux" - }, - "multi_gpu_style": "optimus", - "features": [ - "test_feature_0" - ] - } - ); - GPUInfo gpu_info; - gpu_info.optimus = true; - - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsLinux, entry->GetOsType()); - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsLinux, "10.6", gpu_info)); -} - -TEST_F(GpuControlListEntryTest, AMDSwitchableEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "os": { - "type": "macosx" - }, - "multi_gpu_style": "amd_switchable", - "features": [ - "test_feature_0" - ] - } - ); - GPUInfo gpu_info; - gpu_info.amd_switchable = true; - - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType()); - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsMacosx, "10.6", gpu_info)); -} - -TEST_F(GpuControlListEntryTest, LexicalDriverVersionEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "os": { - "type": "linux" - }, - "vendor_id": "0x1002", - "driver_version": { - "op": "=", - "style": "lexical", - "number": "8.76" - }, - "features": [ - "test_feature_0" - ] - } - ); - GPUInfo gpu_info; - gpu_info.gpu.vendor_id = 0x1002; - - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsLinux, entry->GetOsType()); - - gpu_info.driver_version = "8.76"; - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsLinux, "10.6", gpu_info)); - - gpu_info.driver_version = "8.768"; - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsLinux, "10.6", gpu_info)); - - gpu_info.driver_version = "8.76.8"; - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsLinux, "10.6", gpu_info)); -} - -TEST_F(GpuControlListEntryTest, MultipleGPUsAnyEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "os": { - "type": "macosx" - }, - "vendor_id": "0x8086", - "device_id": ["0x0166"], - "multi_gpu_category": "any", - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType()); - - GPUInfo gpu_info; - gpu_info.gpu.vendor_id = 0x10de; - gpu_info.gpu.device_id = 0x1976; - EXPECT_FALSE(entry->Contains( - GpuControlList::kOsMacosx, "10.6", gpu_info)); - - GPUInfo::GPUDevice gpu_device; - gpu_device.vendor_id = 0x8086; - gpu_device.device_id = 0x0166; - gpu_info.secondary_gpus.push_back(gpu_device); - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsMacosx, "10.6", gpu_info)); -} - -TEST_F(GpuControlListEntryTest, MultipleGPUsSecondaryEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "os": { - "type": "macosx" - }, - "vendor_id": "0x8086", - "device_id": ["0x0166"], - "multi_gpu_category": "secondary", - "features": [ - "test_feature_0" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType()); - - GPUInfo gpu_info; - gpu_info.gpu.vendor_id = 0x10de; - gpu_info.gpu.device_id = 0x1976; - EXPECT_FALSE(entry->Contains( - GpuControlList::kOsMacosx, "10.6", gpu_info)); - - GPUInfo::GPUDevice gpu_device; - gpu_device.vendor_id = 0x8086; - gpu_device.device_id = 0x0166; - gpu_info.secondary_gpus.push_back(gpu_device); - EXPECT_TRUE(entry->Contains( - GpuControlList::kOsMacosx, "10.6", gpu_info)); -} - -TEST_F(GpuControlListEntryTest, NeedsMoreInfoEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "vendor_id": "0x8086", - "driver_version": { - "op": "<", - "number": "10.7" - }, - "features": [ - "test_feature_1" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - - GPUInfo gpu_info; - gpu_info.gpu.vendor_id = 0x8086; - EXPECT_TRUE(entry->NeedsMoreInfo(gpu_info)); - - gpu_info.driver_version = "10.6"; - EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info)); -} - -TEST_F(GpuControlListEntryTest, NeedsMoreInfoForExceptionsEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "vendor_id": "0x8086", - "exceptions": [ - { - "gl_renderer": { - "op": "contains", - "value": "mesa" - } - } - ], - "features": [ - "test_feature_1" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json)); - EXPECT_TRUE(entry != NULL); - - GPUInfo gpu_info; - gpu_info.gpu.vendor_id = 0x8086; - EXPECT_TRUE(entry->NeedsMoreInfo(gpu_info)); - - gpu_info.gl_renderer = "mesa"; - EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info)); -} - -TEST_F(GpuControlListEntryTest, FeatureTypeAllEntry) { - const std::string json = LONG_STRING_CONST( - { - "id": 1, - "features": [ - "all" - ] - } - ); - ScopedEntry entry(GetEntryFromString(json, true)); - EXPECT_TRUE(entry != NULL); - EXPECT_EQ(3u, entry->features().size()); - EXPECT_EQ(1u, entry->features().count(TEST_FEATURE_0)); - EXPECT_EQ(1u, entry->features().count(TEST_FEATURE_1)); - EXPECT_EQ(1u, entry->features().count(TEST_FEATURE_2)); -} - -} // namespace gpu - diff --git a/gpu/config/gpu_control_list_jsons.h b/gpu/config/gpu_control_list_jsons.h deleted file mode 100644 index 671aa9e..0000000 --- a/gpu/config/gpu_control_list_jsons.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2013 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 GPU_CONFIG_GPU_CONTROL_LIST_JSONS_H_ -#define GPU_CONFIG_GPU_CONTROL_LIST_JSONS_H_ - -#include "gpu/gpu_export.h" - -namespace gpu { - -GPU_EXPORT extern const char kGpuDriverBugListJson[]; -GPU_EXPORT extern const char kGpuSwitchingListJson[]; -GPU_EXPORT extern const char kSoftwareRenderingListJson[]; - -} // namespace gpu - -#endif // GPU_CONFIG_GPU_CONTROL_LIST_JSONS_H_ - diff --git a/gpu/config/gpu_control_list_machine_model_info_unittest.cc b/gpu/config/gpu_control_list_machine_model_info_unittest.cc deleted file mode 100644 index 9c681a9..0000000 --- a/gpu/config/gpu_control_list_machine_model_info_unittest.cc +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2013 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 "gpu/config/gpu_control_list.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace gpu { - -class MachineModelInfoTest : public testing::Test { - public: - MachineModelInfoTest() { } - virtual ~MachineModelInfoTest() { } - - typedef GpuControlList::MachineModelInfo MachineModelInfo; -}; - -TEST_F(MachineModelInfoTest, ValidModelInfo) { - const std::string name_op[] = { - "contains", - "beginwith", - "endwith", - "=" - }; - const std::string version_op[] = { - "=", - "<", - "<=", - ">", - ">=", - "any", - "between" - }; - for (size_t i = 0; i < arraysize(name_op); ++i) { - for (size_t j = 0; j < arraysize(version_op); ++j) { - std::string version1; - std::string version2; - if (version_op[j] != "any") - version1 = "3.14"; - if (version_op[j] == "between") - version2 = "5.4"; - MachineModelInfo info(name_op[i], "model", - version_op[j], version1, version2); - EXPECT_TRUE(info.IsValid()); - } - } -} - -TEST_F(MachineModelInfoTest, ModelComparison) { - MachineModelInfo info("=", "model_a", ">", "3.4", std::string()); - EXPECT_TRUE(info.Contains("model_a", "4")); - EXPECT_FALSE(info.Contains("model_b", "4")); - EXPECT_FALSE(info.Contains("model_a", "3.2")); -} - -} // namespace gpu - diff --git a/gpu/config/gpu_control_list_number_info_unittest.cc b/gpu/config/gpu_control_list_number_info_unittest.cc deleted file mode 100644 index 5bd732c..0000000 --- a/gpu/config/gpu_control_list_number_info_unittest.cc +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) 2013 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 "gpu/config/gpu_control_list.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace gpu { - -class NumberInfoTest : public testing::Test { - public: - NumberInfoTest() { } - virtual ~NumberInfoTest() { } - - typedef GpuControlList::FloatInfo FloatInfo; - typedef GpuControlList::IntInfo IntInfo; -}; - -TEST_F(NumberInfoTest, ValidFloatInfo) { - const std::string op[] = { - "=", - "<", - "<=", - ">", - ">=", - "any", - "between" - }; - for (size_t i = 0; i < arraysize(op); ++i) { - std::string value1; - std::string value2; - if (op[i] != "any") - value1 = "3.14"; - if (op[i] == "between") - value2 = "4.21"; - FloatInfo info(op[i], value1, value2); - EXPECT_TRUE(info.IsValid()); - } - - const std::string value[] = { - "1.0E12", - "1.0e12", - "2013", - "1.0e-12", - "2.1400", - "-2.14", - }; - for (size_t i = 0; i < arraysize(value); ++i) { - FloatInfo info("=", value[i], std::string()); - EXPECT_TRUE(info.IsValid()); - } -} - -TEST_F(NumberInfoTest, InvalidFloatInfo) { - const std::string op[] = { - "=", - "<", - "<=", - ">", - ">=", - }; - for (size_t i = 0; i < arraysize(op); ++i) { - FloatInfo info(op[i], std::string(), std::string()); - EXPECT_FALSE(info.IsValid()); - } - { - FloatInfo info("between", "3.14", std::string()); - EXPECT_FALSE(info.IsValid()); - } - const std::string value[] = { - "1.0 E12", - "1.0e 12", - " 2013", - "2013 ", - "- 2.14", - }; - for (size_t i = 0; i < arraysize(value); ++i) { - FloatInfo info("=", value[i], std::string()); - EXPECT_FALSE(info.IsValid()); - } -} - -TEST_F(NumberInfoTest, FloatComparison) { - { - FloatInfo info("=", "3.14", std::string()); - EXPECT_TRUE(info.Contains(3.14f)); - EXPECT_TRUE(info.Contains(3.1400f)); - EXPECT_FALSE(info.Contains(3.1f)); - EXPECT_FALSE(info.Contains(3)); - } - { - FloatInfo info(">", "3.14", std::string()); - EXPECT_FALSE(info.Contains(3.14f)); - EXPECT_TRUE(info.Contains(3.141f)); - EXPECT_FALSE(info.Contains(3.1f)); - } - { - FloatInfo info("<=", "3.14", std::string()); - EXPECT_TRUE(info.Contains(3.14f)); - EXPECT_FALSE(info.Contains(3.141f)); - EXPECT_TRUE(info.Contains(3.1f)); - } - { - FloatInfo info("any", std::string(), std::string()); - EXPECT_TRUE(info.Contains(3.14f)); - } - { - FloatInfo info("between", "3.14", "5.4"); - EXPECT_TRUE(info.Contains(3.14f)); - EXPECT_TRUE(info.Contains(5.4f)); - EXPECT_TRUE(info.Contains(4)); - EXPECT_FALSE(info.Contains(5.6f)); - EXPECT_FALSE(info.Contains(3.12f)); - } -} - -TEST_F(NumberInfoTest, ValidIntInfo) { - const std::string op[] = { - "=", - "<", - "<=", - ">", - ">=", - "any", - "between" - }; - for (size_t i = 0; i < arraysize(op); ++i) { - std::string value1; - std::string value2; - if (op[i] != "any") - value1 = "3"; - if (op[i] == "between") - value2 = "9"; - IntInfo info(op[i], value1, value2); - EXPECT_TRUE(info.IsValid()); - } - - const std::string value[] = { - "12", - "-12", - }; - for (size_t i = 0; i < arraysize(value); ++i) { - IntInfo info("=", value[i], std::string()); - EXPECT_TRUE(info.IsValid()); - } -} - -TEST_F(NumberInfoTest, InvalidIntInfo) { - const std::string op[] = { - "=", - "<", - "<=", - ">", - ">=", - }; - for (size_t i = 0; i < arraysize(op); ++i) { - IntInfo info(op[i], std::string(), std::string()); - EXPECT_FALSE(info.IsValid()); - } - { - IntInfo info("between", "3", std::string()); - EXPECT_FALSE(info.IsValid()); - } - const std::string value[] = { - " 12", - "12 ", - "- 12", - " -12", - "3.14" - }; - for (size_t i = 0; i < arraysize(value); ++i) { - IntInfo info("=", value[i], std::string()); - EXPECT_FALSE(info.IsValid()); - } -} - -TEST_F(NumberInfoTest, IntComparison) { - { - IntInfo info("=", "3", std::string()); - EXPECT_TRUE(info.Contains(3)); - EXPECT_FALSE(info.Contains(4)); - } - { - IntInfo info(">", "3", std::string()); - EXPECT_FALSE(info.Contains(2)); - EXPECT_FALSE(info.Contains(3)); - EXPECT_TRUE(info.Contains(4)); - } - { - IntInfo info("<=", "3", std::string()); - EXPECT_TRUE(info.Contains(2)); - EXPECT_TRUE(info.Contains(3)); - EXPECT_FALSE(info.Contains(4)); - } - { - IntInfo info("any", std::string(), std::string()); - EXPECT_TRUE(info.Contains(3)); - } - { - IntInfo info("between", "3", "5"); - EXPECT_TRUE(info.Contains(3)); - EXPECT_TRUE(info.Contains(5)); - EXPECT_TRUE(info.Contains(4)); - EXPECT_FALSE(info.Contains(6)); - EXPECT_FALSE(info.Contains(2)); - } -} - -} // namespace gpu - diff --git a/gpu/config/gpu_control_list_os_info_unittest.cc b/gpu/config/gpu_control_list_os_info_unittest.cc deleted file mode 100644 index 851f991..0000000 --- a/gpu/config/gpu_control_list_os_info_unittest.cc +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2013 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 "gpu/config/gpu_control_list.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace gpu { - -class OsInfoTest : public testing::Test { - public: - OsInfoTest() { } - virtual ~OsInfoTest() { } - - typedef GpuControlList::OsInfo OsInfo; -}; - -TEST_F(OsInfoTest, ValidOsInfo) { - const std::string os[] = { - "win", - "linux", - "macosx", - "chromeos", - "android", - "any" - }; - const GpuControlList::OsType os_type[] = { - GpuControlList::kOsWin, - GpuControlList::kOsLinux, - GpuControlList::kOsMacosx, - GpuControlList::kOsChromeOS, - GpuControlList::kOsAndroid, - GpuControlList::kOsAny - }; - for (size_t i = 0; i < arraysize(os); ++i) { - OsInfo info(os[i], "=", "10.6", std::string()); - EXPECT_TRUE(info.IsValid()); - EXPECT_EQ(os_type[i], info.type()); - } - { - OsInfo info("any", "any", std::string(), std::string()); - EXPECT_TRUE(info.IsValid()); - } -} - -TEST_F(OsInfoTest, InvalidOsInfo) { - const std::string os[] = { - "win", - "linux", - "macosx", - "chromeos", - "android", - "any" - }; - for (size_t i = 0; i < arraysize(os); ++i) { - { - OsInfo info(os[i], std::string(), std::string(), std::string()); - EXPECT_FALSE(info.IsValid()); - } - { - OsInfo info(os[i], "=", std::string(), std::string()); - EXPECT_FALSE(info.IsValid()); - } - { - OsInfo info(os[i], std::string(), "10.6", std::string()); - EXPECT_FALSE(info.IsValid()); - } - } - const std::string os_cap[] = { - "Win", - "Linux", - "MacOSX", - "ChromeOS", - "Android", - }; - for (size_t i = 0; i < arraysize(os_cap); ++i) { - OsInfo info(os_cap[i], "=", "10.6", std::string()); - EXPECT_FALSE(info.IsValid()); - } -} - -TEST_F(OsInfoTest, OsComparison) { - { - OsInfo info("any", "any", std::string(), std::string()); - const GpuControlList::OsType os_type[] = { - GpuControlList::kOsWin, GpuControlList::kOsLinux, - GpuControlList::kOsMacosx, GpuControlList::kOsChromeOS, - GpuControlList::kOsAndroid, - }; - for (size_t i = 0; i < arraysize(os_type); ++i) { - EXPECT_TRUE(info.Contains(os_type[i], std::string())); - EXPECT_TRUE(info.Contains(os_type[i], "7.8")); - } - } - { - OsInfo info("win", ">=", "6", std::string()); - EXPECT_FALSE(info.Contains(GpuControlList::kOsMacosx, "10.8.3")); - EXPECT_FALSE(info.Contains(GpuControlList::kOsLinux, "10")); - EXPECT_FALSE(info.Contains(GpuControlList::kOsChromeOS, "13")); - EXPECT_FALSE(info.Contains(GpuControlList::kOsAndroid, "7")); - EXPECT_FALSE(info.Contains(GpuControlList::kOsAny, "7")); - EXPECT_FALSE(info.Contains(GpuControlList::kOsWin, std::string())); - EXPECT_TRUE(info.Contains(GpuControlList::kOsWin, "6")); - EXPECT_TRUE(info.Contains(GpuControlList::kOsWin, "6.1")); - EXPECT_TRUE(info.Contains(GpuControlList::kOsWin, "7")); - EXPECT_FALSE(info.Contains(GpuControlList::kOsWin, "5")); - } -} - -} // namespace gpu - diff --git a/gpu/config/gpu_control_list_string_info_unittest.cc b/gpu/config/gpu_control_list_string_info_unittest.cc deleted file mode 100644 index 39e2f58..0000000 --- a/gpu/config/gpu_control_list_string_info_unittest.cc +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) 2013 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 "gpu/config/gpu_control_list.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace gpu { - -class StringInfoTest : public testing::Test { - public: - StringInfoTest() { } - virtual ~StringInfoTest() { } - - typedef GpuControlList::StringInfo StringInfo; -}; - -TEST_F(StringInfoTest, ValidStringInfo) { - const std::string op[] = { - "contains", - "beginwith", - "endwith", - "=" - }; - for (size_t i = 0; i < arraysize(op); ++i) { - { - StringInfo info(op[i], std::string()); - EXPECT_TRUE(info.IsValid()); - } - { - StringInfo info(op[i], "hello"); - EXPECT_TRUE(info.IsValid()); - } - } -} - -TEST_F(StringInfoTest, InvalidStringInfo) { - const std::string op[] = { - "Contains", - "BeginWith", - "EndWith", - " =", - "= " - }; - for (size_t i = 0; i < arraysize(op); ++i) { - StringInfo info(op[i], "hello"); - EXPECT_FALSE(info.IsValid()); - } -} - -TEST_F(StringInfoTest, StringComparison) { - { - StringInfo info("contains", "happy"); - EXPECT_TRUE(info.Contains("unhappy")); - EXPECT_TRUE(info.Contains("happy1")); - EXPECT_TRUE(info.Contains("happy")); - EXPECT_TRUE(info.Contains("a happy dog")); - EXPECT_TRUE(info.Contains("Happy")); - EXPECT_TRUE(info.Contains("HAPPY")); - EXPECT_FALSE(info.Contains("ha-ppy")); - } - { - StringInfo info("beginwith", "happy"); - EXPECT_FALSE(info.Contains("unhappy")); - EXPECT_TRUE(info.Contains("happy1")); - EXPECT_TRUE(info.Contains("happy")); - EXPECT_FALSE(info.Contains("a happy dog")); - EXPECT_TRUE(info.Contains("Happy")); - EXPECT_TRUE(info.Contains("HAPPY")); - EXPECT_FALSE(info.Contains("ha-ppy")); - } - { - StringInfo info("endwith", "happy"); - EXPECT_TRUE(info.Contains("unhappy")); - EXPECT_FALSE(info.Contains("happy1")); - EXPECT_TRUE(info.Contains("happy")); - EXPECT_FALSE(info.Contains("a happy dog")); - EXPECT_TRUE(info.Contains("Happy")); - EXPECT_TRUE(info.Contains("HAPPY")); - EXPECT_FALSE(info.Contains("ha-ppy")); - } - { - StringInfo info("=", "happy"); - EXPECT_FALSE(info.Contains("unhappy")); - EXPECT_FALSE(info.Contains("happy1")); - EXPECT_TRUE(info.Contains("happy")); - EXPECT_FALSE(info.Contains("a happy dog")); - EXPECT_TRUE(info.Contains("Happy")); - EXPECT_TRUE(info.Contains("HAPPY")); - EXPECT_FALSE(info.Contains("ha-ppy")); - EXPECT_FALSE(info.Contains("ha ppy")); - EXPECT_FALSE(info.Contains(" happy")); - EXPECT_FALSE(info.Contains("happy ")); - } -} - -} // namespace gpu - diff --git a/gpu/config/gpu_control_list_unittest.cc b/gpu/config/gpu_control_list_unittest.cc deleted file mode 100644 index 447b684..0000000 --- a/gpu/config/gpu_control_list_unittest.cc +++ /dev/null @@ -1,444 +0,0 @@ -// Copyright (c) 2013 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 <vector> - -#include "base/memory/scoped_ptr.h" -#include "gpu/config/gpu_control_list.h" -#include "gpu/config/gpu_info.h" -#include "testing/gtest/include/gtest/gtest.h" - -const char kOsVersion[] = "10.6.4"; -const uint32 kIntelVendorId = 0x8086; -const uint32 kIntelDeviceId = 0x0166; // 3rd Gen Core Graphics -const uint32 kNvidiaVendorId = 0x10de; -const uint32 kNvidiaDeviceId = 0x0fd5; // GeForce GT 650M - -#define LONG_STRING_CONST(...) #__VA_ARGS__ - -#define EXPECT_EMPTY_SET(feature_set) EXPECT_EQ(0u, feature_set.size()) -#define EXPECT_SINGLE_FEATURE(feature_set, feature) \ - EXPECT_TRUE(feature_set.size() == 1 && feature_set.count(feature) == 1) - -namespace gpu { - -enum TestFeatureType { - TEST_FEATURE_0 = 1, - TEST_FEATURE_1 = 1 << 2, - TEST_FEATURE_2 = 1 << 3, -}; - -class GpuControlListTest : public testing::Test { - public: - GpuControlListTest() { } - - virtual ~GpuControlListTest() { } - - const GPUInfo& gpu_info() const { - return gpu_info_; - } - - GpuControlList* Create() { - GpuControlList* rt = new GpuControlList(); - rt->AddSupportedFeature("test_feature_0", TEST_FEATURE_0); - rt->AddSupportedFeature("test_feature_1", TEST_FEATURE_1); - rt->AddSupportedFeature("test_feature_2", TEST_FEATURE_2); - return rt; - } - - protected: - virtual void SetUp() { - gpu_info_.gpu.vendor_id = kNvidiaVendorId; - gpu_info_.gpu.device_id = 0x0640; - gpu_info_.driver_vendor = "NVIDIA"; - gpu_info_.driver_version = "1.6.18"; - gpu_info_.driver_date = "7-14-2009"; - gpu_info_.machine_model = "MacBookPro 7.1"; - gpu_info_.gl_vendor = "NVIDIA Corporation"; - gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; - gpu_info_.performance_stats.graphics = 5.0; - gpu_info_.performance_stats.gaming = 5.0; - gpu_info_.performance_stats.overall = 5.0; - } - - virtual void TearDown() { - } - - private: - GPUInfo gpu_info_; -}; - -TEST_F(GpuControlListTest, DefaultControlListSettings) { - scoped_ptr<GpuControlList> control_list(Create()); - // Default control list settings: all feature are allowed. - std::set<int> features = control_list->MakeDecision( - GpuControlList::kOsMacosx, kOsVersion, gpu_info()); - EXPECT_EMPTY_SET(features); -} - -TEST_F(GpuControlListTest, EmptyControlList) { - // Empty list: all features are allowed. - const std::string empty_list_json = LONG_STRING_CONST( - { - "name": "gpu control list", - "version": "2.5", - "entries": [ - ] - } - ); - scoped_ptr<GpuControlList> control_list(Create()); - - EXPECT_TRUE(control_list->LoadList(empty_list_json, - GpuControlList::kAllOs)); - EXPECT_EQ("2.5", control_list->version()); - std::set<int> features = control_list->MakeDecision( - GpuControlList::kOsMacosx, kOsVersion, gpu_info()); - EXPECT_EMPTY_SET(features); -} - -TEST_F(GpuControlListTest, DetailedEntryAndInvalidJson) { - // exact setting. - const std::string exact_list_json = LONG_STRING_CONST( - { - "name": "gpu control list", - "version": "0.1", - "entries": [ - { - "id": 5, - "os": { - "type": "macosx", - "version": { - "op": "=", - "number": "10.6.4" - } - }, - "vendor_id": "0x10de", - "device_id": ["0x0640"], - "driver_version": { - "op": "=", - "number": "1.6.18" - }, - "features": [ - "test_feature_0" - ] - } - ] - } - ); - scoped_ptr<GpuControlList> control_list(Create()); - - EXPECT_TRUE(control_list->LoadList(exact_list_json, GpuControlList::kAllOs)); - std::set<int> features = control_list->MakeDecision( - GpuControlList::kOsMacosx, kOsVersion, gpu_info()); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); - - // Invalid json input should not change the current control_list settings. - const std::string invalid_json = "invalid"; - - EXPECT_FALSE(control_list->LoadList(invalid_json, GpuControlList::kAllOs)); - features = control_list->MakeDecision( - GpuControlList::kOsMacosx, kOsVersion, gpu_info()); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); - std::vector<uint32> entries; - control_list->GetDecisionEntries(&entries, false); - ASSERT_EQ(1u, entries.size()); - EXPECT_EQ(5u, entries[0]); - EXPECT_EQ(5u, control_list->max_entry_id()); -} - -TEST_F(GpuControlListTest, VendorOnAllOsEntry) { - // ControlList a vendor on all OS. - const std::string vendor_json = LONG_STRING_CONST( - { - "name": "gpu control list", - "version": "0.1", - "entries": [ - { - "id": 1, - "vendor_id": "0x10de", - "features": [ - "test_feature_0" - ] - } - ] - } - ); - scoped_ptr<GpuControlList> control_list(Create()); - - // ControlList entries won't be filtered to the current OS only upon loading. - EXPECT_TRUE(control_list->LoadList(vendor_json, GpuControlList::kAllOs)); - std::set<int> features = control_list->MakeDecision( - GpuControlList::kOsMacosx, kOsVersion, gpu_info()); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); - features = control_list->MakeDecision( - GpuControlList::kOsWin, kOsVersion, gpu_info()); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); - features = control_list->MakeDecision( - GpuControlList::kOsLinux, kOsVersion, gpu_info()); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); -#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) || \ - defined(OS_OPENBSD) - // ControlList entries will be filtered to the current OS only upon loading. - EXPECT_TRUE(control_list->LoadList( - vendor_json, GpuControlList::kCurrentOsOnly)); - features = control_list->MakeDecision( - GpuControlList::kOsMacosx, kOsVersion, gpu_info()); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); - features = control_list->MakeDecision( - GpuControlList::kOsWin, kOsVersion, gpu_info()); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); - features = control_list->MakeDecision( - GpuControlList::kOsLinux, kOsVersion, gpu_info()); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); -#endif -} - -TEST_F(GpuControlListTest, ChromeVersionEntry) { - const std::string browser_version_json = LONG_STRING_CONST( - { - "name": "gpu control list", - "version": "0.1", - "entries": [ - { - "id": 1, - "browser_version": { - "op": ">=", - "number": "10" - }, - "features": [ - "test_feature_0" - ] - } - ] - } - ); - scoped_ptr<GpuControlList> control_list9(Create()); - EXPECT_TRUE(control_list9->LoadList( - "9.0", browser_version_json, GpuControlList::kAllOs)); - std::set<int> features = control_list9->MakeDecision( - GpuControlList::kOsWin, kOsVersion, gpu_info()); - EXPECT_EMPTY_SET(features); - - scoped_ptr<GpuControlList> control_list10(Create()); - EXPECT_TRUE(control_list10->LoadList( - "10.0", browser_version_json, GpuControlList::kAllOs)); - features = control_list10->MakeDecision( - GpuControlList::kOsWin, kOsVersion, gpu_info()); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); -} - -TEST_F(GpuControlListTest, UnknownField) { - const std::string unknown_field_json = LONG_STRING_CONST( - { - "name": "gpu control list", - "version": "0.1", - "entries": [ - { - "id": 1, - "unknown_field": 0, - "features": [ - "test_feature_1" - ] - }, - { - "id": 2, - "features": [ - "test_feature_0" - ] - } - ] - } - ); - scoped_ptr<GpuControlList> control_list(Create()); - - EXPECT_TRUE(control_list->LoadList( - unknown_field_json, GpuControlList::kAllOs)); - EXPECT_EQ(1u, control_list->num_entries()); - EXPECT_TRUE(control_list->contains_unknown_fields()); - std::set<int> features = control_list->MakeDecision( - GpuControlList::kOsWin, kOsVersion, gpu_info()); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); -} - -TEST_F(GpuControlListTest, UnknownExceptionField) { - const std::string unknown_exception_field_json = LONG_STRING_CONST( - { - "name": "gpu control list", - "version": "0.1", - "entries": [ - { - "id": 1, - "unknown_field": 0, - "features": [ - "test_feature_2" - ] - }, - { - "id": 2, - "exceptions": [ - { - "unknown_field": 0 - } - ], - "features": [ - "test_feature_1" - ] - }, - { - "id": 3, - "features": [ - "test_feature_0" - ] - } - ] - } - ); - scoped_ptr<GpuControlList> control_list(Create()); - - EXPECT_TRUE(control_list->LoadList( - unknown_exception_field_json, GpuControlList::kAllOs)); - EXPECT_EQ(1u, control_list->num_entries()); - EXPECT_TRUE(control_list->contains_unknown_fields()); - std::set<int> features = control_list->MakeDecision( - GpuControlList::kOsWin, kOsVersion, gpu_info()); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); -} - -TEST_F(GpuControlListTest, DisabledEntry) { - const std::string disabled_json = LONG_STRING_CONST( - { - "name": "gpu control list", - "version": "0.1", - "entries": [ - { - "id": 1, - "disabled": true, - "features": [ - "test_feature_0" - ] - } - ] - } - ); - scoped_ptr<GpuControlList> control_list(Create()); - EXPECT_TRUE(control_list->LoadList(disabled_json, GpuControlList::kAllOs)); - std::set<int> features = control_list->MakeDecision( - GpuControlList::kOsWin, kOsVersion, gpu_info()); - EXPECT_EMPTY_SET(features); - std::vector<uint32> flag_entries; - control_list->GetDecisionEntries(&flag_entries, false); - EXPECT_EQ(0u, flag_entries.size()); - control_list->GetDecisionEntries(&flag_entries, true); - EXPECT_EQ(1u, flag_entries.size()); -} - -TEST_F(GpuControlListTest, NeedsMoreInfoForExceptions) { - const std::string json = LONG_STRING_CONST( - { - "name": "gpu control list", - "version": "0.1", - "entries": [ - { - "id": 1, - "os": { - "type": "linux" - }, - "vendor_id": "0x8086", - "exceptions": [ - { - "gl_renderer": { - "op": "contains", - "value": "mesa" - } - } - ], - "features": [ - "test_feature_0" - ] - } - ] - } - ); - GPUInfo gpu_info; - gpu_info.gpu.vendor_id = kIntelVendorId; - - scoped_ptr<GpuControlList> control_list(Create()); - EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); - - // The case this entry does not apply. - std::set<int> features = control_list->MakeDecision( - GpuControlList::kOsMacosx, kOsVersion, gpu_info); - EXPECT_EMPTY_SET(features); - EXPECT_FALSE(control_list->needs_more_info()); - - // The case this entry might apply, but need more info. - features = control_list->MakeDecision( - GpuControlList::kOsLinux, kOsVersion, gpu_info); - EXPECT_EMPTY_SET(features); - EXPECT_TRUE(control_list->needs_more_info()); - - // The case we have full info, and the exception applies (so the entry - // does not apply). - gpu_info.gl_renderer = "mesa"; - features = control_list->MakeDecision( - GpuControlList::kOsLinux, kOsVersion, gpu_info); - EXPECT_EMPTY_SET(features); - EXPECT_FALSE(control_list->needs_more_info()); - - // The case we have full info, and this entry applies. - gpu_info.gl_renderer = "my renderer"; - features = control_list->MakeDecision(GpuControlList::kOsLinux, kOsVersion, - gpu_info); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); - EXPECT_FALSE(control_list->needs_more_info()); -} - -TEST_F(GpuControlListTest, IgnorableEntries) { - // If an entry will not change the control_list decisions, then it should not - // trigger the needs_more_info flag. - const std::string json = LONG_STRING_CONST( - { - "name": "gpu control list", - "version": "0.1", - "entries": [ - { - "id": 1, - "os": { - "type": "linux" - }, - "vendor_id": "0x8086", - "features": [ - "test_feature_0" - ] - }, - { - "id": 2, - "os": { - "type": "linux" - }, - "vendor_id": "0x8086", - "driver_version": { - "op": "<", - "number": "10.7" - }, - "features": [ - "test_feature_0" - ] - } - ] - } - ); - GPUInfo gpu_info; - gpu_info.gpu.vendor_id = kIntelVendorId; - - scoped_ptr<GpuControlList> control_list(Create()); - EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); - std::set<int> features = control_list->MakeDecision( - GpuControlList::kOsLinux, kOsVersion, gpu_info); - EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); - EXPECT_FALSE(control_list->needs_more_info()); -} - -} // namespace gpu - diff --git a/gpu/config/gpu_control_list_version_info_unittest.cc b/gpu/config/gpu_control_list_version_info_unittest.cc deleted file mode 100644 index 39814c8..0000000 --- a/gpu/config/gpu_control_list_version_info_unittest.cc +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright (c) 2013 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 "gpu/config/gpu_control_list.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace gpu { - -class VersionInfoTest : public testing::Test { - public: - VersionInfoTest() { } - virtual ~VersionInfoTest() { } - - typedef GpuControlList::VersionInfo VersionInfo; -}; - -TEST_F(VersionInfoTest, ValidVersionInfo) { - const std::string op[] = { - "=", - "<", - "<=", - ">", - ">=", - "any", - "between" - }; - for (size_t i = 0; i < arraysize(op); ++i) { - std::string string1; - std::string string2; - if (op[i] != "any") - string1 = "8.9"; - if (op[i] == "between") - string2 = "9.0"; - VersionInfo info(op[i], std::string(), string1, string2); - EXPECT_TRUE(info.IsValid()); - } - - const std::string style[] = { - "lexical", - "numerical", - "" // Default, same as "numerical" - }; - for (size_t i =0; i < arraysize(style); ++i) { - VersionInfo info("=", style[i], "8.9", std::string()); - EXPECT_TRUE(info.IsValid()); - if (style[i] == "lexical") - EXPECT_TRUE(info.IsLexical()); - else - EXPECT_FALSE(info.IsLexical()); - } - - const std::string number[] = { - "10", - "10.9", - "10.0", - "10.0.9", - "0.8", - // Leading 0s are valid. - "10.09", - // Whitespaces are ignored. - " 10.9", - "10.9 ", - "10 .9", - "10. 9", - }; - for (size_t i =0; i < arraysize(number); ++i) { - VersionInfo info("=", std::string(), number[i], std::string()); - EXPECT_TRUE(info.IsValid()); - } -} - -TEST_F(VersionInfoTest, InvalidVersionInfo) { - const std::string op[] = { - "=", - "<", - "<=", - ">", - ">=", - "any", - "between" - }; - for (size_t i = 0; i < arraysize(op); ++i) { - { - VersionInfo info(op[i], std::string(), "8.9", std::string()); - if (op[i] == "between") - EXPECT_FALSE(info.IsValid()); - else - EXPECT_TRUE(info.IsValid()); - } - { - VersionInfo info(op[i], std::string(), std::string(), std::string()); - if (op[i] == "any") - EXPECT_TRUE(info.IsValid()); - else - EXPECT_FALSE(info.IsValid()); - } - { - VersionInfo info(op[i], std::string(), "8.9", "9.0"); - EXPECT_TRUE(info.IsValid()); - } - } - - const std::string number[] = { - "8.E", - "8-9", - }; - for (size_t i = 0; i < arraysize(number); ++i) { - VersionInfo info("=", std::string(), number[i], std::string()); - EXPECT_FALSE(info.IsValid()); - } -} - -TEST_F(VersionInfoTest, VersionComparison) { - { - VersionInfo info("any", std::string(), std::string(), std::string()); - EXPECT_TRUE(info.Contains("0")); - EXPECT_TRUE(info.Contains("8.9")); - EXPECT_TRUE(info.Contains("100")); - } - { - VersionInfo info(">", std::string(), "8.9", std::string()); - EXPECT_FALSE(info.Contains("7")); - EXPECT_FALSE(info.Contains("8.9")); - EXPECT_FALSE(info.Contains("8.9.1")); - EXPECT_TRUE(info.Contains("9")); - } - { - VersionInfo info(">=", std::string(), "8.9", std::string()); - EXPECT_FALSE(info.Contains("7")); - EXPECT_TRUE(info.Contains("8.9")); - EXPECT_TRUE(info.Contains("8.9.1")); - EXPECT_TRUE(info.Contains("9")); - } - { - VersionInfo info("=", std::string(), "8.9", std::string()); - EXPECT_FALSE(info.Contains("7")); - EXPECT_TRUE(info.Contains("8")); - EXPECT_TRUE(info.Contains("8.9")); - EXPECT_TRUE(info.Contains("8.9.1")); - EXPECT_FALSE(info.Contains("9")); - } - { - VersionInfo info("<", std::string(), "8.9", std::string()); - EXPECT_TRUE(info.Contains("7")); - EXPECT_TRUE(info.Contains("8.8")); - EXPECT_FALSE(info.Contains("8")); - EXPECT_FALSE(info.Contains("8.9")); - EXPECT_FALSE(info.Contains("8.9.1")); - EXPECT_FALSE(info.Contains("9")); - } - { - VersionInfo info("<=", std::string(), "8.9", std::string()); - EXPECT_TRUE(info.Contains("7")); - EXPECT_TRUE(info.Contains("8.8")); - EXPECT_TRUE(info.Contains("8")); - EXPECT_TRUE(info.Contains("8.9")); - EXPECT_TRUE(info.Contains("8.9.1")); - EXPECT_FALSE(info.Contains("9")); - } - { - VersionInfo info("between", std::string(), "8.9", "9.1"); - EXPECT_FALSE(info.Contains("7")); - EXPECT_FALSE(info.Contains("8.8")); - EXPECT_TRUE(info.Contains("8")); - EXPECT_TRUE(info.Contains("8.9")); - EXPECT_TRUE(info.Contains("8.9.1")); - EXPECT_TRUE(info.Contains("9")); - EXPECT_TRUE(info.Contains("9.1")); - EXPECT_TRUE(info.Contains("9.1.9")); - EXPECT_FALSE(info.Contains("9.2")); - EXPECT_FALSE(info.Contains("10")); - } -} - -TEST_F(VersionInfoTest, DateComparison) { - // When we use '-' as splitter, we assume a format of mm-dd-yyyy - // or mm-yyyy, i.e., a date. - { - VersionInfo info("=", std::string(), "1976.3.21", std::string()); - EXPECT_TRUE(info.Contains("3-21-1976", '-')); - EXPECT_TRUE(info.Contains("3-1976", '-')); - EXPECT_TRUE(info.Contains("03-1976", '-')); - EXPECT_FALSE(info.Contains("21-3-1976", '-')); - } - { - VersionInfo info(">", std::string(), "1976.3.21", std::string()); - EXPECT_TRUE(info.Contains("3-22-1976", '-')); - EXPECT_TRUE(info.Contains("4-1976", '-')); - EXPECT_TRUE(info.Contains("04-1976", '-')); - EXPECT_FALSE(info.Contains("3-1976", '-')); - EXPECT_FALSE(info.Contains("2-1976", '-')); - } - { - VersionInfo info("between", std::string(), "1976.3.21", "2012.12.25"); - EXPECT_FALSE(info.Contains("3-20-1976", '-')); - EXPECT_TRUE(info.Contains("3-21-1976", '-')); - EXPECT_TRUE(info.Contains("3-22-1976", '-')); - EXPECT_TRUE(info.Contains("3-1976", '-')); - EXPECT_TRUE(info.Contains("4-1976", '-')); - EXPECT_TRUE(info.Contains("1-1-2000", '-')); - EXPECT_TRUE(info.Contains("1-2000", '-')); - EXPECT_TRUE(info.Contains("2000", '-')); - EXPECT_TRUE(info.Contains("11-2012", '-')); - EXPECT_TRUE(info.Contains("12-2012", '-')); - EXPECT_TRUE(info.Contains("12-24-2012", '-')); - EXPECT_TRUE(info.Contains("12-25-2012", '-')); - EXPECT_FALSE(info.Contains("12-26-2012", '-')); - EXPECT_FALSE(info.Contains("1-2013", '-')); - EXPECT_FALSE(info.Contains("2013", '-')); - } -} - -TEST_F(VersionInfoTest, LexicalComparison) { - // When we use lexical style, we assume a format major.minor.*. - // We apply numerical comparison to major, lexical comparison to others. - { - VersionInfo info("<", "lexical", "8.201", std::string()); - EXPECT_TRUE(info.Contains("8.001.100")); - EXPECT_TRUE(info.Contains("8.109")); - EXPECT_TRUE(info.Contains("8.10900")); - EXPECT_TRUE(info.Contains("8.109.100")); - EXPECT_TRUE(info.Contains("8.2")); - EXPECT_TRUE(info.Contains("8.20")); - EXPECT_TRUE(info.Contains("8.200")); - EXPECT_TRUE(info.Contains("8.20.100")); - EXPECT_FALSE(info.Contains("8.201")); - EXPECT_FALSE(info.Contains("8.2010")); - EXPECT_FALSE(info.Contains("8.21")); - EXPECT_FALSE(info.Contains("8.21.100")); - EXPECT_FALSE(info.Contains("9.002")); - EXPECT_FALSE(info.Contains("9.201")); - EXPECT_FALSE(info.Contains("12")); - EXPECT_FALSE(info.Contains("12.201")); - } - { - VersionInfo info("<", "lexical", "9.002", std::string()); - EXPECT_TRUE(info.Contains("8.001.100")); - EXPECT_TRUE(info.Contains("8.109")); - EXPECT_TRUE(info.Contains("8.10900")); - EXPECT_TRUE(info.Contains("8.109.100")); - EXPECT_TRUE(info.Contains("8.2")); - EXPECT_TRUE(info.Contains("8.20")); - EXPECT_TRUE(info.Contains("8.200")); - EXPECT_TRUE(info.Contains("8.20.100")); - EXPECT_TRUE(info.Contains("8.201")); - EXPECT_TRUE(info.Contains("8.2010")); - EXPECT_TRUE(info.Contains("8.21")); - EXPECT_TRUE(info.Contains("8.21.100")); - EXPECT_FALSE(info.Contains("9.002")); - EXPECT_FALSE(info.Contains("9.201")); - EXPECT_FALSE(info.Contains("12")); - EXPECT_FALSE(info.Contains("12.201")); - } -} - -} // namespace gpu - diff --git a/gpu/config/gpu_driver_bug_list.cc b/gpu/config/gpu_driver_bug_list.cc deleted file mode 100644 index 68f1b0b..0000000 --- a/gpu/config/gpu_driver_bug_list.cc +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2013 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 "gpu/config/gpu_driver_bug_list.h" - -#include "base/basictypes.h" -#include "base/logging.h" -#include "gpu/config/gpu_driver_bug_workaround_type.h" - -namespace gpu { - -namespace { - -struct DriverBugInfo { - int feature_type; - std::string feature_name; -}; - -} // namespace anonymous - -GpuDriverBugList::GpuDriverBugList() - : GpuControlList() { -} - -GpuDriverBugList::~GpuDriverBugList() { -} - -// static -GpuDriverBugList* GpuDriverBugList::Create() { - GpuDriverBugList* list = new GpuDriverBugList(); - - const DriverBugInfo kFeatureList[] = { -#define GPU_OP(type, name) { type, #name }, - GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) -#undef GPU_OP - }; - DCHECK_EQ(static_cast<int>(arraysize(kFeatureList)), - NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES); - for (int i = 0; i < NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES; ++i) { - list->AddSupportedFeature(kFeatureList[i].feature_name, - kFeatureList[i].feature_type); - } - return list; -} - -} // namespace gpu - diff --git a/gpu/config/gpu_driver_bug_list.h b/gpu/config/gpu_driver_bug_list.h deleted file mode 100644 index 9943251..0000000 --- a/gpu/config/gpu_driver_bug_list.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2013 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 GPU_CONFIG_GPU_DRIVER_BUG_LIST_H_ -#define GPU_CONFIG_GPU_DRIVER_BUG_LIST_H_ - -#include <string> - -#include "gpu/config/gpu_control_list.h" -#include "gpu/gpu_export.h" - -namespace gpu { - -class GPU_EXPORT GpuDriverBugList : public GpuControlList { - public: - virtual ~GpuDriverBugList(); - - static GpuDriverBugList* Create(); - - private: - GpuDriverBugList(); - - DISALLOW_COPY_AND_ASSIGN(GpuDriverBugList); -}; - -} // namespace gpu - -#endif // GPU_CONFIG_GPU_DRIVER_BUG_LIST_H_ - diff --git a/gpu/config/gpu_driver_bug_list_json.cc b/gpu/config/gpu_driver_bug_list_json.cc deleted file mode 100644 index e324231..0000000 --- a/gpu/config/gpu_driver_bug_list_json.cc +++ /dev/null @@ -1,353 +0,0 @@ -// Copyright (c) 2013 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. - -// Determines whether a certain driver bug exists in the current system. -// A valid gpu_driver_bug_list.json file are in the format of -// { -// "version": "x.y", -// "entries": [ -// { // entry 1 -// }, -// ... -// { // entry n -// } -// ] -// } -// -// Each entry contains the following fields (fields are optional unless -// specifically described as mandatory below): -// 1. "id" is an integer. 0 is reserved. This field is mandatory. -// 2. "os" contains "type" and an optional "version". "type" could be "macosx", -// "linux", "win", "chromeos", or "any". "any" is the same as not specifying -// "os". -// "version" is a VERSION structure (defined below). -// 3. "vendor_id" is a string. 0 is reserved. -// 4. "device_id" is an array of strings. 0 is reserved. -// 5. "multi_gpu_style" is a string, valid values include "optimus", and -// "amd_switchable". -// 6. "multi_gpu_category" is a string, valid values include "any", "primary", -// and "secondary". If unspecified, the default value is "primary". -// 7. "driver_vendor" is a STRING structure (defined below). -// 8. "driver_version" is a VERSION structure (defined below). -// 9. "driver_date" is a VERSION structure (defined below). -// The version is interpreted as "year.month.day". -// 10. "gl_vendor" is a STRING structure (defined below). -// 11. "gl_renderer" is a STRING structure (defined below). -// 12. "gl_extensions" is a STRING structure (defined below). -// 13. "perf_graphics" is a FLOAT structure (defined below). -// 14. "perf_gaming" is a FLOAT structure (defined below). -// 15. "perf_overall" is a FLOAT structure (defined below). -// 16. "machine_model" contais "name" and an optional "version". "name" is a -// STRING structure and "version" is a VERSION structure (defined below). -// 17. "gpu_count" is a INT structure (defined below). -// 18 "cpu_info" is a STRING structure (defined below). -// 19. "exceptions" is a list of entries. -// 20. "features" is a list of driver bug types. For a list of supported types, -// see src/gpu/command_buffer/service/gpu_driver_bug_workaround_type.h -// This field is mandatory. -// 21. "description" has the description of the entry. -// 22. "webkit_bugs" is an array of associated webkit bug numbers. -// 23. "cr_bugs" is an array of associated chromium bug numbers. -// 24. "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. -// 25. "disabled" is a boolean. If it is present, the entry will be skipped. -// This can not be used in exceptions. -// -// VERSION includes "op", "style", "number", and "number2". "op" can be any of -// the following values: "=", "<", "<=", ">", ">=", "any", "between". "style" -// is optional and can be "lexical" or "numerical"; if it's not specified, it -// defaults to "numerical". "number2" is only used if "op" is "between". -// "between" is "number <= * <= number2". -// "number" is used for all "op" values except "any". "number" and "number2" -// are in the format of x, x.x, x.x.x, etc. -// Only "driver_version" supports lexical style if the format is major.minor; -// in that case, major is still numerical, but minor is lexical. -// -// STRING includes "op" and "value". "op" can be any of the following values: -// "contains", "beginwith", "endwith", "=". "value" is a string. -// -// FLOAT includes "op" "value", and "value2". "op" can be any of the -// following values: "=", "<", "<=", ">", ">=", "any", "between". "value2" is -// only used if "op" is "between". "value" is used for all "op" values except -// "any". "value" and "value2" are valid float numbers. -// INT is very much like FLOAT, except that the values need to be integers. - -#include "gpu/config/gpu_control_list_jsons.h" - -#define LONG_STRING_CONST(...) #__VA_ARGS__ - -namespace gpu { - -const char kGpuDriverBugListJson[] = LONG_STRING_CONST( - -{ - "name": "gpu driver bug list", - // Please update the version number whenever you change this file. - "version": "2.0", - "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": 13, - "os": { - "type": "macosx", - "version": { - "op": "<", - "number": "10.7.3" - } - }, - "vendor_id": "0x8086", - "features": [ - "max_cube_map_texture_size_limit_512" - ] - }, - { - "id": 14, - "os": { - "type": "macosx" - }, - "vendor_id": "0x1002", - "features": [ - "max_texture_size_limit_4096", - "max_cube_map_texture_size_limit_4096" - ] - }, - { - "id": 15, - "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": 16, - "description": "Intel drivers on Linux appear to be buggy", - "os": { - "type": "linux" - }, - "vendor_id": "0x8086", - "features": [ - "disable_ext_occlusion_query" - ] - }, - { - "id": 17, - "description": "Some drivers are unable to reset the D3D device in the GPU process sandbox", - "os": { - "type": "win" - }, - "features": [ - "exit_on_context_lost" - ] - }, - { - "id": 18, - "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": 19, - "os": { - "type": "android" - }, - "gl_vendor": { - "op": "beginwith", - "value": "Qualcomm" - }, - "features": [ - "disable_depth_texture" - ] - }, - { - "id": 20, - "description": "Disable EXT_draw_buffers on GeForce GT 650M on Mac OS X due to driver bugs.", - "os": { - "type": "macosx" - }, - "vendor_id": "0x10de", - "device_id": ["0x0fd5"], - "multi_gpu_category": "any", - "features": [ - "disable_ext_draw_buffers" - ] - }, - { - "id": 21, - "description": "Vivante GPUs are buggy with context switching.", - "cr_bugs": [179250, 235935], - "os": { - "type": "android" - }, - "gl_extensions": { - "op": "contains", - "value": "GL_VIV_shader_binary" - }, - "features": [ - "unbind_fbo_on_context_switch" - ] - }, - { - "id": 22, - "description": "Imagination drivers are buggy with context switching.", - "cr_bugs": [230896], - "os": { - "type": "android" - }, - "gl_vendor": { - "op": "beginwith", - "value": "Imagination" - }, - "features": [ - "unbind_fbo_on_context_switch" - ] - } - ] -} - -); // LONG_STRING_CONST macro - -} // namespace gpu - diff --git a/gpu/config/gpu_driver_bug_list_unittest.cc b/gpu/config/gpu_driver_bug_list_unittest.cc deleted file mode 100644 index 60bc339..0000000 --- a/gpu/config/gpu_driver_bug_list_unittest.cc +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2013 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 "base/logging.h" -#include "base/memory/scoped_ptr.h" -#include "gpu/config/gpu_control_list_jsons.h" -#include "gpu/config/gpu_driver_bug_list.h" -#include "gpu/config/gpu_driver_bug_workaround_type.h" -#include "gpu/config/gpu_info.h" -#include "testing/gtest/include/gtest/gtest.h" - -const char kOsVersion[] = "10.6.4"; - -namespace gpu { - -class GpuDriverBugListTest : public testing::Test { - public: - GpuDriverBugListTest() { } - - virtual ~GpuDriverBugListTest() { } - - const GPUInfo& gpu_info() const { - return gpu_info_; - } - - protected: - virtual void SetUp() { - gpu_info_.gpu.vendor_id = 0x10de; - gpu_info_.gpu.device_id = 0x0640; - gpu_info_.driver_vendor = "NVIDIA"; - gpu_info_.driver_version = "1.6.18"; - gpu_info_.driver_date = "7-14-2009"; - gpu_info_.machine_model = "MacBookPro 7.1"; - gpu_info_.gl_vendor = "NVIDIA Corporation"; - gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; - gpu_info_.performance_stats.graphics = 5.0; - gpu_info_.performance_stats.gaming = 5.0; - gpu_info_.performance_stats.overall = 5.0; - } - - virtual void TearDown() { - } - - private: - GPUInfo gpu_info_; -}; - -TEST_F(GpuDriverBugListTest, CurrentDriverBugListValidation) { - scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); - std::string json; - EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); - EXPECT_FALSE(list->contains_unknown_fields()); -} - -TEST_F(GpuDriverBugListTest, CurrentListForARM) { - scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); - EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, 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(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); -} - -TEST_F(GpuDriverBugListTest, CurrentListForImagination) { - scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); - EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, 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(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); -} - -} // namespace gpu - diff --git a/gpu/config/gpu_feature_type.h b/gpu/config/gpu_feature_type.h deleted file mode 100644 index b082d78..0000000 --- a/gpu/config/gpu_feature_type.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2012 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 GPU_CONFIG_GPU_FEATURE_TYPE_H_ -#define GPU_CONFIG_GPU_FEATURE_TYPE_H_ - -namespace gpu { - -// Provides flags indicating which gpu features are blacklisted for the system -// on which chrome is currently running. -// If a bit is set to 1, corresponding feature is blacklisted. -enum GpuFeatureType { - GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS = 0, - GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING, - GPU_FEATURE_TYPE_WEBGL, - GPU_FEATURE_TYPE_MULTISAMPLING, - GPU_FEATURE_TYPE_FLASH3D, - GPU_FEATURE_TYPE_FLASH_STAGE3D, - GPU_FEATURE_TYPE_TEXTURE_SHARING, - GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE, - GPU_FEATURE_TYPE_3D_CSS, - GPU_FEATURE_TYPE_ACCELERATED_VIDEO, - GPU_FEATURE_TYPE_PANEL_FITTING, - GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE, - GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE, - NUMBER_OF_GPU_FEATURE_TYPES -}; - -} // namespace gpu - -#endif // GPU_CONFIG_GPU_FEATURE_TYPE_H_ diff --git a/gpu/config/gpu_info.cc b/gpu/config/gpu_info.cc deleted file mode 100644 index b8a9e3c..0000000 --- a/gpu/config/gpu_info.cc +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2012 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 "gpu/config/gpu_info.h" - -namespace gpu { - -GPUInfo::GPUDevice::GPUDevice() - : vendor_id(0), - device_id(0) { -} - -GPUInfo::GPUDevice::~GPUDevice() { } - -GPUInfo::GPUInfo() - : finalized(false), - optimus(false), - amd_switchable(false), - lenovo_dcute(false), - can_lose_context(false), - gpu_accessible(true), - software_rendering(false), - sandboxed(false) { -} - -GPUInfo::~GPUInfo() { } - -} // namespace gpu diff --git a/gpu/config/gpu_info.h b/gpu/config/gpu_info.h deleted file mode 100644 index d589591..0000000 --- a/gpu/config/gpu_info.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2012 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 GPU_CONFIG_GPU_INFO_H_ -#define GPU_CONFIG_GPU_INFO_H_ - -// Provides access to the GPU information for the system -// on which chrome is currently running. - -#include <string> -#include <vector> - -#include "base/basictypes.h" -#include "base/time.h" -#include "base/version.h" -#include "build/build_config.h" -#include "gpu/config/dx_diag_node.h" -#include "gpu/config/gpu_performance_stats.h" -#include "gpu/gpu_export.h" - -namespace gpu { - -struct GPU_EXPORT GPUInfo { - struct GPU_EXPORT GPUDevice { - GPUDevice(); - ~GPUDevice(); - - // The DWORD (uint32) representing the graphics card vendor id. - uint32 vendor_id; - - // The DWORD (uint32) representing the graphics card device id. - // Device ids are unique to vendor, not to one another. - uint32 device_id; - - // The strings that describe the GPU. - // In Linux these strings are obtained through libpci. - // In Win/MacOSX, these two strings are not filled at the moment. - std::string vendor_string; - std::string device_string; - }; - - GPUInfo(); - ~GPUInfo(); - - // Whether more GPUInfo fields might be collected in the future. - bool finalized; - - // The amount of time taken to get from the process starting to the message - // loop being pumped. - base::TimeDelta initialization_time; - - // Computer has NVIDIA Optimus - bool optimus; - - // Computer has AMD Dynamic Switchable Graphics - bool amd_switchable; - - // Lenovo dCute is installed. http://crbug.com/181665. - bool lenovo_dcute; - - // Version of DisplayLink driver installed. Zero if not installed. - // http://crbug.com/177611. - Version display_link_version; - - // Primary GPU, for exmaple, the discrete GPU in a dual GPU machine. - GPUDevice gpu; - - // Secondary GPUs, for example, the integrated GPU in a dual GPU machine. - std::vector<GPUDevice> secondary_gpus; - - // The vendor of the graphics driver currently installed. - std::string driver_vendor; - - // The version of the graphics driver currently installed. - std::string driver_version; - - // The date of the graphics driver currently installed. - std::string driver_date; - - // The version of the pixel/fragment shader used by the gpu. - std::string pixel_shader_version; - - // The version of the vertex shader used by the gpu. - std::string vertex_shader_version; - - // The machine model identifier with format "name major.minor". - // Name should not contain any whitespaces. - std::string machine_model; - - // The version of OpenGL we are using. - // TODO(zmo): should be able to tell if it's GL or GLES. - std::string gl_version; - - // The GL_VERSION string. "" if we are not using OpenGL. - std::string gl_version_string; - - // The GL_VENDOR string. "" if we are not using OpenGL. - std::string gl_vendor; - - // The GL_RENDERER string. "" if we are not using OpenGL. - std::string gl_renderer; - - // The GL_EXTENSIONS string. "" if we are not using OpenGL. - std::string gl_extensions; - - // The device semantics, i.e. whether the Vista and Windows 7 specific - // semantics are available. - bool can_lose_context; - - // Whether gpu or driver is accessible. - bool gpu_accessible; - - // By default all values are 0. - GpuPerformanceStats performance_stats; - - bool software_rendering; - - // Whether the gpu process is running in a sandbox. - bool sandboxed; - -#if defined(OS_WIN) - // The information returned by the DirectX Diagnostics Tool. - DxDiagNode dx_diagnostics; -#endif -}; - -} // namespace gpu - -#endif // GPU_CONFIG_GPU_INFO_H_ diff --git a/gpu/config/gpu_info_unittest.cc b/gpu/config/gpu_info_unittest.cc deleted file mode 100644 index f6b6eb6..0000000 --- a/gpu/config/gpu_info_unittest.cc +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2012 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 "gpu/config/gpu_info.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace gpu { - -// Test that an empty GPUInfo has valid members -TEST(GPUInfoBasicTest, EmptyGPUInfo) { - GPUInfo gpu_info; - EXPECT_EQ(gpu_info.finalized, false); - EXPECT_EQ(gpu_info.initialization_time.ToInternalValue(), 0); - EXPECT_EQ(gpu_info.gpu.vendor_id, 0u); - EXPECT_EQ(gpu_info.gpu.device_id, 0u); - EXPECT_EQ(gpu_info.secondary_gpus.size(), 0u); - EXPECT_EQ(gpu_info.driver_vendor, ""); - EXPECT_EQ(gpu_info.driver_version, ""); - EXPECT_EQ(gpu_info.driver_date, ""); - EXPECT_EQ(gpu_info.pixel_shader_version, ""); - EXPECT_EQ(gpu_info.vertex_shader_version, ""); - EXPECT_EQ(gpu_info.gl_version, ""); - EXPECT_EQ(gpu_info.gl_version_string, ""); - EXPECT_EQ(gpu_info.gl_vendor, ""); - EXPECT_EQ(gpu_info.gl_renderer, ""); - EXPECT_EQ(gpu_info.gl_extensions, ""); - EXPECT_EQ(gpu_info.can_lose_context, false); -} - -} // namespace gpu - diff --git a/gpu/config/gpu_performance_stats.h b/gpu/config/gpu_performance_stats.h deleted file mode 100644 index 2ade8bf..0000000 --- a/gpu/config/gpu_performance_stats.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2012 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 GPU_CONFIG_GPU_PERFORMANCE_STATS_H_ -#define GPU_CONFIG_GPU_PERFORMANCE_STATS_H_ - -#include "gpu/gpu_export.h" - -namespace gpu { - -struct GPU_EXPORT GpuPerformanceStats { - GpuPerformanceStats() : graphics(0.f), gaming(0.f), overall(0.f) {} - - float graphics; - float gaming; - float overall; -}; - -} // namespace gpu - -#endif // GPU_CONFIG_GPU_PERFORMANCE_STATS_H_ - diff --git a/gpu/config/gpu_switching_list.cc b/gpu/config/gpu_switching_list.cc deleted file mode 100644 index b87dfb2..0000000 --- a/gpu/config/gpu_switching_list.cc +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2013 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 "gpu/config/gpu_switching_list.h" - -#include "gpu/config/gpu_switching_option.h" - -namespace gpu { - -GpuSwitchingList::GpuSwitchingList() - : GpuControlList() { -} - -GpuSwitchingList::~GpuSwitchingList() { -} - -// static -GpuSwitchingList* GpuSwitchingList::Create() { - GpuSwitchingList* list = new GpuSwitchingList(); - list->AddSupportedFeature("force_integrated", - GPU_SWITCHING_OPTION_FORCE_INTEGRATED); - list->AddSupportedFeature("force_discrete", - GPU_SWITCHING_OPTION_FORCE_DISCRETE); - return list; -} - -} // namespace gpu - diff --git a/gpu/config/gpu_switching_list.h b/gpu/config/gpu_switching_list.h deleted file mode 100644 index 095597a..0000000 --- a/gpu/config/gpu_switching_list.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2013 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 GPU_CONFIG_GPU_SWITCHING_LIST_H_ -#define GPU_CONFIG_GPU_SWITCHING_LIST_H_ - -#include <string> - -#include "gpu/config/gpu_control_list.h" - -namespace gpu { - -class GPU_EXPORT GpuSwitchingList : public GpuControlList { - public: - virtual ~GpuSwitchingList(); - - static GpuSwitchingList* Create(); - - private: - GpuSwitchingList(); - - DISALLOW_COPY_AND_ASSIGN(GpuSwitchingList); -}; - -} // namespace gpu - -#endif // GPU_CONFIG_GPU_SWITCHING_LIST_H_ - diff --git a/gpu/config/gpu_switching_list_json.cc b/gpu/config/gpu_switching_list_json.cc deleted file mode 100644 index 9916b02..0000000 --- a/gpu/config/gpu_switching_list_json.cc +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) 2013 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. - -// Determines whether a certain gpu is prefered in a dual-gpu situation. -// A valid gpu_switching_list.json file are in the format of -// { -// "version": "x.y", -// "entries": [ -// { // entry 1 -// }, -// ... -// { // entry n -// } -// ] -// } -// -// Each entry contains the following fields (fields are optional unless -// specifically described as mandatory below): -// 1. "id" is an integer. 0 is reserved. This field is mandatory. -// 2. "os" contains "type" and an optional "version". "type" could be "macosx", -// "linux", "win", "chromeos", or "any". "any" is the same as not specifying -// "os". -// "version" is a VERSION structure (defined below). -// 3. "vendor_id" is a string. 0 is reserved. -// 4. "device_id" is an array of strings. 0 is reserved. -// 5. "multi_gpu_style" is a string, valid values include "optimus", and -// "amd_switchable". -// 6. "multi_gpu_category" is a string, valid values include "any", "primary", -// and "secondary". If unspecified, the default value is "primary". -// 7. "driver_vendor" is a STRING structure (defined below). -// 8. "driver_version" is a VERSION structure (defined below). -// 9. "driver_date" is a VERSION structure (defined below). -// The version is interpreted as "year.month.day". -// 10. "gl_vendor" is a STRING structure (defined below). -// 11. "gl_renderer" is a STRING structure (defined below). -// 12. "gl_extensions" is a STRING structure (defined below). -// 13. "perf_graphics" is a FLOAT structure (defined below). -// 14. "perf_gaming" is a FLOAT structure (defined below). -// 15. "perf_overall" is a FLOAT structure (defined below). -// 16. "machine_model" contais "name" and an optional "version". "name" is a -// STRING structure and "version" is a VERSION structure (defined below). -// 17. "gpu_count" is a INT structure (defined below). -// 18 "cpu_info" is a STRING structure (defined below). -// 19. "exceptions" is a list of entries. -// 20. "features" is a list of gpu switching options, including -// "force_discrete" and "force_integrated". -// This field is mandatory. -// 21. "description" has the description of the entry. -// 22. "webkit_bugs" is an array of associated webkit bug numbers. -// 23. "cr_bugs" is an array of associated webkit bug numbers. -// 24. "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. -// 25. "disabled" is a boolean. If it is present, the entry will be skipped. -// This can not be used in exceptions. -// -// VERSION includes "op", "style", "number", and "number2". "op" can be any of -// the following values: "=", "<", "<=", ">", ">=", "any", "between". "style" -// is optional and can be "lexical" or "numerical"; if it's not specified, it -// defaults to "numerical". "number2" is only used if "op" is "between". -// "between" is "number <= * <= number2". -// "number" is used for all "op" values except "any". "number" and "number2" -// are in the format of x, x.x, x.x.x, etc. -// Only "driver_version" supports lexical style if the format is major.minor; -// in that case, major is still numerical, but minor is lexical. -// -// STRING includes "op" and "value". "op" can be any of the following values: -// "contains", "beginwith", "endwith", "=". "value" is a string. -// -// FLOAT includes "op" "value", and "value2". "op" can be any of the -// following values: "=", "<", "<=", ">", ">=", "any", "between". "value2" is -// only used if "op" is "between". "value" is used for all "op" values except -// "any". "value" and "value2" are valid float numbers. -// INT is very much like FLOAT, except that the values need to be integers. - -#include "gpu/config/gpu_control_list_jsons.h" - -#define LONG_STRING_CONST(...) #__VA_ARGS__ - -namespace gpu { - -const char kGpuSwitchingListJson[] = LONG_STRING_CONST( - -{ - "name": "gpu switching list", - // Please update the version number whenever you change this file. - "version": "2.0", - "entries": [ - { - "id": 1, - "description": "Force to use discrete GPU on older MacBookPro models.", - "cr_bugs": [113703], - "os": { - "type": "macosx", - "version": { - "op": ">=", - "number": "10.7" - } - }, - "machine_model": { - "name": { - "op": "=", - "value": "MacBookPro" - }, - "version": { - "op": "<", - "number": "8" - } - }, - "gpu_count": { - "op": "=", - "value": "2" - }, - "features": [ - "force_discrete" - ] - } - ] -} - -); // LONG_STRING_CONST macro - -} // namespace gpu - diff --git a/gpu/config/gpu_switching_list_unittest.cc b/gpu/config/gpu_switching_list_unittest.cc deleted file mode 100644 index 78dc74d..0000000 --- a/gpu/config/gpu_switching_list_unittest.cc +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2013 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 <vector> - -#include "base/memory/scoped_ptr.h" -#include "gpu/config/gpu_control_list_jsons.h" -#include "gpu/config/gpu_info.h" -#include "gpu/config/gpu_switching_list.h" -#include "gpu/config/gpu_switching_option.h" -#include "testing/gtest/include/gtest/gtest.h" - -#define LONG_STRING_CONST(...) #__VA_ARGS__ - -const char kOsVersion[] = "10.6.4"; - -namespace gpu { - -class GpuSwitchingListTest : public testing::Test { - public: - GpuSwitchingListTest() { } - - virtual ~GpuSwitchingListTest() { } - - const GPUInfo& gpu_info() const { - return gpu_info_; - } - - protected: - virtual void SetUp() { - gpu_info_.gpu.vendor_id = 0x10de; - gpu_info_.gpu.device_id = 0x0640; - gpu_info_.driver_vendor = "NVIDIA"; - gpu_info_.driver_version = "1.6.18"; - gpu_info_.driver_date = "7-14-2009"; - gpu_info_.machine_model = "MacBookPro 7.1"; - gpu_info_.gl_vendor = "NVIDIA Corporation"; - gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; - gpu_info_.performance_stats.graphics = 5.0; - gpu_info_.performance_stats.gaming = 5.0; - gpu_info_.performance_stats.overall = 5.0; - } - - virtual void TearDown() { - } - - private: - GPUInfo gpu_info_; -}; - -TEST_F(GpuSwitchingListTest, CurrentSwitchingListValidation) { - scoped_ptr<GpuSwitchingList> switching_list(GpuSwitchingList::Create()); - EXPECT_TRUE(switching_list->LoadList( - kGpuSwitchingListJson, GpuControlList::kAllOs)); - EXPECT_FALSE(switching_list->contains_unknown_fields()); -} - -TEST_F(GpuSwitchingListTest, GpuSwitching) { - const std::string json = LONG_STRING_CONST( - { - "name": "gpu switching list", - "version": "0.1", - "entries": [ - { - "id": 1, - "os": { - "type": "macosx" - }, - "features": [ - "force_discrete" - ] - }, - { - "id": 2, - "os": { - "type": "win" - }, - "features": [ - "force_integrated" - ] - } - ] - } - ); - scoped_ptr<GpuSwitchingList> switching_list(GpuSwitchingList::Create()); - EXPECT_TRUE(switching_list->LoadList(json, GpuControlList::kAllOs)); - std::set<int> switching = switching_list->MakeDecision( - GpuControlList::kOsMacosx, kOsVersion, gpu_info()); - EXPECT_EQ(1u, switching.size()); - EXPECT_EQ(1u, switching.count(GPU_SWITCHING_OPTION_FORCE_DISCRETE)); - std::vector<uint32> entries; - switching_list->GetDecisionEntries(&entries, false); - ASSERT_EQ(1u, entries.size()); - EXPECT_EQ(1u, entries[0]); - - switching_list.reset(GpuSwitchingList::Create()); - EXPECT_TRUE(switching_list->LoadList(json, GpuControlList::kAllOs)); - switching = switching_list->MakeDecision( - GpuControlList::kOsWin, kOsVersion, gpu_info()); - EXPECT_EQ(1u, switching.size()); - EXPECT_EQ(1u, switching.count(GPU_SWITCHING_OPTION_FORCE_INTEGRATED)); - switching_list->GetDecisionEntries(&entries, false); - ASSERT_EQ(1u, entries.size()); - EXPECT_EQ(2u, entries[0]); -} - -} // namespace gpu - diff --git a/gpu/config/gpu_switching_option.h b/gpu/config/gpu_switching_option.h deleted file mode 100644 index 036c15f..0000000 --- a/gpu/config/gpu_switching_option.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2012 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 GPU_CONFIG_GPU_SWITCHING_OPTION_H_ -#define GPU_CONFIG_GPU_SWITCHING_OPTION_H_ - -//#include "build/build_config.h" - -namespace gpu { - -enum GpuSwitchingOption { - GPU_SWITCHING_OPTION_AUTOMATIC, - GPU_SWITCHING_OPTION_FORCE_INTEGRATED, - GPU_SWITCHING_OPTION_FORCE_DISCRETE, - GPU_SWITCHING_OPTION_UNKNOWN -}; - -} // namespace gpu - -#endif // GPU_CONFIG_GPU_SWITCHING_OPTION_H_ - diff --git a/gpu/config/gpu_util.cc b/gpu/config/gpu_util.cc deleted file mode 100644 index bed1f0c..0000000 --- a/gpu/config/gpu_util.cc +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2012 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 "gpu/config/gpu_util.h" - -#include <vector> - -#include "base/logging.h" -#include "ui/gl/gl_switches.h" - -namespace gpu { - -GpuSwitchingOption StringToGpuSwitchingOption( - const std::string& switching_string) { - if (switching_string == switches::kGpuSwitchingOptionNameAutomatic) - return GPU_SWITCHING_OPTION_AUTOMATIC; - if (switching_string == switches::kGpuSwitchingOptionNameForceIntegrated) - return GPU_SWITCHING_OPTION_FORCE_INTEGRATED; - if (switching_string == switches::kGpuSwitchingOptionNameForceDiscrete) - return GPU_SWITCHING_OPTION_FORCE_DISCRETE; - return GPU_SWITCHING_OPTION_UNKNOWN; -} - -std::string GpuSwitchingOptionToString(GpuSwitchingOption option) { - switch (option) { - case GPU_SWITCHING_OPTION_AUTOMATIC: - return switches::kGpuSwitchingOptionNameAutomatic; - case GPU_SWITCHING_OPTION_FORCE_INTEGRATED: - return switches::kGpuSwitchingOptionNameForceIntegrated; - case GPU_SWITCHING_OPTION_FORCE_DISCRETE: - return switches::kGpuSwitchingOptionNameForceDiscrete; - default: - return "unknown"; - } -} - -void MergeFeatureSets(std::set<int>* dst, const std::set<int>& src) { - DCHECK(dst); - if (src.empty()) - return; - dst->insert(src.begin(), src.end()); -} - -} // namespace gpu diff --git a/gpu/config/gpu_util.h b/gpu/config/gpu_util.h deleted file mode 100644 index 40ae16c..0000000 --- a/gpu/config/gpu_util.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2012 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 GPU_CONFIG_GPU_UTIL_H_ -#define GPU_CONFIG_GPU_UTIL_H_ - -#include <set> -#include <string> - -#include "build/build_config.h" -#include "gpu/config/gpu_switching_option.h" -#include "gpu/gpu_export.h" - -namespace gpu { - -// Maps string to GpuSwitchingOption; returns GPU_SWITCHING_UNKNOWN if an -// unknown name is input (case-sensitive). -GPU_EXPORT GpuSwitchingOption StringToGpuSwitchingOption( - const std::string& switching_string); - -// Gets a string version of a GpuSwitchingOption. -GPU_EXPORT std::string GpuSwitchingOptionToString(GpuSwitchingOption option); - -// Merge features in src into dst. -GPU_EXPORT void MergeFeatureSets( - std::set<int>* dst, const std::set<int>& src); - -} // namespace gpu - -#endif // GPU_CONFIG_GPU_UTIL_H_ - diff --git a/gpu/config/gpu_util_unittest.cc b/gpu/config/gpu_util_unittest.cc deleted file mode 100644 index f3e3f8f..0000000 --- a/gpu/config/gpu_util_unittest.cc +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2011 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 "gpu/config/gpu_util.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "ui/gl/gl_switches.h" - -namespace gpu { - -TEST(GpuUtilTest, GpuSwitchingOptionFromString) { - // Test StringToGpuSwitchingOption. - EXPECT_EQ(StringToGpuSwitchingOption( - switches::kGpuSwitchingOptionNameAutomatic), - GPU_SWITCHING_OPTION_AUTOMATIC); - EXPECT_EQ(StringToGpuSwitchingOption( - switches::kGpuSwitchingOptionNameForceDiscrete), - GPU_SWITCHING_OPTION_FORCE_DISCRETE); - EXPECT_EQ(StringToGpuSwitchingOption( - switches::kGpuSwitchingOptionNameForceIntegrated), - GPU_SWITCHING_OPTION_FORCE_INTEGRATED); - EXPECT_EQ(StringToGpuSwitchingOption("xxx"), GPU_SWITCHING_OPTION_UNKNOWN); -} - -TEST(GpuUtilTest, GpuSwitchingOptionToString) { - // Test GpuSwitchingOptionToString. - EXPECT_STREQ( - GpuSwitchingOptionToString(GPU_SWITCHING_OPTION_AUTOMATIC).c_str(), - switches::kGpuSwitchingOptionNameAutomatic); - EXPECT_STREQ( - GpuSwitchingOptionToString(GPU_SWITCHING_OPTION_FORCE_DISCRETE).c_str(), - switches::kGpuSwitchingOptionNameForceDiscrete); - EXPECT_STREQ( - GpuSwitchingOptionToString(GPU_SWITCHING_OPTION_FORCE_INTEGRATED).c_str(), - switches::kGpuSwitchingOptionNameForceIntegrated); -} - -TEST(GpuUtilTest, MergeFeatureSets) { - { - // Merge two empty sets. - std::set<int> src; - std::set<int> dst; - EXPECT_TRUE(dst.empty()); - MergeFeatureSets(&dst, src); - EXPECT_TRUE(dst.empty()); - } - { - // Merge an empty set into a set with elements. - std::set<int> src; - std::set<int> dst; - dst.insert(1); - EXPECT_EQ(1u, dst.size()); - MergeFeatureSets(&dst, src); - EXPECT_EQ(1u, dst.size()); - } - { - // Merge two sets where the source elements are already in the target set. - std::set<int> src; - std::set<int> dst; - src.insert(1); - dst.insert(1); - EXPECT_EQ(1u, dst.size()); - MergeFeatureSets(&dst, src); - EXPECT_EQ(1u, dst.size()); - } - { - // Merge two sets with different elements. - std::set<int> src; - std::set<int> dst; - src.insert(1); - dst.insert(2); - EXPECT_EQ(1u, dst.size()); - MergeFeatureSets(&dst, src); - EXPECT_EQ(2u, dst.size()); - } -} - -} // namespace gpu diff --git a/gpu/config/software_rendering_list_json.cc b/gpu/config/software_rendering_list_json.cc deleted file mode 100644 index 9621100..0000000 --- a/gpu/config/software_rendering_list_json.cc +++ /dev/null @@ -1,1116 +0,0 @@ -// Copyright (c) 2013 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. - -// Determines whether certain gpu-related features are blacklisted or not. -// A valid software_rendering_list.json file are in the format of -// { -// "version": "x.y", -// "entries": [ -// { // entry 1 -// }, -// ... -// { // entry n -// } -// ] -// } -// -// Each entry contains the following fields (fields are optional unless -// specifically described as mandatory below): -// 1. "id" is an integer. 0 is reserved. This field is mandatory. -// 2. "os" contains "type" and an optional "version". "type" could be "macosx", -// "linux", "win", "chromeos", or "any". "any" is the same as not specifying -// "os". -// "version" is a VERSION structure (defined below). -// 3. "vendor_id" is a string. 0 is reserved. -// 4. "device_id" is an array of strings. 0 is reserved. -// 5. "multi_gpu_style" is a string, valid values include "optimus", and -// "amd_switchable". -// 6. "multi_gpu_category" is a string, valid values include "any", "primary", -// and "secondary". If unspecified, the default value is "primary". -// 7. "driver_vendor" is a STRING structure (defined below). -// 8. "driver_version" is a VERSION structure (defined below). -// 9. "driver_date" is a VERSION structure (defined below). -// The version is interpreted as "year.month.day". -// 10. "gl_vendor" is a STRING structure (defined below). -// 11. "gl_renderer" is a STRING structure (defined below). -// 12. "gl_extensions" is a STRING structure (defined below). -// 13. "perf_graphics" is a FLOAT structure (defined below). -// 14. "perf_gaming" is a FLOAT structure (defined below). -// 15. "perf_overall" is a FLOAT structure (defined below). -// 16. "machine_model" contais "name" and an optional "version". "name" is a -// STRING structure and "version" is a VERSION structure (defined below). -// 17. "gpu_count" is a INT structure (defined below). -// 18 "cpu_info" is a STRING structure (defined below). -// 19. "exceptions" is a list of entries. -// 20. "features" is a list of gpu feature strings, valid values include -// "accelerated_2d_canvas", "accelerated_compositing", "webgl", -// "multisampling", "flash_3d", "flash_stage3d", "texture_sharing", -// "accelerated_video", "accelerated_video_decode", "panel_fitting", -// "force_compositing_mode", and "all". -// This field is mandatory. -// 21. "description" has the description of the entry. -// 22. "webkit_bugs" is an array of associated webkit bug numbers. -// 23. "cr_bugs" is an array of associated webkit bug numbers. -// 24. "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. -// 25. "disabled" is a boolean. If it is present, the entry will be skipped. -// This can not be used in exceptions. -// -// VERSION includes "op", "style", "number", and "number2". "op" can be any of -// the following values: "=", "<", "<=", ">", ">=", "any", "between". "style" -// is optional and can be "lexical" or "numerical"; if it's not specified, it -// defaults to "numerical". "number2" is only used if "op" is "between". -// "between" is "number <= * <= number2". -// "number" is used for all "op" values except "any". "number" and "number2" -// are in the format of x, x.x, x.x.x, etc. -// Only "driver_version" supports lexical style if the format is major.minor; -// in that case, major is still numerical, but minor is lexical. -// -// STRING includes "op" and "value". "op" can be any of the following values: -// "contains", "beginwith", "endwith", "=". "value" is a string. -// -// FLOAT includes "op" "value", and "value2". "op" can be any of the -// following values: "=", "<", "<=", ">", ">=", "any", "between". "value2" is -// only used if "op" is "between". "value" is used for all "op" values except -// "any". "value" and "value2" are valid float numbers. -// INT is very much like FLOAT, except that the values need to be integers. - -#include "gpu/config/gpu_control_list_jsons.h" - -#define LONG_STRING_CONST(...) #__VA_ARGS__ - -namespace gpu { - -const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( - -{ - "name": "software rendering list", - // Please update the version number whenever you change this file. - "version": "6.0", - "entries": [ - { - "id": 1, - "description": "ATI Radeon X1900 is not compatible with WebGL on the Mac.", - "webkit_bugs": [47028], - "os": { - "type": "macosx" - }, - "vendor_id": "0x1002", - "device_id": ["0x7249"], - "features": [ - "webgl", - "flash_3d", - "flash_stage3d" - ] - }, - { - "id": 3, - "description": "GL driver is software rendered. Accelerated compositing is disabled.", - "cr_bugs": [59302], - "os": { - "type": "linux" - }, - "gl_renderer": { - "op": "contains", - "value": "software" - }, - "features": [ - "accelerated_compositing" - ] - }, - { - "id": 4, - "description": "The Intel Mobile 945 Express family of chipsets is not compatible with WebGL.", - "os": { - "type": "any" - }, - "vendor_id": "0x8086", - "device_id": ["0x27AE"], - "features": [ - "webgl", - "flash_3d", - "flash_stage3d" - ] - }, - { - "id": 5, - "description": "ATI/AMD cards with older or third-party drivers in Linux are crash-prone.", - "cr_bugs": [71381, 76428, 73910, 101225, 136240], - "os": { - "type": "linux" - }, - "vendor_id": "0x1002", - "exceptions": [ - { - "driver_vendor": { - "op": "contains", - "value": "AMD" - }, - "driver_version": { - "op": ">=", - "style": "lexical", - "number": "8.98" - } - } - ], - "features": [ - "all" - ] - }, - { - "id": 8, - "description": "NVIDIA GeForce FX Go5200 is assumed to be buggy.", - "cr_bugs": [72938], - "os": { - "type": "any" - }, - "vendor_id": "0x10de", - "device_id": ["0x0324"], - "features": [ - "all" - ] - }, - { - "id": 10, - "description": "NVIDIA GeForce 7300 GT on Mac does not support WebGL.", - "cr_bugs": [73794], - "os": { - "type": "macosx" - }, - "vendor_id": "0x10de", - "device_id": ["0x0393"], - "features": [ - "webgl", - "flash_3d", - "flash_stage3d" - ] - }, - { - "id": 12, - "description": "Drivers older than 2009-01 on Windows are possibly unreliable.", - "cr_bugs": [72979, 89802], - "os": { - "type": "win" - }, - "driver_date": { - "op": "<", - "number": "2009.1" - }, - "exceptions": [ - { - "vendor_id": "0x8086", - "device_id": ["0x29a2"], - "driver_version": { - "op": ">=", - "number": "7.15.10.1624" - } - } - ], - "features": [ - "accelerated_2d_canvas", - "accelerated_video", - "accelerated_video_decode", - "3d_css", - "multisampling", - "flash_3d", - "force_compositing_mode" - ] - }, - { - "id": 13, - "description": "ATI drivers older than 10.6 on Windows XP are possibly unreliable.", - "cr_bugs": [74212], - "os": { - "type": "win", - "version": { - "op": "=", - "number": "5" - } - }, - "vendor_id": "0x1002", - "driver_version": { - "op": "<", - "number": "8.741" - }, - "features": [ - "accelerated_video", - "accelerated_video_decode", - "3d_css", - "multisampling", - "flash_3d", - "force_compositing_mode" - ] - }, - { - "id": 14, - "description": "NVIDIA drivers older than 257.21 on Windows XP are possibly unreliable.", - "cr_bugs": [74212], - "os": { - "type": "win", - "version": { - "op": "=", - "number": "5" - } - }, - "vendor_id": "0x10de", - "driver_version": { - "op": "<", - "number": "6.14.12.5721" - }, - "features": [ - "accelerated_video", - "accelerated_video_decode", - "3d_css", - "multisampling", - "flash_3d", - "force_compositing_mode" - ] - }, - { - "id": 15, - "description": "Intel drivers older than 14.42.7.5294 on Windows XP are possibly unreliable.", - "cr_bugs": [74212], - "os": { - "type": "win", - "version": { - "op": "=", - "number": "5" - } - }, - "vendor_id": "0x8086", - "driver_version": { - "op": "<", - "number": "6.14.10.5294" - }, - "features": [ - "accelerated_video", - "accelerated_video_decode", - "3d_css", - "multisampling", - "flash_3d", - "force_compositing_mode" - ] - }, - { - "id": 16, - "description": "Multisampling is buggy in ATI cards on older MacOSX.", - "cr_bugs": [67752, 83153], - "os": { - "type": "macosx", - "version": { - "op": "<", - "number": "10.7.2" - } - }, - "vendor_id": "0x1002", - "features": [ - "multisampling" - ] - }, - { - "id": 17, - "description": "Intel mesa drivers are crash-prone.", - "cr_bugs": [76703, 164555], - "os": { - "type": "linux" - }, - "vendor_id": "0x8086", - "exceptions": [ - { - "device_id": ["0x0102", "0x0106", "0x0112", "0x0116", "0x0122", "0x0126", "0x010a", "0x0152", "0x0156", "0x015a", "0x0162", "0x0166"], - "driver_version": { - "op": ">=", - "number": "8.0" - } - }, - { - "device_id": ["0xa001", "0xa002", "0xa011", "0xa012", "0x29a2", "0x2992", "0x2982", "0x2972", "0x2a12", "0x2a42", "0x2e02", "0x2e12", "0x2e22", "0x2e32", "0x2e42", "0x2e92"], - "driver_version": { - "op": ">", - "number": "8.0.2" - } - }, - { - "device_id": ["0x0042", "0x0046"], - "driver_version": { - "op": ">=", - "number": "8.0.2" - } - }, - { - "device_id": ["0x2a02"], - "driver_version": { - "op": ">=", - "number": "9.1" - } - } - ], - "features": [ - "all" - ] - }, - { - "id": 18, - "description": "NVIDIA Quadro FX 1500 is buggy.", - "cr_bugs": [84701], - "os": { - "type": "linux" - }, - "vendor_id": "0x10de", - "device_id": ["0x029e"], - "features": [ - "all" - ] - }, - { - "id": 19, - "description": "GPU acceleration is no longer supported in Leopard.", - "cr_bugs": [87157, 130495], - "os": { - "type": "macosx", - "version": { - "op": "=", - "number": "10.5" - } - }, - "features": [ - "all" - ] - }, - { - "id": 23, - "description": "Mesa drivers in linux older than 7.11 are assumed to be buggy.", - "os": { - "type": "linux" - }, - "driver_vendor": { - "op": "=", - "value": "Mesa" - }, - "driver_version": { - "op": "<", - "number": "7.11" - }, - "features": [ - "all" - ] - }, - { - "id": 24, - "description": "Accelerated 2d canvas is unstable in Linux at the moment.", - "os": { - "type": "linux" - }, - "features": [ - "accelerated_2d_canvas" - ] - }, - { - "id": 27, - "description": "ATI/AMD cards with older drivers in Linux are crash-prone.", - "cr_bugs": [95934, 94973, 136240], - "os": { - "type": "linux" - }, - "gl_vendor": { - "op": "beginwith", - "value": "ATI" - }, - "exceptions": [ - { - "driver_vendor": { - "op": "contains", - "value": "AMD" - }, - "driver_version": { - "op": ">=", - "style": "lexical", - "number": "8.98" - } - } - ], - "features": [ - "all" - ] - }, - { - "id": 28, - "description": "ATI/AMD cards with third-party drivers in Linux are crash-prone.", - "cr_bugs": [95934, 94973], - "os": { - "type": "linux" - }, - "gl_vendor": { - "op": "beginwith", - "value": "X.Org" - }, - "gl_renderer": { - "op": "contains", - "value": "AMD" - }, - "features": [ - "all" - ] - }, - { - "id": 29, - "description": "ATI/AMD cards with third-party drivers in Linux are crash-prone.", - "cr_bugs": [95934, 94973], - "os": { - "type": "linux" - }, - "gl_vendor": { - "op": "beginwith", - "value": "X.Org" - }, - "gl_renderer": { - "op": "contains", - "value": "ATI" - }, - "features": [ - "all" - ] - }, - { - "id": 30, - "description": "NVIDIA cards with nouveau drivers in Linux are crash-prone.", - "cr_bugs": [94103], - "os": { - "type": "linux" - }, - "vendor_id": "0x10de", - "gl_vendor": { - "op": "beginwith", - "value": "nouveau" - }, - "features": [ - "all" - ] - }, - { - "id": 32, - "description": "Accelerated 2d canvas is disabled on Windows systems with low perf stats.", - "cr_bugs": [116350, 151500], - "os": { - "type": "win" - }, - "perf_overall": { - "op": "<", - "value": "3.5" - }, - "exceptions": [ - { - "perf_gaming": { - "op": ">", - "value": "3.5" - } - }, - { - "cpu_info": { - "op": "contains", - "value": "Atom" - } - } - ], - "features": [ - "accelerated_2d_canvas" - ] - }, - { - "id": 33, - "description": "Multisampling is buggy in Intel IvyBridge.", - "cr_bugs": [116370], - "os": { - "type": "linux" - }, - "vendor_id": "0x8086", - "device_id": ["0x0152", "0x0156", "0x015a", "0x0162", "0x0166"], - "features": [ - "multisampling" - ] - }, - { - "id": 34, - "description": "S3 Trio (used in Virtual PC) is not compatible.", - "cr_bugs": [119948], - "os": { - "type": "win" - }, - "vendor_id": "0x5333", - "device_id": ["0x8811"], - "features": [ - "all" - ] - }, - { - "id": 35, - "description": "Stage3D is not supported on Linux.", - "cr_bugs": [129848], - "os": { - "type": "linux" - }, - "features": [ - "flash_stage3d" - ] - }, - { - "id": 37, - "description": "Drivers are unreliable for Optimus on Linux.", - "cr_bugs": [131308], - "os": { - "type": "linux" - }, - "multi_gpu_style": "optimus", - "features": [ - "all" - ] - }, - { - "id": 38, - "description": "Accelerated 2D canvas is unstable for NVidia GeForce 9400M on Lion.", - "cr_bugs": [130495], - "os": { - "type": "macosx", - "version": { - "op": "=", - "number": "10.7" - } - }, - "vendor_id": "0x10de", - "device_id": ["0x0863"], - "features": [ - "accelerated_2d_canvas" - ] - }, - { - "id": 41, - "description": "Disable 3D (but not Stage3D) in Flash on XP", - "cr_bugs": [134885], - "os": { - "type": "win", - "version": { - "op": "=", - "number": "5" - } - }, - "features": [ - "flash_3d" - ] - }, - { - "id": 42, - "description": "AMD Radeon HD 6490M on Snow Leopard is buggy.", - "cr_bugs": [137307], - "os": { - "type": "macosx", - "version": { - "op": "=", - "number": "10.6" - } - }, - "vendor_id": "0x1002", - "device_id": ["0x6760"], - "features": [ - "webgl" - ] - }, - { - "id": 43, - "description": "Intel driver version 8.15.10.1749 has problems sharing textures.", - "cr_bugs": [133924], - "os": { - "type": "win" - }, - "vendor_id": "0x8086", - "driver_version": { - "op": "=", - "number": "8.15.10.1749" - }, - "features": [ - "texture_sharing" - ] - }, - { - "id": 44, - "description": "Intel HD 4000 causes kernel panic on Lion.", - "cr_bugs": [134015], - "os": { - "type": "macosx", - "version": { - "op": "between", - "number": "10.7.0", - "number2": "10.7.4" - } - }, - "vendor_id": "0x8086", - "device_id": ["0x0166"], - "multi_gpu_category": "any", - "features": [ - "all" - ] - }, - { - "id": 45, - "description": "Parallels drivers older than 7 are buggy.", - "cr_bugs": [138105], - "os": { - "type": "win" - }, - "vendor_id": "0x1ab8", - "driver_version": { - "op": "<", - "number": "7" - }, - "features": [ - "all" - ] - }, - { - "id": 46, - "description": "ATI FireMV 2400 cards on Windows are buggy.", - "cr_bugs": [124152], - "os": { - "type": "win" - }, - "vendor_id": "0x1002", - "device_id": ["0x3151"], - "features": [ - "all" - ] - }, - { - "id": 47, - "description": "NVIDIA linux drivers older than 295.* are assumed to be buggy.", - "cr_bugs": [78497], - "os": { - "type": "linux" - }, - "vendor_id": "0x10de", - "driver_vendor": { - "op": "=", - "value": "NVIDIA" - }, - "driver_version": { - "op": "<", - "number": "295" - }, - "features": [ - "all" - ] - }, - { - "id": 48, - // Please keep in sync with content/test/content_browser_test.cc. - "description": "Accelerated video decode is unavailable on Mac and Linux.", - "cr_bugs": [137247, 133828], - "exceptions": [ - { - "os": { - "type": "chromeos" - } - }, - { - "os": { - "type": "win" - } - } - ], - "features": [ - "accelerated_video_decode" - ] - }, - { - "id": 49, - "description": "NVidia GeForce GT 650M can cause the system to hang with flash 3D.", - "cr_bugs": [140175], - "os": { - "type": "macosx", - "version": { - "op": "between", - "number": "10.8.0", - "number2": "10.8.1" - } - }, - "multi_gpu_style": "optimus", - "vendor_id": "0x10de", - "device_id": ["0x0fd5"], - "features": [ - "flash_3d", - "flash_stage3d" - ] - }, - { - "id": 50, - "description": "Disable VMware software renderer.", - "cr_bugs": [145531], - "os": { - "type": "linux" - }, - "gl_vendor": { - "op": "beginwith", - "value": "VMware" - }, - "features": [ - "all" - ] - }, - { - "id": 51, - "description": "NVIDIA drivers 6.14.11.9621 is buggy on Windows XP.", - "cr_bugs": [152096], - "os": { - "type": "win", - "version": { - "op": "=", - "number": "5" - } - }, - "vendor_id": "0x10de", - "driver_version": { - "op": "=", - "number": "6.14.11.9621" - }, - "features": [ - "all" - ] - }, - { - "id": 52, - "description": "NVIDIA drivers 6.14.11.8267 is buggy on Windows XP.", - "cr_bugs": [152096], - "os": { - "type": "win", - "version": { - "op": "=", - "number": "5" - } - }, - "vendor_id": "0x10de", - "driver_version": { - "op": "=", - "number": "6.14.11.8267" - }, - "features": [ - "all" - ] - }, - { - "id": 53, - "description": "The Intel GMA500 is too slow for Stage3D.", - "cr_bugs": [152096], - "vendor_id": "0x8086", - "device_id": ["0x8108", "0x8109"], - "features": [ - "flash_stage3d" - ] - }, - { - "id": 55, - "description": "Drivers older than 2007-01 on Windows are assumed to be buggy.", - "cr_bugs": [72979, 89802], - "os": { - "type": "win" - }, - "driver_date": { - "op": "<", - "number": "2007.1" - }, - "exceptions": [ - { - "vendor_id": "0x8086", - "device_id": ["0x29a2"], - "driver_version": { - "op": ">=", - "number": "7.15.10.1624" - } - } - ], - "features": [ - "all" - ] - }, - { - "id": 56, - "description": "NVIDIA linux drivers are unstable when using multiple Open GL contexts and with low memory.", - "cr_bugs": [145600], - "os": { - "type": "linux" - }, - "vendor_id": "0x10de", - "driver_vendor": { - "op": "=", - "value": "NVIDIA" - }, - "features": [ - "accelerated_video", - "accelerated_video_decode", - "flash_3d", - "flash_stage3d" - ] - }, - { - "id": 57, - "description": "Enable panel fitting capability on ChromeOS only on IVB and SNB Graphics Controllers.", - "exceptions": [ - { - "os": { - "type": "chromeos" - }, - "vendor_id": "0x8086", - "device_id": ["0x0106", "0x0116", "0x0166"] - } - ], - "features": [ - "panel_fitting" - ] - }, - { - "id": 59, - "description": "NVidia driver 8.15.11.8593 is crashy on Windows.", - "cr_bugs": [155749], - "os": { - "type": "win" - }, - "vendor_id": "0x10de", - "driver_version": { - "op": "=", - "number": "8.15.11.8593" - }, - "features": [ - "accelerated_video_decode" - ] - }, - { - "id": 60, - "description": "Multisampling is buggy on Mac with NVIDIA gpu prior to 10.8.3.", - "cr_bugs": [137303], - "os": { - "type": "macosx", - "version": { - "op": "<", - "number": "10.8.3" - } - }, - "vendor_id": "0x10de", - "features": [ - "multisampling" - ] - }, - { - "id": 61, - "description": "Multisampling is buggy on Mac with Intel gpu prior to 10.8.3.", - "cr_bugs": [137303], - "os": { - "type": "macosx", - "version": { - "op": "<", - "number": "10.8.3" - } - }, - "vendor_id": "0x8086", - "features": [ - "multisampling" - ] - }, - { - "id": 62, - "description": "Accelerated 2D canvas buggy on old Qualcomm Adreno.", - "cr_bugs": [161575], - "os": { - "type": "android" - }, - "gl_renderer": { - "op": "contains", - "value": "Adreno" - }, - "driver_version": { - "op": "<", - "number": "4.1" - }, - "features": [ - "accelerated_2d_canvas" - ] - }, - { - "id": 63, - "description": "Multisampling is buggy on Mac with AMD gpu prior to 10.8.3.", - "cr_bugs": [162466], - "os": { - "type": "macosx", - "version": { - "op": "<", - "number": "10.8.3" - } - }, - "vendor_id": "0x1002", - "features": [ - "multisampling" - ] - }, - { - "id": 64, - "description": "Hardware video decode is only supported in win7+.", - "cr_bugs": [159458], - "os": { - "type": "win", - "version": { - "op": "<", - "number": "6.1" - } - }, - "features": [ - "accelerated_video_decode" - ] - }, - { - "id": 65, - "description": "Force compositing mode is unstable in Win Vista.", - "cr_bugs": [170421], - "os": { - "type": "win", - "version": { - "op": "=", - "number": "6.0" - } - }, - "features": [ - "force_compositing_mode" - ] - }, - { - "id": 66, - "description": "Force compositing mode is unstable in MacOSX earlier than 10.8.", - "cr_bugs": [174101], - "os": { - "type": "macosx", - "version": { - "op": "<", - "number": "10.8" - } - }, - "features": [ - "force_compositing_mode" - ] - }, - { - "id": 67, - "description": "Accelerated 2D Canvas is not supported on WinXP.", - "cr_bugs": [175149], - "os": { - "type": "win", - "version": { - "op": "=", - "number": "5" - } - }, - "features": [ - "accelerated_2d_canvas" - ] - }, - { - "id": 68, - "description": "VMware Fusion 4 has corrupt rendering with Win Vista+.", - "cr_bugs": [169470], - "os": { - "type": "win", - "version": { - "op": ">=", - "number": "6.0" - } - }, - "vendor_id": "0x15ad", - "driver_version": { - "op": "<=", - "number": "7.14.1.1134" - }, - "features": [ - "all" - ] - }, - { - "id": 69, - "description": "NVIDIA driver 8.17.11.9621 is buggy with Stage3D baseline mode.", - "cr_bugs": [172771], - "os": { - "type": "win" - }, - "vendor_id": "0x10de", - "driver_version": { - "op": "=", - "number": "8.17.11.9621" - }, - "features": [ - "flash_stage3d_baseline" - ] - }, - { - "id": 70, - "description": "NVIDIA driver 8.17.11.8267 is buggy with Stage3D baseline mode.", - "cr_bugs": [172771], - "os": { - "type": "win" - }, - "vendor_id": "0x10de", - "driver_version": { - "op": "=", - "number": "8.17.11.8267" - }, - "features": [ - "flash_stage3d_baseline" - ] - }, - { - "id": 71, - "description": "All Intel drivers before 8.15.10.2021 are buggy with Stage3D baseline mode.", - "cr_bugs": [172771], - "os": { - "type": "win" - }, - "vendor_id": "0x8086", - "driver_version": { - "op": "<", - "number": "8.15.10.2021" - }, - "features": [ - "flash_stage3d_baseline" - ] - }, - { - "id": 72, - "description": "NVIDIA GeForce 6200 LE is buggy with WebGL.", - "cr_bugs": [232529], - "os": { - "type": "win" - }, - "vendor_id": "0x10de", - "device_id": ["0x0163"], - "features": [ - "webgl" - ] - }, - { - "id": 73, - "description": "WebGL is buggy with the NVIDIA GeForce GT 330M, 9400, and 9400M on MacOSX earlier than 10.8", - "cr_bugs": [233523], - "os": { - "type": "macosx", - "version": { - "op": "<", - "number": "10.8" - } - }, - "vendor_id": "0x10de", - "device_id": ["0x0a29", "0x0861", "0x0863"], - "features": [ - "webgl" - ] - } - ] -} - -); // LONG_STRING_CONST macro - -} // namespace gpu - diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp index d9ace92..371f5cd 100644 --- a/gpu/gpu.gyp +++ b/gpu/gpu.gyp @@ -206,18 +206,6 @@ 'command_buffer/service/transfer_buffer_manager_unittest.cc', 'command_buffer/service/vertex_attrib_manager_unittest.cc', 'command_buffer/service/vertex_array_manager_unittest.cc', - 'config/gpu_blacklist_unittest.cc', - 'config/gpu_control_list_entry_unittest.cc', - 'config/gpu_control_list_machine_model_info_unittest.cc', - 'config/gpu_control_list_number_info_unittest.cc', - 'config/gpu_control_list_os_info_unittest.cc', - 'config/gpu_control_list_string_info_unittest.cc', - 'config/gpu_control_list_unittest.cc', - 'config/gpu_control_list_version_info_unittest.cc', - 'config/gpu_driver_bug_list_unittest.cc', - 'config/gpu_info_unittest.cc', - 'config/gpu_switching_list_unittest.cc', - 'config/gpu_util_unittest.cc', ], 'conditions': [ ['OS == "android" and gtest_target_type == "shared_library"', { @@ -332,7 +320,6 @@ 'command_buffer_common', 'command_buffer_service', 'gles2_cmd_helper', - 'gpu_config', 'gpu_ipc', ], 'sources': [ @@ -403,13 +390,6 @@ 'command_buffer_common', ], }, - { - 'target_name': 'gpu_config', - 'type': 'static_library', - 'includes': [ - 'gpu_config.gypi', - ], - }, ], }, { # component != static_library @@ -432,7 +412,6 @@ 'command_buffer_common.gypi', 'command_buffer_service.gypi', 'gles2_cmd_helper.gypi', - 'gpu_config.gypi', 'gpu_ipc.gypi', ], 'defines': [ diff --git a/gpu/gpu_config.gypi b/gpu/gpu_config.gypi deleted file mode 100644 index 6b55aa4..0000000 --- a/gpu/gpu_config.gypi +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2012 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. - -{ - 'dependencies': [ - '../base/base.gyp:base', - ], - 'include_dirs': [ - '..', - ], - 'sources': [ - 'config/dx_diag_node.cc', - 'config/dx_diag_node.h', - 'config/gpu_blacklist.cc', - 'config/gpu_blacklist.h', - 'config/gpu_control_list_jsons.h', - 'config/gpu_control_list.cc', - 'config/gpu_control_list.h', - 'config/gpu_driver_bug_list_json.cc', - 'config/gpu_driver_bug_list.cc', - 'config/gpu_driver_bug_list.h', - 'config/gpu_driver_bug_workaround_type.h', - 'config/gpu_feature_type.h', - 'config/gpu_info.cc', - 'config/gpu_info.h', - 'config/gpu_performance_stats.h', - 'config/gpu_switching_list_json.cc', - 'config/gpu_switching_list.cc', - 'config/gpu_switching_list.h', - 'config/gpu_switching_option.h', - 'config/gpu_util.cc', - 'config/gpu_util.h', - 'config/software_rendering_list_json.cc', - ], -} |