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

Side by Side Diff: components/mus/gpu/gpu_service_mus.cc

Issue 2049083002: Implement MusGpuMemoryBufferManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update the mojom document Created 4 years, 6 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
OLDNEW
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 "components/mus/gpu/gpu_service_mus.h" 5 #include "components/mus/gpu/gpu_service_mus.h"
6 6
7 #include "base/memory/shared_memory.h" 7 #include "base/memory/shared_memory.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "components/mus/common/mojo_gpu_memory_buffer_manager.h" 11 #include "build/build_config.h"
12 #include "components/mus/gpu/mus_gpu_memory_buffer_manager.h"
12 #include "gpu/command_buffer/service/gpu_switches.h" 13 #include "gpu/command_buffer/service/gpu_switches.h"
13 #include "gpu/command_buffer/service/sync_point_manager.h" 14 #include "gpu/command_buffer/service/sync_point_manager.h"
14 #include "gpu/config/gpu_info_collector.h" 15 #include "gpu/config/gpu_info_collector.h"
15 #include "gpu/config/gpu_switches.h" 16 #include "gpu/config/gpu_switches.h"
16 #include "gpu/config/gpu_util.h" 17 #include "gpu/config/gpu_util.h"
17 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 18 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
18 #include "gpu/ipc/common/memory_stats.h" 19 #include "gpu/ipc/common/memory_stats.h"
19 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" 20 #include "gpu/ipc/service/gpu_memory_buffer_factory.h"
20 #include "ipc/ipc_channel_handle.h" 21 #include "ipc/ipc_channel_handle.h"
21 #include "ipc/ipc_sync_message_filter.h" 22 #include "ipc/ipc_sync_message_filter.h"
22 #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h" 23 #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h"
23 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h" 24 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
24 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h" 25 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
25 #include "media/gpu/ipc/service/media_service.h" 26 #include "media/gpu/ipc/service/media_service.h"
26 #include "ui/gl/gl_implementation.h" 27 #include "ui/gl/gl_implementation.h"
27 #include "ui/gl/gl_switches.h" 28 #include "ui/gl/gl_switches.h"
28 #include "ui/gl/gpu_switching_manager.h" 29 #include "ui/gl/gpu_switching_manager.h"
29 #include "ui/gl/init/gl_factory.h" 30 #include "ui/gl/init/gl_factory.h"
30 #include "url/gurl.h" 31 #include "url/gurl.h"
31 32
33 #if defined(USE_OZONE)
34 #include "ui/ozone/public/ozone_platform.h"
35 #endif
36
32 namespace mus { 37 namespace mus {
33 namespace { 38 namespace {
34 39
35 const int kLocalGpuChannelClientId = 1; 40 const int kLocalGpuChannelClientId = 1;
36 const uint64_t kLocalGpuChannelClientTracingId = 1; 41 const uint64_t kLocalGpuChannelClientTracingId = 1;
37 42
38 void EstablishGpuChannelDone( 43 void EstablishGpuChannelDone(
39 int client_id, 44 int client_id,
40 const IPC::ChannelHandle* channel_handle, 45 const IPC::ChannelHandle* channel_handle,
41 const GpuServiceMus::EstablishGpuChannelCallback& callback) { 46 const GpuServiceMus::EstablishGpuChannelCallback& callback) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 CHECK(io_thread_.StartWithOptions(thread_options)); 182 CHECK(io_thread_.StartWithOptions(thread_options));
178 183
179 IPC::ChannelHandle channel_handle; 184 IPC::ChannelHandle channel_handle;
180 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, 185 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
181 base::WaitableEvent::InitialState::NOT_SIGNALED); 186 base::WaitableEvent::InitialState::NOT_SIGNALED);
182 gpu_thread_.task_runner()->PostTask( 187 gpu_thread_.task_runner()->PostTask(
183 FROM_HERE, base::Bind(&GpuServiceMus::InitializeOnGpuThread, 188 FROM_HERE, base::Bind(&GpuServiceMus::InitializeOnGpuThread,
184 base::Unretained(this), &channel_handle, &event)); 189 base::Unretained(this), &channel_handle, &event));
185 event.Wait(); 190 event.Wait();
186 191
187 gpu_memory_buffer_manager_local_.reset(new MojoGpuMemoryBufferManager); 192 gpu_memory_buffer_manager_local_.reset(
193 new MusGpuMemoryBufferManager(this, kLocalGpuChannelClientId));
188 gpu_channel_local_ = gpu::GpuChannelHost::Create( 194 gpu_channel_local_ = gpu::GpuChannelHost::Create(
189 this, kLocalGpuChannelClientId, gpu_info_, channel_handle, 195 this, kLocalGpuChannelClientId, gpu_info_, channel_handle,
190 &shutdown_event_, gpu_memory_buffer_manager_local_.get()); 196 &shutdown_event_, gpu_memory_buffer_manager_local_.get());
191 } 197 }
192 198
193 void GpuServiceMus::InitializeOnGpuThread(IPC::ChannelHandle* channel_handle, 199 void GpuServiceMus::InitializeOnGpuThread(IPC::ChannelHandle* channel_handle,
194 base::WaitableEvent* event) { 200 base::WaitableEvent* event) {
195 gpu_info_.video_decode_accelerator_capabilities = 201 gpu_info_.video_decode_accelerator_capabilities =
196 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); 202 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_);
197 gpu_info_.video_encode_accelerator_supported_profiles = 203 gpu_info_.video_encode_accelerator_supported_profiles =
198 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences_); 204 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences_);
199 gpu_info_.jpeg_decode_accelerator_supported = 205 gpu_info_.jpeg_decode_accelerator_supported =
200 media::GpuJpegDecodeAccelerator::IsSupported(); 206 media::GpuJpegDecodeAccelerator::IsSupported();
201 207
208 #if defined(USE_OZONE)
209 ui::OzonePlatform::InitializeForGPU();
210 #endif
211
202 if (gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER) { 212 if (gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER) {
203 gpu_memory_buffer_factory_ = 213 gpu_memory_buffer_factory_ =
204 gpu::GpuMemoryBufferFactory::CreateNativeType(); 214 gpu::GpuMemoryBufferFactory::CreateNativeType();
205 } 215 }
206 216
207 if (!gl::init::InitializeGLOneOff()) 217 if (!gl::init::InitializeGLOneOff())
208 VLOG(1) << "gl::init::InitializeGLOneOff failed"; 218 VLOG(1) << "gl::init::InitializeGLOneOff failed";
209 219
210 DCHECK(!owned_sync_point_manager_); 220 DCHECK(!owned_sync_point_manager_);
211 const bool allow_threaded_wait = false; 221 const bool allow_threaded_wait = false;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 return shm; 276 return shm;
267 } 277 }
268 278
269 // static 279 // static
270 GpuServiceMus* GpuServiceMus::GetInstance() { 280 GpuServiceMus* GpuServiceMus::GetInstance() {
271 return base::Singleton<GpuServiceMus, 281 return base::Singleton<GpuServiceMus,
272 base::LeakySingletonTraits<GpuServiceMus>>::get(); 282 base::LeakySingletonTraits<GpuServiceMus>>::get();
273 } 283 }
274 284
275 } // namespace mus 285 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/gpu/gpu_service_mus.h ('k') | components/mus/gpu/mus_gpu_memory_buffer_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698