From aabe4c4cfc698256d6ea80acda3a9e599b1e2d3e Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 16 Mar 2018 14:08:08 -0400 Subject: [PATCH] macOS: Fix undesirable switch to discrete GPU during startup (issue #2398) --- patch/patch.cfg | 5 +++++ patch/patches/mac_gpu_2398.patch | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 patch/patches/mac_gpu_2398.patch diff --git a/patch/patch.cfg b/patch/patch.cfg index 41ecf376a..b99b6a6bc 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -353,4 +353,9 @@ patches = [ # https://bugs.chromium.org/p/chromium/issues/detail?id=781966 'name': 'webkit_pointer_event_781966', }, + { + # macOS: Fix undesirable switch to discrete GPU during startup. + # https://bitbucket.org/chromiumembedded/cef/issues/2398 + 'name': 'mac_gpu_2398', + }, ] diff --git a/patch/patches/mac_gpu_2398.patch b/patch/patches/mac_gpu_2398.patch new file mode 100644 index 000000000..ee7b9b2e4 --- /dev/null +++ b/patch/patches/mac_gpu_2398.patch @@ -0,0 +1,18 @@ +diff --git ui/gl/init/gl_initializer_mac.cc ui/gl/init/gl_initializer_mac.cc +index 828ce9bb0138..1301e6cc1d14 100644 +--- ui/gl/init/gl_initializer_mac.cc ++++ ui/gl/init/gl_initializer_mac.cc +@@ -40,11 +40,8 @@ bool InitializeOneOffForSandbox() { + // GPU-related stuff is very slow without this, probably because + // the sandbox prevents loading graphics drivers or some such. + std::vector attribs; +- if (GLContext::SwitchableGPUsSupported()) { +- // Avoid switching to the discrete GPU just for this pixel +- // format selection. +- attribs.push_back(kCGLPFAAllowOfflineRenderers); +- } ++ // Avoid switching to the discrete GPU just for this pixel format selection. ++ attribs.push_back(kCGLPFAAllowOfflineRenderers); + if (GetGLImplementation() == kGLImplementationAppleGL) { + attribs.push_back(kCGLPFARendererID); + attribs.push_back(