Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: ui/gl/gl_context_cgl.cc

Issue 1147653002: Fix for 300ms scroll lag on 2013 Mac Pros once idle for 10seconds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove tracing Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/config/gpu_driver_bug_list_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_context_cgl.cc
diff --git a/ui/gl/gl_context_cgl.cc b/ui/gl/gl_context_cgl.cc
index 2fd20a086cbebc83ff8d157f2d8bbaa91acad501..9ec6facb67615c7f3c2ee5de404ac5adeb0a0085 100644
--- a/ui/gl/gl_context_cgl.cc
+++ b/ui/gl/gl_context_cgl.cc
@@ -31,14 +31,15 @@ struct CGLRendererInfoObjDeleter {
} // namespace
-static CGLPixelFormatObj GetPixelFormat() {
+static CGLPixelFormatObj GetPixelFormat(bool prevent_switchable) {
static CGLPixelFormatObj format;
if (format)
return format;
std::vector<CGLPixelFormatAttribute> attribs;
// If the system supports dual gpus then allow offline renderers for every
- // context, so that they can all be in the same share group.
- if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) {
+ // context, so that they can all be in the same share group. Don't do this for
+ // discrete GPUs to avoid being offloaded to an idle GPU by OSX.
+ if (!prevent_switchable) {
attribs.push_back(kCGLPFAAllowOfflineRenderers);
g_support_renderer_switching = true;
}
@@ -93,14 +94,16 @@ bool GLContextCGL::Initialize(GLSurface* compatible_surface,
GLContextCGL* share_context = share_group() ?
static_cast<GLContextCGL*>(share_group()->GetContext()) : NULL;
- CGLPixelFormatObj format = GetPixelFormat();
+ const bool prevent_switchable = gpu_preference == PreferDiscreteGpu ||
+ !ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus();
+
+ CGLPixelFormatObj format = GetPixelFormat(prevent_switchable);
if (!format)
return false;
// If using the discrete gpu, create a pixel format requiring it before we
// create the context.
- if (!ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus() ||
- gpu_preference == PreferDiscreteGpu) {
+ if (prevent_switchable) {
std::vector<CGLPixelFormatAttribute> discrete_attribs;
discrete_attribs.push_back((CGLPixelFormatAttribute) 0);
GLint num_pixel_formats;
@@ -164,7 +167,7 @@ bool GLContextCGL::ForceGpuSwitchIfNeeded() {
// Attempt to find a virtual screen that's using the requested renderer,
// and switch the context to use that screen. Don't attempt to switch if
// the context requires the discrete GPU.
- CGLPixelFormatObj format = GetPixelFormat();
+ CGLPixelFormatObj format = GetPixelFormat(false);
int virtual_screen_count;
if (CGLDescribePixelFormat(format, 0, kCGLPFAVirtualScreenCount,
&virtual_screen_count) != kCGLNoError)
« no previous file with comments | « gpu/config/gpu_driver_bug_list_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698