Skip to content

Commit

Permalink
Remove kGpuDriverBugWorkarounds commandline switch.
Browse files Browse the repository at this point in the history
It was used to pass workarounds from browser process to GPU process, which is
no longer necessary.

Also, this CL wires up platform specific (GLX, EGL, WGL) disabled extensions
for in-process-gpu mode.

BUG=744658
TEST=gpu bots
R=kbr@chromium.org

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ic5d40229f8b6e5a65332b97449aee5ecfa7cd716
Reviewed-on: https://chromium-review.googlesource.com/641981
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#498511}
  • Loading branch information
zhenyao authored and Commit Bot committed Aug 30, 2017
1 parent bc6b6ce commit 10aee7a
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 117 deletions.
5 changes: 0 additions & 5 deletions content/browser/gpu/gpu_data_manager_impl_private.cc
Original file line number Diff line number Diff line change
Expand Up @@ -770,11 +770,6 @@ void GpuDataManagerImplPrivate::AppendGpuCommandLine(
command_line->AppendSwitchASCII(switches::kUseGL, use_gl);
}

if (!gpu_driver_bugs_.empty()) {
command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds,
gpu::IntSetToString(gpu_driver_bugs_, ','));
}

if (ShouldDisableAcceleratedVideoDecode(command_line)) {
command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
}
Expand Down
27 changes: 0 additions & 27 deletions content/browser/gpu/gpu_data_manager_impl_private_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -649,33 +649,6 @@ TEST_F(GpuDataManagerImplPrivateTest, SetGLStringsDefered) {
}
#endif // OS_LINUX

TEST_F(GpuDataManagerImplPrivateTest, GpuDriverBugListSingle) {
ScopedGpuDataManagerImplPrivate manager;
manager->gpu_driver_bugs_.insert(5);

base::CommandLine command_line(0, NULL);
manager->AppendGpuCommandLine(&command_line);

EXPECT_TRUE(command_line.HasSwitch(switches::kGpuDriverBugWorkarounds));
std::string args = command_line.GetSwitchValueASCII(
switches::kGpuDriverBugWorkarounds);
EXPECT_STREQ("5", args.c_str());
}

TEST_F(GpuDataManagerImplPrivateTest, GpuDriverBugListMultiple) {
ScopedGpuDataManagerImplPrivate manager;
manager->gpu_driver_bugs_.insert(5);
manager->gpu_driver_bugs_.insert(7);

base::CommandLine command_line(0, NULL);
manager->AppendGpuCommandLine(&command_line);

EXPECT_TRUE(command_line.HasSwitch(switches::kGpuDriverBugWorkarounds));
std::string args = command_line.GetSwitchValueASCII(
switches::kGpuDriverBugWorkarounds);
EXPECT_STREQ("5,7", args.c_str());
}

