Fix explicitly requesting D3D11 WARP by the command line.
The --use-angle=d3d11-warp flag was not working without also enabling the AllowD3D11WarpFallback feature, the flags for warp and swiftshader would both be added to the command line. Clean up logic for setting software GL command line arguments from the browser process and respect the requested GL implementation if one is provided by command line. Bug: 402163834 Change-Id: I8fdea87be0ce957df6fd33cf3d8f0aed3891c4da Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6377726 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Cr-Commit-Position: refs/heads/main@{#1436956}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
e2c2030794
commit
b5ce6f437f
content/browser/gpu
gpu/config
ui/gl
@ -1315,7 +1315,10 @@ void GpuDataManagerImplPrivate::AppendGpuCommandLine(
|
||||
use_gl = browser_command_line->GetSwitchValueASCII(switches::kUseGL);
|
||||
break;
|
||||
case gpu::GpuMode::SOFTWARE_GL:
|
||||
gl::SetSoftwareWebGLCommandLineSwitches(command_line);
|
||||
if (!gl::HasRequestedSoftwareGLImplementationFromCommandLine(
|
||||
command_line)) {
|
||||
gl::SetSoftwareWebGLCommandLineSwitches(command_line);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
use_gl = gl::kGLImplementationDisabledName;
|
||||
|
@ -777,8 +777,10 @@ bool EnableSwiftShaderIfNeeded(base::CommandLine* command_line,
|
||||
if (disable_software_rasterizer || blocklist_needs_more_info)
|
||||
return false;
|
||||
// Don't overwrite user preference.
|
||||
if (command_line->HasSwitch(switches::kUseGL))
|
||||
if (gl::GetRequestedGLImplementationFromCommandLine(command_line)
|
||||
.has_value()) {
|
||||
return false;
|
||||
}
|
||||
if (gpu_feature_info.status_values[GPU_FEATURE_TYPE_ACCELERATED_WEBGL] !=
|
||||
kGpuFeatureStatusEnabled ||
|
||||
gpu_feature_info.status_values[GPU_FEATURE_TYPE_ACCELERATED_GL] !=
|
||||
|
@ -254,6 +254,10 @@ GL_EXPORT bool IsSwiftShaderGLImplementation(
|
||||
void SetGLImplementationCommandLineSwitches(
|
||||
const GLImplementationParts& implementation,
|
||||
base::CommandLine* command_line) {
|
||||
// Avoid duplicating the GL implementation switches. Multiples are not
|
||||
// handled.
|
||||
command_line->RemoveSwitch(switches::kUseGL);
|
||||
command_line->RemoveSwitch(switches::kUseANGLE);
|
||||
command_line->AppendSwitchASCII(
|
||||
switches::kUseGL, gl::GetGLImplementationGLName(implementation));
|
||||
command_line->AppendSwitchASCII(
|
||||
@ -266,6 +270,11 @@ void SetSoftwareGLCommandLineSwitches(base::CommandLine* command_line) {
|
||||
}
|
||||
|
||||
void SetSoftwareWebGLCommandLineSwitches(base::CommandLine* command_line) {
|
||||
// Avoid duplicating the GL implementation switches. Multiples are not
|
||||
// handled.
|
||||
command_line->RemoveSwitch(switches::kUseGL);
|
||||
command_line->RemoveSwitch(switches::kUseANGLE);
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
if (base::FeatureList::IsEnabled(features::kAllowD3D11WarpFallback)) {
|
||||
command_line->AppendSwitchASCII(switches::kUseGL,
|
||||
@ -281,6 +290,14 @@ void SetSoftwareWebGLCommandLineSwitches(base::CommandLine* command_line) {
|
||||
kANGLEImplementationSwiftShaderForWebGLName);
|
||||
}
|
||||
|
||||
GL_EXPORT bool HasRequestedSoftwareGLImplementationFromCommandLine(
|
||||
const base::CommandLine* command_line) {
|
||||
std::optional<GLImplementationParts> requested_impl =
|
||||
GetRequestedGLImplementationFromCommandLine(command_line);
|
||||
return requested_impl.has_value() &&
|
||||
IsSoftwareGLImplementation(requested_impl.value());
|
||||
}
|
||||
|
||||
std::optional<GLImplementationParts>
|
||||
GetRequestedGLImplementationFromCommandLine(
|
||||
const base::CommandLine* command_line) {
|
||||
|
@ -180,6 +180,12 @@ GL_EXPORT void SetSoftwareGLCommandLineSwitches(
|
||||
GL_EXPORT void SetSoftwareWebGLCommandLineSwitches(
|
||||
base::CommandLine* command_line);
|
||||
|
||||
// Check if there is a requested software GL implementation in the command line
|
||||
// arguments. Used to avoid requesting multiple times or overriding specific
|
||||
// user requests.
|
||||
GL_EXPORT bool HasRequestedSoftwareGLImplementationFromCommandLine(
|
||||
const base::CommandLine* command_line);
|
||||
|
||||
// Return requested GL implementation by checking commandline. If there isn't
|
||||
// gl related argument, nullopt is returned.
|
||||
GL_EXPORT std::optional<GLImplementationParts>
|
||||
|
@ -45,12 +45,6 @@ void GetEGLInitDisplays(bool supports_angle_d3d,
|
||||
bool default_angle_metal =
|
||||
base::FeatureList::IsEnabled(features::kDefaultANGLEMetal);
|
||||
bool default_angle_vulkan = features::IsDefaultANGLEVulkan();
|
||||
const char* default_software_renderer = kANGLEImplementationSwiftShaderName;
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
if (base::FeatureList::IsEnabled(features::kAllowD3D11WarpFallback)) {
|
||||
default_software_renderer = kANGLEImplementationD3D11WarpName;
|
||||
}
|
||||
#endif
|
||||
|
||||
// If we're already requesting software GL, make sure we don't fallback to the
|
||||
// GPU
|
||||
@ -59,7 +53,8 @@ void GetEGLInitDisplays(bool supports_angle_d3d,
|
||||
|
||||
std::string requested_renderer =
|
||||
force_software_gl
|
||||
? default_software_renderer
|
||||
? std::string(
|
||||
GetGLImplementationANGLEName(GetGLImplementationParts()))
|
||||
: command_line->GetSwitchValueASCII(switches::kUseANGLE);
|
||||
|
||||
bool use_angle_default =
|
||||
|
Reference in New Issue
Block a user