Reviewers: Ken Russell
CL:
https://codereview.chromium.org/1578453003/
Description:
Enable DirectComposition by default.
Chrome will now use DirectComposition where supported (Win8+ with d3d11
rendering). --disable-direct-composition can be specified to disable it,
and a
disable_direct_composition driver bug workaround type has been added.
BUG=524838
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Affected files (+20, -15 lines):
M content/browser/gpu/gpu_data_manager_impl_private.cc
M gpu/config/gpu_driver_bug_workaround_type.h
M ui/gl/gl_surface_egl.cc
M ui/gl/gl_switches.h
M ui/gl/gl_switches.cc
Index: content/browser/gpu/gpu_data_manager_impl_private.cc
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc
b/content/browser/gpu/gpu_data_manager_impl_private.cc
index
bb8e0337f57c2a20f0e9ca5e00961204f1f58e62..5a639c87381726c4ab536c9ed2d045abd7babdf2
100644
--- a/content/browser/gpu/gpu_data_manager_impl_private.cc
+++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -659,6 +659,9 @@ void GpuDataManagerImplPrivate::AppendGpuCommandLine(
switches::kSwiftShaderPath);
if (gpu_driver_bugs_.find(gpu::DISABLE_D3D11) != gpu_driver_bugs_.end())
command_line->AppendSwitch(switches::kDisableD3D11);
+ if (gpu_driver_bugs_.find(gpu::DISABLE_DIRECT_COMPOSITION) !=
+ gpu_driver_bugs_.end())
+ command_line->AppendSwitch(switches::kDisableDirectComposition);
if (use_swiftshader_) {
command_line->AppendSwitchASCII(switches::kUseGL, "swiftshader");
if (swiftshader_path.empty())
Index: gpu/config/gpu_driver_bug_workaround_type.h
diff --git a/gpu/config/gpu_driver_bug_workaround_type.h
b/gpu/config/gpu_driver_bug_workaround_type.h
index
864627c44bafe61f0b23867cfebaba9362bac203..b861d9100535dda5a04cd1a1cb796fdffa4d2c0f
100644
--- a/gpu/config/gpu_driver_bug_workaround_type.h
+++ b/gpu/config/gpu_driver_bug_workaround_type.h
@@ -148,6 +148,8 @@
unbind_egl_context_to_flush_driver_caches) \
GPU_OP(SET_ZERO_LEVEL_BEFORE_GENERATING_MIPMAP, \
set_zero_level_before_generating_mipmap) \
+ GPU_OP(DISABLE_DIRECT_COMPOSITION, \
+ disable_direct_composition) \
namespace gpu {
Index: ui/gl/gl_surface_egl.cc
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index
f748cfcc887978ae79d0a6dcbb212ffb41fb5af8..79a2cd38ed70b9a01f3c0ad27c2f80e12a33c284
100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -392,8 +392,8 @@ bool GLSurfaceEGL::InitializeOneOff() {
g_use_direct_composition =
HasEGLExtension("EGL_ANGLE_direct_composition") &&
HasEGLExtension("EGL_ANGLE_flexible_surface_compatibility") &&
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseDirectComposition);
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableDirectComposition);
// TODO(
oet...@nvidia.com): Surfaceless is disabled on Android as a
temporary
// workaround, since code written for Android WebView takes different
paths
Index: ui/gl/gl_switches.cc
diff --git a/ui/gl/gl_switches.cc b/ui/gl/gl_switches.cc
index
5327dd5c0ed08a7ff4b15cfafebc8b16eb9c98a8..b4f26257efa348c33900a083b56898ec60b857fd
100644
--- a/ui/gl/gl_switches.cc
+++ b/ui/gl/gl_switches.cc
@@ -66,8 +66,8 @@ const char kSwiftShaderPath[]
= "swiftshader-path";
// context will never be lost in any situations, say, a GPU reset.
const char kGpuNoContextLost[] = "gpu-no-context-lost";
-// Turns on the use of DirectComposition to draw to the screen.
-const char kUseDirectComposition[] = "use-direct-composition";
+// Disables the use of DirectComposition to draw to the screen.
+const char kDisableDirectComposition[] = "disable-direct-composition";
// Indicates whether the dual GPU switching is supported or not.
const char kSupportsDualGpus[] = "supports-dual-gpus";
@@ -97,16 +97,16 @@ const char kDisableGLExtensions[]
= "disable-gl-extensions";
// 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* kGLSwitchesCopiedFromGpuProcessHost[] = {
- kDisableGpuVsync,
- kDisableD3D11,
- kEnableGPUServiceLogging,
- kEnableGPUServiceTracing,
- kEnableUnsafeES3APIs,
- kGpuNoContextLost,
- kDisableGLDrawingForTests,
- kOverrideUseGLWithOSMesaForTests,
- kUseANGLE,
- kUseDirectComposition,
+ kDisableGpuVsync,
+ kDisableD3D11,
+ kEnableGPUServiceLogging,
+ kEnableGPUServiceTracing,
+ kEnableUnsafeES3APIs,
+ kGpuNoContextLost,
+ kDisableGLDrawingForTests,
+ kOverrideUseGLWithOSMesaForTests,
+ kUseANGLE,
+ kDisableDirectComposition,
};
const int kGLSwitchesCopiedFromGpuProcessHostNumSwitches =
arraysize(kGLSwitchesCopiedFromGpuProcessHost);
Index: ui/gl/gl_switches.h
diff --git a/ui/gl/gl_switches.h b/ui/gl/gl_switches.h
index
ca317a2fb61982a5cdbcad7ba88664d1e89f428c..3c1eff74346e9d8417b08a8599d91214678d18d0
100644
--- a/ui/gl/gl_switches.h
+++ b/ui/gl/gl_switches.h
@@ -35,7 +35,7 @@ GL_EXPORT extern const char kDisableGpuVsync[];
GL_EXPORT extern const char kEnableGPUServiceLogging[];
GL_EXPORT extern const char kEnableGPUServiceTracing[];
GL_EXPORT extern const char kGpuNoContextLost[];
-GL_EXPORT extern const char kUseDirectComposition[];
+GL_EXPORT extern const char kDisableDirectComposition[];
GL_EXPORT extern const char kSupportsDualGpus[];