summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-13 05:27:41 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-13 05:27:41 +0000
commite97f23a7335324fba0cc44a27c5af9e0569d0822 (patch)
tree42d50bc9042c7545b20e6527e4e156b466ed1cf0 /ui
parentd3f9f43a2388b5809c0c569ba6dbb6c82f5ca2c5 (diff)
downloadchromium_src-e97f23a7335324fba0cc44a27c5af9e0569d0822.zip
chromium_src-e97f23a7335324fba0cc44a27c5af9e0569d0822.tar.gz
chromium_src-e97f23a7335324fba0cc44a27c5af9e0569d0822.tar.bz2
Don't migrate contexts that require the discrete GPU off it.
There's a race condition when a context that requires a GPU is created, causing it to be migrated to the integrated GPU which was where the context in the browser process last presented from. Fix this by not migrating contexts that require the discrete GPU, and clearing out the current renderer id when creating a context that requires the discrete GPU. BUG=181629 Review URL: https://chromiumcodereview.appspot.com/12771022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187789 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gl/gl_context_cgl.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/gl/gl_context_cgl.cc b/ui/gl/gl_context_cgl.cc
index beda807..9c6cc10 100644
--- a/ui/gl/gl_context_cgl.cc
+++ b/ui/gl/gl_context_cgl.cc
@@ -88,6 +88,8 @@ bool GLContextCGL::Initialize(GLSurface* compatible_surface,
LOG(ERROR) << "Error choosing pixel format.";
return false;
}
+ // The renderer might be switched after this, so ignore the saved ID.
+ share_group()->SetRendererID(-1);
}
CGLError res = CGLCreateContext(
@@ -123,10 +125,12 @@ bool GLContextCGL::MakeCurrent(GLSurface* surface) {
CGLGetVirtualScreen(static_cast<CGLContextObj>(context_), &screen);
if (g_support_renderer_switching &&
+ !discrete_pixelformat_ && renderer_id != -1 &&
(screen != screen_ || renderer_id != renderer_id_)) {
- CGLPixelFormatObj format = GetPixelFormat();
// Attempt to find a virtual screen that's using the requested renderer,
- // and switch the context to use that screen.
+ // and switch the context to use that screen. Don't attempt to switch if
+ // the context requires the discrete GPU.
+ CGLPixelFormatObj format = GetPixelFormat();
int virtual_screen_count;
if (CGLDescribePixelFormat(format, 0, kCGLPFAVirtualScreenCount,
&virtual_screen_count) != kCGLNoError)