OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/gpu/gpu_service.h" | 5 #include "services/ui/gpu/gpu_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 gpu_channel_manager_.reset(); | 55 gpu_channel_manager_.reset(); |
56 owned_sync_point_manager_.reset(); | 56 owned_sync_point_manager_.reset(); |
57 | 57 |
58 // Signal this event before destroying the child process. That way all | 58 // Signal this event before destroying the child process. That way all |
59 // background threads can cleanup. | 59 // background threads can cleanup. |
60 // For example, in the renderer the RenderThread instances will be able to | 60 // For example, in the renderer the RenderThread instances will be able to |
61 // notice shutdown before the render process begins waiting for them to exit. | 61 // notice shutdown before the render process begins waiting for them to exit. |
62 shutdown_event_.Signal(); | 62 shutdown_event_.Signal(); |
63 } | 63 } |
64 | 64 |
65 void GpuService::InitializeWithHost(mojom::GpuHostPtr gpu_host, | 65 void GpuService::InitializeWithHost( |
66 const gpu::GpuPreferences& preferences, | 66 mojom::GpuHostPtr gpu_host, |
67 gpu::SyncPointManager* sync_point_manager, | 67 const gpu::GpuPreferences& preferences, |
68 base::WaitableEvent* shutdown_event) { | 68 const gpu::GpuDriverBugWorkarounds& workarounds, |
| 69 gpu::SyncPointManager* sync_point_manager, |
| 70 base::WaitableEvent* shutdown_event) { |
69 DCHECK(CalledOnValidThread()); | 71 DCHECK(CalledOnValidThread()); |
70 DCHECK(!gpu_host_); | 72 DCHECK(!gpu_host_); |
71 gpu_host_ = std::move(gpu_host); | 73 gpu_host_ = std::move(gpu_host); |
72 gpu_preferences_ = preferences; | 74 gpu_preferences_ = preferences; |
73 gpu_info_.video_decode_accelerator_capabilities = | 75 gpu_info_.video_decode_accelerator_capabilities = |
74 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); | 76 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_, |
| 77 workarounds); |
75 gpu_info_.video_encode_accelerator_supported_profiles = | 78 gpu_info_.video_encode_accelerator_supported_profiles = |
76 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences_); | 79 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences_); |
77 gpu_info_.jpeg_decode_accelerator_supported = | 80 gpu_info_.jpeg_decode_accelerator_supported = |
78 media::GpuJpegDecodeAccelerator::IsSupported(); | 81 media::GpuJpegDecodeAccelerator::IsSupported(); |
79 gpu_host_->DidInitialize(gpu_info_); | 82 gpu_host_->DidInitialize(gpu_info_); |
80 | 83 |
81 sync_point_manager_ = sync_point_manager; | 84 sync_point_manager_ = sync_point_manager; |
82 if (!sync_point_manager_) { | 85 if (!sync_point_manager_) { |
83 const bool allow_threaded_wait = false; | 86 const bool allow_threaded_wait = false; |
84 owned_sync_point_manager_ = | 87 owned_sync_point_manager_ = |
85 base::MakeUnique<gpu::SyncPointManager>(allow_threaded_wait); | 88 base::MakeUnique<gpu::SyncPointManager>(allow_threaded_wait); |
86 sync_point_manager_ = owned_sync_point_manager_.get(); | 89 sync_point_manager_ = owned_sync_point_manager_.get(); |
87 } | 90 } |
88 | 91 |
89 // Defer creation of the render thread. This is to prevent it from handling | 92 // Defer creation of the render thread. This is to prevent it from handling |
90 // IPC messages before the sandbox has been enabled and all other necessary | 93 // IPC messages before the sandbox has been enabled and all other necessary |
91 // initialization has succeeded. | 94 // initialization has succeeded. |
92 gpu_channel_manager_.reset(new gpu::GpuChannelManager( | 95 gpu_channel_manager_.reset(new gpu::GpuChannelManager( |
93 gpu_preferences_, this, watchdog_thread_.get(), | 96 gpu_preferences_, workarounds, this, watchdog_thread_.get(), |
94 base::ThreadTaskRunnerHandle::Get().get(), io_runner_.get(), | 97 base::ThreadTaskRunnerHandle::Get().get(), io_runner_.get(), |
95 shutdown_event ? shutdown_event : &shutdown_event_, sync_point_manager_, | 98 shutdown_event ? shutdown_event : &shutdown_event_, sync_point_manager_, |
96 gpu_memory_buffer_factory_)); | 99 gpu_memory_buffer_factory_)); |
97 | 100 |
98 media_gpu_channel_manager_.reset( | 101 media_gpu_channel_manager_.reset( |
99 new media::MediaGpuChannelManager(gpu_channel_manager_.get())); | 102 new media::MediaGpuChannelManager(gpu_channel_manager_.get())); |
100 } | 103 } |
101 | 104 |
102 void GpuService::Bind(mojom::GpuServiceRequest request) { | 105 void GpuService::Bind(mojom::GpuServiceRequest request) { |
103 bindings_.AddBinding(this, std::move(request)); | 106 bindings_.AddBinding(this, std::move(request)); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 mojo::ScopedMessagePipeHandle channel_handle; | 183 mojo::ScopedMessagePipeHandle channel_handle; |
181 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel( | 184 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel( |
182 client_id, client_tracing_id, preempts, allow_view_command_buffers, | 185 client_id, client_tracing_id, preempts, allow_view_command_buffers, |
183 allow_real_time_streams); | 186 allow_real_time_streams); |
184 channel_handle.reset(handle.mojo_handle); | 187 channel_handle.reset(handle.mojo_handle); |
185 media_gpu_channel_manager_->AddChannel(client_id); | 188 media_gpu_channel_manager_->AddChannel(client_id); |
186 callback.Run(std::move(channel_handle)); | 189 callback.Run(std::move(channel_handle)); |
187 } | 190 } |
188 | 191 |
189 } // namespace ui | 192 } // namespace ui |
OLD | NEW |