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

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

Issue 13140006: gpu: Fix Vivante's "hisilicon" GPUs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add TODO 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
115 if (!surface->OnMakeCurrent(this)) { 118 if (!surface->OnMakeCurrent(this)) {
116 LOG(ERROR) << "Could not make current."; 119 LOG(ERROR) << "Could not make current.";
117 return false; 120 return false;
118 } 121 }
119 122
120 SetRealGLApi(); 123 SetRealGLApi();
121 return true; 124 return true;
122 } 125 }
123 126
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
136 glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
greggman 2013/04/16 19:51:20 Sorry if this is a dumb question. It's getting har
137 eglMakeCurrent(display_,
138 EGL_NO_SURFACE,
139 EGL_NO_SURFACE,
140 EGL_NO_CONTEXT);
141 if (!surface->Recreate()) {
142 LOG(ERROR) << "Failed to recreate surface";
143 return false;
144 }
145 if (!eglMakeCurrent(display_,
146 surface->GetHandle(),
147 surface->GetHandle(),
148 context_)) {
149 LOG(ERROR) << "eglMakeCurrent failed with error "
150 << GetLastEGLErrorString();
151 return false;
152 }
153 return true;
154 }
155
124 void GLContextEGL::ReleaseCurrent(GLSurface* surface) { 156 void GLContextEGL::ReleaseCurrent(GLSurface* surface) {
125 if (!IsCurrent(surface)) 157 if (!IsCurrent(surface))
126 return; 158 return;
127 159
128 SetCurrent(NULL, NULL); 160 SetCurrent(NULL, NULL);
129 eglMakeCurrent(display_, 161 eglMakeCurrent(display_,
130 EGL_NO_SURFACE, 162 EGL_NO_SURFACE,
131 EGL_NO_SURFACE, 163 EGL_NO_SURFACE,
132 EGL_NO_CONTEXT); 164 EGL_NO_CONTEXT);
133 } 165 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 216
185 #if !defined(OS_ANDROID) 217 #if !defined(OS_ANDROID)
186 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { 218 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) {
187 DCHECK(bytes); 219 DCHECK(bytes);
188 *bytes = 0; 220 *bytes = 0;
189 return false; 221 return false;
190 } 222 }
191 #endif 223 #endif
192 224
193 } // namespace gfx 225 } // 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