From 394e596bb817f3db6cf9f8834f5d24492f7ddc94 Mon Sep 17 00:00:00 2001 From: kkinnunen Date: Mon, 1 Feb 2016 00:30:42 -0800 Subject: Set disabled GL extensions from gpu driver bug list for the test executables Apply disabled GL extensions from gpu driver bug list for all the gpu related executables. This makes it possible to use the disabled extensions in gpu driver bug list so that they apply to unit tests. This is needed in order to implement and test features that are likely to not work at all unless disabled extensions work. BUG=344330 Review URL: https://codereview.chromium.org/1215063005 Cr-Commit-Position: refs/heads/master@{#372624} --- gpu/config/gpu_driver_bug_list_json.cc | 18 +++++------------- gpu/config/gpu_driver_bug_workaround_type.h | 4 ---- gpu/config/gpu_util.cc | 29 ++++++++++++++++++++++------- gpu/config/gpu_util.h | 11 ++++------- gpu/config/gpu_util_unittest.cc | 29 +++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 31 deletions(-) (limited to 'gpu/config') diff --git a/gpu/config/gpu_driver_bug_list_json.cc b/gpu/config/gpu_driver_bug_list_json.cc index 1838efd..95d713f 100644 --- a/gpu/config/gpu_driver_bug_list_json.cc +++ b/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": "8.41", + "version": "8.42", "entries": [ { "id": 1, @@ -1439,9 +1439,7 @@ LONG_STRING_CONST( "op": "<", "value": "346" }, - "features": [ - "disable_gl_path_rendering" - ] + "disabled_extensions": ["GL_NV_path_rendering"] }, { "id": 124, @@ -1582,9 +1580,7 @@ LONG_STRING_CONST( } }, "gl_vendor": "Qualcomm.*", - "features": [ - "disable_ext_srgb" - ] + "disabled_extensions": ["GL_EXT_sRGB"] }, { "id": 135, @@ -1635,9 +1631,7 @@ LONG_STRING_CONST( "op": "<", "value": "346" }, - "features": [ - "disable_gl_path_rendering" - ] + "disabled_extensions": ["GL_NV_path_rendering"] }, { "id": 139, @@ -1670,9 +1664,7 @@ LONG_STRING_CONST( }, "gl_vendor": "Qualcomm", "gl_renderer": "Adreno \\(TM\\) 4.*", // Originally on 418. - "features": [ - "disable_ext_srgb" - ] + "disabled_extensions": ["GL_EXT_sRGB"] }, { "id": 141, diff --git a/gpu/config/gpu_driver_bug_workaround_type.h b/gpu/config/gpu_driver_bug_workaround_type.h index bccf63b..b139643 100644 --- a/gpu/config/gpu_driver_bug_workaround_type.h +++ b/gpu/config/gpu_driver_bug_workaround_type.h @@ -34,10 +34,6 @@ disable_discard_framebuffer) \ GPU_OP(DISABLE_EXT_DRAW_BUFFERS, \ disable_ext_draw_buffers) \ - GPU_OP(DISABLE_EXT_SRGB, \ - disable_ext_srgb) \ - GPU_OP(DISABLE_GL_PATH_RENDERING, \ - disable_gl_path_rendering) \ GPU_OP(DISABLE_GL_RGB_FORMAT, \ disable_gl_rgb_format) \ GPU_OP(DISABLE_MSAA_ON_NON_WEBGL_CONTEXTS, \ diff --git a/gpu/config/gpu_util.cc b/gpu/config/gpu_util.cc index 80a99fb..34fac58 100644 --- a/gpu/config/gpu_util.cc +++ b/gpu/config/gpu_util.cc @@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" +#include "base/strings/string_util.h" #include "gpu/config/gpu_control_list_jsons.h" #include "gpu/config/gpu_driver_bug_list.h" #include "gpu/config/gpu_info_collector.h" @@ -53,13 +54,6 @@ void MergeFeatureSets(std::set* dst, const std::set& src) { dst->insert(src.begin(), src.end()); } -void ApplyGpuDriverBugWorkarounds(base::CommandLine* command_line) { - GPUInfo gpu_info; - CollectBasicGraphicsInfo(&gpu_info); - - ApplyGpuDriverBugWorkarounds(gpu_info, command_line); -} - void ApplyGpuDriverBugWorkarounds(const GPUInfo& gpu_info, base::CommandLine* command_line) { scoped_ptr list(GpuDriverBugList::Create()); @@ -73,6 +67,27 @@ void ApplyGpuDriverBugWorkarounds(const GPUInfo& gpu_info, command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, IntSetToString(workarounds)); } + + std::set disabled_extensions; + std::vector buglist_disabled_extensions = + list->GetDisabledExtensions(); + disabled_extensions.insert(buglist_disabled_extensions.begin(), + buglist_disabled_extensions.end()); + + if (command_line->HasSwitch(switches::kDisableGLExtensions)) { + std::vector existing_disabled_extensions = base::SplitString( + command_line->GetSwitchValueASCII(switches::kDisableGLExtensions), " ", + base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + disabled_extensions.insert(existing_disabled_extensions.begin(), + existing_disabled_extensions.end()); + } + + if (!disabled_extensions.empty()) { + std::vector v(disabled_extensions.begin(), + disabled_extensions.end()); + command_line->AppendSwitchASCII(switches::kDisableGLExtensions, + base::JoinString(v, " ")); + } } void StringToFeatureSet( diff --git a/gpu/config/gpu_util.h b/gpu/config/gpu_util.h index 21c802c..6b89303 100644 --- a/gpu/config/gpu_util.h +++ b/gpu/config/gpu_util.h @@ -24,14 +24,11 @@ struct GPUInfo; GPU_EXPORT void MergeFeatureSets( std::set* dst, const std::set& src); -// Collect basic GPUInfo, compute the driver bug workarounds for the current -// system, and append the |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|. +// With provided GPUInfo, compute the driver bug workarounds and disabled +// extensions for the current system, and append the |command_line|. GPU_EXPORT void ApplyGpuDriverBugWorkarounds( - const GPUInfo& gpu_inco, base::CommandLine* command_line); + const GPUInfo& gpu_info, + base::CommandLine* command_line); // |str| is in the format of "feature1,feature2,...,featureN". GPU_EXPORT void StringToFeatureSet( diff --git a/gpu/config/gpu_util_unittest.cc b/gpu/config/gpu_util_unittest.cc index e1264db..fb7fd2b 100644 --- a/gpu/config/gpu_util_unittest.cc +++ b/gpu/config/gpu_util_unittest.cc @@ -3,7 +3,14 @@ // found in the LICENSE file. #include "gpu/config/gpu_util.h" +#include "base/memory/scoped_ptr.h" +#include "base/strings/string_split.h" +#include "gpu/config/gpu_control_list_jsons.h" +#include "gpu/config/gpu_driver_bug_list.h" +#include "gpu/config/gpu_info.h" +#include "gpu/config/gpu_info_collector.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/gl/gl_switches.h" namespace gpu { @@ -68,4 +75,26 @@ TEST(GpuUtilTest, StringToFeatureSet) { } } +TEST(GpuUtilTest, + ApplyGpuDriverBugWorkarounds_DisabledExtensions) { + GPUInfo gpu_info; + CollectBasicGraphicsInfo(&gpu_info); + scoped_ptr list(GpuDriverBugList::Create()); + list->LoadList(kGpuDriverBugListJson, GpuControlList::kCurrentOsOnly); + list->MakeDecision(GpuControlList::kOsAny, std::string(), gpu_info); + std::vector expected_disabled_extensions = + list->GetDisabledExtensions(); + base::CommandLine command_line(base::CommandLine::NO_PROGRAM); + ApplyGpuDriverBugWorkarounds(gpu_info, &command_line); + + std::vector actual_disabled_extensions = base::SplitString( + command_line.GetSwitchValueASCII(switches::kDisableGLExtensions), ", ;", + base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + sort(expected_disabled_extensions.begin(), + expected_disabled_extensions.end()); + sort(actual_disabled_extensions.begin(), actual_disabled_extensions.end()); + + EXPECT_EQ(expected_disabled_extensions, actual_disabled_extensions); +} + } // namespace gpu -- cgit v1.1