Chromium Code Reviews| Index: ui/gl/gl_context_cgl.cc |
| diff --git a/ui/gl/gl_context_cgl.cc b/ui/gl/gl_context_cgl.cc |
| index 7d5a92317cd91d87baaa6bcd59a57709f3c0d666..f88f9c940951b9ed3c8f9147e9d79e0d15c4c313 100644 |
| --- a/ui/gl/gl_context_cgl.cc |
| +++ b/ui/gl/gl_context_cgl.cc |
| @@ -19,6 +19,8 @@ namespace gfx { |
| bool g_support_renderer_switching; |
| +bool g_force_cgl_set_virtual_screen = false; |
| + |
| static CGLPixelFormatObj GetPixelFormat() { |
| static CGLPixelFormatObj format; |
| if (format) |
| @@ -149,7 +151,10 @@ bool GLContextCGL::MakeCurrent(GLSurface* surface) { |
| screen_renderer_id &= kCGLRendererIDMatchingMask; |
| if (screen_renderer_id == renderer_id) { |
| - CGLSetVirtualScreen(static_cast<CGLContextObj>(context_), i); |
| + // This call can hang on some AMD drivers |
| + // http://crbug.com/227228 |
| + if (g_force_cgl_set_virtual_screen) |
|
jbauman
2013/04/06 01:52:02
I'd recommend moving this check up to the beginnin
ccameron
2013/04/08 17:25:14
I put the whole thing in an if-block. My initial i
|
| + CGLSetVirtualScreen(static_cast<CGLContextObj>(context_), i); |
| screen_ = i; |
| break; |
| } |
| @@ -267,6 +272,11 @@ bool GLContextCGL::GetTotalGpuMemory(size_t* bytes) { |
| return false; |
| } |
| +// static |
| +void GLContextCGL::ForceCGLSetVirtualScreen() { |
| + g_force_cgl_set_virtual_screen = true; |
| +} |
| + |
| GLContextCGL::~GLContextCGL() { |
| Destroy(); |
| } |