Skip to content

Commit

Permalink
Forward disable-gpu-driver-bug-workarounds to ANGLE
Browse files Browse the repository at this point in the history
Needed to add the ability to disable all of ANGLE's workaround with this
flag.

Bug: 1016377

Change-Id: Icff8bde12cf6194e057ac09db099bd045da902a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1937668
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Cr-Commit-Position: refs/heads/master@{#720958}
  • Loading branch information
jonahryandavis authored and Commit Bot committed Dec 3, 2019
1 parent 470bf88 commit 7491b47
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 26 deletions.
2 changes: 0 additions & 2 deletions gpu/command_buffer/service/service_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ GpuPreferences ParseGpuPreferences(const base::CommandLine* command_line) {
command_line->HasSwitch(switches::kEnableGPUServiceTracing);
gpu_preferences.use_passthrough_cmd_decoder =
gpu::gles2::UsePassthroughCommandDecoder(command_line);
gpu_preferences.disable_gpu_driver_bug_workarounds =
command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds);
gpu_preferences.ignore_gpu_blacklist =
command_line->HasSwitch(switches::kIgnoreGpuBlacklist);
gpu_preferences.enable_webgpu =
Expand Down
3 changes: 0 additions & 3 deletions gpu/config/gpu_preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ struct GPU_EXPORT GpuPreferences {
// ===================================
// Settings from //gpu/config/gpu_switches.h

// Disables workarounds for various GPU driver bugs.
bool disable_gpu_driver_bug_workarounds = false;

// Ignores GPU blacklist.
bool ignore_gpu_blacklist = false;

Expand Down
3 changes: 0 additions & 3 deletions gpu/config/gpu_preferences_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ void CheckGpuPreferencesEqual(GpuPreferences left, GpuPreferences right) {
right.disable_biplanar_gpu_memory_buffers_for_video_frames);
EXPECT_EQ(left.texture_target_exception_list,
right.texture_target_exception_list);
EXPECT_EQ(left.disable_gpu_driver_bug_workarounds,
right.disable_gpu_driver_bug_workarounds);
EXPECT_EQ(left.ignore_gpu_blacklist, right.ignore_gpu_blacklist);
EXPECT_EQ(left.enable_oop_rasterization, right.enable_oop_rasterization);
EXPECT_EQ(left.disable_oop_rasterization, right.disable_oop_rasterization);
Expand Down Expand Up @@ -150,7 +148,6 @@ TEST(GpuPreferencesTest, EncodeDecode) {
GPU_PREFERENCES_FIELD(use_passthrough_cmd_decoder, true)
GPU_PREFERENCES_FIELD(disable_biplanar_gpu_memory_buffers_for_video_frames,
true)
GPU_PREFERENCES_FIELD(disable_gpu_driver_bug_workarounds, true)
GPU_PREFERENCES_FIELD(ignore_gpu_blacklist, true)
GPU_PREFERENCES_FIELD(enable_oop_rasterization, true)
GPU_PREFERENCES_FIELD(disable_oop_rasterization, true)
Expand Down
4 changes: 0 additions & 4 deletions gpu/config/gpu_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

namespace switches {

// Disable workarounds for various GPU driver bugs.
const char kDisableGpuDriverBugWorkarounds[] =
"disable-gpu-driver-bug-workarounds";

// Disable GPU rasterization, i.e. rasterize on the CPU only.
// Overrides the kEnableGpuRasterization and kForceGpuRasterization flags.
const char kDisableGpuRasterization[] = "disable-gpu-rasterization";
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 @@ -9,7 +9,6 @@

namespace switches {

GPU_EXPORT extern const char kDisableGpuDriverBugWorkarounds[];
GPU_EXPORT extern const char kDisableGpuRasterization[];
GPU_EXPORT extern const char kEnableGpuRasterization[];
GPU_EXPORT extern const char kGpuBlacklistTestGroup[];
Expand Down
2 changes: 1 addition & 1 deletion gpu/config/gpu_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ GpuFeatureInfo ComputeGpuFeatureInfo(const GPUInfo& gpu_info,

std::set<int> enabled_driver_bug_workarounds;
std::vector<std::string> driver_bug_disabled_extensions;
if (!gpu_preferences.disable_gpu_driver_bug_workarounds) {
if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) {
std::unique_ptr<gpu::GpuDriverBugList> list(GpuDriverBugList::Create());
unsigned target_test_group = 0u;
if (command_line->HasSwitch(switches::kGpuDriverBugListTestGroup)) {
Expand Down
2 changes: 1 addition & 1 deletion gpu/gles2_conform_support/egl/thread_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "base/strings/utf_string_conversions.h"
#include "gpu/command_buffer/client/gles2_lib.h"
#include "gpu/command_buffer/common/thread_local.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/config/gpu_info_collector.h"
#include "gpu/config/gpu_preferences.h"
#include "gpu/config/gpu_util.h"
Expand All @@ -23,6 +22,7 @@
#include "gpu/gles2_conform_support/egl/test_support.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/gl_switches.h"
#include "ui/gl/init/gl_factory.h"

// Thread local key for ThreadState instance. Accessed when holding g_egl_lock
Expand Down
1 change: 0 additions & 1 deletion gpu/ipc/common/gpu_preferences.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ struct GpuPreferences {
bool disable_biplanar_gpu_memory_buffers_for_video_frames;
array<gfx.mojom.BufferUsageAndFormat> texture_target_exception_list;

bool disable_gpu_driver_bug_workarounds;
bool ignore_gpu_blacklist;
bool enable_oop_rasterization;
bool disable_oop_rasterization;
Expand Down
6 changes: 0 additions & 6 deletions gpu/ipc/common/gpu_preferences_mojom_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ struct StructTraits<gpu::mojom::GpuPreferencesDataView, gpu::GpuPreferences> {
out->texture_target_exception_list.push_back(usage_format);
}

out->disable_gpu_driver_bug_workarounds =
prefs.disable_gpu_driver_bug_workarounds();
out->ignore_gpu_blacklist = prefs.ignore_gpu_blacklist();
out->enable_oop_rasterization = prefs.enable_oop_rasterization();
out->disable_oop_rasterization = prefs.disable_oop_rasterization();
Expand Down Expand Up @@ -284,10 +282,6 @@ struct StructTraits<gpu::mojom::GpuPreferencesDataView, gpu::GpuPreferences> {
texture_target_exception_list(const gpu::GpuPreferences& prefs) {
return prefs.texture_target_exception_list;
}
static bool disable_gpu_driver_bug_workarounds(
const gpu::GpuPreferences& prefs) {
return prefs.disable_gpu_driver_bug_workarounds;
}
static bool ignore_gpu_blacklist(const gpu::GpuPreferences& prefs) {
return prefs.ignore_gpu_blacklist;
}
Expand Down
17 changes: 13 additions & 4 deletions ui/gl/gl_surface_egl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
#define EGL_FEATURE_COUNT_ANGLE 0x3465
#define EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466
#define EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467
#define EGL_FEATURE_ALL_DISABLED_ANGLE 0x3469
#endif /* EGL_ANGLE_feature_control */

using ui::GetLastEGLErrorString;
Expand Down Expand Up @@ -347,8 +348,13 @@ EGLDisplay GetDisplayFromType(
DisplayType display_type,
EGLNativeDisplayType native_display,
const std::vector<std::string>& enabled_angle_features,
const std::vector<std::string>& disabled_angle_features) {
const std::vector<std::string>& disabled_angle_features,
bool disable_all_angle_features) {
std::vector<EGLAttrib> extra_display_attribs;
if (disable_all_angle_features) {
extra_display_attribs.push_back(EGL_FEATURE_ALL_DISABLED_ANGLE);
extra_display_attribs.push_back(EGL_TRUE);
}
switch (display_type) {
case DEFAULT:
case SWIFT_SHADER:
Expand Down Expand Up @@ -1118,11 +1124,14 @@ EGLDisplay GLSurfaceEGL::InitializeDisplay(
GetStringVectorFromCommandLine(command_line,
switches::kDisableANGLEFeatures);

bool disable_all_angle_features =
command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds);

for (size_t disp_index = 0; disp_index < init_displays.size(); ++disp_index) {
DisplayType display_type = init_displays[disp_index];
EGLDisplay display =
GetDisplayFromType(display_type, g_native_display,
enabled_angle_features, disabled_angle_features);
EGLDisplay display = GetDisplayFromType(
display_type, g_native_display, enabled_angle_features,
disabled_angle_features, disable_all_angle_features);
if (display == EGL_NO_DISPLAY) {
LOG(ERROR) << "EGL display query failed with error "
<< GetLastEGLErrorString();
Expand Down
5 changes: 5 additions & 0 deletions ui/gl/gl_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ const char kDisableES3GLContext[] = "disable-es3-gl-context";
const char kDisableES3GLContextForTesting[] =
"disable-es3-gl-context-for-testing";

// Disable workarounds for various GPU driver bugs.
const char kDisableGpuDriverBugWorkarounds[] =
"disable-gpu-driver-bug-workarounds";

// Stop the GPU from synchronizing presentation with vblank.
const char kDisableGpuVsync[] = "disable-gpu-vsync";

Expand Down Expand Up @@ -139,6 +143,7 @@ const char kDisableDirectCompositionVideoOverlays[] =
// GpuProcessHost to the GPU Process. Add your switch to this list if you need
// to read it in the GPU process, else don't add it.
const char* const kGLSwitchesCopiedFromGpuProcessHost[] = {
kDisableGpuDriverBugWorkarounds,
kDisableGpuVsync,
kDisableD3D11,
kDisableES3GLContext,
Expand Down
1 change: 1 addition & 0 deletions ui/gl/gl_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace switches {
GL_EXPORT extern const char kDisableD3D11[];
GL_EXPORT extern const char kDisableES3GLContext[];
GL_EXPORT extern const char kDisableES3GLContextForTesting[];
GL_EXPORT extern const char kDisableGpuDriverBugWorkarounds[];
GL_EXPORT extern const char kDisableGpuVsync[];
GL_EXPORT extern const char kEnableGPUServiceLogging[];
GL_EXPORT extern const char kEnableGPUServiceTracing[];
Expand Down

0 comments on commit 7491b47

Please sign in to comment.