| 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 #ifndef COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_ | 5 #ifndef COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_ |
| 6 #define COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_ | 6 #define COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/threading/non_thread_safe.h" |
| 10 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 12 #include "gpu/command_buffer/service/gpu_preferences.h" | 13 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 13 #include "gpu/config/gpu_info.h" | 14 #include "gpu/config/gpu_info.h" |
| 14 #include "gpu/ipc/client/gpu_channel_host.h" | 15 #include "gpu/ipc/client/gpu_channel_host.h" |
| 15 #include "gpu/ipc/common/surface_handle.h" | 16 #include "gpu/ipc/common/surface_handle.h" |
| 16 #include "gpu/ipc/service/gpu_channel.h" | 17 #include "gpu/ipc/service/gpu_channel.h" |
| 17 #include "gpu/ipc/service/gpu_channel_manager.h" | 18 #include "gpu/ipc/service/gpu_channel_manager.h" |
| 18 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" | 19 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
| 19 #include "gpu/ipc/service/gpu_config.h" | 20 #include "gpu/ipc/service/gpu_config.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 class GpuMemoryBufferFactory; | 35 class GpuMemoryBufferFactory; |
| 35 class SyncPointManager; | 36 class SyncPointManager; |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace media { | 39 namespace media { |
| 39 class MediaService; | 40 class MediaService; |
| 40 } | 41 } |
| 41 | 42 |
| 42 namespace mus { | 43 namespace mus { |
| 43 | 44 |
| 44 class GpuMemoryBufferManagerMusLocal; | 45 class MojoGpuMemoryBufferManager; |
| 45 | 46 |
| 46 // TODO(fsamuel): GpuServiceMus is intended to be the Gpu thread within Mus. | 47 // TODO(fsamuel): GpuServiceMus is intended to be the Gpu thread within Mus. |
| 47 // Similar to GpuChildThread, it is a GpuChannelManagerDelegate and will have a | 48 // Similar to GpuChildThread, it is a GpuChannelManagerDelegate and will have a |
| 48 // GpuChannelManager. | 49 // GpuChannelManager. |
| 49 class GpuServiceMus : public gpu::GpuChannelManagerDelegate, | 50 class GpuServiceMus : public gpu::GpuChannelManagerDelegate, |
| 50 public gpu::GpuChannelHostFactory { | 51 public gpu::GpuChannelHostFactory, |
| 52 public base::NonThreadSafe { |
| 51 public: | 53 public: |
| 52 typedef base::Callback<void(const IPC::ChannelHandle&)> | 54 typedef base::Callback<void(int client_id, const IPC::ChannelHandle&)> |
| 53 EstablishGpuChannelCallback; | 55 EstablishGpuChannelCallback; |
| 54 void EstablishGpuChannel(int client_id, | 56 void EstablishGpuChannel(uint64_t client_tracing_id, |
| 55 uint64_t client_tracing_id, | |
| 56 bool preempts, | 57 bool preempts, |
| 57 bool allow_view_command_buffers, | 58 bool allow_view_command_buffers, |
| 58 bool allow_real_time_streams, | 59 bool allow_real_time_streams, |
| 59 const EstablishGpuChannelCallback& callback); | 60 const EstablishGpuChannelCallback& callback); |
| 60 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 61 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
| 61 gfx::GpuMemoryBufferId id, | 62 gfx::GpuMemoryBufferId id, |
| 62 const gfx::Size& size, | 63 const gfx::Size& size, |
| 63 gfx::BufferFormat format, | 64 gfx::BufferFormat format, |
| 64 gfx::BufferUsage usage, | 65 gfx::BufferUsage usage, |
| 65 int client_id, | 66 int client_id, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void Initialize(); | 116 void Initialize(); |
| 116 void InitializeOnGpuThread(IPC::ChannelHandle* channel_handle, | 117 void InitializeOnGpuThread(IPC::ChannelHandle* channel_handle, |
| 117 base::WaitableEvent* event); | 118 base::WaitableEvent* event); |
| 118 void EstablishGpuChannelOnGpuThread(int client_id, | 119 void EstablishGpuChannelOnGpuThread(int client_id, |
| 119 uint64_t client_tracing_id, | 120 uint64_t client_tracing_id, |
| 120 bool preempts, | 121 bool preempts, |
| 121 bool allow_view_command_buffers, | 122 bool allow_view_command_buffers, |
| 122 bool allow_real_time_streams, | 123 bool allow_real_time_streams, |
| 123 IPC::ChannelHandle* channel_handle); | 124 IPC::ChannelHandle* channel_handle); |
| 124 | 125 |
| 126 // The next client id. |
| 127 int next_client_id_; |
| 128 |
| 125 // The main thread message loop. | 129 // The main thread message loop. |
| 126 base::MessageLoop* main_message_loop_; | 130 base::MessageLoop* main_message_loop_; |
| 127 | 131 |
| 128 // An event that will be signalled when we shutdown. | 132 // An event that will be signalled when we shutdown. |
| 129 base::WaitableEvent shutdown_event_; | 133 base::WaitableEvent shutdown_event_; |
| 130 | 134 |
| 131 // The main thread for GpuService. | 135 // The main thread for GpuService. |
| 132 base::Thread gpu_thread_; | 136 base::Thread gpu_thread_; |
| 133 | 137 |
| 134 // The thread that handles IO events for GpuService. | 138 // The thread that handles IO events for GpuService. |
| 135 base::Thread io_thread_; | 139 base::Thread io_thread_; |
| 136 | 140 |
| 137 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; | 141 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; |
| 138 | 142 |
| 139 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; | 143 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; |
| 140 | 144 |
| 141 std::unique_ptr<media::MediaService> media_service_; | 145 std::unique_ptr<media::MediaService> media_service_; |
| 142 | 146 |
| 143 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; | 147 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
| 144 | 148 |
| 145 // A GPU memory buffer manager used locally. | 149 // A GPU memory buffer manager used locally. |
| 146 std::unique_ptr<GpuMemoryBufferManagerMusLocal> | 150 std::unique_ptr<MojoGpuMemoryBufferManager> gpu_memory_buffer_manager_local_; |
| 147 gpu_memory_buffer_manager_mus_local_; | |
| 148 | 151 |
| 149 // A GPU channel used locally. | 152 // A GPU channel used locally. |
| 150 scoped_refptr<gpu::GpuChannelHost> gpu_channel_local_; | 153 scoped_refptr<gpu::GpuChannelHost> gpu_channel_local_; |
| 151 | 154 |
| 152 gpu::GpuPreferences gpu_preferences_; | 155 gpu::GpuPreferences gpu_preferences_; |
| 153 | 156 |
| 154 // Information about the GPU, such as device and vendor ID. | 157 // Information about the GPU, such as device and vendor ID. |
| 155 gpu::GPUInfo gpu_info_; | 158 gpu::GPUInfo gpu_info_; |
| 156 | 159 |
| 157 DISALLOW_COPY_AND_ASSIGN(GpuServiceMus); | 160 DISALLOW_COPY_AND_ASSIGN(GpuServiceMus); |
| 158 }; | 161 }; |
| 159 | 162 |
| 160 } // namespace mus | 163 } // namespace mus |
| 161 | 164 |
| 162 #endif // COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_ | 165 #endif // COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_ |
| OLD | NEW |