| 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 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 | 900 |
| 901 gles2::QueryManager::Query* query = query_manager_->GetQuery(query_id); | 901 gles2::QueryManager::Query* query = query_manager_->GetQuery(query_id); |
| 902 if (!query) | 902 if (!query) |
| 903 callback.Run(); | 903 callback.Run(); |
| 904 else | 904 else |
| 905 query->AddCallback(callback); | 905 query->AddCallback(callback); |
| 906 } | 906 } |
| 907 | 907 |
| 908 void InProcessCommandBuffer::SetSurfaceVisible(bool visible) {} | 908 void InProcessCommandBuffer::SetSurfaceVisible(bool visible) {} |
| 909 | 909 |
| 910 uint32 InProcessCommandBuffer::CreateStreamTexture(uint32 texture_id) { | 910 int32 InProcessCommandBuffer::CreateStreamTexture(uint32 texture_id) { |
| 911 base::WaitableEvent completion(true, false); | 911 base::WaitableEvent completion(true, false); |
| 912 uint32 stream_id = 0; | 912 int32 stream_id = 0; |
| 913 base::Callback<uint32(void)> task = | 913 base::Callback<int32(void)> task = |
| 914 base::Bind(&InProcessCommandBuffer::CreateStreamTextureOnGpuThread, | 914 base::Bind(&InProcessCommandBuffer::CreateStreamTextureOnGpuThread, |
| 915 base::Unretained(this), | 915 base::Unretained(this), texture_id); |
| 916 texture_id); | |
| 917 QueueTask( | 916 QueueTask( |
| 918 base::Bind(&RunTaskWithResult<uint32>, task, &stream_id, &completion)); | 917 base::Bind(&RunTaskWithResult<int32>, task, &stream_id, &completion)); |
| 919 completion.Wait(); | 918 completion.Wait(); |
| 920 return stream_id; | 919 return stream_id; |
| 921 } | 920 } |
| 922 | 921 |
| 922 void InProcessCommandBuffer::SetStreamTextureSize(uint32 texture_id, |
| 923 int32 stream_id, |
| 924 size_t width, |
| 925 size_t height) { |
| 926 QueueTask(base::Bind(&InProcessCommandBuffer::SetStreamTextureSizeOnGpuThread, |
| 927 base::Unretained(this), texture_id, stream_id, width, |
| 928 height)); |
| 929 } |
| 930 |
| 923 void InProcessCommandBuffer::SetLock(base::Lock*) { | 931 void InProcessCommandBuffer::SetLock(base::Lock*) { |
| 924 } | 932 } |
| 925 | 933 |
| 926 bool InProcessCommandBuffer::IsGpuChannelLost() { | 934 bool InProcessCommandBuffer::IsGpuChannelLost() { |
| 927 // There is no such channel to lose for in-process contexts. This only | 935 // There is no such channel to lose for in-process contexts. This only |
| 928 // makes sense for out-of-process command buffers. | 936 // makes sense for out-of-process command buffers. |
| 929 return false; | 937 return false; |
| 930 } | 938 } |
| 931 | 939 |
| 932 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const { | 940 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 | 977 |
| 970 sync_point_client_->Wait(release_state.get(), sync_token.release_count(), | 978 sync_point_client_->Wait(release_state.get(), sync_token.release_count(), |
| 971 WrapCallback(callback)); | 979 WrapCallback(callback)); |
| 972 } | 980 } |
| 973 | 981 |
| 974 bool InProcessCommandBuffer::CanWaitUnverifiedSyncToken( | 982 bool InProcessCommandBuffer::CanWaitUnverifiedSyncToken( |
| 975 const SyncToken* sync_token) { | 983 const SyncToken* sync_token) { |
| 976 return false; | 984 return false; |
| 977 } | 985 } |
| 978 | 986 |
| 979 uint32 InProcessCommandBuffer::CreateStreamTextureOnGpuThread( | 987 int32 InProcessCommandBuffer::CreateStreamTextureOnGpuThread( |
| 980 uint32 client_texture_id) { | 988 uint32 client_texture_id) { |
| 981 #if defined(OS_ANDROID) | 989 #if defined(OS_ANDROID) |
| 982 return stream_texture_manager_->CreateStreamTexture( | 990 return stream_texture_manager_->CreateStreamTexture( |
| 983 client_texture_id, decoder_->GetContextGroup()->texture_manager()); | 991 client_texture_id, decoder_->GetContextGroup()->texture_manager()); |
| 984 #else | 992 #else |
| 985 return 0; | 993 return 0; |
| 986 #endif | 994 #endif |
| 987 } | 995 } |
| 988 | 996 |
| 997 void InProcessCommandBuffer::SetStreamTextureSizeOnGpuThread( |
| 998 uint32 client_texture_id, |
| 999 int32 stream_id, |
| 1000 size_t width, |
| 1001 size_t height) { |
| 1002 #if defined(OS_ANDROID) |
| 1003 stream_texture_manager_->SetStreamTextureSize( |
| 1004 client_texture_id, stream_id, width, height, |
| 1005 decoder_->GetContextGroup()->texture_manager()); |
| 1006 #endif |
| 1007 } |
| 1008 |
| 989 gpu::error::Error InProcessCommandBuffer::GetLastError() { | 1009 gpu::error::Error InProcessCommandBuffer::GetLastError() { |
| 990 CheckSequencedThread(); | 1010 CheckSequencedThread(); |
| 991 return last_state_.error; | 1011 return last_state_.error; |
| 992 } | 1012 } |
| 993 | 1013 |
| 994 bool InProcessCommandBuffer::Initialize() { | 1014 bool InProcessCommandBuffer::Initialize() { |
| 995 NOTREACHED(); | 1015 NOTREACHED(); |
| 996 return false; | 1016 return false; |
| 997 } | 1017 } |
| 998 | 1018 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1026 base::Bind(&RunOnTargetThread, base::Passed(&scoped_callback)); | 1046 base::Bind(&RunOnTargetThread, base::Passed(&scoped_callback)); |
| 1027 base::Closure wrapped_callback = | 1047 base::Closure wrapped_callback = |
| 1028 base::Bind(&PostCallback, base::ThreadTaskRunnerHandle::IsSet() | 1048 base::Bind(&PostCallback, base::ThreadTaskRunnerHandle::IsSet() |
| 1029 ? base::ThreadTaskRunnerHandle::Get() | 1049 ? base::ThreadTaskRunnerHandle::Get() |
| 1030 : nullptr, | 1050 : nullptr, |
| 1031 callback_on_client_thread); | 1051 callback_on_client_thread); |
| 1032 return wrapped_callback; | 1052 return wrapped_callback; |
| 1033 } | 1053 } |
| 1034 | 1054 |
| 1035 #if defined(OS_ANDROID) | 1055 #if defined(OS_ANDROID) |
| 1036 scoped_refptr<gfx::SurfaceTexture> | 1056 scoped_refptr<gfx::SurfaceTexture> InProcessCommandBuffer::GetSurfaceTexture( |
| 1037 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { | 1057 int32 stream_id) { |
| 1038 DCHECK(stream_texture_manager_); | 1058 DCHECK(stream_texture_manager_); |
| 1039 return stream_texture_manager_->GetSurfaceTexture(stream_id); | 1059 return stream_texture_manager_->GetSurfaceTexture(stream_id); |
| 1040 } | 1060 } |
| 1041 #endif | 1061 #endif |
| 1042 | 1062 |
| 1043 GpuInProcessThread::GpuInProcessThread(SyncPointManager* sync_point_manager) | 1063 GpuInProcessThread::GpuInProcessThread(SyncPointManager* sync_point_manager) |
| 1044 : base::Thread("GpuThread"), sync_point_manager_(sync_point_manager) { | 1064 : base::Thread("GpuThread"), sync_point_manager_(sync_point_manager) { |
| 1045 Start(); | 1065 Start(); |
| 1046 } | 1066 } |
| 1047 | 1067 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 framebuffer_completeness_cache_ = | 1103 framebuffer_completeness_cache_ = |
| 1084 new gpu::gles2::FramebufferCompletenessCache; | 1104 new gpu::gles2::FramebufferCompletenessCache; |
| 1085 return framebuffer_completeness_cache_; | 1105 return framebuffer_completeness_cache_; |
| 1086 } | 1106 } |
| 1087 | 1107 |
| 1088 SyncPointManager* GpuInProcessThread::sync_point_manager() { | 1108 SyncPointManager* GpuInProcessThread::sync_point_manager() { |
| 1089 return sync_point_manager_; | 1109 return sync_point_manager_; |
| 1090 } | 1110 } |
| 1091 | 1111 |
| 1092 } // namespace gpu | 1112 } // namespace gpu |
| OLD | NEW |