Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/gpu/gpu_channel.h" | 5 #include "content/common/gpu/gpu_channel.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 753 RemoveRouteFromStream(route_id); | 753 RemoveRouteFromStream(route_id); |
| 754 } | 754 } |
| 755 | 755 |
| 756 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { | 756 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { |
| 757 bool handled = true; | 757 bool handled = true; |
| 758 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) | 758 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) |
| 759 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateCommandBuffer, | 759 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateCommandBuffer, |
| 760 OnCreateCommandBuffer) | 760 OnCreateCommandBuffer) |
| 761 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, | 761 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, |
| 762 OnDestroyCommandBuffer) | 762 OnDestroyCommandBuffer) |
| 763 IPC_MESSAGE_HANDLER(GpuChannelMsg_GetDriverBugWorkArounds, | |
| 764 OnGetDriverBugWorkArounds) | |
| 763 IPC_MESSAGE_UNHANDLED(handled = false) | 765 IPC_MESSAGE_UNHANDLED(handled = false) |
| 764 IPC_END_MESSAGE_MAP() | 766 IPC_END_MESSAGE_MAP() |
| 765 return handled; | 767 return handled; |
| 766 } | 768 } |
| 767 | 769 |
| 768 scoped_refptr<gpu::SyncPointOrderData> GpuChannel::GetSyncPointOrderData( | 770 scoped_refptr<gpu::SyncPointOrderData> GpuChannel::GetSyncPointOrderData( |
| 769 int32_t stream_id) { | 771 int32_t stream_id) { |
| 770 auto it = streams_.find(stream_id); | 772 auto it = streams_.find(stream_id); |
| 771 DCHECK(it != streams_.end()); | 773 DCHECK(it != streams_.end()); |
| 772 DCHECK(it->second); | 774 DCHECK(it->second); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 884 void GpuChannel::RemoveRouteFromStream(int32_t route_id) { | 886 void GpuChannel::RemoveRouteFromStream(int32_t route_id) { |
| 885 DCHECK(routes_to_streams_.find(route_id) != routes_to_streams_.end()); | 887 DCHECK(routes_to_streams_.find(route_id) != routes_to_streams_.end()); |
| 886 int32_t stream_id = routes_to_streams_[route_id]; | 888 int32_t stream_id = routes_to_streams_[route_id]; |
| 887 DCHECK(streams_.find(stream_id) != streams_.end()); | 889 DCHECK(streams_.find(stream_id) != streams_.end()); |
| 888 routes_to_streams_.erase(route_id); | 890 routes_to_streams_.erase(route_id); |
| 889 streams_to_num_routes_[stream_id]--; | 891 streams_to_num_routes_[stream_id]--; |
| 890 filter_->RemoveRoute(route_id); | 892 filter_->RemoveRoute(route_id); |
| 891 DestroyStreamIfNecessary(streams_[stream_id]); | 893 DestroyStreamIfNecessary(streams_[stream_id]); |
| 892 } | 894 } |
| 893 | 895 |
| 894 #if defined(OS_ANDROID) | |
| 895 const GpuCommandBufferStub* GpuChannel::GetOneStub() const { | 896 const GpuCommandBufferStub* GpuChannel::GetOneStub() const { |
| 896 for (const auto& kv : stubs_) { | 897 for (const auto& kv : stubs_) { |
| 897 const GpuCommandBufferStub* stub = kv.second; | 898 const GpuCommandBufferStub* stub = kv.second; |
| 898 if (stub->decoder() && !stub->decoder()->WasContextLost()) | 899 if (stub->decoder() && !stub->decoder()->WasContextLost()) |
| 899 return stub; | 900 return stub; |
| 900 } | 901 } |
| 901 return nullptr; | 902 return nullptr; |
| 902 } | 903 } |
| 903 #endif | |
| 904 | 904 |
| 905 void GpuChannel::OnCreateCommandBuffer( | 905 void GpuChannel::OnCreateCommandBuffer( |
| 906 gpu::SurfaceHandle surface_handle, | 906 gpu::SurfaceHandle surface_handle, |
| 907 const gfx::Size& size, | 907 const gfx::Size& size, |
| 908 const GPUCreateCommandBufferConfig& init_params, | 908 const GPUCreateCommandBufferConfig& init_params, |
| 909 int32_t route_id, | 909 int32_t route_id, |
| 910 bool* succeeded) { | 910 bool* succeeded) { |
| 911 TRACE_EVENT2("gpu", "GpuChannel::OnCreateCommandBuffer", "route_id", route_id, | 911 TRACE_EVENT2("gpu", "GpuChannel::OnCreateCommandBuffer", "route_id", route_id, |
| 912 "offscreen", (surface_handle == gpu::kNullSurfaceHandle)); | 912 "offscreen", (surface_handle == gpu::kNullSurfaceHandle)); |
| 913 *succeeded = false; | 913 *succeeded = false; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 971 // In case the renderer is currently blocked waiting for a sync reply from the | 971 // In case the renderer is currently blocked waiting for a sync reply from the |
| 972 // stub, we need to make sure to reschedule the correct stream here. | 972 // stub, we need to make sure to reschedule the correct stream here. |
| 973 if (stub && !stub->IsScheduled()) { | 973 if (stub && !stub->IsScheduled()) { |
| 974 // This stub won't get a chance to reschedule the stream so do that now. | 974 // This stub won't get a chance to reschedule the stream so do that now. |
| 975 OnStreamRescheduled(stub->stream_id(), true); | 975 OnStreamRescheduled(stub->stream_id(), true); |
| 976 } | 976 } |
| 977 | 977 |
| 978 RemoveRoute(route_id); | 978 RemoveRoute(route_id); |
| 979 } | 979 } |
| 980 | 980 |
| 981 void GpuChannel::OnGetDriverBugWorkArounds( | |
| 982 std::vector<std::string>* gpu_driver_bug_workarounds) { | |
| 983 const GpuCommandBufferStub* stub = GetOneStub(); | |
| 984 if (stub) { | |
|
piman
2016/03/31 01:44:21
This sounds potentially flaky - the IPC result dep
Julien Isorce Samsung
2016/03/31 15:20:09
I was not able to understand why it is done once p
| |
| 985 std::vector<std::string> workaround_names; | |
| 986 #define GPU_OP(type, name) \ | |
| 987 if (stub->GetFeatureInfo()->workarounds().name) \ | |
| 988 workaround_names.push_back(#name); | |
| 989 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) | |
| 990 #undef GPU_OP | |
| 991 *gpu_driver_bug_workarounds = workaround_names; | |
|
dcheng
2016/03/30 23:45:25
std::move() if you're feeling fancy. Alternatively
Julien Isorce Samsung
2016/03/31 15:20:09
No particular reason, I thought about you second s
| |
| 992 } | |
| 993 } | |
| 994 | |
| 981 void GpuChannel::CacheShader(const std::string& key, | 995 void GpuChannel::CacheShader(const std::string& key, |
| 982 const std::string& shader) { | 996 const std::string& shader) { |
| 983 gpu_channel_manager_->delegate()->StoreShaderToDisk(client_id_, key, shader); | 997 gpu_channel_manager_->delegate()->StoreShaderToDisk(client_id_, key, shader); |
| 984 } | 998 } |
| 985 | 999 |
| 986 void GpuChannel::AddFilter(IPC::MessageFilter* filter) { | 1000 void GpuChannel::AddFilter(IPC::MessageFilter* filter) { |
| 987 io_task_runner_->PostTask( | 1001 io_task_runner_->PostTask( |
| 988 FROM_HERE, base::Bind(&GpuChannelMessageFilter::AddChannelFilter, | 1002 FROM_HERE, base::Bind(&GpuChannelMessageFilter::AddChannelFilter, |
| 989 filter_, make_scoped_refptr(filter))); | 1003 filter_, make_scoped_refptr(filter))); |
| 990 } | 1004 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1044 } | 1058 } |
| 1045 } | 1059 } |
| 1046 } | 1060 } |
| 1047 | 1061 |
| 1048 void GpuChannel::HandleUpdateValueState( | 1062 void GpuChannel::HandleUpdateValueState( |
| 1049 unsigned int target, const gpu::ValueState& state) { | 1063 unsigned int target, const gpu::ValueState& state) { |
| 1050 pending_valuebuffer_state_->UpdateState(target, state); | 1064 pending_valuebuffer_state_->UpdateState(target, state); |
| 1051 } | 1065 } |
| 1052 | 1066 |
| 1053 } // namespace content | 1067 } // namespace content |
| OLD | NEW |