TEST_F(GpuDataManagerImplPrivateTest, BlacklistAllFeatures) {
ScopedGpuDataManagerImplPrivate manager;
EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount());
Expand Down
1 change: 0 additions & 1 deletion content/browser/gpu/gpu_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ static const char* const kSwitchNames[] = {
#if defined(OS_CHROMEOS)
switches::kDisableVaapiAcceleratedVideoEncode,
#endif
switches::kGpuDriverBugWorkarounds,
switches::kGpuStartupDialog,
switches::kGpuSandboxAllowSysVShm,
switches::kGpuSandboxFailuresFatal,
Expand Down
11 changes: 9 additions & 2 deletions content/gpu/in_process_gpu_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ void InProcessGpuThread::Init() {
gpu::GPUInfo gpu_info;
gpu::GpuFeatureInfo gpu_feature_info;
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!gl::init::InitializeGLOneOff()) {
VLOG(1) << "gl::init::InitializeGLOneOff failed";
if (!gl::init::InitializeGLNoExtensionsOneOff()) {
VLOG(1) << "gl::init::InitializeGLNoExtensionsOneOff failed";
} else if (GetContentClient()->gpu() &&
GetContentClient()->gpu()->GetGPUInfo() &&
GetContentClient()->gpu()->GetGpuFeatureInfo()) {
Expand All @@ -72,6 +72,13 @@ void InProcessGpuThread::Init() {
gpu::CollectContextGraphicsInfo(&gpu_info);
gpu_feature_info = gpu::GetGpuFeatureInfo(gpu_info, *command_line);
}
if (!gpu_feature_info.disabled_extensions.empty()) {
gl::init::SetDisabledExtensionsPlatform(
gpu_feature_info.disabled_extensions);
}
if (!gl::init::InitializeExtensionSettingsOneOffPlatform()) {
VLOG(1) << "gl::init::InitializeExtensionSettingsOneOffPlatform failed";
}
GetContentClient()->SetGpuInfo(gpu_info);

// The process object takes ownership of the thread object, so do not
Expand Down
1 change: 0 additions & 1 deletion gpu/command_buffer/tests/gl_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ void GLManager::InitializeWithWorkaroundsImpl(
const SharedMemoryLimits limits;
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
DCHECK(!command_line.HasSwitch(switches::kGpuDriverBugWorkarounds));
DCHECK(!command_line.HasSwitch(switches::kDisableGLExtensions));
InitializeGpuPreferencesForTestingFromCommandLine(command_line,
&gpu_preferences_);
Expand Down
9 changes: 0 additions & 9 deletions gpu/config/gpu_driver_bug_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,6 @@ void GpuDriverBugList::AppendWorkaroundsFromCommandLine(
std::set<int>* workarounds,
const base::CommandLine& command_line) {
DCHECK(workarounds);

if (command_line.HasSwitch(switches::kGpuDriverBugWorkarounds)) {
std::string cmd_workarounds_str =
command_line.GetSwitchValueASCII(switches::kGpuDriverBugWorkarounds);
std::set<int> cmd_workarounds;
gpu::StringToFeatureSet(cmd_workarounds_str, &cmd_workarounds);
workarounds->insert(cmd_workarounds.begin(), cmd_workarounds.end());
}

for (int i = 0; i < NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES; i++) {
if (command_line.HasSwitch(kFeatureList[i].name)) {
// Check for disabling workaround flag.
Expand Down
3 changes: 0 additions & 3 deletions gpu/config/gpu_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ const char kGpuActiveDeviceID[] = "gpu-active-device-id";
// Passes gpu device_id from browser process to GPU process.
const char kGpuDeviceID[] = "gpu-device-id";

// Pass a set of GpuDriverBugWorkaroundType ids, seperated by ','.
const char kGpuDriverBugWorkarounds[] = "gpu-driver-bug-workarounds";

// Passes gpu driver_vendor from browser process to GPU process.
const char kGpuDriverVendor[] = "gpu-driver-vendor";

Expand Down
1 change: 0 additions & 1 deletion gpu/config/gpu_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ GPU_EXPORT extern const char kEnableOOPRasterization[];
GPU_EXPORT extern const char kGpuActiveVendorID[];
GPU_EXPORT extern const char kGpuActiveDeviceID[];
GPU_EXPORT extern const char kGpuDeviceID[];
GPU_EXPORT extern const char kGpuDriverBugWorkarounds[];
GPU_EXPORT extern const char kGpuDriverVendor[];
GPU_EXPORT extern const char kGpuDriverVersion[];
GPU_EXPORT extern const char kGpuDriverDate[];
Expand Down
27 changes: 0 additions & 27 deletions gpu/config/gpu_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ namespace gpu {

namespace {

void StringToIntSet(const std::string& str, std::set<int>* list) {
DCHECK(list);
for (const base::StringPiece& piece :
base::SplitStringPiece(str, ",", base::TRIM_WHITESPACE,
base::SPLIT_WANT_ALL)) {
int number = 0;
bool succeed = base::StringToInt(piece, &number);
DCHECK(succeed);
list->insert(number);
}
}

// |str| is in the format of "0x040a;0x10de;...;hex32_N".
void StringToIds(const std::string& str, std::vector<uint32_t>* list) {
DCHECK(list);
Expand Down Expand Up @@ -82,21 +70,6 @@ GpuFeatureStatus GetGpuRasterizationFeatureStatus(

} // namespace anonymous

std::string IntSetToString(const std::set<int>& list, char divider) {
std::string rt;
for (auto number : list) {
if (!rt.empty())
rt += divider;
rt += base::IntToString(number);
}
return rt;
}

void StringToFeatureSet(
const std::string& str, std::set<int>* feature_set) {
StringToIntSet(str, feature_set);
}

void ParseSecondaryGpuDevicesFromCommandLine(
const base::CommandLine& command_line,
GPUInfo* gpu_info) {
Expand Down
10 changes: 0 additions & 10 deletions gpu/config/gpu_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#ifndef GPU_CONFIG_GPU_UTIL_H_
#define GPU_CONFIG_GPU_UTIL_H_

#include <set>
#include <string>

#include "build/build_config.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/gpu_export.h"
Expand All @@ -20,10 +17,6 @@ namespace gpu {

struct GPUInfo;

// |str| is in the format of "feature1,feature2,...,featureN".
GPU_EXPORT void StringToFeatureSet(
const std::string& str, std::set<int>* feature_set);

// With provided command line, fill gpu_info->secondary_gpus with parsed
// secondary vendor and device ids.
GPU_EXPORT void ParseSecondaryGpuDevicesFromCommandLine(
Expand All @@ -38,9 +31,6 @@ GetGpuFeatureInfo(const GPUInfo& gpu_info,
const base::CommandLine& command_line);

GPU_EXPORT void SetKeysForCrashLogging(const GPUInfo& gpu_info);

// Combine the integers into a string, separated by divider.
GPU_EXPORT std::string IntSetToString(const std::set<int>& list, char divider);
} // namespace gpu

#endif // GPU_CONFIG_GPU_UTIL_H_
68 changes: 47 additions & 21 deletions gpu/config/gpu_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,13 @@

#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "gpu/config/gpu_driver_bug_workaround_type.h"
#include "gpu/config/gpu_info.h"
#include "gpu/config/gpu_switches.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace gpu {

TEST(GpuUtilTest, StringToFeatureSet) {
{
// zero feature.
std::set<int> features;
StringToFeatureSet("", &features);
EXPECT_EQ(0u, features.size());
}
{
// One features.
std::set<int> features;
StringToFeatureSet("4", &features);
EXPECT_EQ(1u, features.size());
}
{
// Multiple features.
std::set<int> features;
StringToFeatureSet("1,9", &features);
EXPECT_EQ(2u, features.size());
}
}

TEST(GpuUtilTest, ParseSecondaryGpuDevicesFromCommandLine_Simple) {
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(switches::kGpuSecondaryVendorIDs, "0x10de");
Expand Down Expand Up @@ -141,4 +121,50 @@ TEST(GpuUtilTest, ParseSecondaryGpuDevicesFromCommandLine_TestingClear) {
EXPECT_EQ(gpu_info.secondary_gpus.size(), 0ul);
}

TEST(GpuUtilTest, GetGpuFeatureInfo_WorkaroundFromCommandLine) {
{
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
GPUInfo gpu_info;
GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(gpu_info, command_line);
EXPECT_FALSE(gpu_feature_info.IsWorkaroundEnabled(
USE_GPU_DRIVER_WORKAROUND_FOR_TESTING));
}

{
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(GpuDriverBugWorkaroundTypeToString(
USE_GPU_DRIVER_WORKAROUND_FOR_TESTING),
"1");
GPUInfo gpu_info;
GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(gpu_info, command_line);
EXPECT_TRUE(gpu_feature_info.IsWorkaroundEnabled(
USE_GPU_DRIVER_WORKAROUND_FOR_TESTING));
}

{
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
GPUInfo gpu_info;
// See gpu/config/gpu_driver_bug_list.json, entry 215.
gpu_info.gpu.vendor_id = 0xbad9;
gpu_info.gpu.device_id = 0xbad9;
GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(gpu_info, command_line);
EXPECT_TRUE(gpu_feature_info.IsWorkaroundEnabled(
USE_GPU_DRIVER_WORKAROUND_FOR_TESTING));
}

{
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(GpuDriverBugWorkaroundTypeToString(
USE_GPU_DRIVER_WORKAROUND_FOR_TESTING),
"0");
GPUInfo gpu_info;
// See gpu/config/gpu_driver_bug_list.json, entry 215.
gpu_info.gpu.vendor_id = 0xbad9;
gpu_info.gpu.device_id = 0xbad9;
GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(gpu_info, command_line);
EXPECT_FALSE(gpu_feature_info.IsWorkaroundEnabled(
USE_GPU_DRIVER_WORKAROUND_FOR_TESTING));
}
}

} // namespace gpu
10 changes: 0 additions & 10 deletions gpu/ipc/service/gpu_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,6 @@ bool GpuInit::InitializeAndStartSandbox(const base::CommandLine& command_line,
UMA_HISTOGRAM_TIMES("GPU.CollectContextGraphicsInfo", collect_context_time);

gpu_feature_info_ = gpu::GetGpuFeatureInfo(gpu_info_, command_line);
if (!gpu_feature_info_.enabled_gpu_driver_bug_workarounds.empty()) {
// TODO(zmo): Remove this block of code. They are only for existing tests.
std::set<int> workarounds;
workarounds.insert(
gpu_feature_info_.enabled_gpu_driver_bug_workarounds.begin(),
gpu_feature_info_.enabled_gpu_driver_bug_workarounds.end());
base::CommandLine* cmd_line = const_cast<base::CommandLine*>(&command_line);
cmd_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds,
gpu::IntSetToString(workarounds, ','));
}
if (!gpu_feature_info_.disabled_extensions.empty()) {
gl::init::SetDisabledExtensionsPlatform(
gpu_feature_info_.disabled_extensions);
Expand Down

0 comments on commit 10aee7a

Please sign in to comment.