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 SERVICES_UI_GPU_GPU_SERVICE_H_ | 5 #ifndef SERVICES_UI_GPU_GPU_SERVICE_H_ |
6 #define SERVICES_UI_GPU_GPU_SERVICE_H_ | 6 #define SERVICES_UI_GPU_GPU_SERVICE_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/non_thread_safe.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // This runs in the GPU process, and communicates with the gpu host (which is | 41 // This runs in the GPU process, and communicates with the gpu host (which is |
42 // the window server) over the mojom APIs. This is responsible for setting up | 42 // the window server) over the mojom APIs. This is responsible for setting up |
43 // the connection to clients, allocating/free'ing gpu memory etc. | 43 // the connection to clients, allocating/free'ing gpu memory etc. |
44 class GpuService : public gpu::GpuChannelManagerDelegate, | 44 class GpuService : public gpu::GpuChannelManagerDelegate, |
45 public mojom::GpuService, | 45 public mojom::GpuService, |
46 public base::NonThreadSafe { | 46 public base::NonThreadSafe { |
47 public: | 47 public: |
48 GpuService(const gpu::GPUInfo& gpu_info, | 48 GpuService(const gpu::GPUInfo& gpu_info, |
49 std::unique_ptr<gpu::GpuWatchdogThread> watchdog, | 49 std::unique_ptr<gpu::GpuWatchdogThread> watchdog, |
50 gpu::GpuMemoryBufferFactory* memory_buffer_factory, | 50 gpu::GpuMemoryBufferFactory* memory_buffer_factory, |
51 scoped_refptr<base::SingleThreadTaskRunner> io_runner); | 51 scoped_refptr<base::SingleThreadTaskRunner> io_runner, |
| 52 const gpu::GpuFeatureInfo& gpu_feature_info); |
52 | 53 |
53 ~GpuService() override; | 54 ~GpuService() override; |
54 | 55 |
55 void InitializeWithHost(mojom::GpuHostPtr gpu_host, | 56 void InitializeWithHost(mojom::GpuHostPtr gpu_host, |
56 const gpu::GpuPreferences& preferences, | 57 const gpu::GpuPreferences& preferences, |
57 gpu::SyncPointManager* sync_point_manager = nullptr, | 58 gpu::SyncPointManager* sync_point_manager = nullptr, |
58 base::WaitableEvent* shutdown_event = nullptr); | 59 base::WaitableEvent* shutdown_event = nullptr); |
59 void Bind(mojom::GpuServiceRequest request); | 60 void Bind(mojom::GpuServiceRequest request); |
60 | 61 |
61 media::MediaGpuChannelManager* media_gpu_channel_manager() { | 62 media::MediaGpuChannelManager* media_gpu_channel_manager() { |
62 return media_gpu_channel_manager_.get(); | 63 return media_gpu_channel_manager_.get(); |
63 } | 64 } |
64 | 65 |
65 gpu::GpuChannelManager* gpu_channel_manager() { | 66 gpu::GpuChannelManager* gpu_channel_manager() { |
66 return gpu_channel_manager_.get(); | 67 return gpu_channel_manager_.get(); |
67 } | 68 } |
68 | 69 |
69 gpu::GpuWatchdogThread* watchdog_thread() { return watchdog_thread_.get(); } | 70 gpu::GpuWatchdogThread* watchdog_thread() { return watchdog_thread_.get(); } |
70 | 71 |
| 72 const gpu::GpuFeatureInfo& gpu_feature_info() const { |
| 73 return gpu_feature_info_; |
| 74 } |
| 75 |
71 private: | 76 private: |
72 friend class GpuMain; | 77 friend class GpuMain; |
73 | 78 |
74 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle( | 79 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle( |
75 gfx::GpuMemoryBufferHandle buffer_handle, | 80 gfx::GpuMemoryBufferHandle buffer_handle, |
76 gfx::GpuMemoryBufferId id, | 81 gfx::GpuMemoryBufferId id, |
77 const gfx::Size& size, | 82 const gfx::Size& size, |
78 gfx::BufferFormat format, | 83 gfx::BufferFormat format, |
79 int client_id); | 84 int client_id); |
80 | 85 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 137 |
133 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; | 138 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; |
134 | 139 |
135 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; | 140 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; |
136 | 141 |
137 gpu::GpuPreferences gpu_preferences_; | 142 gpu::GpuPreferences gpu_preferences_; |
138 | 143 |
139 // Information about the GPU, such as device and vendor ID. | 144 // Information about the GPU, such as device and vendor ID. |
140 gpu::GPUInfo gpu_info_; | 145 gpu::GPUInfo gpu_info_; |
141 | 146 |
| 147 // Information about general chrome feature support for the GPU. |
| 148 gpu::GpuFeatureInfo gpu_feature_info_; |
| 149 |
142 mojom::GpuHostPtr gpu_host_; | 150 mojom::GpuHostPtr gpu_host_; |
143 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; | 151 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; |
144 std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_; | 152 std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_; |
145 | 153 |
146 // On some platforms (e.g. android webview), the SyncPointManager comes from | 154 // On some platforms (e.g. android webview), the SyncPointManager comes from |
147 // external sources. | 155 // external sources. |
148 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; | 156 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; |
149 gpu::SyncPointManager* sync_point_manager_ = nullptr; | 157 gpu::SyncPointManager* sync_point_manager_ = nullptr; |
150 | 158 |
151 mojo::BindingSet<mojom::GpuService> bindings_; | 159 mojo::BindingSet<mojom::GpuService> bindings_; |
152 | 160 |
153 DISALLOW_COPY_AND_ASSIGN(GpuService); | 161 DISALLOW_COPY_AND_ASSIGN(GpuService); |
154 }; | 162 }; |
155 | 163 |
156 } // namespace ui | 164 } // namespace ui |
157 | 165 |
158 #endif // SERVICES_UI_GPU_GPU_SERVICE_H_ | 166 #endif // SERVICES_UI_GPU_GPU_SERVICE_H_ |
OLD | NEW |