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

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 1386323004: Revert of Added SyncToken command buffer trait to help with IPC messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « gpu/command_buffer/common/sync_token.cc ('k') | gpu/command_buffer/service/mailbox_manager.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 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/sync_token.h" 22 #include "gpu/command_buffer/common/gles2_cmd_format.h"
23 #include "gpu/command_buffer/common/value_state.h" 23 #include "gpu/command_buffer/common/value_state.h"
24 #include "gpu/command_buffer/service/command_buffer_service.h" 24 #include "gpu/command_buffer/service/command_buffer_service.h"
25 #include "gpu/command_buffer/service/context_group.h" 25 #include "gpu/command_buffer/service/context_group.h"
26 #include "gpu/command_buffer/service/gl_context_virtual.h" 26 #include "gpu/command_buffer/service/gl_context_virtual.h"
27 #include "gpu/command_buffer/service/gpu_scheduler.h" 27 #include "gpu/command_buffer/service/gpu_scheduler.h"
28 #include "gpu/command_buffer/service/gpu_switches.h" 28 #include "gpu/command_buffer/service/gpu_switches.h"
29 #include "gpu/command_buffer/service/image_factory.h" 29 #include "gpu/command_buffer/service/image_factory.h"
30 #include "gpu/command_buffer/service/image_manager.h" 30 #include "gpu/command_buffer/service/image_manager.h"
31 #include "gpu/command_buffer/service/mailbox_manager.h" 31 #include "gpu/command_buffer/service/mailbox_manager.h"
32 #include "gpu/command_buffer/service/memory_program_cache.h" 32 #include "gpu/command_buffer/service/memory_program_cache.h"
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 bool make_current_success = false; 810 bool make_current_success = false;
811 { 811 {
812 base::AutoLock lock(command_buffer_lock_); 812 base::AutoLock lock(command_buffer_lock_);
813 make_current_success = MakeCurrent(); 813 make_current_success = MakeCurrent();
814 } 814 }
815 if (make_current_success) { 815 if (make_current_success) {
816 // Old sync points are global and do not have a command buffer ID, 816 // Old sync points are global and do not have a command buffer ID,
817 // We can simply use the GPUIO namespace with 0 for the command buffer ID 817 // We can simply use the GPUIO namespace with 0 for the command buffer ID
818 // (under normal circumstances 0 is invalid so will not be used) until 818 // (under normal circumstances 0 is invalid so will not be used) until
819 // the old sync points are replaced. 819 // the old sync points are replaced.
820 SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, sync_point); 820 gles2::SyncToken sync_token = {gpu::CommandBufferNamespace::GPU_IO, 0,
821 sync_point};
821 mailbox_manager->PushTextureUpdates(sync_token); 822 mailbox_manager->PushTextureUpdates(sync_token);
822 } 823 }
823 } 824 }
824 service_->sync_point_manager()->RetireSyncPoint(sync_point); 825 service_->sync_point_manager()->RetireSyncPoint(sync_point);
825 } 826 }
826 827
827 void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point, 828 void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point,
828 const base::Closure& callback) { 829 const base::Closure& callback) {
829 CheckSequencedThread(); 830 CheckSequencedThread();
830 QueueTask(base::Bind(&InProcessCommandBuffer::SignalSyncPointOnGpuThread, 831 QueueTask(base::Bind(&InProcessCommandBuffer::SignalSyncPointOnGpuThread,
831 base::Unretained(this), 832 base::Unretained(this),
832 sync_point, 833 sync_point,
833 WrapCallback(callback))); 834 WrapCallback(callback)));
834 } 835 }
835 836
836 bool InProcessCommandBuffer::WaitSyncPointOnGpuThread(unsigned sync_point) { 837 bool InProcessCommandBuffer::WaitSyncPointOnGpuThread(unsigned sync_point) {
837 service_->sync_point_manager()->WaitSyncPoint(sync_point); 838 service_->sync_point_manager()->WaitSyncPoint(sync_point);
838 gles2::MailboxManager* mailbox_manager = 839 gles2::MailboxManager* mailbox_manager =
839 decoder_->GetContextGroup()->mailbox_manager(); 840 decoder_->GetContextGroup()->mailbox_manager();
840 // Old sync points are global and do not have a command buffer ID, 841 // Old sync points are global and do not have a command buffer ID,
841 // We can simply use the GPUIO namespace with 0 for the command buffer ID 842 // We can simply use the GPUIO namespace with 0 for the command buffer ID
842 // (under normal circumstances 0 is invalid so will not be used) until 843 // (under normal circumstances 0 is invalid so will not be used) until
843 // the old sync points are replaced. 844 // the old sync points are replaced.
844 SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, sync_point); 845 gles2::SyncToken sync_token = {gpu::CommandBufferNamespace::GPU_IO, 0,
846 sync_point};
845 mailbox_manager->PullTextureUpdates(sync_token); 847 mailbox_manager->PullTextureUpdates(sync_token);
846 return true; 848 return true;
847 } 849 }
848 850
849 void InProcessCommandBuffer::FenceSyncReleaseOnGpuThread(uint64_t release) { 851 void InProcessCommandBuffer::FenceSyncReleaseOnGpuThread(uint64_t release) {
850 DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release)); 852 DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release));
851 gles2::MailboxManager* mailbox_manager = 853 gles2::MailboxManager* mailbox_manager =
852 decoder_->GetContextGroup()->mailbox_manager(); 854 decoder_->GetContextGroup()->mailbox_manager();
853 if (mailbox_manager->UsesSync()) { 855 if (mailbox_manager->UsesSync()) {
854 bool make_current_success = false; 856 bool make_current_success = false;
855 { 857 {
856 base::AutoLock lock(command_buffer_lock_); 858 base::AutoLock lock(command_buffer_lock_);
857 make_current_success = MakeCurrent(); 859 make_current_success = MakeCurrent();
858 } 860 }
859 if (make_current_success) { 861 if (make_current_success) {
860 SyncToken sync_token(GetNamespaceID(), GetCommandBufferID(), release); 862 gles2::SyncToken sync_token = {GetNamespaceID(), GetCommandBufferID(),
863 release};
861 mailbox_manager->PushTextureUpdates(sync_token); 864 mailbox_manager->PushTextureUpdates(sync_token);
862 } 865 }
863 } 866 }
864 867
865 sync_point_client_->ReleaseFenceSync(release); 868 sync_point_client_->ReleaseFenceSync(release);
866 } 869 }
867 870
868 bool InProcessCommandBuffer::WaitFenceSyncOnGpuThread( 871 bool InProcessCommandBuffer::WaitFenceSyncOnGpuThread(
869 gpu::CommandBufferNamespace namespace_id, 872 gpu::CommandBufferNamespace namespace_id,
870 uint64_t command_buffer_id, 873 uint64_t command_buffer_id,
(...skipping 12 matching lines...) Expand all
883 // Use waitable event which is signalled when the release fence is released. 886 // Use waitable event which is signalled when the release fence is released.
884 sync_point_client_->Wait( 887 sync_point_client_->Wait(
885 release_state.get(), release, 888 release_state.get(), release,
886 base::Bind(&base::WaitableEvent::Signal, 889 base::Bind(&base::WaitableEvent::Signal,
887 base::Unretained(&fence_sync_wait_event_))); 890 base::Unretained(&fence_sync_wait_event_)));
888 fence_sync_wait_event_.Wait(); 891 fence_sync_wait_event_.Wait();
889 } 892 }
890 893
891 gles2::MailboxManager* mailbox_manager = 894 gles2::MailboxManager* mailbox_manager =
892 decoder_->GetContextGroup()->mailbox_manager(); 895 decoder_->GetContextGroup()->mailbox_manager();
893 SyncToken sync_token(namespace_id, command_buffer_id, release); 896 gles2::SyncToken sync_token = {namespace_id, command_buffer_id, release};
894 mailbox_manager->PullTextureUpdates(sync_token); 897 mailbox_manager->PullTextureUpdates(sync_token);
895 return true; 898 return true;
896 } 899 }
897 900
898 void InProcessCommandBuffer::SignalSyncPointOnGpuThread( 901 void InProcessCommandBuffer::SignalSyncPointOnGpuThread(
899 unsigned sync_point, 902 unsigned sync_point,
900 const base::Closure& callback) { 903 const base::Closure& callback) {
901 service_->sync_point_manager()->AddSyncPointCallback(sync_point, callback); 904 service_->sync_point_manager()->AddSyncPointCallback(sync_point, callback);
902 } 905 }
903 906
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 framebuffer_completeness_cache_ = 1077 framebuffer_completeness_cache_ =
1075 new gpu::gles2::FramebufferCompletenessCache; 1078 new gpu::gles2::FramebufferCompletenessCache;
1076 return framebuffer_completeness_cache_; 1079 return framebuffer_completeness_cache_;
1077 } 1080 }
1078 1081
1079 SyncPointManager* GpuInProcessThread::sync_point_manager() { 1082 SyncPointManager* GpuInProcessThread::sync_point_manager() {
1080 return sync_point_manager_; 1083 return sync_point_manager_;
1081 } 1084 }
1082 1085
1083 } // namespace gpu 1086 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/sync_token.cc ('k') | gpu/command_buffer/service/mailbox_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698