OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gl/gl_context_egl.h" | 5 #include "ui/gl/gl_context_egl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 context_ = NULL; | 69 context_ = NULL; |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 bool GLContextEGL::MakeCurrent(GLSurface* surface) { | 73 bool GLContextEGL::MakeCurrent(GLSurface* surface) { |
74 DCHECK(context_); | 74 DCHECK(context_); |
75 if (IsCurrent(surface)) | 75 if (IsCurrent(surface)) |
76 return true; | 76 return true; |
77 | 77 |
78 TRACE_EVENT0("gpu", "GLContextEGL::MakeCurrent"); | 78 TRACE_EVENT2("gpu", "GLContextEGL::MakeCurrent", |
| 79 "context", context_, |
| 80 "surface", surface); |
| 81 |
| 82 // Mali work-around: glFlush() does not synchronize between contexts |
| 83 // chrome-os-partner:10068 |
| 84 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 85 if (eglGetCurrentContext() != NULL) |
| 86 glFinish(); |
| 87 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
79 | 88 |
80 if (!eglMakeCurrent(display_, | 89 if (!eglMakeCurrent(display_, |
81 surface->GetHandle(), | 90 surface->GetHandle(), |
82 surface->GetHandle(), | 91 surface->GetHandle(), |
83 context_)) { | 92 context_)) { |
84 DVLOG(1) << "eglMakeCurrent failed with error " | 93 DVLOG(1) << "eglMakeCurrent failed with error " |
85 << GetLastEGLErrorString(); | 94 << GetLastEGLErrorString(); |
86 return false; | 95 return false; |
87 } | 96 } |
88 | 97 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return GLContext::GetExtensions(); | 160 return GLContext::GetExtensions(); |
152 | 161 |
153 return GLContext::GetExtensions() + " " + extensions; | 162 return GLContext::GetExtensions() + " " + extensions; |
154 } | 163 } |
155 | 164 |
156 GLContextEGL::~GLContextEGL() { | 165 GLContextEGL::~GLContextEGL() { |
157 Destroy(); | 166 Destroy(); |
158 } | 167 } |
159 | 168 |
160 } // namespace gfx | 169 } // namespace gfx |
OLD | NEW |