OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" | 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 12 #include "base/debug/trace_event_synthetic_delay.h" |
12 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
16 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
17 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" | 18 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" |
18 #include "gpu/command_buffer/service/safe_shared_memory_pool.h" | 19 #include "gpu/command_buffer/service/safe_shared_memory_pool.h" |
19 #include "ui/gl/gl_context.h" | 20 #include "ui/gl/gl_context.h" |
20 #include "ui/gl/gl_surface_egl.h" | 21 #include "ui/gl/gl_surface_egl.h" |
21 #include "ui/gl/scoped_binders.h" | 22 #include "ui/gl/scoped_binders.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // GPU action that needs to occur. We could use fences and try | 228 // GPU action that needs to occur. We could use fences and try |
228 // to do this less often. However, on older drivers fences are | 229 // to do this less often. However, on older drivers fences are |
229 // not always reliable (eg. Mali-400 just blocks forever). | 230 // not always reliable (eg. Mali-400 just blocks forever). |
230 if (wait_for_uploads_) { | 231 if (wait_for_uploads_) { |
231 TRACE_EVENT0("gpu", "glFinish"); | 232 TRACE_EVENT0("gpu", "glFinish"); |
232 glFinish(); | 233 glFinish(); |
233 } | 234 } |
234 } | 235 } |
235 | 236 |
236 void MarkAsTransferIsInProgress() { | 237 void MarkAsTransferIsInProgress() { |
| 238 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("gpu.AsyncTexImage"); |
237 transfer_completion_.Reset(); | 239 transfer_completion_.Reset(); |
238 } | 240 } |
239 | 241 |
240 void MarkAsCompleted() { | 242 void MarkAsCompleted() { |
| 243 TRACE_EVENT_SYNTHETIC_DELAY_END("gpu.AsyncTexImage"); |
241 transfer_completion_.Signal(); | 244 transfer_completion_.Signal(); |
242 } | 245 } |
243 | 246 |
244 void WaitForTransferCompletion() { | 247 void WaitForTransferCompletion() { |
245 TRACE_EVENT0("gpu", "WaitForTransferCompletion"); | 248 TRACE_EVENT0("gpu", "WaitForTransferCompletion"); |
246 // TODO(backer): Deschedule the channel rather than blocking the main GPU | 249 // TODO(backer): Deschedule the channel rather than blocking the main GPU |
247 // thread (crbug.com/240265). | 250 // thread (crbug.com/240265). |
248 transfer_completion_.Wait(); | 251 transfer_completion_.Wait(); |
249 } | 252 } |
250 | 253 |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 | 768 |
766 AsyncPixelTransferDelegate* | 769 AsyncPixelTransferDelegate* |
767 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl( | 770 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl( |
768 gles2::TextureRef* ref, | 771 gles2::TextureRef* ref, |
769 const AsyncTexImage2DParams& define_params) { | 772 const AsyncTexImage2DParams& define_params) { |
770 return new AsyncPixelTransferDelegateEGL( | 773 return new AsyncPixelTransferDelegateEGL( |
771 &shared_state_, ref->service_id(), define_params); | 774 &shared_state_, ref->service_id(), define_params); |
772 } | 775 } |
773 | 776 |
774 } // namespace gpu | 777 } // namespace gpu |
OLD | NEW |