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

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

Issue 1495893005: Revert of Added an extra sync token field for extra command buffer identification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 DCHECK_EQ(fence_sync - 1, flushed_fence_sync_release_); 699 DCHECK_EQ(fence_sync - 1, flushed_fence_sync_release_);
700 } 700 }
701 701
702 QueueTask(base::Bind(&InProcessCommandBuffer::CreateImageOnGpuThread, 702 QueueTask(base::Bind(&InProcessCommandBuffer::CreateImageOnGpuThread,
703 base::Unretained(this), new_id, handle, 703 base::Unretained(this), new_id, handle,
704 gfx::Size(width, height), gpu_memory_buffer->GetFormat(), 704 gfx::Size(width, height), gpu_memory_buffer->GetFormat(),
705 internalformat, order_num, fence_sync)); 705 internalformat, order_num, fence_sync));
706 706
707 if (fence_sync) { 707 if (fence_sync) {
708 flushed_fence_sync_release_ = fence_sync; 708 flushed_fence_sync_release_ = fence_sync;
709 SyncToken sync_token(GetNamespaceID(), GetExtraCommandBufferData(), 709 SyncToken sync_token(GetNamespaceID(), GetCommandBufferID(), fence_sync);
710 GetCommandBufferID(), fence_sync);
711 sync_token.SetVerifyFlush(); 710 sync_token.SetVerifyFlush();
712 gpu_memory_buffer_manager_->SetDestructionSyncToken(gpu_memory_buffer, 711 gpu_memory_buffer_manager_->SetDestructionSyncToken(gpu_memory_buffer,
713 sync_token); 712 sync_token);
714 } 713 }
715 714
716 return new_id; 715 return new_id;
717 } 716 }
718 717
719 void InProcessCommandBuffer::CreateImageOnGpuThread( 718 void InProcessCommandBuffer::CreateImageOnGpuThread(
720 int32 id, 719 int32 id,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 bool make_current_success = false; 845 bool make_current_success = false;
847 { 846 {
848 base::AutoLock lock(command_buffer_lock_); 847 base::AutoLock lock(command_buffer_lock_);
849 make_current_success = MakeCurrent(); 848 make_current_success = MakeCurrent();
850 } 849 }
851 if (make_current_success) { 850 if (make_current_success) {
852 // Old sync points are global and do not have a command buffer ID, 851 // Old sync points are global and do not have a command buffer ID,
853 // We can simply use the GPUIO namespace with 0 for the command buffer ID 852 // We can simply use the GPUIO namespace with 0 for the command buffer ID
854 // (under normal circumstances 0 is invalid so will not be used) until 853 // (under normal circumstances 0 is invalid so will not be used) until
855 // the old sync points are replaced. 854 // the old sync points are replaced.
856 SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, 0, 855 SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, sync_point);
857 sync_point);
858 mailbox_manager->PushTextureUpdates(sync_token); 856 mailbox_manager->PushTextureUpdates(sync_token);
859 } 857 }
860 } 858 }
861 service_->sync_point_manager()->RetireSyncPoint(sync_point); 859 service_->sync_point_manager()->RetireSyncPoint(sync_point);
862 } 860 }
863 861
864 void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point, 862 void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point,
865 const base::Closure& callback) { 863 const base::Closure& callback) {
866 service_->sync_point_manager()->AddSyncPointCallback(sync_point, 864 service_->sync_point_manager()->AddSyncPointCallback(sync_point,
867 WrapCallback(callback)); 865 WrapCallback(callback));
868 } 866 }
869 867
870 bool InProcessCommandBuffer::WaitSyncPointOnGpuThread(unsigned sync_point) { 868 bool InProcessCommandBuffer::WaitSyncPointOnGpuThread(unsigned sync_point) {
871 service_->sync_point_manager()->WaitSyncPoint(sync_point); 869 service_->sync_point_manager()->WaitSyncPoint(sync_point);
872 gles2::MailboxManager* mailbox_manager = 870 gles2::MailboxManager* mailbox_manager =
873 decoder_->GetContextGroup()->mailbox_manager(); 871 decoder_->GetContextGroup()->mailbox_manager();
874 // Old sync points are global and do not have a command buffer ID, 872 // Old sync points are global and do not have a command buffer ID,
875 // We can simply use the GPUIO namespace with 0 for the command buffer ID 873 // We can simply use the GPUIO namespace with 0 for the command buffer ID
876 // (under normal circumstances 0 is invalid so will not be used) until 874 // (under normal circumstances 0 is invalid so will not be used) until
877 // the old sync points are replaced. 875 // the old sync points are replaced.
878 SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, 0, sync_point); 876 SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, sync_point);
879 mailbox_manager->PullTextureUpdates(sync_token); 877 mailbox_manager->PullTextureUpdates(sync_token);
880 return true; 878 return true;
881 } 879 }
882 880
883 void InProcessCommandBuffer::FenceSyncReleaseOnGpuThread(uint64_t release) { 881 void InProcessCommandBuffer::FenceSyncReleaseOnGpuThread(uint64_t release) {
884 DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release)); 882 DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release));
885 gles2::MailboxManager* mailbox_manager = 883 gles2::MailboxManager* mailbox_manager =
886 decoder_->GetContextGroup()->mailbox_manager(); 884 decoder_->GetContextGroup()->mailbox_manager();
887 if (mailbox_manager->UsesSync()) { 885 if (mailbox_manager->UsesSync()) {
888 bool make_current_success = false; 886 bool make_current_success = false;
889 { 887 {
890 base::AutoLock lock(command_buffer_lock_); 888 base::AutoLock lock(command_buffer_lock_);
891 make_current_success = MakeCurrent(); 889 make_current_success = MakeCurrent();
892 } 890 }
893 if (make_current_success) { 891 if (make_current_success) {
894 SyncToken sync_token(GetNamespaceID(), GetExtraCommandBufferData(), 892 SyncToken sync_token(GetNamespaceID(), GetCommandBufferID(), release);
895 GetCommandBufferID(), release);
896 mailbox_manager->PushTextureUpdates(sync_token); 893 mailbox_manager->PushTextureUpdates(sync_token);
897 } 894 }
898 } 895 }
899 896
900 sync_point_client_->ReleaseFenceSync(release); 897 sync_point_client_->ReleaseFenceSync(release);
901 } 898 }
902 899
903 bool InProcessCommandBuffer::WaitFenceSyncOnGpuThread( 900 bool InProcessCommandBuffer::WaitFenceSyncOnGpuThread(
904 gpu::CommandBufferNamespace namespace_id, 901 gpu::CommandBufferNamespace namespace_id,
905 uint64_t command_buffer_id, 902 uint64_t command_buffer_id,
(...skipping 12 matching lines...) Expand all
918 // Use waitable event which is signalled when the release fence is released. 915 // Use waitable event which is signalled when the release fence is released.
919 sync_point_client_->Wait( 916 sync_point_client_->Wait(
920 release_state.get(), release, 917 release_state.get(), release,
921 base::Bind(&base::WaitableEvent::Signal, 918 base::Bind(&base::WaitableEvent::Signal,
922 base::Unretained(&fence_sync_wait_event_))); 919 base::Unretained(&fence_sync_wait_event_)));
923 fence_sync_wait_event_.Wait(); 920 fence_sync_wait_event_.Wait();
924 } 921 }
925 922
926 gles2::MailboxManager* mailbox_manager = 923 gles2::MailboxManager* mailbox_manager =
927 decoder_->GetContextGroup()->mailbox_manager(); 924 decoder_->GetContextGroup()->mailbox_manager();
928 SyncToken sync_token(namespace_id, 0, command_buffer_id, release); 925 SyncToken sync_token(namespace_id, command_buffer_id, release);
929 mailbox_manager->PullTextureUpdates(sync_token); 926 mailbox_manager->PullTextureUpdates(sync_token);
930 return true; 927 return true;
931 } 928 }
932 929
933 void InProcessCommandBuffer::SignalSyncTokenOnGpuThread( 930 void InProcessCommandBuffer::SignalSyncTokenOnGpuThread(
934 const SyncToken& sync_token, const base::Closure& callback) { 931 const SyncToken& sync_token, const base::Closure& callback) {
935 gpu::SyncPointManager* sync_point_manager = service_->sync_point_manager(); 932 gpu::SyncPointManager* sync_point_manager = service_->sync_point_manager();
936 DCHECK(sync_point_manager); 933 DCHECK(sync_point_manager);
937 934
938 scoped_refptr<gpu::SyncPointClientState> release_state = 935 scoped_refptr<gpu::SyncPointClientState> release_state =
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 } 977 }
981 978
982 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const { 979 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const {
983 return CommandBufferNamespace::IN_PROCESS; 980 return CommandBufferNamespace::IN_PROCESS;
984 } 981 }
985 982
986 uint64_t InProcessCommandBuffer::GetCommandBufferID() const { 983 uint64_t InProcessCommandBuffer::GetCommandBufferID() const {
987 return command_buffer_id_; 984 return command_buffer_id_;
988 } 985 }
989 986
990 int32_t InProcessCommandBuffer::GetExtraCommandBufferData() const {
991 return 0;
992 }
993
994 uint64_t InProcessCommandBuffer::GenerateFenceSyncRelease() { 987 uint64_t InProcessCommandBuffer::GenerateFenceSyncRelease() {
995 return next_fence_sync_release_++; 988 return next_fence_sync_release_++;
996 } 989 }
997 990
998 bool InProcessCommandBuffer::IsFenceSyncRelease(uint64_t release) { 991 bool InProcessCommandBuffer::IsFenceSyncRelease(uint64_t release) {
999 return release != 0 && release < next_fence_sync_release_; 992 return release != 0 && release < next_fence_sync_release_;
1000 } 993 }
1001 994
1002 bool InProcessCommandBuffer::IsFenceSyncFlushed(uint64_t release) { 995 bool InProcessCommandBuffer::IsFenceSyncFlushed(uint64_t release) {
1003 return release <= flushed_fence_sync_release_; 996 return release <= flushed_fence_sync_release_;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 framebuffer_completeness_cache_ = 1133 framebuffer_completeness_cache_ =
1141 new gpu::gles2::FramebufferCompletenessCache; 1134 new gpu::gles2::FramebufferCompletenessCache;
1142 return framebuffer_completeness_cache_; 1135 return framebuffer_completeness_cache_;
1143 } 1136 }
1144 1137
1145 SyncPointManager* GpuInProcessThread::sync_point_manager() { 1138 SyncPointManager* GpuInProcessThread::sync_point_manager() {
1146 return sync_point_manager_; 1139 return sync_point_manager_;
1147 } 1140 }
1148 1141
1149 } // namespace gpu 1142 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.h ('k') | gpu/command_buffer/service/mailbox_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698