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: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 1331843005: Implemented new fence syncs which replaces the old sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reverted some unnecesary changes, fixed some small issues Created 5 years, 2 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
OLDNEW
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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/sequence_checker.h" 18 #include "base/sequence_checker.h"
19 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
20 #include "base/thread_task_runner_handle.h" 20 #include "base/thread_task_runner_handle.h"
21 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 21 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
22 #include "gpu/command_buffer/common/gles2_cmd_format.h"
22 #include "gpu/command_buffer/common/value_state.h" 23 #include "gpu/command_buffer/common/value_state.h"
23 #include "gpu/command_buffer/service/command_buffer_service.h" 24 #include "gpu/command_buffer/service/command_buffer_service.h"
24 #include "gpu/command_buffer/service/context_group.h" 25 #include "gpu/command_buffer/service/context_group.h"
25 #include "gpu/command_buffer/service/gl_context_virtual.h" 26 #include "gpu/command_buffer/service/gl_context_virtual.h"
26 #include "gpu/command_buffer/service/gpu_scheduler.h" 27 #include "gpu/command_buffer/service/gpu_scheduler.h"
27 #include "gpu/command_buffer/service/gpu_switches.h" 28 #include "gpu/command_buffer/service/gpu_switches.h"
28 #include "gpu/command_buffer/service/image_factory.h" 29 #include "gpu/command_buffer/service/image_factory.h"
29 #include "gpu/command_buffer/service/image_manager.h" 30 #include "gpu/command_buffer/service/image_manager.h"
30 #include "gpu/command_buffer/service/mailbox_manager.h" 31 #include "gpu/command_buffer/service/mailbox_manager.h"
31 #include "gpu/command_buffer/service/memory_program_cache.h" 32 #include "gpu/command_buffer/service/memory_program_cache.h"
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 791
791 void InProcessCommandBuffer::RetireSyncPointOnGpuThread(uint32 sync_point) { 792 void InProcessCommandBuffer::RetireSyncPointOnGpuThread(uint32 sync_point) {
792 gles2::MailboxManager* mailbox_manager = 793 gles2::MailboxManager* mailbox_manager =
793 decoder_->GetContextGroup()->mailbox_manager(); 794 decoder_->GetContextGroup()->mailbox_manager();
794 if (mailbox_manager->UsesSync()) { 795 if (mailbox_manager->UsesSync()) {
795 bool make_current_success = false; 796 bool make_current_success = false;
796 { 797 {
797 base::AutoLock lock(command_buffer_lock_); 798 base::AutoLock lock(command_buffer_lock_);
798 make_current_success = MakeCurrent(); 799 make_current_success = MakeCurrent();
799 } 800 }
800 if (make_current_success) 801 if (make_current_success) {
801 mailbox_manager->PushTextureUpdates(sync_point); 802 gles2::SyncToken sync_token = {
803 GetNamespaceID(),
804 GetCommandBufferID(),
805 sync_point
806 };
807 mailbox_manager->PushTextureUpdates(sync_token);
808 }
802 } 809 }
803 service_->sync_point_manager()->RetireSyncPoint(sync_point); 810 service_->sync_point_manager()->RetireSyncPoint(sync_point);
804 } 811 }
805 812
806 void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point, 813 void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point,
807 const base::Closure& callback) { 814 const base::Closure& callback) {
808 CheckSequencedThread(); 815 CheckSequencedThread();
809 QueueTask(base::Bind(&InProcessCommandBuffer::SignalSyncPointOnGpuThread, 816 QueueTask(base::Bind(&InProcessCommandBuffer::SignalSyncPointOnGpuThread,
810 base::Unretained(this), 817 base::Unretained(this),
811 sync_point, 818 sync_point,
812 WrapCallback(callback))); 819 WrapCallback(callback)));
813 } 820 }
814 821
815 bool InProcessCommandBuffer::WaitSyncPointOnGpuThread(unsigned sync_point) { 822 bool InProcessCommandBuffer::WaitSyncPointOnGpuThread(unsigned sync_point) {
816 service_->sync_point_manager()->WaitSyncPoint(sync_point); 823 service_->sync_point_manager()->WaitSyncPoint(sync_point);
817 gles2::MailboxManager* mailbox_manager = 824 gles2::MailboxManager* mailbox_manager =
818 decoder_->GetContextGroup()->mailbox_manager(); 825 decoder_->GetContextGroup()->mailbox_manager();
819 mailbox_manager->PullTextureUpdates(sync_point); 826 gles2::SyncToken sync_token = {
827 GetNamespaceID(),
828 GetCommandBufferID(),
829 sync_point
830 };
831 mailbox_manager->PullTextureUpdates(sync_token);
820 return true; 832 return true;
821 } 833 }
822 834
823 void InProcessCommandBuffer::SignalSyncPointOnGpuThread( 835 void InProcessCommandBuffer::SignalSyncPointOnGpuThread(
824 unsigned sync_point, 836 unsigned sync_point,
825 const base::Closure& callback) { 837 const base::Closure& callback) {
826 service_->sync_point_manager()->AddSyncPointCallback(sync_point, callback); 838 service_->sync_point_manager()->AddSyncPointCallback(sync_point, callback);
827 } 839 }
828 840
829 void InProcessCommandBuffer::SignalQuery(unsigned query_id, 841 void InProcessCommandBuffer::SignalQuery(unsigned query_id,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 framebuffer_completeness_cache_ = 999 framebuffer_completeness_cache_ =
988 new gpu::gles2::FramebufferCompletenessCache; 1000 new gpu::gles2::FramebufferCompletenessCache;
989 return framebuffer_completeness_cache_; 1001 return framebuffer_completeness_cache_;
990 } 1002 }
991 1003
992 SyncPointManager* GpuInProcessThread::sync_point_manager() { 1004 SyncPointManager* GpuInProcessThread::sync_point_manager() {
993 return sync_point_manager_; 1005 return sync_point_manager_;
994 } 1006 }
995 1007
996 } // namespace gpu 1008 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698