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

Side by Side Diff: ui/gl/gl_context_egl.cc

Issue 14241009: Revert "gpu: Fix Vivante's "hisilicon" GPUs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@HUAWEI_fix_black_fix_var
Patch Set: Created 7 years, 8 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 unified diff | Download patch
« no previous file with comments | « ui/gl/gl_context_egl.h ('k') | ui/gl/gl_surface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 << GetLastEGLErrorString(); 105 << GetLastEGLErrorString();
106 return false; 106 return false;
107 } 107 }
108 108
109 SetCurrent(this, surface); 109 SetCurrent(this, surface);
110 if (!InitializeExtensionBindings()) { 110 if (!InitializeExtensionBindings()) {
111 ReleaseCurrent(surface); 111 ReleaseCurrent(surface);
112 return false; 112 return false;
113 } 113 }
114 114
115 if (!RecreateSurfaceIfNeeded(surface))
116 return false;
117
118 if (!surface->OnMakeCurrent(this)) { 115 if (!surface->OnMakeCurrent(this)) {
119 LOG(ERROR) << "Could not make current."; 116 LOG(ERROR) << "Could not make current.";
120 return false; 117 return false;
121 } 118 }
122 119
123 SetRealGLApi(); 120 SetRealGLApi();
124 return true; 121 return true;
125 } 122 }
126 123
127 bool GLContextEGL::RecreateSurfaceIfNeeded(GLSurface* surface) {
128 if (!surface || !surface->RecreateOnMakeCurrent())
129 return true;
130
131 // This is specifically needed for Vivante GPU's on Android.
132 // A native view surface will not be configured correctly
133 // unless we do all of the following steps after making the
134 // surface current.
135 GLint fbo = 0;
136 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbo);
137 glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
138
139 eglMakeCurrent(display_,
140 EGL_NO_SURFACE,
141 EGL_NO_SURFACE,
142 EGL_NO_CONTEXT);
143 if (!surface->Recreate()) {
144 LOG(ERROR) << "Failed to recreate surface";
145 return false;
146 }
147 if (!eglMakeCurrent(display_,
148 surface->GetHandle(),
149 surface->GetHandle(),
150 context_)) {
151 LOG(ERROR) << "eglMakeCurrent failed with error "
152 << GetLastEGLErrorString();
153 return false;
154 }
155
156 glBindFramebufferEXT(GL_FRAMEBUFFER, fbo);
157 return true;
158 }
159
160 void GLContextEGL::ReleaseCurrent(GLSurface* surface) { 124 void GLContextEGL::ReleaseCurrent(GLSurface* surface) {
161 if (!IsCurrent(surface)) 125 if (!IsCurrent(surface))
162 return; 126 return;
163 127
164 SetCurrent(NULL, NULL); 128 SetCurrent(NULL, NULL);
165 eglMakeCurrent(display_, 129 eglMakeCurrent(display_,
166 EGL_NO_SURFACE, 130 EGL_NO_SURFACE,
167 EGL_NO_SURFACE, 131 EGL_NO_SURFACE,
168 EGL_NO_CONTEXT); 132 EGL_NO_CONTEXT);
169 } 133 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 184
221 #if !defined(OS_ANDROID) 185 #if !defined(OS_ANDROID)
222 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { 186 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) {
223 DCHECK(bytes); 187 DCHECK(bytes);
224 *bytes = 0; 188 *bytes = 0;
225 return false; 189 return false;
226 } 190 }
227 #endif 191 #endif
228 192
229 } // namespace gfx 193 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_context_egl.h ('k') | ui/gl/gl_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698