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

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

Issue 12208007: gpu: Work around Mali-400 driver bug. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch. Created 7 years, 10 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 | « no previous file | no next file » | 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/async_pixel_transfer_delegate_android.h" 5 #include "ui/gl/async_pixel_transfer_delegate_android.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // doing the first upload (or the texture remains black). 214 // doing the first upload (or the texture remains black).
215 // A fence after image creation didn't always work, but glFinish 215 // A fence after image creation didn't always work, but glFinish
216 // seems to always work, and this only happens on the upload thread. 216 // seems to always work, and this only happens on the upload thread.
217 if (wait_for_egl_images_) { 217 if (wait_for_egl_images_) {
218 TRACE_EVENT0("gpu", "glFinish"); 218 TRACE_EVENT0("gpu", "glFinish");
219 glFinish(); 219 glFinish();
220 } 220 }
221 } 221 }
222 222
223 void WaitForLastUpload() { 223 void WaitForLastUpload() {
224 if (!wait_for_uploads_) 224 // This glFinish is just a safe-guard for if uploads have some
225 return; 225 // GPU action that needs to occur. We could use fences and try
226 226 // to do this less often. However, on older drivers fences are
227 // This fence is basically like calling glFinish, which is fine on 227 // not always reliable (eg. Mali-400 just blocks forever).
228 // the upload thread if uploads occur on the CPU. We may want to delay 228 if (wait_for_uploads_) {
229 // blocking on this fence if this causes any stalls. 229 TRACE_EVENT0("gpu", "glFinish");
230 230 glFinish();
231 TRACE_EVENT0("gpu", "eglWaitSync"); 231 }
232 EGLDisplay display = eglGetCurrentDisplay();
233 EGLSyncKHR fence = eglCreateSyncKHR(display, EGL_SYNC_FENCE_KHR, NULL);
234 EGLint flags = EGL_SYNC_FLUSH_COMMANDS_BIT_KHR;
235 EGLTimeKHR time = EGL_FOREVER_KHR;
236 eglClientWaitSyncKHR(display, fence, flags, time);
237 eglDestroySyncKHR(display, fence);
238 } 232 }
239 233
240 protected: 234 protected:
241 friend class base::RefCountedThreadSafe<TransferStateInternal>; 235 friend class base::RefCountedThreadSafe<TransferStateInternal>;
242 friend class AsyncPixelTransferDelegateAndroid; 236 friend class AsyncPixelTransferDelegateAndroid;
243 237
244 static void DeleteTexture(GLuint id) { 238 static void DeleteTexture(GLuint id) {
245 glDeleteTextures(1, &id); 239 glDeleteTextures(1, &id);
246 } 240 }
247 241
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 data); 757 data);
764 } 758 }
765 texture_upload_count_++; 759 texture_upload_count_++;
766 total_texture_upload_time_ += base::TimeTicks::HighResNow() - begin_time; 760 total_texture_upload_time_ += base::TimeTicks::HighResNow() - begin_time;
767 761
768 DCHECK(CHECK_GL()); 762 DCHECK(CHECK_GL());
769 return true; 763 return true;
770 } 764 }
771 765
772 } // namespace gfx 766 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698