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/in_process_command_buffer.h" | 5 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "base/message_loop/message_loop_proxy.h" | 23 #include "base/message_loop/message_loop_proxy.h" |
24 #include "base/sequence_checker.h" | 24 #include "base/sequence_checker.h" |
25 #include "base/synchronization/condition_variable.h" | 25 #include "base/synchronization/condition_variable.h" |
26 #include "base/threading/thread.h" | 26 #include "base/threading/thread.h" |
27 #include "gpu/command_buffer/service/command_buffer_service.h" | 27 #include "gpu/command_buffer/service/command_buffer_service.h" |
28 #include "gpu/command_buffer/service/context_group.h" | 28 #include "gpu/command_buffer/service/context_group.h" |
29 #include "gpu/command_buffer/service/gl_context_virtual.h" | 29 #include "gpu/command_buffer/service/gl_context_virtual.h" |
30 #include "gpu/command_buffer/service/gpu_control_service.h" | 30 #include "gpu/command_buffer/service/gpu_control_service.h" |
31 #include "gpu/command_buffer/service/gpu_scheduler.h" | 31 #include "gpu/command_buffer/service/gpu_scheduler.h" |
32 #include "gpu/command_buffer/service/image_manager.h" | 32 #include "gpu/command_buffer/service/image_manager.h" |
| 33 #include "gpu/command_buffer/service/mailbox_manager.h" |
33 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 34 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
34 #include "ui/gfx/size.h" | 35 #include "ui/gfx/size.h" |
35 #include "ui/gl/gl_context.h" | 36 #include "ui/gl/gl_context.h" |
36 #include "ui/gl/gl_image.h" | 37 #include "ui/gl/gl_image.h" |
37 #include "ui/gl/gl_share_group.h" | 38 #include "ui/gl/gl_share_group.h" |
38 | 39 |
39 #if defined(OS_ANDROID) | 40 #if defined(OS_ANDROID) |
40 #include "gpu/command_buffer/service/stream_texture_manager_in_process_android.h
" | 41 #include "gpu/command_buffer/service/stream_texture_manager_in_process_android.h
" |
41 #include "ui/gl/android/surface_texture.h" | 42 #include "ui/gl/android/surface_texture.h" |
42 #endif | 43 #endif |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 166 } |
166 | 167 |
167 base::LazyInstance<SyncPointManager> g_sync_point_manager = | 168 base::LazyInstance<SyncPointManager> g_sync_point_manager = |
168 LAZY_INSTANCE_INITIALIZER; | 169 LAZY_INSTANCE_INITIALIZER; |
169 | 170 |
170 bool WaitSyncPoint(uint32 sync_point) { | 171 bool WaitSyncPoint(uint32 sync_point) { |
171 g_sync_point_manager.Get().WaitSyncPoint(sync_point); | 172 g_sync_point_manager.Get().WaitSyncPoint(sync_point); |
172 return true; | 173 return true; |
173 } | 174 } |
174 | 175 |
175 void RetireSyncPoint(uint32 sync_point) { | |
176 g_sync_point_manager.Get().RetireSyncPoint(sync_point); | |
177 } | |
178 | |
179 } // anonyous namespace | 176 } // anonyous namespace |
180 | 177 |
181 InProcessCommandBuffer::Service::Service() {} | 178 InProcessCommandBuffer::Service::Service() {} |
182 | 179 |
183 InProcessCommandBuffer::Service::~Service() {} | 180 InProcessCommandBuffer::Service::~Service() {} |
184 | 181 |
185 scoped_refptr<InProcessCommandBuffer::Service> | 182 scoped_refptr<InProcessCommandBuffer::Service> |
186 InProcessCommandBuffer::GetDefaultService() { | 183 InProcessCommandBuffer::GetDefaultService() { |
187 base::AutoLock lock(default_thread_clients_lock_.Get()); | 184 base::AutoLock lock(default_thread_clients_lock_.Get()); |
188 scoped_refptr<Service> service; | 185 scoped_refptr<Service> service; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 CheckSequencedThread(); | 611 CheckSequencedThread(); |
615 base::Closure task = base::Bind(&GpuControl::DestroyGpuMemoryBuffer, | 612 base::Closure task = base::Bind(&GpuControl::DestroyGpuMemoryBuffer, |
616 base::Unretained(gpu_control_.get()), | 613 base::Unretained(gpu_control_.get()), |
617 id); | 614 id); |
618 | 615 |
619 QueueTask(task); | 616 QueueTask(task); |
620 } | 617 } |
621 | 618 |
622 uint32 InProcessCommandBuffer::InsertSyncPoint() { | 619 uint32 InProcessCommandBuffer::InsertSyncPoint() { |
623 uint32 sync_point = g_sync_point_manager.Get().GenerateSyncPoint(); | 620 uint32 sync_point = g_sync_point_manager.Get().GenerateSyncPoint(); |
624 QueueTask(base::Bind(&RetireSyncPoint, sync_point)); | 621 QueueTask(base::Bind(&InProcessCommandBuffer::RetireSyncPointOnGpuThread, |
| 622 base::Unretained(this), |
| 623 sync_point)); |
625 return sync_point; | 624 return sync_point; |
626 } | 625 } |
627 | 626 |
| 627 void InProcessCommandBuffer::RetireSyncPointOnGpuThread(uint32 sync_point) { |
| 628 gles2::MailboxManager* mailbox_manager = |
| 629 decoder_->GetContextGroup()->mailbox_manager(); |
| 630 if (mailbox_manager->UsesSync() && MakeCurrent()) |
| 631 mailbox_manager->PushTextureUpdates(); |
| 632 g_sync_point_manager.Get().RetireSyncPoint(sync_point); |
| 633 } |
| 634 |
628 void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point, | 635 void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point, |
629 const base::Closure& callback) { | 636 const base::Closure& callback) { |
630 CheckSequencedThread(); | 637 CheckSequencedThread(); |
631 QueueTask(base::Bind(&InProcessCommandBuffer::SignalSyncPointOnGpuThread, | 638 QueueTask(base::Bind(&InProcessCommandBuffer::SignalSyncPointOnGpuThread, |
632 base::Unretained(this), | 639 base::Unretained(this), |
633 sync_point, | 640 sync_point, |
634 WrapCallback(callback))); | 641 WrapCallback(callback))); |
635 } | 642 } |
636 | 643 |
637 void InProcessCommandBuffer::SignalSyncPointOnGpuThread( | 644 void InProcessCommandBuffer::SignalSyncPointOnGpuThread( |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 } | 759 } |
753 #endif | 760 #endif |
754 | 761 |
755 // static | 762 // static |
756 void InProcessCommandBuffer::SetGpuMemoryBufferFactory( | 763 void InProcessCommandBuffer::SetGpuMemoryBufferFactory( |
757 GpuMemoryBufferFactory* factory) { | 764 GpuMemoryBufferFactory* factory) { |
758 g_gpu_memory_buffer_factory = factory; | 765 g_gpu_memory_buffer_factory = factory; |
759 } | 766 } |
760 | 767 |
761 } // namespace gpu | 768 } // namespace gpu |
OLD | NEW |