diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-08 14:30:41 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-12 13:49:54 +0200 |
commit | ab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch) | |
tree | 498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/gpu/config | |
parent | 4ce69f7403811819800e7c5ae1318b2647e778d1 (diff) |
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/gpu/config')
36 files changed, 2308 insertions, 903 deletions
diff --git a/chromium/gpu/config/BUILD.gn b/chromium/gpu/config/BUILD.gn new file mode 100644 index 00000000000..8e7b04dc68d --- /dev/null +++ b/chromium/gpu/config/BUILD.gn @@ -0,0 +1,74 @@ +# Copyright 2014 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. + +import("//build/config/ui.gni") + +source_set("config") { + sources = [ + "dx_diag_node.cc", + "dx_diag_node.h", + "gpu_blacklist.cc", + "gpu_blacklist.h", + "gpu_control_list_jsons.h", + "gpu_control_list.cc", + "gpu_control_list.h", + "gpu_driver_bug_list_json.cc", + "gpu_driver_bug_list.cc", + "gpu_driver_bug_list.h", + "gpu_driver_bug_workaround_type.h", + "gpu_dx_diagnostics_win.cc", + "gpu_feature_type.h", + "gpu_info.cc", + "gpu_info.h", + "gpu_info_collector_android.cc", + "gpu_info_collector_mac.mm", + "gpu_info_collector_ozone.cc", + "gpu_info_collector_win.cc", + "gpu_info_collector_x11.cc", + "gpu_info_collector.cc", + "gpu_info_collector.h", + "gpu_performance_stats.h", + "gpu_test_config.cc", + "gpu_test_config.h", + "gpu_test_expectations_parser.cc", + "gpu_test_expectations_parser.h", + "gpu_util.cc", + "gpu_util.h", + "software_rendering_list_json.cc", + ] + + deps = [ + "//base", + "//third_party/re2", + "//ui/gl", + ] + + if (is_win) { + deps += [ "//third_party/libxml" ] + libs = [ "dxguid.lib", "setupapi.lib" ] + + if (is_chrome_branded) { + sources += [ + "//third_party/amd/AmdCfxPxExt.h", + "//third_party/amd/amd_videocard_info_win.cc", + ] + } + } + if (is_linux && use_x11) { + configs += [ + "//build/config/linux:x11", + "//build/config/linux:xext", + ] + deps += [ + "//build/config/linux:libpci", + "//third_party/libXNVCtrl", + ] + } else { + sources -= [ "gpu_info_collector_x11.cc" ] + } + if (!use_ozone) { + sources -= [ "gpu_info_collector_ozone.cc" ] + } +} + diff --git a/chromium/gpu/config/gpu_blacklist.cc b/chromium/gpu/config/gpu_blacklist.cc index 92c520740a9..600b42b09a4 100644 --- a/chromium/gpu/config/gpu_blacklist.cc +++ b/chromium/gpu/config/gpu_blacklist.cc @@ -20,32 +20,26 @@ 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("gpu_compositing", + GPU_FEATURE_TYPE_GPU_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("accelerated_video_encode", GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE); - 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->AddSupportedFeature("gpu_rasterization", + GPU_FEATURE_TYPE_GPU_RASTERIZATION); + list->AddSupportedFeature("gpu_rasterization_field_trial", + GPU_FEATURE_TYPE_GPU_RASTERIZATION_FIELD_TRIAL); list->set_supports_feature_type_all(true); return list; } diff --git a/chromium/gpu/config/gpu_blacklist_unittest.cc b/chromium/gpu/config/gpu_blacklist_unittest.cc index af381e02a90..7b05d4e7518 100644 --- a/chromium/gpu/config/gpu_blacklist_unittest.cc +++ b/chromium/gpu/config/gpu_blacklist_unittest.cc @@ -61,7 +61,8 @@ class GpuBlacklistTest : public testing::Test { 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_.machine_model_name = "MacBookPro"; + gpu_info_.machine_model_version = "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; @@ -91,18 +92,14 @@ 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(GpuCompositing, + "gpu_compositing", + GPU_FEATURE_TYPE_GPU_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) @@ -115,10 +112,6 @@ 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) @@ -127,20 +120,16 @@ GPU_BLACKLIST_FEATURE_TEST(AcceleratedVideoEncode, "accelerated_video_encode", GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) -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) +GPU_BLACKLIST_FEATURE_TEST(GpuRasterization, + "gpu_rasterization", + GPU_FEATURE_TYPE_GPU_RASTERIZATION) + +GPU_BLACKLIST_FEATURE_TEST(GpuRasterizationFieldTrial, + "gpu_rasterization_field_trial", + GPU_FEATURE_TYPE_GPU_RASTERIZATION_FIELD_TRIAL) } // namespace gpu diff --git a/chromium/gpu/config/gpu_control_list.cc b/chromium/gpu/config/gpu_control_list.cc index 9cc8680623a..dc5c75c11f4 100644 --- a/chromium/gpu/config/gpu_control_list.cc +++ b/chromium/gpu/config/gpu_control_list.cc @@ -19,7 +19,7 @@ namespace gpu { namespace { // Break a version string into segments. Return true if each segment is -// a valid number. +// a valid number, and not all segment is 0. bool ProcessVersionString(const std::string& version_string, char splitter, std::vector<std::string>* version) { @@ -36,12 +36,15 @@ bool ProcessVersionString(const std::string& version_string, } (*version)[0] = year; } + bool all_zero = true; for (size_t i = 0; i < version->size(); ++i) { unsigned num = 0; if (!base::StringToUint((*version)[i], &num)) return false; + if (num) + all_zero = false; } - return true; + return !all_zero; } // Compare two number strings using numerical ordering. @@ -86,30 +89,22 @@ int CompareLexicalNumberStrings( 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 kMultiGpuStyleStringAMDSwitchableDiscrete[] = + "amd_switchable_discrete"; +const char kMultiGpuStyleStringAMDSwitchableIntegrated[] = + "amd_switchable_integrated"; const char kMultiGpuStyleStringOptimus[] = "optimus"; const char kMultiGpuCategoryStringPrimary[] = "primary"; const char kMultiGpuCategoryStringSecondary[] = "secondary"; +const char kMultiGpuCategoryStringActive[] = "active"; const char kMultiGpuCategoryStringAny[] = "any"; +const char kGLTypeStringGL[] = "gl"; +const char kGLTypeStringGLES[] = "gles"; +const char kGLTypeStringANGLE[] = "angle"; + const char kVersionStyleStringNumerical[] = "numerical"; const char kVersionStyleStringLexical[] = "lexical"; @@ -225,13 +220,20 @@ GpuControlList::OsInfo::OsInfo(const std::string& os, GpuControlList::OsInfo::~OsInfo() {} -bool GpuControlList::OsInfo::Contains(OsType type, - const std::string& version) const { +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); + std::string processed_version; + size_t pos = version.find_first_not_of("0123456789."); + if (pos != std::string::npos) + processed_version = version.substr(0, pos); + else + processed_version = version; + + return version_info_->Contains(processed_version); } bool GpuControlList::OsInfo::IsValid() const { @@ -259,32 +261,6 @@ GpuControlList::OsType GpuControlList::OsInfo::StringToOsType( 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); @@ -414,6 +390,12 @@ bool GpuControlList::IntInfo::IsValid() const { return op_ != kUnknown; } +GpuControlList::BoolInfo::BoolInfo(bool value) : value_(value) {} + +bool GpuControlList::BoolInfo::Contains(bool value) const { + return value_ == value; +} + // static GpuControlList::ScopedGpuControlListEntry GpuControlList::GpuControlListEntry::GetEntryFromValue( @@ -510,7 +492,7 @@ GpuControlList::GpuControlListEntry::GetEntryFromValue( 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; + std::string device_id; if (!device_id_list->GetString(i, &device_id) || !entry->AddDeviceId(device_id)) { LOG(WARNING) << "Malformed device_id entry " << entry->id(); @@ -587,6 +569,31 @@ GpuControlList::GpuControlListEntry::GetEntryFromValue( dictionary_entry_count++; } + std::string gl_type; + if (value->GetString("gl_type", &gl_type)) { + if (!entry->SetGLType(gl_type)) { + LOG(WARNING) << "Malformed gl_type entry " << entry->id(); + return NULL; + } + dictionary_entry_count++; + } + + const base::DictionaryValue* gl_version_value = NULL; + if (value->GetDictionary("gl_version", &gl_version_value)) { + std::string version_op = "any"; + std::string version_string; + std::string version_string2; + gl_version_value->GetString(kOp, &version_op); + gl_version_value->GetString("value", &version_string); + gl_version_value->GetString("value2", &version_string2); + if (!entry->SetGLVersionInfo( + version_op, version_string, version_string2)) { + LOG(WARNING) << "Malformed gl_version 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; @@ -702,28 +709,31 @@ GpuControlList::GpuControlListEntry::GetEntryFromValue( 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); + const base::ListValue* machine_model_name_list; + if (value->GetList("machine_model_name", &machine_model_name_list)) { + for (size_t i = 0; i < machine_model_name_list->GetSize(); ++i) { + std::string model_name; + if (!machine_model_name_list->GetString(i, &model_name) || + !entry->AddMachineModelName(model_name)) { + LOG(WARNING) << "Malformed machine_model_name entry " << entry->id(); + return NULL; + } } + dictionary_entry_count++; + } + const base::DictionaryValue* machine_model_version_value = NULL; + if (value->GetDictionary( + "machine_model_version", &machine_model_version_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("value", &version_string); - version_value->GetString("value2", &version_string2); - } - if (!entry->SetMachineModelInfo( - name_op, name_value, version_op, version_string, version_string2)) { - LOG(WARNING) << "Malformed machine_model entry " << entry->id(); + machine_model_version_value->GetString(kOp, &version_op); + machine_model_version_value->GetString("value", &version_string); + machine_model_version_value->GetString("value2", &version_string2); + if (!entry->SetMachineModelVersionInfo( + version_op, version_string, version_string2)) { + LOG(WARNING) << "Malformed machine_model_version entry " << entry->id(); return NULL; } dictionary_entry_count++; @@ -744,6 +754,12 @@ GpuControlList::GpuControlListEntry::GetEntryFromValue( dictionary_entry_count++; } + bool direct_rendering; + if (value->GetBoolean("direct_rendering", &direct_rendering)) { + entry->SetDirectRenderingInfo(direct_rendering); + dictionary_entry_count++; + } + if (top_level) { const base::ListValue* feature_value = NULL; if (value->GetList("features", &feature_value)) { @@ -795,6 +811,12 @@ GpuControlList::GpuControlListEntry::GetEntryFromValue( LOG(WARNING) << "Entry with unknown fields " << entry->id(); return NULL; } + + // If GL_VERSION is specified, but no info about whether it's GL or GLES, + // we use the default for the platform. See GLType enum declaration. + if (entry->gl_version_info_.get() != NULL && entry->gl_type_ == kGLTypeNone) + entry->gl_type_ = GetDefaultGLType(); + return entry; } @@ -803,7 +825,8 @@ GpuControlList::GpuControlListEntry::GpuControlListEntry() disabled_(false), vendor_id_(0), multi_gpu_style_(kMultiGpuStyleNone), - multi_gpu_category_(kMultiGpuCategoryPrimary) { + multi_gpu_category_(kMultiGpuCategoryPrimary), + gl_type_(kGLTypeNone) { } GpuControlList::GpuControlListEntry::~GpuControlListEntry() { } @@ -832,13 +855,14 @@ bool GpuControlList::GpuControlListEntry::SetOsInfo( bool GpuControlList::GpuControlListEntry::SetVendorId( const std::string& vendor_id_string) { vendor_id_ = 0; - return base::HexStringToUInt(vendor_id_string, &vendor_id_); + return base::HexStringToUInt(vendor_id_string, &vendor_id_) && + vendor_id_ != 0; } bool GpuControlList::GpuControlListEntry::AddDeviceId( const std::string& device_id_string) { uint32 device_id = 0; - if (base::HexStringToUInt(device_id_string, &device_id)) { + if (base::HexStringToUInt(device_id_string, &device_id) && device_id != 0) { device_id_list_.push_back(device_id); return true; } @@ -864,6 +888,15 @@ bool GpuControlList::GpuControlListEntry::SetMultiGpuCategory( return true; } +bool GpuControlList::GpuControlListEntry::SetGLType( + const std::string& gl_type_string) { + GLType gl_type = StringToGLType(gl_type_string); + if (gl_type == kGLTypeNone) + return false; + gl_type_ = gl_type; + return true; +} + bool GpuControlList::GpuControlListEntry::SetDriverVendorInfo( const std::string& vendor_op, const std::string& vendor_value) { @@ -890,6 +923,15 @@ bool GpuControlList::GpuControlListEntry::SetDriverDateInfo( return driver_date_info_->IsValid(); } +bool GpuControlList::GpuControlListEntry::SetGLVersionInfo( + const std::string& version_op, + const std::string& version_string, + const std::string& version_string2) { + gl_version_info_.reset(new VersionInfo( + version_op, std::string(), version_string, version_string2)); + return gl_version_info_->IsValid(); +} + bool GpuControlList::GpuControlListEntry::SetGLVendorInfo( const std::string& vendor_op, const std::string& vendor_value) { @@ -951,15 +993,21 @@ bool GpuControlList::GpuControlListEntry::SetPerfOverallInfo( return perf_overall_info_->IsValid(); } -bool GpuControlList::GpuControlListEntry::SetMachineModelInfo( - const std::string& name_op, - const std::string& name_value, +bool GpuControlList::GpuControlListEntry::AddMachineModelName( + const std::string& model_name) { + if (model_name.empty()) + return false; + machine_model_name_list_.push_back(model_name); + return true; +} + +bool GpuControlList::GpuControlListEntry::SetMachineModelVersionInfo( 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(); + machine_model_version_info_.reset(new VersionInfo( + version_op, std::string(), version_string, version_string2)); + return machine_model_version_info_->IsValid(); } bool GpuControlList::GpuControlListEntry::SetGpuCountInfo( @@ -970,6 +1018,10 @@ bool GpuControlList::GpuControlListEntry::SetGpuCountInfo( return gpu_count_info_->IsValid(); } +void GpuControlList::GpuControlListEntry::SetDirectRenderingInfo(bool value) { + direct_rendering_info_.reset(new BoolInfo(value)); +} + bool GpuControlList::GpuControlListEntry::SetFeatures( const std::vector<std::string>& feature_strings, const FeatureMap& feature_map, @@ -1000,6 +1052,38 @@ void GpuControlList::GpuControlListEntry::AddException( exceptions_.push_back(exception); } +bool GpuControlList::GpuControlListEntry::GLVersionInfoMismatch( + const std::string& gl_version) const { + if (gl_version.empty()) + return false; + + if (gl_version_info_.get() == NULL && gl_type_ == kGLTypeNone) + return false; + + std::vector<std::string> segments; + base::SplitString(gl_version, ' ', &segments); + std::string number; + GLType gl_type = kGLTypeNone; + if (segments.size() > 2 && + segments[0] == "OpenGL" && segments[1] == "ES") { + number = segments[2]; + gl_type = kGLTypeGLES; + if (segments.size() > 3 && + StartsWithASCII(segments[3], "(ANGLE", false)) { + gl_type = kGLTypeANGLE; + } + } else { + number = segments[0]; + gl_type = kGLTypeGL; + } + + if (gl_type_ != kGLTypeNone && gl_type_ != gl_type) + return true; + if (gl_version_info_.get() != NULL && !gl_version_info_->Contains(number)) + return true; + return false; +} + // static GpuControlList::GpuControlListEntry::MultiGpuStyle GpuControlList::GpuControlListEntry::StringToMultiGpuStyle( @@ -1008,6 +1092,10 @@ GpuControlList::GpuControlListEntry::StringToMultiGpuStyle( return kMultiGpuStyleOptimus; if (style == kMultiGpuStyleStringAMDSwitchable) return kMultiGpuStyleAMDSwitchable; + if (style == kMultiGpuStyleStringAMDSwitchableIntegrated) + return kMultiGpuStyleAMDSwitchableIntegrated; + if (style == kMultiGpuStyleStringAMDSwitchableDiscrete) + return kMultiGpuStyleAMDSwitchableDiscrete; return kMultiGpuStyleNone; } @@ -1019,11 +1107,44 @@ GpuControlList::GpuControlListEntry::StringToMultiGpuCategory( return kMultiGpuCategoryPrimary; if (category == kMultiGpuCategoryStringSecondary) return kMultiGpuCategorySecondary; + if (category == kMultiGpuCategoryStringActive) + return kMultiGpuCategoryActive; if (category == kMultiGpuCategoryStringAny) return kMultiGpuCategoryAny; return kMultiGpuCategoryNone; } +// static +GpuControlList::GpuControlListEntry::GLType +GpuControlList::GpuControlListEntry::StringToGLType( + const std::string& gl_type) { + if (gl_type == kGLTypeStringGL) + return kGLTypeGL; + if (gl_type == kGLTypeStringGLES) + return kGLTypeGLES; + if (gl_type == kGLTypeStringANGLE) + return kGLTypeANGLE; + return kGLTypeNone; +} + +// static +GpuControlList::GpuControlListEntry::GLType +GpuControlList::GpuControlListEntry::GetDefaultGLType() { +#if defined(OS_CHROMEOS) + return kGLTypeGL; +#elif defined(OS_LINUX) || defined(OS_OPENBSD) + return kGLTypeGL; +#elif defined(OS_MACOSX) + return kGLTypeGL; +#elif defined(OS_WIN) + return kGLTypeANGLE; +#elif defined(OS_ANDROID) + return kGLTypeGLES; +#else + return kGLTypeNone; +#endif +} + void GpuControlList::GpuControlListEntry::LogControlListMatch( const std::string& control_list_logging_name) const { static const char kControlListMatchMessage[] = @@ -1038,37 +1159,79 @@ bool GpuControlList::GpuControlListEntry::Contains( 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]); + if (vendor_id_ != 0) { + std::vector<GPUInfo::GPUDevice> candidates; + switch (multi_gpu_category_) { + case kMultiGpuCategoryPrimary: + candidates.push_back(gpu_info.gpu); + break; + case kMultiGpuCategorySecondary: + candidates = gpu_info.secondary_gpus; + break; + case kMultiGpuCategoryAny: + candidates = gpu_info.secondary_gpus; + candidates.push_back(gpu_info.gpu); + break; + case kMultiGpuCategoryActive: + if (gpu_info.gpu.active) + candidates.push_back(gpu_info.gpu); + for (size_t ii = 0; ii < gpu_info.secondary_gpus.size(); ++ii) { + if (gpu_info.secondary_gpus[ii].active) + candidates.push_back(gpu_info.secondary_gpus[ii]); + } + default: + break; + } + + GPUInfo::GPUDevice gpu; + gpu.vendor_id = vendor_id_; + bool found = false; + if (device_id_list_.empty()) { + for (size_t ii = 0; ii < candidates.size(); ++ii) { + if (gpu.vendor_id == candidates[ii].vendor_id) { + found = true; + break; + } + } + } else { + for (size_t ii = 0; ii < device_id_list_.size(); ++ii) { + gpu.device_id = device_id_list_[ii]; + for (size_t jj = 0; jj < candidates.size(); ++jj) { + if (gpu.vendor_id == candidates[jj].vendor_id && + gpu.device_id == candidates[jj].device_id) { + found = true; + break; + } + } + } + } + if (!found) + return false; } - switch (multi_gpu_category_) { - case kMultiGpuCategoryPrimary: - if (is_not_primary_gpu) + switch (multi_gpu_style_) { + case kMultiGpuStyleOptimus: + if (!gpu_info.optimus) return false; break; - case kMultiGpuCategorySecondary: - if (is_not_secondary_gpu) + case kMultiGpuStyleAMDSwitchable: + if (!gpu_info.amd_switchable) return false; break; - case kMultiGpuCategoryAny: - if (is_not_primary_gpu && is_not_secondary_gpu) + case kMultiGpuStyleAMDSwitchableDiscrete: + if (!gpu_info.amd_switchable) return false; - break; - case kMultiGpuCategoryNone: - break; - } - switch (multi_gpu_style_) { - case kMultiGpuStyleOptimus: - if (!gpu_info.optimus) + // The discrete GPU is always the primary GPU. + // This is guaranteed by GpuInfoCollector. + if (!gpu_info.gpu.active) return false; break; - case kMultiGpuStyleAMDSwitchable: + case kMultiGpuStyleAMDSwitchableIntegrated: if (!gpu_info.amd_switchable) return false; + // Assume the integrated GPU is the first in the secondary GPU list. + if (gpu_info.secondary_gpus.size() == 0 || + !gpu_info.secondary_gpus[0].active) + return false; break; case kMultiGpuStyleNone: break; @@ -1084,6 +1247,8 @@ bool GpuControlList::GpuControlListEntry::Contains( if (!driver_date_info_->Contains(gpu_info.driver_date, '-')) return false; } + if (GLVersionInfoMismatch(gpu_info.gl_version)) + return false; if (gl_vendor_info_.get() != NULL && !gpu_info.gl_vendor.empty() && !gl_vendor_info_->Contains(gpu_info.gl_vendor)) return false; @@ -1109,16 +1274,29 @@ bool GpuControlList::GpuControlListEntry::Contains( (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])) + if (!machine_model_name_list_.empty()) { + if (gpu_info.machine_model_name.empty()) + return false; + bool found_match = false; + for (size_t ii = 0; ii < machine_model_name_list_.size(); ++ii) { + if (machine_model_name_list_[ii] == gpu_info.machine_model_name) { + found_match = true; + break; + } + } + if (!found_match) return false; } + if (machine_model_version_info_.get() != NULL && + (gpu_info.machine_model_version.empty() || + !machine_model_version_info_->Contains(gpu_info.machine_model_version))) + return false; if (gpu_count_info_.get() != NULL && !gpu_count_info_->Contains(gpu_info.secondary_gpus.size() + 1)) return false; + if (direct_rendering_info_.get() != NULL && + !direct_rendering_info_->Contains(gpu_info.direct_rendering)) + return false; if (cpu_brand_.get() != NULL) { base::CPU cpu_info; if (!cpu_brand_->Contains(cpu_info.cpu_brand())) @@ -1172,6 +1350,22 @@ const std::set<int>& GpuControlList::GpuControlListEntry::features() const { return features_; } +void GpuControlList::GpuControlListEntry::GetFeatureNames( + base::ListValue* feature_names, + const FeatureMap& feature_map, + bool supports_feature_type_all) const { + DCHECK(feature_names); + if (supports_feature_type_all && features_.size() == feature_map.size()) { + feature_names->AppendString("all"); + return; + } + for (FeatureMap::const_iterator iter = feature_map.begin(); + iter != feature_map.end(); ++iter) { + if (features_.count(iter->second) > 0) + feature_names->AppendString(iter->first); + } +} + // static bool GpuControlList::GpuControlListEntry::StringToFeature( const std::string& feature_name, int* feature_id, @@ -1261,15 +1455,8 @@ std::set<int> GpuControlList::MakeDecision( if (os == kOsAny) os = GetOsType(); - if (os_version.empty()) { + 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)) { @@ -1300,7 +1487,8 @@ void GpuControlList::GetDecisionEntries( } } -void GpuControlList::GetReasons(base::ListValue* problem_list) const { +void GpuControlList::GetReasons(base::ListValue* problem_list, + const std::string& tag) const { DCHECK(problem_list); for (size_t i = 0; i < active_entries_.size(); ++i) { GpuControlListEntry* entry = active_entries_[i].get(); @@ -1321,6 +1509,13 @@ void GpuControlList::GetReasons(base::ListValue* problem_list) const { } problem->Set("webkitBugs", webkit_bugs); + base::ListValue* features = new base::ListValue(); + entry->GetFeatureNames(features, feature_map_, supports_feature_type_all_); + problem->Set("affectedGpuSettings", features); + + DCHECK(tag == "workarounds" || tag == "disabledFeatures"); + problem->SetString("tag", tag); + problem_list->Append(problem); } } diff --git a/chromium/gpu/config/gpu_control_list.h b/chromium/gpu/config/gpu_control_list.h index ce740852b0f..b2daa47eb38 100644 --- a/chromium/gpu/config/gpu_control_list.h +++ b/chromium/gpu/config/gpu_control_list.h @@ -70,7 +70,8 @@ class GPU_EXPORT GpuControlList { // "crBugs": [1234], // "webkitBugs": [] // } - void GetReasons(base::ListValue* problem_list) const; + void GetReasons( + base::ListValue* problem_list, const std::string& tag) const; // Return the largest entry id. This is used for histogramming. uint32 max_entry_id() const; @@ -253,24 +254,15 @@ class GPU_EXPORT GpuControlList { int value2_; }; - class GPU_EXPORT MachineModelInfo { + class GPU_EXPORT BoolInfo { 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(); + explicit BoolInfo(bool value); - // 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; + // Determines if a given bool is included in the BoolInfo. + bool Contains(bool value) const; private: - scoped_ptr<StringInfo> name_info_; - scoped_ptr<VersionInfo> version_info_; + bool value_; }; class GpuControlListEntry; @@ -321,22 +313,41 @@ class GPU_EXPORT GpuControlList { // Returns the blacklisted features in this entry. const std::set<int>& features() const; + // Returns a list of blacklisted feature names in this entry. + void GetFeatureNames(base::ListValue* feature_names, + const FeatureMap& feature_map, + bool supports_feature_type_all) const; + private: friend class base::RefCounted<GpuControlListEntry>; enum MultiGpuStyle { kMultiGpuStyleOptimus, kMultiGpuStyleAMDSwitchable, + kMultiGpuStyleAMDSwitchableIntegrated, + kMultiGpuStyleAMDSwitchableDiscrete, kMultiGpuStyleNone }; enum MultiGpuCategory { + // This entry applies if this is the primary GPU on the system. kMultiGpuCategoryPrimary, + // This entry applies if this is a secondary GPU on the system. kMultiGpuCategorySecondary, + // This entry applies if this is the active GPU on the system. + kMultiGpuCategoryActive, + // This entry applies if this is any of the GPUs on the system. kMultiGpuCategoryAny, kMultiGpuCategoryNone }; + enum GLType { + kGLTypeGL, // This is default on MacOSX, Linux, ChromeOS + kGLTypeGLES, // This is default on Android + kGLTypeANGLE, // This is default on Windows + kGLTypeNone + }; + GpuControlListEntry(); ~GpuControlListEntry(); @@ -357,6 +368,8 @@ class GPU_EXPORT GpuControlList { bool SetMultiGpuCategory(const std::string& multi_gpu_category_string); + bool SetGLType(const std::string& gl_type_string); + bool SetDriverVendorInfo(const std::string& vendor_op, const std::string& vendor_value); @@ -369,6 +382,10 @@ class GPU_EXPORT GpuControlList { const std::string& date_string, const std::string& date_string2); + bool SetGLVersionInfo(const std::string& version_op, + const std::string& version_string, + const std::string& version_string2); + bool SetGLVendorInfo(const std::string& vendor_op, const std::string& vendor_value); @@ -397,33 +414,45 @@ class GPU_EXPORT GpuControlList { 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 AddMachineModelName(const std::string& model_name); + + bool SetMachineModelVersionInfo(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); + void SetDirectRenderingInfo(bool value); + bool SetFeatures(const std::vector<std::string>& features, const FeatureMap& feature_map, bool supports_feature_type_all); void AddException(ScopedGpuControlListEntry exception); + // Return true if GL_VERSION string does not fit the entry info + // on GL type and GL version. + bool GLVersionInfoMismatch(const std::string& gl_version) const; + static MultiGpuStyle StringToMultiGpuStyle(const std::string& style); static MultiGpuCategory StringToMultiGpuCategory( const std::string& category); + static GLType StringToGLType(const std::string& gl_type); + // 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); + // Return the default GL type, depending on the OS. + // See GLType declaration. + static GLType GetDefaultGLType(); + uint32 id_; bool disabled_; std::string description_; @@ -434,9 +463,11 @@ class GPU_EXPORT GpuControlList { std::vector<uint32> device_id_list_; MultiGpuStyle multi_gpu_style_; MultiGpuCategory multi_gpu_category_; + GLType gl_type_; scoped_ptr<StringInfo> driver_vendor_info_; scoped_ptr<VersionInfo> driver_version_info_; scoped_ptr<VersionInfo> driver_date_info_; + scoped_ptr<VersionInfo> gl_version_info_; scoped_ptr<StringInfo> gl_vendor_info_; scoped_ptr<StringInfo> gl_renderer_info_; scoped_ptr<StringInfo> gl_extensions_info_; @@ -445,8 +476,10 @@ class GPU_EXPORT GpuControlList { scoped_ptr<FloatInfo> perf_graphics_info_; scoped_ptr<FloatInfo> perf_gaming_info_; scoped_ptr<FloatInfo> perf_overall_info_; - scoped_ptr<MachineModelInfo> machine_model_info_; + std::vector<std::string> machine_model_name_list_; + scoped_ptr<VersionInfo> machine_model_version_info_; scoped_ptr<IntInfo> gpu_count_info_; + scoped_ptr<BoolInfo> direct_rendering_info_; std::set<int> features_; std::vector<ScopedGpuControlListEntry> exceptions_; }; diff --git a/chromium/gpu/config/gpu_control_list_entry_unittest.cc b/chromium/gpu/config/gpu_control_list_entry_unittest.cc index 63cf48eb34c..6ae866b7747 100644 --- a/chromium/gpu/config/gpu_control_list_entry_unittest.cc +++ b/chromium/gpu/config/gpu_control_list_entry_unittest.cc @@ -32,7 +32,7 @@ class GpuControlListEntryTest : public testing::Test { const std::string& json, bool supports_feature_type_all) { scoped_ptr<base::Value> root; root.reset(base::JSONReader::Read(json)); - DictionaryValue* value = NULL; + base::DictionaryValue* value = NULL; if (root.get() == NULL || !root->GetAsDictionary(&value)) return NULL; @@ -52,10 +52,11 @@ class GpuControlListEntryTest : public testing::Test { virtual void SetUp() { gpu_info_.gpu.vendor_id = 0x10de; gpu_info_.gpu.device_id = 0x0640; + gpu_info_.gpu.active = true; 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_version = "2.1 NVIDIA-8.24.11 310.90.9b01"; gpu_info_.gl_vendor = "NVIDIA Corporation"; gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; gpu_info_.performance_stats.graphics = 5.0; @@ -63,7 +64,7 @@ class GpuControlListEntryTest : public testing::Test { gpu_info_.performance_stats.overall = 5.0; } - private: + protected: GPUInfo gpu_info_; }; @@ -376,6 +377,99 @@ TEST_F(GpuControlListEntryTest, UnknownFeatureEntry) { EXPECT_TRUE(entry.get() == NULL); } +TEST_F(GpuControlListEntryTest, GlVersionGLESEntry) { + const std::string json = LONG_STRING_CONST( + { + "id": 1, + "gl_type": "gles", + "gl_version": { + "op": "=", + "value": "3.0" + }, + "features": [ + "test_feature_0" + ] + } + ); + ScopedEntry entry(GetEntryFromString(json)); + EXPECT_TRUE(entry.get() != NULL); + + GPUInfo gpu_info; + gpu_info.gl_version = "OpenGL ES 3.0 V@66.0 AU@ (CL@)"; + EXPECT_TRUE(entry->Contains(GpuControlList::kOsAndroid, "4.4.2", gpu_info)); + + gpu_info.gl_version = "OpenGL ES 3.1 V@66.0 AU@ (CL@)"; + EXPECT_FALSE(entry->Contains(GpuControlList::kOsAndroid, "4.4.2", gpu_info)); + + gpu_info.gl_version = "3.0 NVIDIA-8.24.11 310.90.9b01"; + EXPECT_FALSE(entry->Contains(GpuControlList::kOsMacosx, "10.9", gpu_info)); + + gpu_info.gl_version = "OpenGL ES 3.0 (ANGLE 1.2.0.2450)"; + EXPECT_FALSE(entry->Contains(GpuControlList::kOsWin, "6.1", gpu_info)); +} + +TEST_F(GpuControlListEntryTest, GlVersionANGLEEntry) { + const std::string json = LONG_STRING_CONST( + { + "id": 1, + "gl_type": "angle", + "gl_version": { + "op": ">", + "value": "2.0" + }, + "features": [ + "test_feature_0" + ] + } + ); + ScopedEntry entry(GetEntryFromString(json)); + EXPECT_TRUE(entry.get() != NULL); + + GPUInfo gpu_info; + gpu_info.gl_version = "OpenGL ES 3.0 V@66.0 AU@ (CL@)"; + EXPECT_FALSE(entry->Contains(GpuControlList::kOsAndroid, "4.4.2", gpu_info)); + + gpu_info.gl_version = "3.0 NVIDIA-8.24.11 310.90.9b01"; + EXPECT_FALSE(entry->Contains(GpuControlList::kOsMacosx, "10.9", gpu_info)); + + gpu_info.gl_version = "OpenGL ES 3.0 (ANGLE 1.2.0.2450)"; + EXPECT_TRUE(entry->Contains(GpuControlList::kOsWin, "6.1", gpu_info)); + + gpu_info.gl_version = "OpenGL ES 2.0 (ANGLE 1.2.0.2450)"; + EXPECT_FALSE(entry->Contains(GpuControlList::kOsWin, "6.1", gpu_info)); +} + +TEST_F(GpuControlListEntryTest, GlVersionGLEntry) { + const std::string json = LONG_STRING_CONST( + { + "id": 1, + "gl_type": "gl", + "gl_version": { + "op": "<", + "value": "4.0" + }, + "features": [ + "test_feature_0" + ] + } + ); + ScopedEntry entry(GetEntryFromString(json)); + EXPECT_TRUE(entry.get() != NULL); + + GPUInfo gpu_info; + gpu_info.gl_version = "OpenGL ES 3.0 V@66.0 AU@ (CL@)"; + EXPECT_FALSE(entry->Contains(GpuControlList::kOsAndroid, "4.4.2", gpu_info)); + + gpu_info.gl_version = "3.0 NVIDIA-8.24.11 310.90.9b01"; + EXPECT_TRUE(entry->Contains(GpuControlList::kOsMacosx, "10.9", gpu_info)); + + gpu_info.gl_version = "4.0 NVIDIA-8.24.11 310.90.9b01"; + EXPECT_FALSE(entry->Contains(GpuControlList::kOsMacosx, "10.9", gpu_info)); + + gpu_info.gl_version = "OpenGL ES 3.0 (ANGLE 1.2.0.2450)"; + EXPECT_FALSE(entry->Contains(GpuControlList::kOsWin, "6.1", gpu_info)); +} + TEST_F(GpuControlListEntryTest, GlVendorEntry) { const std::string json = LONG_STRING_CONST( { @@ -584,49 +678,116 @@ TEST_F(GpuControlListEntryTest, LexicalDriverVersionEntry) { GpuControlList::kOsLinux, "10.6", gpu_info)); } -TEST_F(GpuControlListEntryTest, MultipleGPUsAnyEntry) { +TEST_F(GpuControlListEntryTest, NeedsMoreInfoEntry) { const std::string json = LONG_STRING_CONST( { "id": 1, - "os": { - "type": "macosx" + "vendor_id": "0x8086", + "driver_version": { + "op": "<", + "value": "10.7" }, + "features": [ + "test_feature_1" + ] + } + ); + ScopedEntry entry(GetEntryFromString(json)); + EXPECT_TRUE(entry.get() != 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", - "device_id": ["0x0166"], - "multi_gpu_category": "any", + "exceptions": [ + { + "gl_renderer": { + "op": "contains", + "value": "mesa" + } + } + ], "features": [ - "test_feature_0" + "test_feature_1" ] } ); ScopedEntry entry(GetEntryFromString(json)); EXPECT_TRUE(entry.get() != 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)); + gpu_info.gpu.vendor_id = 0x8086; + EXPECT_TRUE(entry->NeedsMoreInfo(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)); + 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.get() != 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)); } -TEST_F(GpuControlListEntryTest, MultipleGPUsSecondaryEntry) { +TEST_F(GpuControlListEntryTest, InvalidVendorIdEntry) { + const std::string json = LONG_STRING_CONST( + { + "id": 1, + "vendor_id": "0x0000", + "features": [ + "test_feature_1" + ] + } + ); + ScopedEntry entry(GetEntryFromString(json)); + EXPECT_TRUE(entry.get() == NULL); +} + +TEST_F(GpuControlListEntryTest, InvalidDeviceIdEntry) { + const std::string json = LONG_STRING_CONST( + { + "id": 1, + "vendor_id": "0x10de", + "device_id": ["0x1023", "0x0000"], + "features": [ + "test_feature_1" + ] + } + ); + ScopedEntry entry(GetEntryFromString(json)); + EXPECT_TRUE(entry.get() == NULL); +} + +TEST_F(GpuControlListEntryTest, SingleActiveGPU) { const std::string json = LONG_STRING_CONST( { "id": 1, "os": { "type": "macosx" }, - "vendor_id": "0x8086", - "device_id": ["0x0166"], - "multi_gpu_category": "secondary", + "vendor_id": "0x10de", + "device_id": ["0x0640"], + "multi_gpu_category": "active", "features": [ "test_feature_0" ] @@ -635,90 +796,363 @@ TEST_F(GpuControlListEntryTest, MultipleGPUsSecondaryEntry) { ScopedEntry entry(GetEntryFromString(json)); EXPECT_TRUE(entry.get() != NULL); EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType()); + EXPECT_TRUE(entry->Contains( + GpuControlList::kOsMacosx, "10.6", gpu_info())); +} +TEST_F(GpuControlListEntryTest, MachineModelName) { + const std::string json = LONG_STRING_CONST( + { + "id": 1, + "os": { + "type": "android" + }, + "machine_model_name": ["Nexus 4", "XT1032"], + "features": [ + "test_feature_0" + ] + } + ); + ScopedEntry entry(GetEntryFromString(json)); + EXPECT_TRUE(entry.get() != NULL); + EXPECT_EQ(GpuControlList::kOsAndroid, entry->GetOsType()); GPUInfo gpu_info; - gpu_info.gpu.vendor_id = 0x10de; - gpu_info.gpu.device_id = 0x1976; + + gpu_info.machine_model_name = "Nexus 4"; + EXPECT_TRUE(entry->Contains( + GpuControlList::kOsAndroid, "4.1", gpu_info)); + + gpu_info.machine_model_name = "XT1032"; + EXPECT_TRUE(entry->Contains( + GpuControlList::kOsAndroid, "4.1", gpu_info)); + + gpu_info.machine_model_name = "XT1032i"; EXPECT_FALSE(entry->Contains( - GpuControlList::kOsMacosx, "10.6", gpu_info)); + GpuControlList::kOsAndroid, "4.1", gpu_info)); + + gpu_info.machine_model_name = "Nexus 5"; + EXPECT_FALSE(entry->Contains( + GpuControlList::kOsAndroid, "4.1", gpu_info)); + + gpu_info.machine_model_name = "Nexus"; + EXPECT_FALSE(entry->Contains( + GpuControlList::kOsAndroid, "4.1", gpu_info)); + + gpu_info.machine_model_name = ""; + EXPECT_FALSE(entry->Contains( + GpuControlList::kOsAndroid, "4.1", gpu_info)); +} + +TEST_F(GpuControlListEntryTest, MachineModelNameException) { + const std::string json = LONG_STRING_CONST( + { + "id": 1, + "exceptions": [ + { + "os": { + "type": "android" + }, + "machine_model_name": ["Nexus 4"] + } + ], + "features": [ + "test_feature_0" + ] + } + ); + ScopedEntry entry(GetEntryFromString(json)); + EXPECT_TRUE(entry.get() != NULL); + EXPECT_EQ(GpuControlList::kOsAny, entry->GetOsType()); + GPUInfo gpu_info; - GPUInfo::GPUDevice gpu_device; - gpu_device.vendor_id = 0x8086; - gpu_device.device_id = 0x0166; - gpu_info.secondary_gpus.push_back(gpu_device); + gpu_info.machine_model_name = "Nexus 4"; + EXPECT_FALSE(entry->Contains( + GpuControlList::kOsAndroid, "4.1", gpu_info)); EXPECT_TRUE(entry->Contains( - GpuControlList::kOsMacosx, "10.6", gpu_info)); + GpuControlList::kOsLinux, "4.1", gpu_info)); + + gpu_info.machine_model_name = ""; + EXPECT_TRUE(entry->Contains( + GpuControlList::kOsAndroid, "4.1", gpu_info)); + EXPECT_TRUE(entry->Contains( + GpuControlList::kOsLinux, "4.1", gpu_info)); } -TEST_F(GpuControlListEntryTest, NeedsMoreInfoEntry) { +TEST_F(GpuControlListEntryTest, MachineModelVersion) { const std::string json = LONG_STRING_CONST( { "id": 1, - "vendor_id": "0x8086", - "driver_version": { - "op": "<", - "value": "10.7" + "os": { + "type": "macosx" + }, + "machine_model_name": ["MacBookPro"], + "machine_model_version": { + "op": "=", + "value": "7.1" }, "features": [ - "test_feature_1" + "test_feature_0" ] } ); ScopedEntry entry(GetEntryFromString(json)); EXPECT_TRUE(entry.get() != 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)); + gpu_info.machine_model_name = "MacBookPro"; + gpu_info.machine_model_version = "7.1"; + EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType()); + EXPECT_TRUE(entry->Contains( + GpuControlList::kOsMacosx, "10.6", gpu_info)); } -TEST_F(GpuControlListEntryTest, NeedsMoreInfoForExceptionsEntry) { +TEST_F(GpuControlListEntryTest, MachineModelVersionException) { const std::string json = LONG_STRING_CONST( { "id": 1, - "vendor_id": "0x8086", + "os": { + "type": "macosx" + }, + "machine_model_name": ["MacBookPro"], "exceptions": [ { - "gl_renderer": { - "op": "contains", - "value": "mesa" + "machine_model_version": { + "op": ">", + "value": "7.1" } } ], "features": [ - "test_feature_1" + "test_feature_0" ] } ); ScopedEntry entry(GetEntryFromString(json)); EXPECT_TRUE(entry.get() != NULL); + EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType()); GPUInfo gpu_info; - gpu_info.gpu.vendor_id = 0x8086; - EXPECT_TRUE(entry->NeedsMoreInfo(gpu_info)); + gpu_info.machine_model_name = "MacBookPro"; + gpu_info.machine_model_version = "7.0"; + EXPECT_TRUE(entry->Contains( + GpuControlList::kOsMacosx, "10.6", gpu_info)); - gpu_info.gl_renderer = "mesa"; - EXPECT_FALSE(entry->NeedsMoreInfo(gpu_info)); + gpu_info.machine_model_version = "7.2"; + EXPECT_FALSE(entry->Contains( + GpuControlList::kOsMacosx, "10.6", gpu_info)); + + gpu_info.machine_model_version = ""; + EXPECT_TRUE(entry->Contains( + GpuControlList::kOsMacosx, "10.6", gpu_info)); } -TEST_F(GpuControlListEntryTest, FeatureTypeAllEntry) { +class GpuControlListEntryDualGPUTest : public GpuControlListEntryTest { + public: + GpuControlListEntryDualGPUTest() { } + virtual ~GpuControlListEntryDualGPUTest() { } + + virtual void SetUp() OVERRIDE { + // Set up a NVIDIA/Intel dual, with NVIDIA as primary and Intel as + // secondary, and initially Intel is active. + gpu_info_.gpu.vendor_id = 0x10de; + gpu_info_.gpu.device_id = 0x0640; + gpu_info_.gpu.active = false; + GPUInfo::GPUDevice second_gpu; + second_gpu.vendor_id = 0x8086; + second_gpu.device_id = 0x0166; + second_gpu.active = true; + gpu_info_.secondary_gpus.push_back(second_gpu); + } + + void ActivatePrimaryGPU() { + gpu_info_.gpu.active = true; + gpu_info_.secondary_gpus[0].active = false; + } + + void EntryShouldApply(const std::string& entry_json) const { + EXPECT_TRUE(EntryApplies(entry_json)); + } + + void EntryShouldNotApply(const std::string& entry_json) const { + EXPECT_FALSE(EntryApplies(entry_json)); + } + + private: + bool EntryApplies(const std::string& entry_json) const { + ScopedEntry entry(GetEntryFromString(entry_json)); + EXPECT_TRUE(entry.get()); + EXPECT_EQ(GpuControlList::kOsMacosx, entry->GetOsType()); + return entry->Contains(GpuControlList::kOsMacosx, "10.6", gpu_info()); + } +}; + +TEST_F(GpuControlListEntryDualGPUTest, CategoryAny) { + const std::string json_intel = LONG_STRING_CONST( + { + "id": 1, + "os": { + "type": "macosx" + }, + "vendor_id": "0x8086", + "device_id": ["0x0166"], + "multi_gpu_category": "any", + "features": [ + "test_feature_0" + ] + } + ); + EntryShouldApply(json_intel); + + const std::string json_nvidia = LONG_STRING_CONST( + { + "id": 1, + "os": { + "type": "macosx" + }, + "vendor_id": "0x10de", + "device_id": ["0x0640"], + "multi_gpu_category": "any", + "features": [ + "test_feature_0" + ] + } + ); + EntryShouldApply(json_nvidia); +} + +TEST_F(GpuControlListEntryDualGPUTest, CategoryPrimarySecondary) { + const std::string json_secondary = LONG_STRING_CONST( + { + "id": 1, + "os": { + "type": "macosx" + }, + "vendor_id": "0x8086", + "device_id": ["0x0166"], + "multi_gpu_category": "secondary", + "features": [ + "test_feature_0" + ] + } + ); + EntryShouldApply(json_secondary); + + const std::string json_primary = LONG_STRING_CONST( + { + "id": 1, + "os": { + "type": "macosx" + }, + "vendor_id": "0x8086", + "device_id": ["0x0166"], + "multi_gpu_category": "primary", + "features": [ + "test_feature_0" + ] + } + ); + EntryShouldNotApply(json_primary); + + const std::string json_default = LONG_STRING_CONST( + { + "id": 1, + "os": { + "type": "macosx" + }, + "vendor_id": "0x8086", + "device_id": ["0x0166"], + "features": [ + "test_feature_0" + ] + } + ); + // Default is primary. + EntryShouldNotApply(json_default); +} + +TEST_F(GpuControlListEntryDualGPUTest, ActiveSecondaryGPU) { const std::string json = LONG_STRING_CONST( { "id": 1, + "os": { + "type": "macosx" + }, + "vendor_id": "0x8086", + "device_id": ["0x0166", "0x0168"], + "multi_gpu_category": "active", "features": [ - "all" + "test_feature_0" ] } ); - ScopedEntry entry(GetEntryFromString(json, true)); - EXPECT_TRUE(entry.get() != 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)); + // By default, secondary GPU is active. + EntryShouldApply(json); + + ActivatePrimaryGPU(); + EntryShouldNotApply(json); +} + +TEST_F(GpuControlListEntryDualGPUTest, VendorOnlyActiveSecondaryGPU) { + const std::string json = LONG_STRING_CONST( + { + "id": 1, + "os": { + "type": "macosx" + }, + "vendor_id": "0x8086", + "multi_gpu_category": "active", + "features": [ + "test_feature_0" + ] + } + ); + // By default, secondary GPU is active. + EntryShouldApply(json); + + ActivatePrimaryGPU(); + EntryShouldNotApply(json); +} + +TEST_F(GpuControlListEntryDualGPUTest, ActivePrimaryGPU) { + const std::string json = LONG_STRING_CONST( + { + "id": 1, + "os": { + "type": "macosx" + }, + "vendor_id": "0x10de", + "device_id": ["0x0640"], + "multi_gpu_category": "active", + "features": [ + "test_feature_0" + ] + } + ); + // By default, secondary GPU is active. + EntryShouldNotApply(json); + + ActivatePrimaryGPU(); + EntryShouldApply(json); +} + +TEST_F(GpuControlListEntryDualGPUTest, VendorOnlyActivePrimaryGPU) { + const std::string json = LONG_STRING_CONST( + { + "id": 1, + "os": { + "type": "macosx" + }, + "vendor_id": "0x10de", + "multi_gpu_category": "active", + "features": [ + "test_feature_0" + ] + } + ); + // By default, secondary GPU is active. + EntryShouldNotApply(json); + + ActivatePrimaryGPU(); + EntryShouldApply(json); } } // namespace gpu diff --git a/chromium/gpu/config/gpu_control_list_format.txt b/chromium/gpu/config/gpu_control_list_format.txt index e9522c34504..71c569c8397 100644 --- a/chromium/gpu/config/gpu_control_list_format.txt +++ b/chromium/gpu/config/gpu_control_list_format.txt @@ -23,33 +23,46 @@ // "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". +// 5. "multi_gpu_style" is a string, valid values include: +// a) "optimus": NVIDIA dual GPU +// b) "amd_switchable": AMD dual GPU +// c) "amd_switchable_integrated": AMD dual GPU, integrated GPU is active +// d) "amd_switchable_discrete": AMD dual GPU, discrete GPU is active +// c) and d) are only valid on Win, as on Mac we can switch GPU on the fly. // 6. "multi_gpu_category" is a string, valid values include "any", "primary", -// and "secondary". If unspecified, the default value is "primary". +// "secondary", and "active". If unspecified, the default value is "primary". +// See gpu_control_list.h for more details on the meanings of the strings. // 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 control list options, which can be +// 10. "gl_type" is a string, valid values include "gl", "gles", and "angle". +// If "gl_version" is specified and "gl_type" is not, use the default value. +// The default value on Android is "gles", on Windows is "angle", on other +// platforms is "gl". +// 11. "gl_version" is a VERSION structure (defined below). +// 12. "gl_vendor" is a STRING structure (defined below). +// 13. "gl_renderer" is a STRING structure (defined below). +// 14. "gl_extensions" is a STRING structure (defined below). +// 15. "perf_graphics" is a FLOAT structure (defined below). +// 16. "perf_gaming" is a FLOAT structure (defined below). +// 17. "perf_overall" is a FLOAT structure (defined below). +// 18. "machine_model_name" is an array of strings. The strings can contain +// any characters. +// 19. "machine_model_version" is a VERSION structure (defined below). +// 20. "gpu_count" is a INT structure (defined below). +// 21 "cpu_info" is a STRING structure (defined below). +// 22. "exceptions" is a list of entries. +// 23. "features" is a list of gpu control list options, which can be // configured by a specific list. See its *_json.cc file for a list of // supported features. 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. "disabled" is a boolean. If it is present, the entry will be skipped. +// 24. "description" has the description of the entry. +// 25. "webkit_bugs" is an array of associated webkit bug numbers. +// 26. "cr_bugs" is an array of associated webkit bug numbers. +// 27. "disabled" is a boolean. If it is present, the entry will be skipped. // This can not be used in exceptions. +// 28. "direct_rendering" is a boolean. If present, this will filter on whether +// the GL contexts are direct or indirect based on the value. // // VERSION includes "op", "style", "value", and "value2". "op" can be any of // the following values: "=", "<", "<=", ">", ">=", "any", "between". "style" diff --git a/chromium/gpu/config/gpu_control_list_machine_model_info_unittest.cc b/chromium/gpu/config/gpu_control_list_machine_model_info_unittest.cc deleted file mode 100644 index 9c681a9264f..00000000000 --- a/chromium/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/chromium/gpu/config/gpu_control_list_number_info_unittest.cc b/chromium/gpu/config/gpu_control_list_number_info_unittest.cc index 5bd732cf91e..bbddcb947fb 100644 --- a/chromium/gpu/config/gpu_control_list_number_info_unittest.cc +++ b/chromium/gpu/config/gpu_control_list_number_info_unittest.cc @@ -14,6 +14,7 @@ class NumberInfoTest : public testing::Test { typedef GpuControlList::FloatInfo FloatInfo; typedef GpuControlList::IntInfo IntInfo; + typedef GpuControlList::BoolInfo BoolInfo; }; TEST_F(NumberInfoTest, ValidFloatInfo) { @@ -206,5 +207,18 @@ TEST_F(NumberInfoTest, IntComparison) { } } +TEST_F(NumberInfoTest, Bool) { + { + BoolInfo info(true); + EXPECT_TRUE(info.Contains(true)); + EXPECT_FALSE(info.Contains(false)); + } + { + BoolInfo info(false); + EXPECT_FALSE(info.Contains(true)); + EXPECT_TRUE(info.Contains(false)); + } +} + } // namespace gpu diff --git a/chromium/gpu/config/gpu_control_list_os_info_unittest.cc b/chromium/gpu/config/gpu_control_list_os_info_unittest.cc index 851f9917028..1da6f99dc1d 100644 --- a/chromium/gpu/config/gpu_control_list_os_info_unittest.cc +++ b/chromium/gpu/config/gpu_control_list_os_info_unittest.cc @@ -79,6 +79,46 @@ TEST_F(OsInfoTest, InvalidOsInfo) { } } +TEST_F(OsInfoTest, NonNumericOsVersion) { + { + OsInfo info("android", "<", "4.2", std::string()); + EXPECT_TRUE(info.IsValid()); + // The expectation is the version number first, then extra info. + EXPECT_TRUE(info.Contains( + GpuControlList::kOsAndroid, "4.0 bug fix version 5.2")); + EXPECT_FALSE(info.Contains(GpuControlList::kOsAndroid, "F")); + EXPECT_FALSE(info.Contains(GpuControlList::kOsAndroid, "F 4.0")); + EXPECT_FALSE(info.Contains(GpuControlList::kOsAndroid, std::string())); + } + { + OsInfo info("android", "any", std::string(), std::string()); + EXPECT_TRUE(info.IsValid()); + EXPECT_TRUE(info.Contains( + GpuControlList::kOsAndroid, "4.0 bug fix version 5.2")); + EXPECT_TRUE(info.Contains(GpuControlList::kOsAndroid, "F")); + EXPECT_TRUE(info.Contains(GpuControlList::kOsAndroid, "F 4.0")); + EXPECT_TRUE(info.Contains(GpuControlList::kOsAndroid, std::string())); + } +} + +TEST_F(OsInfoTest, OsVersionZero) { + { + OsInfo info("android", "<", "4.2", std::string()); + EXPECT_TRUE(info.IsValid()); + // All forms of version 0 is considered invalid. + EXPECT_FALSE(info.Contains(GpuControlList::kOsAndroid, "0")); + EXPECT_FALSE(info.Contains(GpuControlList::kOsAndroid, "0.0")); + EXPECT_FALSE(info.Contains(GpuControlList::kOsAndroid, "0.00.0")); + } + { + OsInfo info("android", "any", std::string(), std::string()); + EXPECT_TRUE(info.IsValid()); + EXPECT_TRUE(info.Contains(GpuControlList::kOsAndroid, "0")); + EXPECT_TRUE(info.Contains(GpuControlList::kOsAndroid, "0.0")); + EXPECT_TRUE(info.Contains(GpuControlList::kOsAndroid, "0.00.0")); + } +} + TEST_F(OsInfoTest, OsComparison) { { OsInfo info("any", "any", std::string(), std::string()); diff --git a/chromium/gpu/config/gpu_control_list_unittest.cc b/chromium/gpu/config/gpu_control_list_unittest.cc index 996276aff61..03a7d0e2491 100644 --- a/chromium/gpu/config/gpu_control_list_unittest.cc +++ b/chromium/gpu/config/gpu_control_list_unittest.cc @@ -12,6 +12,7 @@ const char kOsVersion[] = "10.6.4"; const uint32 kIntelVendorId = 0x8086; const uint32 kNvidiaVendorId = 0x10de; +const uint32 kAmdVendorId = 0x10de; #define LONG_STRING_CONST(...) #__VA_ARGS__ @@ -52,7 +53,8 @@ class GpuControlListTest : public testing::Test { 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_.machine_model_name = "MacBookPro"; + gpu_info_.machine_model_version = "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; @@ -447,5 +449,98 @@ TEST_F(GpuControlListTest, ExceptionWithoutVendorId) { EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); } +TEST_F(GpuControlListTest, AMDSwitchable) { + GPUInfo gpu_info; + gpu_info.amd_switchable = true; + gpu_info.gpu.vendor_id = kAmdVendorId; + gpu_info.gpu.device_id = 0x6760; + GPUInfo::GPUDevice integrated_gpu; + integrated_gpu.vendor_id = kIntelVendorId; + integrated_gpu.device_id = 0x0116; + gpu_info.secondary_gpus.push_back(integrated_gpu); + + { // amd_switchable_discrete entry + const std::string json= LONG_STRING_CONST( + { + "name": "gpu control list", + "version": "0.1", + "entries": [ + { + "id": 1, + "os": { + "type": "win" + }, + "multi_gpu_style": "amd_switchable_discrete", + "features": [ + "test_feature_0" + ] + } + ] + } + ); + + scoped_ptr<GpuControlList> control_list(Create()); + EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); + + // Integrated GPU is active + gpu_info.gpu.active = false; + gpu_info.secondary_gpus[0].active = true; + std::set<int> features = control_list->MakeDecision( + GpuControlList::kOsWin, kOsVersion, gpu_info); + EXPECT_EMPTY_SET(features); + + // Discrete GPU is active + gpu_info.gpu.active = true; + gpu_info.secondary_gpus[0].active = false; + features = control_list->MakeDecision( + GpuControlList::kOsWin, kOsVersion, gpu_info); + EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); + } + + { // amd_switchable_integrated entry + const std::string json= LONG_STRING_CONST( + { + "name": "gpu control list", + "version": "0.1", + "entries": [ + { + "id": 1, + "os": { + "type": "win" + }, + "multi_gpu_style": "amd_switchable_integrated", + "features": [ + "test_feature_0" + ] + } + ] + } + ); + + scoped_ptr<GpuControlList> control_list(Create()); + EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); + + // Discrete GPU is active + gpu_info.gpu.active = true; + gpu_info.secondary_gpus[0].active = false; + std::set<int> features = control_list->MakeDecision( + GpuControlList::kOsWin, kOsVersion, gpu_info); + EXPECT_EMPTY_SET(features); + + // Integrated GPU is active + gpu_info.gpu.active = false; + gpu_info.secondary_gpus[0].active = true; + features = control_list->MakeDecision( + GpuControlList::kOsWin, kOsVersion, gpu_info); + EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); + + // For non AMD switchable + gpu_info.amd_switchable = false; + features = control_list->MakeDecision( + GpuControlList::kOsWin, kOsVersion, gpu_info); + EXPECT_EMPTY_SET(features); + } +} + } // namespace gpu diff --git a/chromium/gpu/config/gpu_driver_bug_list.cc b/chromium/gpu/config/gpu_driver_bug_list.cc index d845c163043..a091c4218f7 100644 --- a/chromium/gpu/config/gpu_driver_bug_list.cc +++ b/chromium/gpu/config/gpu_driver_bug_list.cc @@ -12,9 +12,15 @@ namespace gpu { namespace { -struct DriverBugInfo { - int feature_type; - std::string feature_name; +struct GpuDriverBugWorkaroundInfo { + GpuDriverBugWorkaroundType type; + const char* name; +}; + +const GpuDriverBugWorkaroundInfo kFeatureList[] = { +#define GPU_OP(type, name) { type, #name }, + GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) +#undef GPU_OP }; } // namespace anonymous @@ -30,29 +36,53 @@ GpuDriverBugList::~GpuDriverBugList() { 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); + list->AddSupportedFeature(kFeatureList[i].name, + kFeatureList[i].type); } return list; } std::string GpuDriverBugWorkaroundTypeToString( GpuDriverBugWorkaroundType type) { - switch (type) { -#define GPU_OP(type, name) case type: return #name; - GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) -#undef GPU_OP - default: - return "unknown"; - }; + if (type < NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES) + return kFeatureList[type].name; + else + return "unknown"; +} + +// static +void GpuDriverBugList::AppendWorkaroundsFromCommandLine( + std::set<int>* workarounds, const CommandLine& command_line) { + DCHECK(workarounds); + for (int i = 0; i < NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES; i++) { + if (!command_line.HasSwitch(kFeatureList[i].name)) + continue; + // Removing conflicting workarounds. + switch (kFeatureList[i].type) { + case FORCE_DISCRETE_GPU: + workarounds->erase(FORCE_INTEGRATED_GPU); + workarounds->insert(FORCE_DISCRETE_GPU); + break; + case FORCE_INTEGRATED_GPU: + workarounds->erase(FORCE_DISCRETE_GPU); + workarounds->insert(FORCE_INTEGRATED_GPU); + break; + case MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_512: + case MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024: + case MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_4096: + workarounds->erase(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_512); + workarounds->erase(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024); + workarounds->erase(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_4096); + workarounds->insert(kFeatureList[i].type); + break; + default: + workarounds->insert(kFeatureList[i].type); + break; + } + } } } // namespace gpu diff --git a/chromium/gpu/config/gpu_driver_bug_list.h b/chromium/gpu/config/gpu_driver_bug_list.h index 99432516389..a4bd3bb02b9 100644 --- a/chromium/gpu/config/gpu_driver_bug_list.h +++ b/chromium/gpu/config/gpu_driver_bug_list.h @@ -5,9 +5,12 @@ #ifndef GPU_CONFIG_GPU_DRIVER_BUG_LIST_H_ #define GPU_CONFIG_GPU_DRIVER_BUG_LIST_H_ +#include <set> #include <string> +#include "base/command_line.h" #include "gpu/config/gpu_control_list.h" +#include "gpu/config/gpu_driver_bug_workaround_type.h" #include "gpu/gpu_export.h" namespace gpu { @@ -18,6 +21,11 @@ class GPU_EXPORT GpuDriverBugList : public GpuControlList { static GpuDriverBugList* Create(); + // Append |workarounds| with these passed in through the + // |command_line|. + static void AppendWorkaroundsFromCommandLine( + std::set<int>* workarounds, const CommandLine& command_line); + private: GpuDriverBugList(); diff --git a/chromium/gpu/config/gpu_driver_bug_list_json.cc b/chromium/gpu/config/gpu_driver_bug_list_json.cc index ec015db7b67..bcd2dd4d77e 100644 --- a/chromium/gpu/config/gpu_driver_bug_list_json.cc +++ b/chromium/gpu/config/gpu_driver_bug_list_json.cc @@ -19,7 +19,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "name": "gpu driver bug list", // Please update the version number whenever you change this file. - "version": "3.10", + "version": "6.7", "entries": [ { "id": 1, @@ -51,26 +51,59 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 3, + "description": "glGenerateMipmap leaks vram without setting texture filters on some Mac drivers", + "webkit_bugs": [48489], + "cr_bugs": [349137], + "os": { + "type": "macosx", + "version": { + "op": "<", + "value": "10.9" + } + }, "features": [ "set_texture_filter_before_generating_mipmap" ] }, { "id": 4, - "description": "Need to set the alpha to 255", + "description": "glReadPixels incorrectly sets alpha to 0 on some drivers from a drawing buffer without alpha channel", + "webkit_bugs": [33416], + "cr_bugs": [349137], + "os": { + "type": "macosx", + "version": { + "op": "<", + "value": "10.9" + } + }, "features": [ "clear_alpha_in_readpixels" ] }, { "id": 5, + "description": "Always call glUseProgram after a successful link to avoid a driver bug", + "cr_bugs": [349137], "vendor_id": "0x10de", + "exceptions": [ + { + "os": { + "type": "macosx", + "version": { + "op": ">=", + "value": "10.9" + } + } + } + ], "features": [ "use_current_program_after_successful_link" ] }, { "id": 6, + "description": "Restore scissor on FBO change with Qualcomm GPUs on older versions of Android", "cr_bugs": [165493, 222018], "os": { "type": "android", @@ -90,6 +123,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 7, "cr_bugs": [89557], + "description": "Work around a bug in offscreen buffers on NVIDIA GPUs on Macs", "os": { "type": "macosx" }, @@ -100,8 +134,14 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 8, + "description": "A few built-in glsl functions on Mac behave incorrectly", + "cr_bugs": [349137], "os": { - "type": "macosx" + "type": "macosx", + "version": { + "op": "<", + "value": "10.9" + } }, "vendor_id": "0x1002", "features": [ @@ -110,7 +150,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 9, - "description": "Mac AMD drivers get gl_PointCoord backward on OSX 10.8 or earlier", + "description": "AMD drivers get gl_PointCoord backward on OS X 10.8 or earlier", "cr_bugs": [256349], "os": { "type": "macosx", @@ -126,7 +166,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 10, - "description": "Mac Intel drivers get gl_PointCoord backward on OSX 10.8 or earlier", + "description": "Intel drivers get gl_PointCoord backward on OS X 10.8 or earlier", "cr_bugs": [256349], "os": { "type": "macosx", @@ -142,6 +182,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 11, + "description": "Limit max texure size to 4096 on Macs with Intel GPUs", "os": { "type": "macosx" }, @@ -152,6 +193,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 12, + "description": "Limit max cube map texure size to 1024 on Macs with Intel GPUs", "os": { "type": "macosx" }, @@ -162,6 +204,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 13, + "description": "Limit max cube map texure size to 512 on older Macs with Intel GPUs", "os": { "type": "macosx", "version": { @@ -176,6 +219,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 14, + "description": "Limit max texure size and cube map texture size to 4096 on Macs with AMD GPUs", "os": { "type": "macosx" }, @@ -187,7 +231,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 16, - "description": "Intel drivers on Linux appear to be buggy", + "description": "EXT_occlusion_query appears to be buggy with Intel GPUs on Linux", "os": { "type": "linux" }, @@ -222,6 +266,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 19, + "description": "Disable depth textures on Android with Qualcomm GPUs", "os": { "type": "android" }, @@ -235,7 +280,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 20, - "description": "Disable EXT_draw_buffers on GeForce GT 650M on Mac OS X due to driver bugs.", + "description": "Disable EXT_draw_buffers on GeForce GT 650M on Mac OS X due to driver bugs", "os": { "type": "macosx" }, @@ -248,7 +293,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 21, - "description": "Vivante GPUs are buggy with context switching.", + "description": "Vivante GPUs are buggy with context switching", "cr_bugs": [179250, 235935], "os": { "type": "android" @@ -263,7 +308,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 22, - "description": "Imagination drivers are buggy with context switching.", + "description": "Imagination drivers are buggy with context switching", "cr_bugs": [230896], "os": { "type": "android" @@ -279,7 +324,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 23, "cr_bugs": [243038], - "description": "Disable OES_standard_derivative on Intel Pineview M Gallium drivers.", + "description": "Disable OES_standard_derivative on Intel Pineview M Gallium drivers", "os": { "type": "chromeos" }, @@ -292,7 +337,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 24, "cr_bugs": [231082], - "description": "Mali-400 drivers throw an error when a buffer object's size is set to 0.", + "description": "Mali-400 drivers throw an error when a buffer object's size is set to 0", "os": { "type": "android" }, @@ -311,8 +356,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 25, "cr_bugs": [152225], - "description": - "PBO + Readpixels + intel gpu doesn't work on OSX 10.7.", + "description": "PBO + Readpixels don't work on OS X 10.7", "os": { "type": "macosx", "version": { @@ -320,14 +364,13 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( "value": "10.8" } }, - "vendor_id": "0x8086", "features": [ "disable_async_readpixels" ] }, { "id": 26, - "description": "Disable use of Direct3D 11 on Windows Vista and lower.", + "description": "Disable use of Direct3D 11 on Windows Vista and lower", "os": { "type": "win", "version": { @@ -342,7 +385,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 27, "cr_bugs": [265115], - "description": "Async Readpixels with GL_BGRA format is broken on Haswell chipset on Mac.", + "description": "Async Readpixels with GL_BGRA format is broken on Haswell chipset on Macs", "os": { "type": "macosx" }, @@ -354,25 +397,6 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( ] }, { - "id": 29, - "cr_bugs": [278606], - "description": "Testing fences is broken on QualComm.", - "os": { - "type": "android", - "version": { - "op": "<", - "value": "4.4" - } - }, - "gl_vendor": { - "op": "beginwith", - "value": "Qualcomm" - }, - "features": [ - "disable_async_readpixels" - ] - }, - { "id": 30, "cr_bugs": [237931], "description": "Multisampling is buggy on OSX when multiple monitors are connected", @@ -386,14 +410,14 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 31, "cr_bugs": [154715, 10068, 269829, 294779, 285292], - "description": "The Mali T-6xx driver does not guarantee flush ordering.", + "description": "The Mali-Txxx driver does not guarantee flush ordering", "gl_vendor": { "op": "beginwith", "value": "ARM" }, "gl_renderer": { "op": "beginwith", - "value": "Mali-T6" + "value": "Mali-T" }, "features": [ "use_virtualized_gl_contexts" @@ -402,7 +426,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 32, "cr_bugs": [179815], - "description": "Share groups are not working on (older?) Broadcom drivers.", + "description": "Share groups are not working on (older?) Broadcom drivers", "os": { "type": "android" }, @@ -416,7 +440,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 33, - "description": "Share group-related crashes and poor context switching perf on Galaxy Nexus.", + "description": "Share group-related crashes and poor context switching perf on Galaxy Nexus", "os": { "type": "android" }, @@ -431,7 +455,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 34, "cr_bugs": [179250, 229643, 230896], - "description": "Share groups are not working on (older?) Vivante drivers.", + "description": "Share groups are not working on (older?) Vivante drivers", "os": { "type": "android" }, @@ -446,7 +470,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 35, "cr_bugs": [163464], - "description": "Share-group related crashes on older NVIDIA drivers.", + "description": "Share-group related crashes on older NVIDIA drivers", "os": { "type": "android", "version": { @@ -465,7 +489,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 36, "cr_bugs": [163464, 233612], - "description": "Share-group related crashes on Qualcomm drivers.", + "description": "Share-group related crashes on Qualcomm drivers", "os": { "type": "android", "version": { @@ -541,7 +565,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 42, "cr_bugs": [290876], - "description": "Framebuffer discarding causes flickering on older IMG drivers.", + "description": "Framebuffer discarding causes flickering on older IMG drivers", "os": { "type": "android" }, @@ -560,7 +584,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 43, "cr_bugs": [299494], - "description": "Framebuffer discarding doesn't accept trivial attachments on Vivante.", + "description": "Framebuffer discarding doesn't accept trivial attachments on Vivante", "os": { "type": "android" }, @@ -586,7 +610,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 45, "cr_bugs": [307751], - "description": "Unfold short circuit on MacOSX.", + "description": "Unfold short circuit on Mac OS X", "os": { "type": "macosx" }, @@ -595,20 +619,8 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( ] }, { - "id": 46, - "description": "Using D3D11 causes browser crashes on certain Intel GPUs.", - "cr_bugs": [310808], - "os": { - "type": "win" - }, - "vendor_id": "0x8086", - "features": [ - "disable_d3d11" - ] - }, - { "id": 48, - "description": "Force to use discrete GPU on older MacBookPro models.", + "description": "Force to use discrete GPU on older MacBookPro models", "cr_bugs": [113703], "os": { "type": "macosx", @@ -617,15 +629,10 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( "value": "10.7" } }, - "machine_model": { - "name": { - "op": "=", - "value": "MacBookPro" - }, - "version": { - "op": "<", - "value": "8" - } + "machine_model_name": ["MacBookPro"], + "machine_model_version": { + "op": "<", + "value": "8" }, "gpu_count": { "op": "=", @@ -638,7 +645,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( { "id": 49, "cr_bugs": [309734], - "description": "The first draw operation from an idle state is slow.", + "description": "The first draw operation from an idle state is slow", "os": { "type": "android" }, @@ -666,7 +673,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 51, - "description": "TexSubImage2D() is faster for full uploads on ANGLE.", + "description": "TexSubImage2D() is faster for full uploads on ANGLE", "os": { "type": "win" }, @@ -680,7 +687,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( }, { "id": 52, - "description": "ES3 MSAA is broken on Qualcomm.", + "description": "ES3 MSAA is broken on Qualcomm", "os": { "type": "android" }, @@ -689,29 +696,24 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( "value": "Qualcomm" }, "features": [ - "disable_framebuffer_multisample" - ] - }, - { - "id": 53, - "cr_bugs": [321701], - "description": "ES3 multisampling is too slow to be usable on Mali.", - "gl_vendor": { - "op": "beginwith", - "value": "ARM" - }, - "gl_renderer": { - "op": "beginwith", - "value": "Mali" - }, - "features": [ - "disable_framebuffer_multisample" + "disable_multisampling" ] }, { "id": 54, - "cr_bugs": [124764], + "cr_bugs": [124764, 349137], "description": "Clear uniforms before first program use on all platforms", + "exceptions": [ + { + "os": { + "type": "macosx", + "version": { + "op": ">=", + "value": "10.9" + } + } + } + ], "features": [ "clear_uniforms_before_first_program_use" ] @@ -745,6 +747,353 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST( "features": [ "count_all_in_varyings_packing" ] + }, + { + "id": 57, + "cr_bugs": [322760], + "description": "Mac drivers handle varyings without static use incorrectly", + "os": { + "type": "macosx" + }, + "features": [ + "init_varyings_without_static_use" + ] + }, + { + "id": 58, + "description": "Multisampling is buggy in ATI cards on older Mac OS X", + "cr_bugs": [67752, 83153], + "os": { + "type": "macosx", + "version": { + "op": "<", + "value": "10.7.2" + } + }, + "vendor_id": "0x1002", + "features": [ + "disable_multisampling" + ] + }, + { + "id": 59, + "description": "Multisampling is buggy in Intel IvyBridge", + "cr_bugs": [116370], + "os": { + "type": "linux" + }, + "vendor_id": "0x8086", + "device_id": ["0x0152", "0x0156", "0x015a", "0x0162", "0x0166"], + "features": [ + "disable_multisampling" + ] + }, + { + "id": 60, + "description": "Multisampling is buggy on Mac OS X prior to 10.8.3", + "cr_bugs": [137303, 162466], + "os": { + "type": "macosx", + "version": { + "op": "<", + "value": "10.8.3" + } + }, + "features": [ + "disable_multisampling" + ] + }, + { + "id": 63, + "description": "Shaders with sampler arrays indexing for-loop indices cause the GLSL compiler to crash on OS X", + "cr_bugs": [348198, 349137], + "os": { + "type": "macosx", + "version": { + "op": "<", + "value": "10.9" + } + }, + "features": [ + "unroll_for_loop_with_sampler_array_index" + ] + }, + { + "id": 64, + "description": "Linux AMD drivers incorrectly return initial value of 1 for TEXTURE_MAX_ANISOTROPY", + "cr_bugs": [348237], + "os": { + "type": "linux" + }, + "vendor_id": "0x1002", + "features": [ + "init_texture_max_anisotropy" + ] + }, + { + "id": 65, + "description": "Linux NVIDIA drivers don't have the correct defaults for vertex attributes", + "cr_bugs": [351528], + "os": { + "type": "linux" + }, + "vendor_id": "0x10de", + "features": [ + "init_vertex_attributes" + ] + }, + { + "id": 66, + "description": "Force glFinish() after compositing on older OS X on Intel GPU", + "cr_bugs": [123409], + "os": { + "type": "macosx", + "version": { + "op": "<=", + "value": "10.7" + } + }, + "vendor_id": "0x8086", + "multi_gpu_category": "active", + "features": [ + "force_gl_finish_after_compositing" + ] + }, + { + "id": 68, + "description": "Disable partial swaps on linux drivers", + "cr_bugs": [339493], + "os": { + "type": "linux" + }, + "features": [ + "disable_post_sub_buffers_for_onscreen_surfaces" + ] + }, + { + "id": 69, + "description": "Some shaders in Skia need more than the min available vertex and fragment shader uniform vectors in case of OSMesa", + "cr_bugs": [174845], + "driver_vendor": { + "op": "=", + "value": "osmesa" + }, + "features": [ + "max_fragment_uniform_vectors_32", + "max_varying_vectors_16", + "max_vertex_uniform_vectors_256" + ] + }, + { + "id": 70, + "description": "Disable D3D11 on older nVidia drivers", + "cr_bugs": [349929], + "os": { + "type": "win" + }, + "vendor_id": "0x10de", + "driver_version": { + "op": "<=", + "value": "8.17.12.6973" + }, + "features": [ + "disable_d3d11" + ] + }, + { + "id": 71, + "description": "Vivante's support of OES_standard_derivatives is buggy", + "cr_bugs": [368005], + "os": { + "type": "android" + }, + "gl_extensions": { + "op": "contains", + "value": "GL_VIV_shader_binary" + }, + "features": [ + "disable_oes_standard_derivatives" + ] + }, + { + "id": 72, + "description": "Use virtual contexts on NVIDIA with GLES 3.1", + "cr_bugs": [369316], + "os": { + "type": "android" + }, + "gl_type": "gles", + "gl_version": { + "op": "=", + "value": "3.1" + }, + "gl_vendor": { + "op": "beginwith", + "value": "NVidia" + }, + "features": [ + "use_virtualized_gl_contexts" + ] + }, + { + "id": 73, + "description": "Using D3D11 causes browser crashes on certain Intel GPUs", + "cr_bugs": [310808], + "os": { + "type": "win" + }, + "vendor_id": "0x8086", + "features": [ + "disable_d3d11" + ] + }, +) // LONG_STRING_CONST macro +// Avoid C2026 (string too big) error on VisualStudio. +LONG_STRING_CONST( + { + "id": 74, + "cr_bugs": [278606, 382686], + "description": "Testing EGL sync fences was broken on most Qualcomm drivers", + "os": { + "type": "android", + "version": { + "op": "<=", + "value": "4.4.4" + } + }, + "gl_vendor": { + "op": "beginwith", + "value": "Qualcomm" + }, + "features": [ + "disable_egl_khr_fence_sync" + ] + }, + { + "id": 75, + "description": "Mali-400 support of EXT_multisampled_render_to_texture is buggy on Android < 4.3", + "cr_bugs": [362435], + "os": { + "type": "android", + "version": { + "op": "<", + "value": "4.3" + } + }, + "gl_vendor": { + "op": "beginwith", + "value": "ARM" + }, + "gl_renderer": { + "op": "contains", + "value": "Mali-400" + }, + "features": [ + "disable_multisampling" + ] + }, + { + "id": 76, + "cr_bugs": [371530], + "description": "Testing EGL sync fences was broken on IMG", + "os": { + "type": "android", + "version": { + "op": "<=", + "value": "4.4.4" + } + }, + "gl_vendor": { + "op": "beginwith", + "value": "Imagination Technologies" + }, + "features": [ + "disable_egl_khr_fence_sync" + ] + }, + { + "id": 77, + "cr_bugs": [378691, 373360, 371530], + "description": "Testing fences was broken on Mali-400 MP drivers", + "os": { + "type": "android", + "version": { + "op": "<=", + "value": "4.4.4" + } + }, + "gl_vendor": { + "op": "beginwith", + "value": "ARM" + }, + "gl_renderer": { + "op": "beginwith", + "value": "Mali-400 MP" + }, + "features": [ + "disable_egl_khr_fence_sync" + ] + }, + { + "id": 78, + "cr_bugs": [378691, 373360, 371530], + "description": "Testing fences was broken on Broadcom drivers", + "os": { + "type": "android", + "version": { + "op": "<=", + "value": "4.4.4" + } + }, + "gl_vendor": { + "op": "beginwith", + "value": "Broadcom" + }, + "features": [ + "disable_egl_khr_fence_sync" + ] + }, + { + "id": 79, + "cr_bugs": [371530], + "description": "Testing ARB sync fences is broken on MacOSX", + "os": { + "type": "macosx" + }, + "features": [ + "disable_arb_sync" + ] + }, + { + "id": 82, + "description": "PBO mappings segfault on certain older Qualcomm drivers", + "cr_bugs": [394510], + "os": { + "type": "android", + "version": { + "op": "<", + "value": "4.3" + } + }, + "gl_vendor": { + "op": "beginwith", + "value": "Qualcomm" + }, + "features": [ + "disable_async_readpixels" + ] + }, + { + "id": 86, + "description": "Disable use of Direct3D 11 on Matrox video cards", + "cr_bugs": [395861], + "os": { + "type": "win" + }, + "vendor_id": "0x102b", + "features": [ + "disable_d3d11" + ] } ] } diff --git a/chromium/gpu/config/gpu_driver_bug_list_unittest.cc b/chromium/gpu/config/gpu_driver_bug_list_unittest.cc index 1a5590c556b..e927e6c2c78 100644 --- a/chromium/gpu/config/gpu_driver_bug_list_unittest.cc +++ b/chromium/gpu/config/gpu_driver_bug_list_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/command_line.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "gpu/config/gpu_control_list_jsons.h" @@ -31,7 +32,8 @@ class GpuDriverBugListTest : public testing::Test { 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_.machine_model_name = "MacBookPro"; + gpu_info_.machine_model_version = "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; @@ -125,5 +127,86 @@ TEST_F(GpuDriverBugListTest, GpuSwitching) { EXPECT_EQ(2u, entries[0]); } +TEST_F(GpuDriverBugListTest, AppendSingleWorkaround) { + base::CommandLine command_line(0, NULL); + command_line.AppendSwitch( + GpuDriverBugWorkaroundTypeToString(DISABLE_MULTISAMPLING)); + std::set<int> workarounds; + workarounds.insert(EXIT_ON_CONTEXT_LOST); + workarounds.insert(INIT_VERTEX_ATTRIBUTES); + EXPECT_EQ(2u, workarounds.size()); + GpuDriverBugList::AppendWorkaroundsFromCommandLine( + &workarounds, command_line); + EXPECT_EQ(3u, workarounds.size()); + EXPECT_EQ(1u, workarounds.count(DISABLE_MULTISAMPLING)); +} + +TEST_F(GpuDriverBugListTest, AppendForceGPUWorkaround) { + base::CommandLine command_line(0, NULL); + command_line.AppendSwitch( + GpuDriverBugWorkaroundTypeToString(FORCE_DISCRETE_GPU)); + std::set<int> workarounds; + workarounds.insert(EXIT_ON_CONTEXT_LOST); + workarounds.insert(FORCE_INTEGRATED_GPU); + EXPECT_EQ(2u, workarounds.size()); + EXPECT_EQ(1u, workarounds.count(FORCE_INTEGRATED_GPU)); + GpuDriverBugList::AppendWorkaroundsFromCommandLine( + &workarounds, command_line); + EXPECT_EQ(2u, workarounds.size()); + EXPECT_EQ(0u, workarounds.count(FORCE_INTEGRATED_GPU)); + EXPECT_EQ(1u, workarounds.count(FORCE_DISCRETE_GPU)); +} + +TEST_F(GpuDriverBugListTest, NVIDIANumberingScheme) { + const std::string json = LONG_STRING_CONST( + { + "name": "gpu driver bug list", + "version": "0.1", + "entries": [ + { + "id": 1, + "os": { + "type": "win" + }, + "vendor_id": "0x10de", + "driver_version": { + "op": "<=", + "value": "8.17.12.6973" + }, + "features": [ + "disable_d3d11" + ] + } + ] + } + ); + + scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); + EXPECT_TRUE(list->LoadList(json, GpuControlList::kAllOs)); + + GPUInfo gpu_info; + gpu_info.gl_vendor = "NVIDIA"; + gpu_info.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; + gpu_info.gpu.vendor_id = 0x10de; + gpu_info.gpu.device_id = 0x0640; + + // test the same driver version number + gpu_info.driver_version = "8.17.12.6973"; + std::set<int> bugs = list->MakeDecision( + GpuControlList::kOsWin, "7.0", gpu_info); + EXPECT_EQ(1u, bugs.count(DISABLE_D3D11)); + + // test a lower driver version number + gpu_info.driver_version = "8.15.11.8647"; + + bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info); + EXPECT_EQ(1u, bugs.count(DISABLE_D3D11)); + + // test a higher driver version number + gpu_info.driver_version = "9.18.13.2723"; + bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info); + EXPECT_EQ(0u, bugs.count(DISABLE_D3D11)); +} + } // namespace gpu diff --git a/chromium/gpu/config/gpu_driver_bug_workaround_type.h b/chromium/gpu/config/gpu_driver_bug_workaround_type.h index e48eeff10fa..5b3c684c5b7 100644 --- a/chromium/gpu/config/gpu_driver_bug_workaround_type.h +++ b/chromium/gpu/config/gpu_driver_bug_workaround_type.h @@ -18,42 +18,62 @@ count_all_in_varyings_packing) \ GPU_OP(DISABLE_ANGLE_INSTANCED_ARRAYS, \ disable_angle_instanced_arrays) \ + GPU_OP(DISABLE_ARB_SYNC, \ + disable_arb_sync) \ GPU_OP(DISABLE_ASYNC_READPIXELS, \ disable_async_readpixels) \ GPU_OP(DISABLE_D3D11, \ disable_d3d11) \ GPU_OP(DISABLE_DEPTH_TEXTURE, \ disable_depth_texture) \ + GPU_OP(DISABLE_EGL_KHR_FENCE_SYNC, \ + disable_egl_khr_fence_sync) \ GPU_OP(DISABLE_EXT_DISCARD_FRAMEBUFFER, \ disable_ext_discard_framebuffer) \ GPU_OP(DISABLE_EXT_DRAW_BUFFERS, \ disable_ext_draw_buffers) \ GPU_OP(DISABLE_EXT_OCCLUSION_QUERY, \ disable_ext_occlusion_query) \ - GPU_OP(DISABLE_FRAMEBUFFER_MULTISAMPLE, \ - disable_framebuffer_multisample) \ GPU_OP(DISABLE_MULTIMONITOR_MULTISAMPLING, \ disable_multimonitor_multisampling) \ + GPU_OP(DISABLE_MULTISAMPLING, \ + disable_multisampling) \ GPU_OP(DISABLE_OES_STANDARD_DERIVATIVES, \ disable_oes_standard_derivatives) \ + GPU_OP(DISABLE_POST_SUB_BUFFERS_FOR_ONSCREEN_SURFACES, \ + disable_post_sub_buffers_for_onscreen_surfaces) \ GPU_OP(ENABLE_CHROMIUM_FAST_NPOT_MO8_TEXTURES, \ enable_chromium_fast_npot_mo8_textures) \ GPU_OP(EXIT_ON_CONTEXT_LOST, \ exit_on_context_lost) \ GPU_OP(FORCE_DISCRETE_GPU, \ force_discrete_gpu) \ + GPU_OP(FORCE_GL_FINISH_AFTER_COMPOSITING, \ + force_gl_finish_after_compositing) \ GPU_OP(FORCE_INTEGRATED_GPU, \ force_integrated_gpu) \ GPU_OP(INIT_GL_POSITION_IN_VERTEX_SHADER, \ init_gl_position_in_vertex_shader) \ + GPU_OP(INIT_TEXTURE_MAX_ANISOTROPY, \ + init_texture_max_anisotropy) \ + GPU_OP(INIT_VARYINGS_WITHOUT_STATIC_USE, \ + init_varyings_without_static_use) \ + GPU_OP(INIT_VERTEX_ATTRIBUTES, \ + init_vertex_attributes) \ GPU_OP(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024, \ max_cube_map_texture_size_limit_1024) \ GPU_OP(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_4096, \ max_cube_map_texture_size_limit_4096) \ GPU_OP(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_512, \ max_cube_map_texture_size_limit_512) \ + GPU_OP(MAX_FRAGMENT_UNIFORM_VECTORS_32, \ + max_fragment_uniform_vectors_32) \ GPU_OP(MAX_TEXTURE_SIZE_LIMIT_4096, \ max_texture_size_limit_4096) \ + GPU_OP(MAX_VARYING_VECTORS_16, \ + max_varying_vectors_16) \ + GPU_OP(MAX_VERTEX_UNIFORM_VECTORS_256, \ + max_vertex_uniform_vectors_256) \ GPU_OP(NEEDS_GLSL_BUILT_IN_FUNCTION_EMULATION, \ needs_glsl_built_in_function_emulation) \ GPU_OP(NEEDS_OFFSCREEN_BUFFER_WORKAROUND, \ @@ -74,6 +94,8 @@ unbind_fbo_on_context_switch) \ GPU_OP(UNFOLD_SHORT_CIRCUIT_AS_TERNARY_OPERATION, \ unfold_short_circuit_as_ternary_operation) \ + GPU_OP(UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX, \ + unroll_for_loop_with_sampler_array_index) \ GPU_OP(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS, \ use_client_side_arrays_for_stream_buffers) \ GPU_OP(USE_CURRENT_PROGRAM_AFTER_SUCCESSFUL_LINK, \ diff --git a/chromium/gpu/config/gpu_dx_diagnostics_win.cc b/chromium/gpu/config/gpu_dx_diagnostics_win.cc index 023e351d82c..0c09ded59cf 100644 --- a/chromium/gpu/config/gpu_dx_diagnostics_win.cc +++ b/chromium/gpu/config/gpu_dx_diagnostics_win.cc @@ -36,7 +36,7 @@ void RecurseDiagnosticTree(DxDiagNode* output, WCHAR prop_name16[256]; hr = container->EnumPropNames(i, prop_name16, arraysize(prop_name16)); if (SUCCEEDED(hr)) { - std::string prop_name8 = WideToUTF8(prop_name16); + std::string prop_name8 = base::WideToUTF8(prop_name16); hr = container->GetProp(prop_name16, &variant); if (SUCCEEDED(hr)) { @@ -51,7 +51,7 @@ void RecurseDiagnosticTree(DxDiagNode* output, output->values[prop_name8] = variant.boolVal ? "true" : "false"; break; case VT_BSTR: - output->values[prop_name8] = WideToUTF8(variant.bstrVal); + output->values[prop_name8] = base::WideToUTF8(variant.bstrVal); break; default: break; @@ -74,7 +74,7 @@ void RecurseDiagnosticTree(DxDiagNode* output, child_name16, arraysize(child_name16)); if (SUCCEEDED(hr)) { - std::string child_name8 = WideToUTF8(child_name16); + std::string child_name8 = base::WideToUTF8(child_name16); DxDiagNode* output_child = &output->children[child_name8]; IDxDiagContainer* child_container = NULL; diff --git a/chromium/gpu/config/gpu_feature_type.h b/chromium/gpu/config/gpu_feature_type.h index e0e4df495b2..c4f3b6222a3 100644 --- a/chromium/gpu/config/gpu_feature_type.h +++ b/chromium/gpu/config/gpu_feature_type.h @@ -12,19 +12,16 @@ namespace gpu { // 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_GPU_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_ACCELERATED_VIDEO_ENCODE, - 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, + GPU_FEATURE_TYPE_GPU_RASTERIZATION, + GPU_FEATURE_TYPE_GPU_RASTERIZATION_FIELD_TRIAL, NUMBER_OF_GPU_FEATURE_TYPES }; diff --git a/chromium/gpu/config/gpu_info.cc b/chromium/gpu/config/gpu_info.cc index c3dc16f1a0f..2c7e67b5eae 100644 --- a/chromium/gpu/config/gpu_info.cc +++ b/chromium/gpu/config/gpu_info.cc @@ -11,6 +11,7 @@ void EnumerateGPUDevice(gpu::GPUInfo::Enumerator* enumerator, enumerator->BeginGPUDevice(); enumerator->AddInt("vendorId", device.vendor_id); enumerator->AddInt("deviceId", device.device_id); + enumerator->AddBool("active", device.active); enumerator->AddString("vendorString", device.vendor_string); enumerator->AddString("deviceString", device.device_string); enumerator->EndGPUDevice(); @@ -22,7 +23,8 @@ namespace gpu { GPUInfo::GPUDevice::GPUDevice() : vendor_id(0), - device_id(0) { + device_id(0), + active(false) { } GPUInfo::GPUDevice::~GPUDevice() { } @@ -36,6 +38,7 @@ GPUInfo::GPUInfo() gl_reset_notification_strategy(0), can_lose_context(false), software_rendering(false), + direct_rendering(true), sandboxed(false) { } @@ -57,8 +60,8 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const { std::string driver_date; std::string pixel_shader_version; std::string vertex_shader_version; - std::string machine_model; - std::string gl_version; + std::string machine_model_name; + std::string machine_model_version; std::string gl_version_string; std::string gl_vendor; std::string gl_renderer; @@ -70,6 +73,7 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const { bool can_lose_context; GpuPerformanceStats performance_stats; bool software_rendering; + bool direct_rendering; bool sandboxed; #if defined(OS_WIN) DxDiagNode dx_diagnostics; @@ -84,7 +88,8 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const { Fields_Have_Changed_In_GPUInfo_So_Update_Below); // Required fields (according to DevTools protocol) first. - enumerator->AddString("machineModel", machine_model); + enumerator->AddString("machineModelName", machine_model_name); + enumerator->AddString("machineModelVersion", machine_model_version); EnumerateGPUDevice(enumerator, gpu); for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) { EnumerateGPUDevice(enumerator, secondary_gpus[ii]); @@ -108,7 +113,6 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const { enumerator->AddString("pixelShaderVersion", pixel_shader_version); enumerator->AddString("vertexShaderVersion", vertex_shader_version); enumerator->AddString("glVersion", gl_version); - enumerator->AddString("glVersionString", gl_version_string); enumerator->AddString("glVendor", gl_vendor); enumerator->AddString("glRenderer", gl_renderer); enumerator->AddString("glExtensions", gl_extensions); @@ -121,6 +125,7 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const { enumerator->AddBool("can_lose_context", can_lose_context); // TODO(kbr): add performance_stats. enumerator->AddBool("softwareRendering", software_rendering); + enumerator->AddBool("directRendering", direct_rendering); enumerator->AddBool("sandboxed", sandboxed); // TODO(kbr): add dx_diagnostics on Windows. enumerator->EndAuxAttributes(); diff --git a/chromium/gpu/config/gpu_info.h b/chromium/gpu/config/gpu_info.h index 09417f7777d..40630b3b0aa 100644 --- a/chromium/gpu/config/gpu_info.h +++ b/chromium/gpu/config/gpu_info.h @@ -33,6 +33,10 @@ struct GPU_EXPORT GPUInfo { // Device ids are unique to vendor, not to one another. uint32 device_id; + // Whether this GPU is the currently used one. + // Currently this field is only supported and meaningful on OS X. + bool active; + // 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. @@ -96,24 +100,28 @@ struct GPU_EXPORT GPUInfo { // 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 machine model identifier. They can contain any character, including + // whitespaces. Currently it is supported on MacOSX and Android. + // Android examples: "Naxus 5", "XT1032". + // On MacOSX, the version is stripped out of the model identifier, for + // example, the original identifier is "MacBookPro7,2", and we put + // "MacBookPro" as machine_model_name, and "7.2" as machine_model_version. + std::string machine_model_name; - // 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 version of the machine model. Currently it is supported on MacOSX. + // See machine_model_name's comment. + std::string machine_model_version; - // The GL_VERSION string. "" if we are not using OpenGL. - std::string gl_version_string; + // The GL_VERSION string. + std::string gl_version; - // The GL_VENDOR string. "" if we are not using OpenGL. + // The GL_VENDOR string. std::string gl_vendor; - // The GL_RENDERER string. "" if we are not using OpenGL. + // The GL_RENDERER string. std::string gl_renderer; - // The GL_EXTENSIONS string. "" if we are not using OpenGL. + // The GL_EXTENSIONS string. std::string gl_extensions; // GL window system binding vendor. "" if not available. @@ -138,6 +146,10 @@ struct GPU_EXPORT GPUInfo { bool software_rendering; + // Whether the driver uses direct rendering. True on most platforms, false on + // X11 when using remote X. + bool direct_rendering; + // Whether the gpu process is running in a sandbox. bool sandboxed; diff --git a/chromium/gpu/config/gpu_info_collector.cc b/chromium/gpu/config/gpu_info_collector.cc index 0bb83dd04f7..5d7dd5a9c22 100644 --- a/chromium/gpu/config/gpu_info_collector.cc +++ b/chromium/gpu/config/gpu_info_collector.cc @@ -22,7 +22,7 @@ namespace { scoped_refptr<gfx::GLSurface> InitializeGLSurface() { scoped_refptr<gfx::GLSurface> surface( - gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1))); + gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size())); if (!surface.get()) { LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLSurface failed"; return NULL; @@ -80,25 +80,26 @@ std::string GetVersionFromString(const std::string& version_string) { namespace gpu { -bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { +CollectInfoResult CollectGraphicsInfoGL(GPUInfo* gpu_info) { TRACE_EVENT0("startup", "gpu_info_collector::CollectGraphicsInfoGL"); - if (!gfx::GLSurface::InitializeOneOff()) { - LOG(ERROR) << "gfx::GLSurface::InitializeOneOff() failed"; - return false; - } + DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); scoped_refptr<gfx::GLSurface> surface(InitializeGLSurface()); - if (!surface.get()) - return false; + if (!surface.get()) { + LOG(ERROR) << "Could not create surface for info collection."; + return kCollectInfoFatalFailure; + } scoped_refptr<gfx::GLContext> context(InitializeGLContext(surface.get())); - if (!context.get()) - return false; + if (!context.get()) { + LOG(ERROR) << "Could not create context for info collection."; + return kCollectInfoFatalFailure; + } gpu_info->gl_renderer = GetGLString(GL_RENDERER); gpu_info->gl_vendor = GetGLString(GL_VENDOR); gpu_info->gl_extensions = GetGLString(GL_EXTENSIONS); - gpu_info->gl_version_string = GetGLString(GL_VERSION); + gpu_info->gl_version = GetGLString(GL_VERSION); std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); gfx::GLWindowSystemBindingInfo window_system_binding_info; @@ -106,6 +107,7 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { gpu_info->gl_ws_vendor = window_system_binding_info.vendor; gpu_info->gl_ws_version = window_system_binding_info.version; gpu_info->gl_ws_extensions = window_system_binding_info.extensions; + gpu_info->direct_rendering = window_system_binding_info.direct_rendering; } bool supports_robustness = @@ -120,7 +122,6 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { // clears the current context. context->ReleaseCurrent(surface.get()); - gpu_info->gl_version = GetVersionFromString(gpu_info->gl_version_string); std::string glsl_version = GetVersionFromString(glsl_version_string); gpu_info->pixel_shader_version = glsl_version; gpu_info->vertex_shader_version = glsl_version; @@ -133,9 +134,8 @@ void MergeGPUInfoGL(GPUInfo* basic_gpu_info, DCHECK(basic_gpu_info); basic_gpu_info->gl_renderer = context_gpu_info.gl_renderer; basic_gpu_info->gl_vendor = context_gpu_info.gl_vendor; - basic_gpu_info->gl_version_string = context_gpu_info.gl_version_string; - basic_gpu_info->gl_extensions = context_gpu_info.gl_extensions; basic_gpu_info->gl_version = context_gpu_info.gl_version; + basic_gpu_info->gl_extensions = context_gpu_info.gl_extensions; basic_gpu_info->pixel_shader_version = context_gpu_info.pixel_shader_version; basic_gpu_info->vertex_shader_version = @@ -153,6 +153,7 @@ void MergeGPUInfoGL(GPUInfo* basic_gpu_info, basic_gpu_info->can_lose_context = context_gpu_info.can_lose_context; basic_gpu_info->sandboxed = context_gpu_info.sandboxed; + basic_gpu_info->direct_rendering = context_gpu_info.direct_rendering; basic_gpu_info->finalized = context_gpu_info.finalized; basic_gpu_info->initialization_time = context_gpu_info.initialization_time; } diff --git a/chromium/gpu/config/gpu_info_collector.h b/chromium/gpu/config/gpu_info_collector.h index d278aea7359..4758aec704b 100644 --- a/chromium/gpu/config/gpu_info_collector.h +++ b/chromium/gpu/config/gpu_info_collector.h @@ -18,6 +18,18 @@ enum GpuIDResult { kGpuIDNotSupported }; +// Result for the various Collect*Info* functions below. +// Fatal failures are for cases where we can't create a context at all or +// something, making the use of the GPU impossible. +// Non-fatal failures are for cases where we could gather most info, but maybe +// some is missing (e.g. unable to parse a version string or to detect the exact +// model). +enum CollectInfoResult { + kCollectInfoFatalFailure, + kCollectInfoNonFatalFailure, + kCollectInfoSuccess +}; + // Collect GPU vendor_id and device ID. GPU_EXPORT GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id); @@ -25,12 +37,11 @@ GPU_EXPORT GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id); // the danger of crashing), including vendor_id and device_id. // This is called at browser process startup time. // The subset each platform collects may be different. -GPU_EXPORT bool CollectBasicGraphicsInfo(GPUInfo* gpu_info); +GPU_EXPORT CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info); // Create a GL/DirectX context and collect related info. // This is called at GPU process startup time. -// Returns true on success. -GPU_EXPORT bool CollectContextGraphicsInfo(GPUInfo* gpu_info); +GPU_EXPORT CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info); #if defined(OS_WIN) // Collect the DirectX Disagnostics information about the attached displays. @@ -38,10 +49,10 @@ GPU_EXPORT bool GetDxDiagnostics(DxDiagNode* output); #endif // OS_WIN // Create a GL context and collect GL strings and versions. -GPU_EXPORT bool CollectGraphicsInfoGL(GPUInfo* gpu_info); +GPU_EXPORT CollectInfoResult CollectGraphicsInfoGL(GPUInfo* gpu_info); // Each platform stores the driver version on the GL_VERSION string differently -GPU_EXPORT bool CollectDriverInfoGL(GPUInfo* gpu_info); +GPU_EXPORT CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info); // Merge GPUInfo from CollectContextGraphicsInfo into basic GPUInfo. // This is platform specific, depending on which info are collected at which @@ -53,22 +64,6 @@ GPU_EXPORT void MergeGPUInfo(GPUInfo* basic_gpu_info, GPU_EXPORT void MergeGPUInfoGL(GPUInfo* basic_gpu_info, const GPUInfo& context_gpu_info); -// If multiple GPUs are detected, use GL_VENDOR string to determine which GPU -// is currently active. -// |gpu_info| is expected to be the merged GPUInfo after full info collection. -// Upon return, |gpu_info->gpu| will contain the active GPU, assuming the -// platform supports it. Return false if it's not supported. -GPU_EXPORT bool DetermineActiveGPU(GPUInfo* gpu_info); - -// Advanced Micro Devices has interesting configurations on laptops were -// there are two videocards that can alternatively a given process output. -enum AMDVideoCardType { - UNKNOWN, - STANDALONE, - INTEGRATED, - SWITCHABLE -}; - } // namespace gpu #endif // GPU_CONFIG_GPU_INFO_COLLECTOR_H_ diff --git a/chromium/gpu/config/gpu_info_collector_android.cc b/chromium/gpu/config/gpu_info_collector_android.cc index 035f47481ee..fc6a5472833 100644 --- a/chromium/gpu/config/gpu_info_collector_android.cc +++ b/chromium/gpu/config/gpu_info_collector_android.cc @@ -65,30 +65,26 @@ ScopedRestoreNonOwnedEGLContext::ScopedRestoreNonOwnedEGLContext() // Chromium native code, but created by Android system itself. DCHECK(!gfx::GLContext::GetCurrent()); - if (gfx::GLSurface::InitializeOneOff()) { - context_ = eglGetCurrentContext(); - display_ = eglGetCurrentDisplay(); - draw_surface_ = eglGetCurrentSurface(EGL_DRAW); - read_surface_ = eglGetCurrentSurface(EGL_READ); - } + context_ = eglGetCurrentContext(); + display_ = eglGetCurrentDisplay(); + draw_surface_ = eglGetCurrentSurface(EGL_DRAW); + read_surface_ = eglGetCurrentSurface(EGL_READ); } ScopedRestoreNonOwnedEGLContext::~ScopedRestoreNonOwnedEGLContext() { if (context_ == EGL_NO_CONTEXT || display_ == EGL_NO_DISPLAY || - draw_surface_ == EGL_NO_SURFACE || read_surface_ == EGL_NO_SURFACE) { + draw_surface_ == EGL_NO_SURFACE || read_surface_ == EGL_NO_SURFACE) return; - } - if (!eglMakeCurrent(display_, draw_surface_, read_surface_, context_)) { + if (!eglMakeCurrent(display_, draw_surface_, read_surface_, context_)) LOG(WARNING) << "Failed to restore EGL context"; - } } } namespace gpu { -bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { +CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info) { return CollectBasicGraphicsInfo(gpu_info); } @@ -99,11 +95,12 @@ GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { return kGpuIDNotSupported; } -bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { +CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { gpu_info->can_lose_context = false; gpu_info->finalized = true; - gpu_info->machine_model = base::android::BuildInfo::GetInstance()->model(); + gpu_info->machine_model_name = + base::android::BuildInfo::GetInstance()->model(); // Create a short-lived context on the UI thread to collect the GL strings. // Make sure we restore the existing context if there is one. @@ -111,12 +108,12 @@ bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { return CollectGraphicsInfoGL(gpu_info); } -bool CollectDriverInfoGL(GPUInfo* gpu_info) { +CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { gpu_info->driver_version = GetDriverVersionFromString( - gpu_info->gl_version_string); + gpu_info->gl_version); gpu_info->gpu.vendor_string = gpu_info->gl_vendor; gpu_info->gpu.device_string = gpu_info->gl_renderer; - return true; + return kCollectInfoSuccess; } void MergeGPUInfo(GPUInfo* basic_gpu_info, @@ -124,13 +121,4 @@ void MergeGPUInfo(GPUInfo* basic_gpu_info, MergeGPUInfoGL(basic_gpu_info, context_gpu_info); } -bool DetermineActiveGPU(GPUInfo* gpu_info) { - DCHECK(gpu_info); - if (gpu_info->secondary_gpus.size() == 0) - return true; - // TODO(zmo): implement this when Android starts to support more - // than one GPUs. - return false; -} - } // namespace gpu diff --git a/chromium/gpu/config/gpu_info_collector_mac.mm b/chromium/gpu/config/gpu_info_collector_mac.mm index 1f58323c867..e4d404e1bf9 100644 --- a/chromium/gpu/config/gpu_info_collector_mac.mm +++ b/chromium/gpu/config/gpu_info_collector_mac.mm @@ -18,7 +18,6 @@ #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context.h" #include "ui/gl/gl_implementation.h" -#include "ui/gl/gl_interface.h" #import <Cocoa/Cocoa.h> #import <Foundation/Foundation.h> @@ -65,6 +64,7 @@ GPUInfo::GPUDevice GetActiveGPU() { // Scan IO registry for PCI video cards. bool CollectPCIVideoCardInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); + GPUInfo::GPUDevice active_gpu = GetActiveGPU(); // Collect all GPUs' info. // match_dictionary will be consumed by IOServiceGetMatchingServices, no need @@ -84,8 +84,13 @@ bool CollectPCIVideoCardInfo(GPUInfo* gpu_info) { } gpu.vendor_id = GetEntryProperty(entry, CFSTR("vendor-id")); gpu.device_id = GetEntryProperty(entry, CFSTR("device-id")); - if (gpu.vendor_id && gpu.device_id) + if (gpu.vendor_id && gpu.device_id) { + if (gpu.vendor_id == active_gpu.vendor_id && + gpu.device_id == active_gpu.device_id) { + gpu.active = true; + } gpu_list.push_back(gpu); + } } IOObjectRelease(entry_iterator); } @@ -129,15 +134,11 @@ bool CollectPCIVideoCardInfo(GPUInfo* gpu_info) { } default: { - GPUInfo::GPUDevice active_gpu = GetActiveGPU(); size_t current = gpu_list.size(); - if (active_gpu.vendor_id && active_gpu.device_id) { - for (size_t i = 0; i < gpu_list.size(); ++i) { - if (gpu_list[i].vendor_id == active_gpu.vendor_id && - gpu_list[i].device_id == active_gpu.device_id) { - current = i; - break; - } + for (size_t i = 0; i < gpu_list.size(); ++i) { + if (gpu_list[i].active) { + current = i; + break; } } if (current == gpu_list.size()) { @@ -158,7 +159,7 @@ bool CollectPCIVideoCardInfo(GPUInfo* gpu_info) { } // namespace anonymous -bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { +CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo"); @@ -171,45 +172,42 @@ bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { DCHECK(vendor_id && device_id); - *vendor_id = 0; - *device_id = 0; - GPUInfo gpu_info; - if (CollectPCIVideoCardInfo(&gpu_info)) { - *vendor_id = gpu_info.gpu.vendor_id; - *device_id = gpu_info.gpu.device_id; + GPUInfo::GPUDevice gpu = GetActiveGPU(); + *vendor_id = gpu.vendor_id; + *device_id = gpu.device_id; + + if (*vendor_id != 0 && *device_id != 0) return kGpuIDSuccess; - } return kGpuIDFailure; } -bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { +CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); - std::string model_name; int32 model_major = 0, model_minor = 0; base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(), - &model_name, &model_major, &model_minor); - base::ReplaceChars(model_name, " ", "_", &gpu_info->machine_model); - gpu_info->machine_model += " " + base::IntToString(model_major) + - "." + base::IntToString(model_minor); + &gpu_info->machine_model_name, + &model_major, &model_minor); + gpu_info->machine_model_version = + base::IntToString(model_major) + "." + base::IntToString(model_minor); - return CollectPCIVideoCardInfo(gpu_info); + bool result = CollectPCIVideoCardInfo(gpu_info); + return result ? kCollectInfoSuccess : kCollectInfoNonFatalFailure; } -bool CollectDriverInfoGL(GPUInfo* gpu_info) { +CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { DCHECK(gpu_info); // Extract the OpenGL driver version string from the GL_VERSION string. // Mac OpenGL drivers have the driver version // at the end of the gl version string preceded by a dash. // Use some jiggery-pokery to turn that utf8 string into a std::wstring. - std::string gl_version_string = gpu_info->gl_version_string; - size_t pos = gl_version_string.find_last_of('-'); + size_t pos = gpu_info->gl_version.find_last_of('-'); if (pos == std::string::npos) - return false; - gpu_info->driver_version = gl_version_string.substr(pos + 1); - return true; + return kCollectInfoNonFatalFailure; + gpu_info->driver_version = gpu_info->gl_version.substr(pos + 1); + return kCollectInfoSuccess; } void MergeGPUInfo(GPUInfo* basic_gpu_info, @@ -217,10 +215,4 @@ void MergeGPUInfo(GPUInfo* basic_gpu_info, MergeGPUInfoGL(basic_gpu_info, context_gpu_info); } -bool DetermineActiveGPU(GPUInfo* gpu_info) { - DCHECK(gpu_info); - // On mac, during info collection, we've already detected the active gpu. - return true; -} - } // namespace gpu diff --git a/chromium/gpu/config/gpu_info_collector_ozone.cc b/chromium/gpu/config/gpu_info_collector_ozone.cc index 5e28e8ae61e..b8dac8478af 100644 --- a/chromium/gpu/config/gpu_info_collector_ozone.cc +++ b/chromium/gpu/config/gpu_info_collector_ozone.cc @@ -4,12 +4,33 @@ #include "gpu/config/gpu_info_collector.h" +#include "base/command_line.h" +#include "base/debug/trace_event.h" #include "base/logging.h" +#include "base/strings/string_split.h" +#include "ui/gl/gl_surface_egl.h" +#include "ui/gl/gl_switches.h" namespace gpu { -bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { - return CollectBasicGraphicsInfo(gpu_info); +CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info) { + DCHECK(gpu_info); + TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo"); + CollectInfoResult result = CollectGraphicsInfoGL(gpu_info); + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kGpuNoContextLost)) { + gpu_info->can_lose_context = false; + } else { +#if defined(OS_CHROMEOS) + gpu_info->can_lose_context = false; +#else + gpu_info->can_lose_context = + !gfx::GLSurfaceEGL::IsCreateContextRobustnessSupported(); +#endif + } + + gpu_info->finalized = true; + return result; } GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { @@ -19,14 +40,36 @@ GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { return kGpuIDNotSupported; } -bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { +CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { gpu_info->can_lose_context = false; - return true; + return kCollectInfoSuccess; } -bool CollectDriverInfoGL(GPUInfo* gpu_info) { - NOTIMPLEMENTED(); - return false; +CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { + DCHECK(gpu_info); + // Extract driver vendor, version from a string like: + // "OpenGL ES 3.0 V@6.0 AU@ (CL@2946718)" + size_t begin = gpu_info->gl_version.find_first_of("0123456789"); + if (begin == std::string::npos) + return kCollectInfoNonFatalFailure; + + std::string sub_string = gpu_info->gl_version.substr(begin); + std::vector<std::string> pieces; + base::SplitStringAlongWhitespace(sub_string, &pieces); + if (pieces.size() < 3) + return kCollectInfoNonFatalFailure; + + std::string driver_version = pieces[2]; + size_t pos = driver_version.find_first_not_of("0123456789."); + if (pos == 0) + return kCollectInfoNonFatalFailure; + + if (pos != std::string::npos) + driver_version = driver_version.substr(0, pos); + + gpu_info->driver_vendor = pieces[1]; + gpu_info->driver_version = driver_version; + return kCollectInfoSuccess; } void MergeGPUInfo(GPUInfo* basic_gpu_info, @@ -34,12 +77,4 @@ void MergeGPUInfo(GPUInfo* basic_gpu_info, MergeGPUInfoGL(basic_gpu_info, context_gpu_info); } -bool DetermineActiveGPU(GPUInfo* gpu_info) { - DCHECK(gpu_info); - if (gpu_info->secondary_gpus.size() == 0) - return true; - // TODO(zmo): implement this. - return false; -} - -} // namespace gpu_info_collector +} // namespace gpu diff --git a/chromium/gpu/config/gpu_info_collector_unittest.cc b/chromium/gpu/config/gpu_info_collector_unittest.cc index 5607312a383..c5e15c81b8b 100644 --- a/chromium/gpu/config/gpu_info_collector_unittest.cc +++ b/chromium/gpu/config/gpu_info_collector_unittest.cc @@ -7,7 +7,6 @@ #include "gpu/config/gpu_info_collector.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/gl/gl_implementation.h" #include "ui/gl/gl_mock.h" using ::gfx::MockGLInterface; @@ -21,22 +20,17 @@ class GPUInfoCollectorTest : public testing::Test { virtual ~GPUInfoCollectorTest() { } virtual void SetUp() { - // TODO(kbr): make this setup robust in the case where - // GLSurface::InitializeOneOff() has already been called by - // another unit test. http://crbug.com/100285 - gfx::InitializeGLBindings(gfx::kGLImplementationMockGL); gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); - ::gfx::GLInterface::SetGLInterface(gl_.get()); + ::gfx::MockGLInterface::SetGLInterface(gl_.get()); #if defined(OS_WIN) const uint32 vendor_id = 0x10de; const uint32 device_id = 0x0658; const char* driver_vendor = ""; // not implemented const char* driver_version = ""; const char* shader_version = "1.40"; - const char* gl_version = "3.1"; const char* gl_renderer = "Quadro FX 380/PCI/SSE2"; const char* gl_vendor = "NVIDIA Corporation"; - const char* gl_version_string = "3.1.0"; + const char* gl_version = "3.1.0"; const char* gl_shading_language_version = "1.40 NVIDIA via Cg compiler"; const char* gl_extensions = "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 " @@ -47,10 +41,9 @@ class GPUInfoCollectorTest : public testing::Test { const char* driver_vendor = ""; // not implemented const char* driver_version = "1.6.18"; const char* shader_version = "1.20"; - const char* gl_version = "2.1"; const char* gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; const char* gl_vendor = "NVIDIA Corporation"; - const char* gl_version_string = "2.1 NVIDIA-1.6.18"; + const char* gl_version = "2.1 NVIDIA-1.6.18"; const char* gl_shading_language_version = "1.20 "; const char* gl_extensions = "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 " @@ -61,10 +54,9 @@ class GPUInfoCollectorTest : public testing::Test { const char* driver_vendor = "NVIDIA"; const char* driver_version = "195.36.24"; const char* shader_version = "1.50"; - const char* gl_version = "3.2"; const char* gl_renderer = "Quadro FX 380/PCI/SSE2"; const char* gl_vendor = "NVIDIA Corporation"; - const char* gl_version_string = "3.2.0 NVIDIA 195.36.24"; + const char* gl_version = "3.2.0 NVIDIA 195.36.24"; const char* gl_shading_language_version = "1.50 NVIDIA via Cg compiler"; const char* gl_extensions = "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 " @@ -76,10 +68,9 @@ class GPUInfoCollectorTest : public testing::Test { test_values_.driver_version =driver_version; test_values_.pixel_shader_version = shader_version; test_values_.vertex_shader_version = shader_version; - test_values_.gl_version = gl_version; test_values_.gl_renderer = gl_renderer; test_values_.gl_vendor = gl_vendor; - test_values_.gl_version_string = gl_version_string; + test_values_.gl_version = gl_version; test_values_.gl_extensions = gl_extensions; test_values_.can_lose_context = false; @@ -91,7 +82,7 @@ class GPUInfoCollectorTest : public testing::Test { gl_shading_language_version))); EXPECT_CALL(*gl_, GetString(GL_VERSION)) .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( - gl_version_string))); + gl_version))); EXPECT_CALL(*gl_, GetString(GL_VENDOR)) .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( gl_vendor))); @@ -101,7 +92,7 @@ class GPUInfoCollectorTest : public testing::Test { } virtual void TearDown() { - ::gfx::GLInterface::SetGLInterface(NULL); + ::gfx::MockGLInterface::SetGLInterface(NULL); gl_.reset(); } @@ -150,103 +141,26 @@ TEST_F(GPUInfoCollectorTest, DISABLED_VertexShaderVersionGL) { TEST_F(GPUInfoCollectorTest, DISABLED_GLVersionGL) { GPUInfo gpu_info; CollectGraphicsInfoGL(&gpu_info); - EXPECT_EQ(test_values_.gl_version, - gpu_info.gl_version); -} - -TEST_F(GPUInfoCollectorTest, DISABLED_GLVersionStringGL) { - GPUInfo gpu_info; - CollectGraphicsInfoGL(&gpu_info); - EXPECT_EQ(test_values_.gl_version_string, - gpu_info.gl_version_string); + EXPECT_EQ(test_values_.gl_version, gpu_info.gl_version); } TEST_F(GPUInfoCollectorTest, DISABLED_GLRendererGL) { GPUInfo gpu_info; CollectGraphicsInfoGL(&gpu_info); - EXPECT_EQ(test_values_.gl_renderer, - gpu_info.gl_renderer); + EXPECT_EQ(test_values_.gl_renderer, gpu_info.gl_renderer); } TEST_F(GPUInfoCollectorTest, DISABLED_GLVendorGL) { GPUInfo gpu_info; CollectGraphicsInfoGL(&gpu_info); - EXPECT_EQ(test_values_.gl_vendor, - gpu_info.gl_vendor); + EXPECT_EQ(test_values_.gl_vendor, gpu_info.gl_vendor); } TEST_F(GPUInfoCollectorTest, DISABLED_GLExtensionsGL) { GPUInfo gpu_info; CollectGraphicsInfoGL(&gpu_info); - EXPECT_EQ(test_values_.gl_extensions, - gpu_info.gl_extensions); -} - -#if defined(OS_LINUX) -TEST(GPUInfoCollectorUtilTest, DetermineActiveGPU) { - const uint32 kIntelVendorID = 0x8086; - const uint32 kIntelDeviceID = 0x0046; - GPUInfo::GPUDevice intel_gpu; - intel_gpu.vendor_id = kIntelVendorID; - intel_gpu.device_id = kIntelDeviceID; - - const uint32 kAMDVendorID = 0x1002; - const uint32 kAMDDeviceID = 0x68c1; - GPUInfo::GPUDevice amd_gpu; - amd_gpu.vendor_id = kAMDVendorID; - amd_gpu.device_id = kAMDDeviceID; - - // One GPU, do nothing. - { - GPUInfo gpu_info; - gpu_info.gpu = amd_gpu; - EXPECT_TRUE(DetermineActiveGPU(&gpu_info)); - } - - // Two GPUs, switched. - { - GPUInfo gpu_info; - gpu_info.gpu = amd_gpu; - gpu_info.secondary_gpus.push_back(intel_gpu); - gpu_info.gl_vendor = "Intel Open Source Technology Center"; - EXPECT_TRUE(DetermineActiveGPU(&gpu_info)); - EXPECT_EQ(kIntelVendorID, gpu_info.gpu.vendor_id); - EXPECT_EQ(kIntelDeviceID, gpu_info.gpu.device_id); - EXPECT_EQ(kAMDVendorID, gpu_info.secondary_gpus[0].vendor_id); - EXPECT_EQ(kAMDDeviceID, gpu_info.secondary_gpus[0].device_id); - } - - // Two GPUs, no switch necessary. - { - GPUInfo gpu_info; - gpu_info.gpu = intel_gpu; - gpu_info.secondary_gpus.push_back(amd_gpu); - gpu_info.gl_vendor = "Intel Open Source Technology Center"; - EXPECT_TRUE(DetermineActiveGPU(&gpu_info)); - EXPECT_EQ(kIntelVendorID, gpu_info.gpu.vendor_id); - EXPECT_EQ(kIntelDeviceID, gpu_info.gpu.device_id); - EXPECT_EQ(kAMDVendorID, gpu_info.secondary_gpus[0].vendor_id); - EXPECT_EQ(kAMDDeviceID, gpu_info.secondary_gpus[0].device_id); - } - - // Two GPUs, empty GL_VENDOR string. - { - GPUInfo gpu_info; - gpu_info.gpu = intel_gpu; - gpu_info.secondary_gpus.push_back(amd_gpu); - EXPECT_FALSE(DetermineActiveGPU(&gpu_info)); - } - - // Two GPUs, unhandled GL_VENDOR string. - { - GPUInfo gpu_info; - gpu_info.gpu = intel_gpu; - gpu_info.secondary_gpus.push_back(amd_gpu); - gpu_info.gl_vendor = "nouveau"; - EXPECT_FALSE(DetermineActiveGPU(&gpu_info)); - } + EXPECT_EQ(test_values_.gl_extensions, gpu_info.gl_extensions); } -#endif } // namespace gpu diff --git a/chromium/gpu/config/gpu_info_collector_win.cc b/chromium/gpu/config/gpu_info_collector_win.cc index 3b63296ff9e..65d75ec91a1 100644 --- a/chromium/gpu/config/gpu_info_collector_win.cc +++ b/chromium/gpu/config/gpu_info_collector_win.cc @@ -27,6 +27,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" +#include "base/strings/utf_string_conversions.h" #include "base/threading/thread.h" #include "base/threading/worker_pool.h" #include "base/win/registry.h" @@ -186,7 +187,7 @@ Version DisplayLinkVersion() { if (key.ReadValue(L"Version", &version)) return Version(); - return Version(WideToASCII(version)); + return Version(base::UTF16ToASCII(version)); } // Returns whether Lenovo dCute is installed. @@ -210,8 +211,9 @@ bool IsLenovoDCuteInstalled() { bool D3D11ShouldWork(const GPUInfo& gpu_info) { // TODO(apatrick): This is a temporary change to see what impact disabling // D3D11 stats collection has on Canary. +#if 1 return false; - +#else // Windows XP never supports D3D11. It seems to be less stable that D3D9 on // Vista. if (base::win::GetVersion() <= base::win::VERSION_VISTA) @@ -222,6 +224,7 @@ bool D3D11ShouldWork(const GPUInfo& gpu_info) { return false; return true; +#endif } // Collects information about the level of D3D11 support and records it in @@ -360,13 +363,14 @@ void CollectD3D11Support() { } // namespace anonymous #if !defined(GOOGLE_CHROME_BUILD) -AMDVideoCardType GetAMDVideocardType() { - return STANDALONE; +void GetAMDVideocardInfo(GPUInfo* gpu_info) { + DCHECK(gpu_info); + return; } #else // This function has a real implementation for official builds that can // be found in src/third_party/amd. -AMDVideoCardType GetAMDVideocardType(); +void GetAMDVideocardInfo(GPUInfo* gpu_info); #endif bool CollectDriverInfoD3D(const std::wstring& device_id, @@ -407,7 +411,7 @@ bool CollectDriverInfoD3D(const std::wstring& device_id, key, L"DriverVersion", NULL, NULL, reinterpret_cast<LPBYTE>(value), &dwcb_data); if (result == ERROR_SUCCESS) - driver_version = WideToASCII(std::wstring(value)); + driver_version = base::UTF16ToASCII(std::wstring(value)); std::string driver_date; dwcb_data = sizeof(value); @@ -415,7 +419,7 @@ bool CollectDriverInfoD3D(const std::wstring& device_id, key, L"DriverDate", NULL, NULL, reinterpret_cast<LPBYTE>(value), &dwcb_data); if (result == ERROR_SUCCESS) - driver_date = WideToASCII(std::wstring(value)); + driver_date = base::UTF16ToASCII(std::wstring(value)); std::string driver_vendor; dwcb_data = sizeof(value); @@ -423,16 +427,21 @@ bool CollectDriverInfoD3D(const std::wstring& device_id, key, L"ProviderName", NULL, NULL, reinterpret_cast<LPBYTE>(value), &dwcb_data); if (result == ERROR_SUCCESS) { - driver_vendor = WideToASCII(std::wstring(value)); + driver_vendor = base::UTF16ToASCII(std::wstring(value)); if (driver_vendor == "Advanced Micro Devices, Inc." || driver_vendor == "ATI Technologies Inc.") { // We are conservative and assume that in the absence of a clear // signal the videocard is assumed to be switchable. Additionally, // some switchable systems with Intel GPUs aren't correctly // detected, so always count them. - AMDVideoCardType amd_card_type = GetAMDVideocardType(); - gpu_info->amd_switchable = (gpu_info->gpu.vendor_id == 0x8086) || - (amd_card_type != STANDALONE); + GetAMDVideocardInfo(gpu_info); + if (!gpu_info->amd_switchable && + gpu_info->gpu.vendor_id == 0x8086) { + gpu_info->amd_switchable = true; + gpu_info->secondary_gpus.push_back(gpu_info->gpu); + gpu_info->gpu.vendor_id = 0x1002; + gpu_info->gpu.device_id = 0; // Unknown discrete AMD GPU. + } } } @@ -449,7 +458,7 @@ bool CollectDriverInfoD3D(const std::wstring& device_id, return found; } -bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { +CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info) { TRACE_EVENT0("gpu", "CollectGraphicsInfo"); DCHECK(gpu_info); @@ -459,12 +468,13 @@ bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kUseGL); if (requested_implementation_name == "swiftshader") { gpu_info->software_rendering = true; - return false; + return kCollectInfoNonFatalFailure; } } - if (!CollectGraphicsInfoGL(gpu_info)) - return false; + CollectInfoResult result = CollectGraphicsInfoGL(gpu_info); + if (result != kCollectInfoSuccess) + return result; // ANGLE's renderer strings are of the form: // ANGLE (<adapter_identifier> Direct3D<version> vs_x_x ps_x_x) @@ -514,7 +524,7 @@ bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { gpu_info->finalized = true; } - return true; + return kCollectInfoSuccess; } GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { @@ -537,16 +547,17 @@ GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { int vendor = 0, device = 0; std::wstring vendor_string = id.substr(8, 4); std::wstring device_string = id.substr(17, 4); - base::HexStringToInt(WideToASCII(vendor_string), &vendor); - base::HexStringToInt(WideToASCII(device_string), &device); + base::HexStringToInt(base::UTF16ToASCII(vendor_string), &vendor); + base::HexStringToInt(base::UTF16ToASCII(device_string), &device); *vendor_id = vendor; *device_id = device; - return kGpuIDSuccess; + if (*vendor_id != 0 && *device_id != 0) + return kGpuIDSuccess; } return kGpuIDFailure; } -bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { +CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { TRACE_EVENT0("gpu", "CollectPreliminaryGraphicsInfo"); DCHECK(gpu_info); @@ -587,18 +598,18 @@ bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { } if (id.length() <= 20) - return false; + return kCollectInfoNonFatalFailure; int vendor_id = 0, device_id = 0; base::string16 vendor_id_string = id.substr(8, 4); base::string16 device_id_string = id.substr(17, 4); - base::HexStringToInt(WideToASCII(vendor_id_string), &vendor_id); - base::HexStringToInt(WideToASCII(device_id_string), &device_id); + base::HexStringToInt(base::UTF16ToASCII(vendor_id_string), &vendor_id); + base::HexStringToInt(base::UTF16ToASCII(device_id_string), &device_id); gpu_info->gpu.vendor_id = vendor_id; gpu_info->gpu.device_id = device_id; // TODO(zmo): we only need to call CollectDriverInfoD3D() if we use ANGLE. if (!CollectDriverInfoD3D(id, gpu_info)) - return false; + return kCollectInfoNonFatalFailure; // Collect basic information about supported D3D11 features. Delay for 45 // seconds so as not to regress performance tests. @@ -620,20 +631,18 @@ bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { } } - return true; + return kCollectInfoSuccess; } -bool CollectDriverInfoGL(GPUInfo* gpu_info) { +CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { TRACE_EVENT0("gpu", "CollectDriverInfoGL"); if (!gpu_info->driver_version.empty()) - return true; + return kCollectInfoSuccess; - std::string gl_version_string = gpu_info->gl_version_string; - - return RE2::PartialMatch(gl_version_string, - "([\\d\\.]+)$", - &gpu_info->driver_version); + bool parsed = RE2::PartialMatch( + gpu_info->gl_version, "([\\d\\.]+)$", &gpu_info->driver_version); + return parsed ? kCollectInfoSuccess : kCollectInfoNonFatalFailure; } void MergeGPUInfo(GPUInfo* basic_gpu_info, @@ -650,12 +659,4 @@ void MergeGPUInfo(GPUInfo* basic_gpu_info, basic_gpu_info->dx_diagnostics = context_gpu_info.dx_diagnostics; } -bool DetermineActiveGPU(GPUInfo* gpu_info) { - DCHECK(gpu_info); - if (gpu_info->secondary_gpus.size() == 0) - return true; - // TODO(zmo): implement this. - return false; -} - } // namespace gpu diff --git a/chromium/gpu/config/gpu_info_collector_x11.cc b/chromium/gpu/config/gpu_info_collector_x11.cc index 12fe80d0033..5d29d384cdc 100644 --- a/chromium/gpu/config/gpu_info_collector_x11.cc +++ b/chromium/gpu/config/gpu_info_collector_x11.cc @@ -20,6 +20,7 @@ #include "library_loaders/libpci.h" #include "third_party/libXNVCtrl/NVCtrl.h" #include "third_party/libXNVCtrl/NVCtrlLib.h" +#include "ui/gfx/x/x11_types.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context.h" #include "ui/gl/gl_implementation.h" @@ -70,7 +71,7 @@ std::string CollectDriverVersionATI() { // Use NVCtrl extention to query NV driver version. // Return empty string on failing. std::string CollectDriverVersionNVidia() { - Display* display = base::MessagePumpForUI::GetDefaultXDisplay(); + Display* display = gfx::GetXDisplay(); if (!display) { LOG(ERROR) << "XOpenDisplay failed."; return std::string(); @@ -124,8 +125,18 @@ bool CollectPCIVideoCardInfo(GPUInfo* gpu_info) { device != NULL; device = device->next) { // Fill the IDs and class fields. (libpci_loader.pci_fill_info)(device, 33); - // TODO(zmo): there might be other classes that qualify as display devices. - if (device->device_class != 0x0300) // Device class is DISPLAY_VGA. + bool is_gpu = false; + switch (device->device_class) { + case PCI_CLASS_DISPLAY_VGA: + case PCI_CLASS_DISPLAY_XGA: + case PCI_CLASS_DISPLAY_3D: + is_gpu = true; + break; + case PCI_CLASS_DISPLAY_OTHER: + default: + break; + } + if (!is_gpu) continue; GPUInfo::GPUDevice gpu; @@ -162,29 +173,9 @@ bool CollectPCIVideoCardInfo(GPUInfo* gpu_info) { return (primary_gpu_identified); } -// Find the first GPU in |secondary_gpus| list that matches |active_vendor| -// and switch it to primary gpu. -// Return false if we cannot find a match. -bool FindAndSetActiveGPU(GPUInfo* gpu_info, uint32 active_vendor) { - DCHECK(gpu_info); - GPUInfo::GPUDevice* device = NULL; - for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { - if (gpu_info->secondary_gpus[ii].vendor_id == active_vendor) { - device = &(gpu_info->secondary_gpus[ii]); - break; - } - } - if (device == NULL) - return false; - GPUInfo::GPUDevice temp = gpu_info->gpu; - gpu_info->gpu = *device; - *device = temp; - return true; -} - } // namespace anonymous -bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { +CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo"); @@ -203,10 +194,9 @@ bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { #endif } + CollectInfoResult result = CollectGraphicsInfoGL(gpu_info); gpu_info->finalized = true; - bool rt = CollectGraphicsInfoGL(gpu_info); - - return rt; + return result; } GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { @@ -218,12 +208,13 @@ GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { if (CollectPCIVideoCardInfo(&gpu_info)) { *vendor_id = gpu_info.gpu.vendor_id; *device_id = gpu_info.gpu.device_id; - return kGpuIDSuccess; + if (*vendor_id != 0 && *device_id != 0) + return kGpuIDSuccess; } return kGpuIDFailure; } -bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { +CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); bool rt = CollectPCIVideoCardInfo(gpu_info); @@ -247,43 +238,48 @@ bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { case kVendorIDIntel: // In dual-GPU cases, sometimes PCI scan only gives us the // integrated GPU (i.e., the Intel one). - driver_version = CollectDriverVersionNVidia(); - if (!driver_version.empty()) { - gpu_info->driver_vendor = "NVIDIA"; - gpu_info->driver_version = driver_version; - // Machines with more than two GPUs are not handled. - if (gpu_info->secondary_gpus.size() <= 1) + if (gpu_info->secondary_gpus.size() == 0) { + driver_version = CollectDriverVersionNVidia(); + if (!driver_version.empty()) { + gpu_info->driver_vendor = "NVIDIA"; + gpu_info->driver_version = driver_version; gpu_info->optimus = true; + // Put Intel to the secondary GPU list. + gpu_info->secondary_gpus.push_back(gpu_info->gpu); + // Put NVIDIA as the primary GPU. + gpu_info->gpu.vendor_id = kVendorIDNVidia; + gpu_info->gpu.device_id = 0; // Unknown Device. + } } break; } - return rt; + return rt ? kCollectInfoSuccess : kCollectInfoNonFatalFailure; } -bool CollectDriverInfoGL(GPUInfo* gpu_info) { +CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) { DCHECK(gpu_info); - std::string gl_version_string = gpu_info->gl_version_string; - if (StartsWithASCII(gl_version_string, "OpenGL ES", true)) - gl_version_string = gl_version_string.substr(10); + std::string gl_version = gpu_info->gl_version; + if (StartsWithASCII(gl_version, "OpenGL ES", true)) + gl_version = gl_version.substr(10); std::vector<std::string> pieces; - base::SplitStringAlongWhitespace(gl_version_string, &pieces); + base::SplitStringAlongWhitespace(gl_version, &pieces); // In linux, the gl version string might be in the format of // GLVersion DriverVendor DriverVersion if (pieces.size() < 3) - return false; + return kCollectInfoNonFatalFailure; std::string driver_version = pieces[2]; size_t pos = driver_version.find_first_not_of("0123456789."); if (pos == 0) - return false; + return kCollectInfoNonFatalFailure; if (pos != std::string::npos) driver_version = driver_version.substr(0, pos); gpu_info->driver_vendor = pieces[1]; gpu_info->driver_version = driver_version; - return true; + return kCollectInfoSuccess; } void MergeGPUInfo(GPUInfo* basic_gpu_info, @@ -291,33 +287,4 @@ void MergeGPUInfo(GPUInfo* basic_gpu_info, MergeGPUInfoGL(basic_gpu_info, context_gpu_info); } -bool DetermineActiveGPU(GPUInfo* gpu_info) { - DCHECK(gpu_info); - if (gpu_info->secondary_gpus.size() == 0) - return true; - if (gpu_info->gl_vendor.empty()) - return false; - uint32 active_vendor = 0; - // For now we only handle Intel/NVIDIA/AMD. - if (gpu_info->gl_vendor.find("Intel") != std::string::npos) { - if (gpu_info->gpu.vendor_id == kVendorIDIntel) - return true; - active_vendor = kVendorIDIntel; - } - if (gpu_info->gl_vendor.find("NVIDIA") != std::string::npos) { - if (gpu_info->gpu.vendor_id == kVendorIDNVidia) - return true; - active_vendor = kVendorIDNVidia; - } - if (gpu_info->gl_vendor.find("ATI") != std::string::npos || - gpu_info->gl_vendor.find("AMD") != std::string::npos) { - if (gpu_info->gpu.vendor_id == kVendorIDAMD) - return true; - active_vendor = kVendorIDAMD; - } - if (active_vendor == 0) - return false; - return FindAndSetActiveGPU(gpu_info, active_vendor); -} - } // namespace gpu diff --git a/chromium/gpu/config/gpu_info_unittest.cc b/chromium/gpu/config/gpu_info_unittest.cc index 42cbd3c7091..1843b5ae516 100644 --- a/chromium/gpu/config/gpu_info_unittest.cc +++ b/chromium/gpu/config/gpu_info_unittest.cc @@ -21,7 +21,6 @@ TEST(GPUInfoBasicTest, EmptyGPUInfo) { 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, ""); diff --git a/chromium/gpu/config/gpu_test_config.cc b/chromium/gpu/config/gpu_test_config.cc index d99f71dc45e..e3d489c25fa 100644 --- a/chromium/gpu/config/gpu_test_config.cc +++ b/chromium/gpu/config/gpu_test_config.cc @@ -12,6 +12,8 @@ #if defined(OS_MACOSX) #include "base/mac/mac_util.h" +#elif defined(OS_WIN) +#include "base/win/windows_version.h" #endif namespace gpu { @@ -35,7 +37,7 @@ GPUTestConfig::OS GetCurrentOS() { return GPUTestConfig::kOsWinVista; if (major_version == 6 && minor_version == 1) return GPUTestConfig::kOsWin7; - if (major_version == 6 && minor_version == 2) + if (major_version == 6 && (minor_version == 2 || minor_version == 3)) return GPUTestConfig::kOsWin8; #elif defined(OS_MACOSX) int32 major_version = 0; @@ -53,6 +55,8 @@ GPUTestConfig::OS GetCurrentOS() { return GPUTestConfig::kOsMacLion; case 8: return GPUTestConfig::kOsMacMountainLion; + case 9: + return GPUTestConfig::kOsMacMavericks; } } #elif defined(OS_ANDROID) @@ -167,6 +171,7 @@ bool GPUTestBotConfig::IsValid() const { case kOsMacSnowLeopard: case kOsMacLion: case kOsMacMountainLion: + case kOsMacMavericks: case kOsLinux: case kOsChromeOS: case kOsAndroid: @@ -232,6 +237,7 @@ bool GPUTestBotConfig::LoadCurrentConfig(const GPUInfo* gpu_info) { result = CollectGpuID(&my_gpu_info.gpu.vendor_id, &my_gpu_info.gpu.device_id); if (result == kGpuIDNotSupported) { + LOG(ERROR) << "Fail to identify GPU"; DisableGPUInfoValidation(); rt = true; } else { @@ -241,8 +247,10 @@ bool GPUTestBotConfig::LoadCurrentConfig(const GPUInfo* gpu_info) { rt = SetGPUInfo(*gpu_info); } set_os(GetCurrentOS()); - if (os() == kOsUnknown) + if (os() == kOsUnknown) { + LOG(ERROR) << "Unknown OS"; rt = false; + } #if defined(NDEBUG) set_build_type(kBuildTypeRelease); #else @@ -279,8 +287,12 @@ bool GPUTestBotConfig::GpuBlacklistedOnBot() { if (CurrentConfigMatches("MAC VMWARE") && base::mac::IsOSLionOrEarlier()) { return true; } +#elif defined(OS_WIN) + // Blacklist rule #79 disables all Gpu acceleration before Windows 7. + if (base::win::GetVersion() <= base::win::VERSION_VISTA) { + return true; + } #endif - // TODO(ccameron): This should be true on Windows XP as well. return false; } diff --git a/chromium/gpu/config/gpu_test_config.h b/chromium/gpu/config/gpu_test_config.h index 2b0db4c9cb6..635a97775bc 100644 --- a/chromium/gpu/config/gpu_test_config.h +++ b/chromium/gpu/config/gpu_test_config.h @@ -29,11 +29,12 @@ class GPU_EXPORT GPUTestConfig { kOsMacSnowLeopard = 1 << 5, kOsMacLion = 1 << 6, kOsMacMountainLion = 1 << 7, + kOsMacMavericks = 1 << 8, kOsMac = kOsMacLeopard | kOsMacSnowLeopard | kOsMacLion | - kOsMacMountainLion, - kOsLinux = 1 << 8, - kOsChromeOS = 1 << 9, - kOsAndroid = 1 << 10, + kOsMacMountainLion | kOsMacMavericks, + kOsLinux = 1 << 9, + kOsChromeOS = 1 << 10, + kOsAndroid = 1 << 11, }; enum BuildType { diff --git a/chromium/gpu/config/gpu_test_expectations_parser.cc b/chromium/gpu/config/gpu_test_expectations_parser.cc index dd08db60b84..ef1e7f45234 100644 --- a/chromium/gpu/config/gpu_test_expectations_parser.cc +++ b/chromium/gpu/config/gpu_test_expectations_parser.cc @@ -36,6 +36,7 @@ enum Token { kConfigMacSnowLeopard, kConfigMacLion, kConfigMacMountainLion, + kConfigMacMavericks, kConfigMac, kConfigLinux, kConfigChromeOS, @@ -81,6 +82,7 @@ const TokenInfo kTokenData[] = { { "snowleopard", GPUTestConfig::kOsMacSnowLeopard }, { "lion", GPUTestConfig::kOsMacLion }, { "mountainlion", GPUTestConfig::kOsMacMountainLion }, + { "mavericks", GPUTestConfig::kOsMacMavericks }, { "mac", GPUTestConfig::kOsMac }, { "linux", GPUTestConfig::kOsLinux }, { "chromeos", GPUTestConfig::kOsChromeOS }, @@ -232,6 +234,7 @@ bool GPUTestExpectationsParser::ParseConfig( case kConfigMacSnowLeopard: case kConfigMacLion: case kConfigMacMountainLion: + case kConfigMacMavericks: case kConfigMac: case kConfigLinux: case kConfigChromeOS: @@ -282,6 +285,7 @@ bool GPUTestExpectationsParser::ParseLine( case kConfigMacSnowLeopard: case kConfigMacLion: case kConfigMacMountainLion: + case kConfigMacMavericks: case kConfigMac: case kConfigLinux: case kConfigChromeOS: @@ -395,6 +399,7 @@ bool GPUTestExpectationsParser::UpdateTestConfig( case kConfigMacSnowLeopard: case kConfigMacLion: case kConfigMacMountainLion: + case kConfigMacMavericks: case kConfigMac: case kConfigLinux: case kConfigChromeOS: diff --git a/chromium/gpu/config/gpu_test_expectations_parser_unittest.cc b/chromium/gpu/config/gpu_test_expectations_parser_unittest.cc index 79c169c1a85..810a1a8bc01 100644 --- a/chromium/gpu/config/gpu_test_expectations_parser_unittest.cc +++ b/chromium/gpu/config/gpu_test_expectations_parser_unittest.cc @@ -92,7 +92,7 @@ TEST_F(GPUTestExpectationsParserTest, ValidUnrelatedTestEntry) { TEST_F(GPUTestExpectationsParserTest, AllModifiers) { const std::string text = "BUG12345 XP VISTA WIN7 WIN8 LEOPARD SNOWLEOPARD LION MOUNTAINLION " - "LINUX CHROMEOS ANDROID " + "MAVERICKS LINUX CHROMEOS ANDROID " "NVIDIA INTEL AMD VMWARE RELEASE DEBUG : MyTest = " "PASS FAIL FLAKY TIMEOUT SKIP"; diff --git a/chromium/gpu/config/gpu_util.cc b/chromium/gpu/config/gpu_util.cc index f2c861b5169..4605981cfb9 100644 --- a/chromium/gpu/config/gpu_util.cc +++ b/chromium/gpu/config/gpu_util.cc @@ -67,6 +67,8 @@ void ApplyGpuDriverBugWorkarounds( GpuControlList::kCurrentOsOnly); std::set<int> workarounds = list->MakeDecision( GpuControlList::kOsAny, std::string(), gpu_info); + GpuDriverBugList::AppendWorkaroundsFromCommandLine( + &workarounds, *command_line); if (!workarounds.empty()) { command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, IntSetToString(workarounds)); diff --git a/chromium/gpu/config/gpu_util.h b/chromium/gpu/config/gpu_util.h index 39aeb205677..21c802cbbb1 100644 --- a/chromium/gpu/config/gpu_util.h +++ b/chromium/gpu/config/gpu_util.h @@ -8,10 +8,13 @@ #include <set> #include <string> +#include "base/command_line.h" #include "build/build_config.h" #include "gpu/gpu_export.h" +namespace base { class CommandLine; +} namespace gpu { @@ -23,12 +26,12 @@ GPU_EXPORT void MergeFeatureSets( // Collect basic GPUInfo, compute the driver bug workarounds for the current // system, and append the |command_line|. -GPU_EXPORT void ApplyGpuDriverBugWorkarounds(CommandLine* command_line); +GPU_EXPORT void ApplyGpuDriverBugWorkarounds(base::CommandLine* command_line); // With provided GPUInfo, compute the driver bug workarounds for the current // system, and append the |command_line|. GPU_EXPORT void ApplyGpuDriverBugWorkarounds( - const GPUInfo& gpu_inco, CommandLine* command_line); + const GPUInfo& gpu_inco, base::CommandLine* command_line); // |str| is in the format of "feature1,feature2,...,featureN". GPU_EXPORT void StringToFeatureSet( diff --git a/chromium/gpu/config/software_rendering_list_json.cc b/chromium/gpu/config/software_rendering_list_json.cc index f1b737d8c46..52614eb519f 100644 --- a/chromium/gpu/config/software_rendering_list_json.cc +++ b/chromium/gpu/config/software_rendering_list_json.cc @@ -18,7 +18,7 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( { "name": "software rendering list", // Please update the version number whenever you change this file. - "version": "6.21", + "version": "8.8", "entries": [ { "id": 1, @@ -68,8 +68,8 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( }, { "id": 5, - "description": "ATI/AMD cards with older or third-party drivers in Linux are crash-prone", - "cr_bugs": [71381, 76428, 73910, 101225, 136240], + "description": "ATI/AMD cards with older drivers in Linux are crash-prone", + "cr_bugs": [71381, 76428, 73910, 101225, 136240, 357314], "os": { "type": "linux" }, @@ -85,6 +85,16 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "style": "lexical", "value": "8.98" } + }, + { + "driver_vendor": { + "op": "=", + "value": "Mesa" + }, + "driver_version": { + "op": ">=", + "value": "10.0.4" + } } ], "features": [ @@ -151,29 +161,21 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ] }, { - "id": 16, - "description": "Multisampling is buggy in ATI cards on older MacOSX", - "cr_bugs": [67752, 83153], - "os": { - "type": "macosx", - "version": { - "op": "<", - "value": "10.7.2" - } - }, - "vendor_id": "0x1002", - "features": [ - "multisampling" - ] - }, - { "id": 17, - "description": "Intel mesa drivers are crash-prone", - "cr_bugs": [76703, 164555, 225200], + "description": "Older Intel mesa drivers are crash-prone", + "cr_bugs": [76703, 164555, 225200, 340886], "os": { "type": "linux" }, "vendor_id": "0x8086", + "driver_vendor": { + "op": "=", + "value": "Mesa" + }, + "driver_version": { + "op": "<", + "value": "10.1" + }, "exceptions": [ { "device_id": ["0x0102", "0x0106", "0x0112", "0x0116", "0x0122", "0x0126", "0x010a", "0x0152", "0x0156", "0x015a", "0x0162", "0x0166"], @@ -202,6 +204,13 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "op": ">=", "value": "9.1" } + }, + { + "device_id": ["0x0a16", "0x0a26"], + "driver_version": { + "op": ">=", + "value": "10.0.1" + } } ], "features": [ @@ -260,7 +269,7 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( { "id": 27, "description": "ATI/AMD cards with older drivers in Linux are crash-prone", - "cr_bugs": [95934, 94973, 136240], + "cr_bugs": [95934, 94973, 136240, 357314], "os": { "type": "linux" }, @@ -279,6 +288,16 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "style": "lexical", "value": "8.98" } + }, + { + "driver_vendor": { + "op": "=", + "value": "Mesa" + }, + "driver_version": { + "op": ">=", + "value": "10.0.4" + } } ], "features": [ @@ -288,7 +307,7 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( { "id": 28, "description": "ATI/AMD cards with third-party drivers in Linux are crash-prone", - "cr_bugs": [95934, 94973], + "cr_bugs": [95934, 94973, 357314], "os": { "type": "linux" }, @@ -300,6 +319,18 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "op": "contains", "value": "AMD" }, + "exceptions": [ + { + "driver_vendor": { + "op": "=", + "value": "Mesa" + }, + "driver_version": { + "op": ">=", + "value": "10.0.4" + } + } + ], "features": [ "all" ] @@ -307,7 +338,7 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( { "id": 29, "description": "ATI/AMD cards with third-party drivers in Linux are crash-prone", - "cr_bugs": [95934, 94973], + "cr_bugs": [95934, 94973, 357314], "os": { "type": "linux" }, @@ -319,6 +350,18 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "op": "contains", "value": "ATI" }, + "exceptions": [ + { + "driver_vendor": { + "op": "=", + "value": "Mesa" + }, + "driver_version": { + "op": ">=", + "value": "10.0.4" + } + } + ], "features": [ "all" ] @@ -369,19 +412,6 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ] }, { - "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], @@ -407,12 +437,28 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( }, { "id": 37, - "description": "Drivers are unreliable for Optimus on Linux", - "cr_bugs": [131308], + "description": "Older drivers are unreliable for Optimus on Linux", + "cr_bugs": [131308, 363418], "os": { "type": "linux" }, "multi_gpu_style": "optimus", + "exceptions": [ + { + "driver_vendor": { + "op": "=", + "value": "Mesa" + }, + "driver_version": { + "op": ">=", + "value": "10.1" + }, + "gl_vendor": { + "op": "beginwith", + "value": "Intel" + } + } + ], "features": [ "all" ] @@ -566,8 +612,8 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( }, { "id": 50, - "description": "Disable VMware software renderer", - "cr_bugs": [145531], + "description": "Disable VMware software renderer on older Mesa", + "cr_bugs": [145531, 332596], "os": { "type": "linux" }, @@ -575,6 +621,22 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "op": "beginwith", "value": "VMware" }, + "exceptions": [ + { + "driver_vendor": { + "op": "=", + "value": "Mesa" + }, + "driver_version": { + "op": ">=", + "value": "9.2.1" + }, + "gl_renderer": { + "op": "contains", + "value": "SVGA3D" + } + } + ], "features": [ "all" ] @@ -633,7 +695,6 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( "value": "NVIDIA" }, "features": [ - "accelerated_video", "accelerated_video_decode", "flash_3d", "flash_stage3d" @@ -676,38 +737,6 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ] }, { - "id": 60, - "description": "Multisampling is buggy on Mac with NVIDIA gpu prior to 10.8.3", - "cr_bugs": [137303], - "os": { - "type": "macosx", - "version": { - "op": "<", - "value": "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": "<", - "value": "10.8.3" - } - }, - "vendor_id": "0x8086", - "features": [ - "multisampling" - ] - }, - { "id": 62, "description": "Accelerated 2D canvas buggy on old Qualcomm Adreno", "cr_bugs": [161575], @@ -727,22 +756,6 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ] }, { - "id": 63, - "description": "Multisampling is buggy on Mac with AMD gpu prior to 10.8.3", - "cr_bugs": [162466], - "os": { - "type": "macosx", - "version": { - "op": "<", - "value": "10.8.3" - } - }, - "vendor_id": "0x1002", - "features": [ - "multisampling" - ] - }, - { "id": 64, "description": "Hardware video decode is only supported in win7+", "cr_bugs": [159458], @@ -918,30 +931,11 @@ LONG_STRING_CONST( "value": "6.0" } }, - "exceptions": [ - { - "driver_vendor": { - "op": "=", - "value": "osmesa" - } - } - ], "features": [ "all" ] }, { - "id": 80, - "description": "Texture sharing should be disabled on all Windows machines", - "cr_bugs": [304369, 315215], - "os": { - "type": "win" - }, - "features": [ - "texture_sharing" - ] - }, - { "id": 81, "description": "Apple software renderer used under VMWare hangs on Mac OS 10.6 and 10.7", "cr_bugs": [230931], @@ -978,44 +972,114 @@ LONG_STRING_CONST( "value": "4.1.2" } }, - "machine_model": { - "name": { - "op": "=", - "value": "GT-N7100" - } + "machine_model_name": ["GT-N7100"], + "features": [ + "accelerated_video_decode" + ] + }, + { + "id": 85, + "description": "Samsung Gaxlaxy S4 is too buggy to use for video decoding", + "cr_bugs": [329072], + "os": { + "type": "android" }, + "machine_model_name": ["SCH-I545"], "features": [ "accelerated_video_decode" ] }, { - "id": 84, - "description": "Incorrect rendering in pink with NVIDIA driver 9.18.13.3165 on Windows", - "cr_bugs": [319115], + "id": 86, + "description": "Intel Graphics Media Accelerator 3150 causes the GPU process to hang running WebGL", + "cr_bugs": [305431], "os": { "type": "win" }, - "vendor_id": "0x10de", + "vendor_id": "0x8086", + "device_id": ["0xa011"], + "features": [ + "webgl" + ] + }, + { + "id": 87, + "description": "Accelerated video decode on Intel driver 10.18.10.3308 is incompatible with the GPU sandbox", + "cr_bugs": [298968], + "os": { + "type": "win" + }, + "vendor_id": "0x8086", "driver_version": { "op": "=", - "value": "9.18.13.3165" + "value": "10.18.10.3308" }, "features": [ - "all" + "accelerated_video_decode" ] }, { - "id": 85, - "description": "Samsung Gaxlaxy S4 is too buggy to use for video decoding", - "cr_bugs": [329072], + "id": 88, + "description": "Accelerated video decode on AMD driver 13.152.1.8000 is incompatible with the GPU sandbox", + "cr_bugs": [298968], "os": { - "type": "android" + "type": "win" }, - "machine_model": { - "name": { - "op": "=", - "value": "SCH-I545" - } + "vendor_id": "0x1002", + "driver_version": { + "op": "=", + "value": "13.152.1.8000" + }, + "features": [ + "accelerated_video_decode" + ] + }, + { + "id": 89, + "description": "Accelerated video decode interferes with GPU sandbox on certain AMD drivers", + "cr_bugs": [298968], + "os": { + "type": "win" + }, + "vendor_id": "0x1002", + "driver_version": { + "op": "between", + "value": "8.810.4.5000", + "value2": "8.970.100.1100" + }, + "features": [ + "accelerated_video_decode" + ] + }, + { + "id": 90, + "description": "Accelerated video decode interferes with GPU sandbox on certain NVIDIA drivers", + "cr_bugs": [298968], + "os": { + "type": "win" + }, + "vendor_id": "0x10de", + "driver_version": { + "op": "between", + "value": "8.17.12.5729", + "value2": "8.17.12.8026" + }, + "features": [ + "accelerated_video_decode" + ] + }, + { + "id": 91, + "description": "Accelerated video decode interferes with GPU sandbox on certain NVIDIA drivers", + "cr_bugs": [298968], + "os": { + "type": "win" + }, + "vendor_id": "0x10de", + "driver_version": { + "op": "between", + "value": "9.18.13.783", + "value2": "9.18.13.1090" }, "features": [ "accelerated_video_decode" @@ -1028,12 +1092,108 @@ LONG_STRING_CONST( "os": { "type": "win" }, - "multi_gpu_style": "amd_switchable", + "multi_gpu_style": "amd_switchable_discrete", "features": [ "accelerated_video_decode" ] + }, + { + "id": 93, + "description": "GLX indirect rendering (X remoting) is not supported", + "cr_bugs": [72373], + "os": { + "type": "linux" + }, + "direct_rendering": false, + "features": [ + "all" + ] + }, + { + "id": 94, + "description": "Intel driver version 8.15.10.1749 causes GPU process hangs.", + "cr_bugs": [350566], + "os": { + "type": "win" + }, + "vendor_id": "0x8086", + "driver_version": { + "op": "=", + "value": "8.15.10.1749" + }, + "features": [ + "all" + ] + }, + { + "id": 95, + "description": "AMD driver version 13.101 is unstable on linux.", + "cr_bugs": [363378], + "os": { + "type": "linux" + }, + "vendor_id": "0x1002", + "driver_vendor": { + "op": "contains", + "value": "AMD" + }, + "driver_version": { + "op": "=", + "value": "13.101" + }, + "features": [ + "all" + ] + }, + { + "id": 96, + "description": "GPU rasterization is whitelisted on N4, N5, N7 and Moto X", + "cr_bugs": [362779], + "exceptions": [ + { + "os": { + "type": "android" + }, + "machine_model_name": ["Nexus 4", "Nexus 5", "Nexus 7", + "XT1049", "XT1050", "XT1052", "XT1053", + "XT1055", "XT1056", "XT1058", "XT1060"] + }, + { + "os": { + "type": "android", + "version": { + "op": ">=", + "value": "4.4.99" + } + } + } + ], + "features": [ + "gpu_rasterization" + ] + }, + { + "id": 97, + "description": "Additional GPU rasterization whitelist for field trial", + "cr_bugs": [380694], + "exceptions": [ + { + "os": { + "type": "android" + }, + "machine_model_name": ["HTC One", + "C5303", "C6603", "C6903", + "GT-I8262", "GT-I8552", "GT-I9195", "GT-I9300", + "GT-I9500", "GT-I9505", "GT-N7100", + "SAMSUNG-SCH-I337", "SCH-I545", "SGH-M919", + "SM-N900", "SM-N9005", "SPH-L720", + "XT907", "XT1032", "XT1033", "XT1080"] + } + ], + "features": [ + "gpu_rasterization_field_trial" + ] } - ] } |