| 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 "gpu/ipc/service/gpu_channel_manager.h" | 5 #include "gpu/ipc/service/gpu_channel_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 io_task_runner_(io_task_runner), | 57 io_task_runner_(io_task_runner), |
| 58 gpu_preferences_(gpu_preferences), | 58 gpu_preferences_(gpu_preferences), |
| 59 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()), | 59 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()), |
| 60 delegate_(delegate), | 60 delegate_(delegate), |
| 61 watchdog_(watchdog), | 61 watchdog_(watchdog), |
| 62 shutdown_event_(shutdown_event), | 62 shutdown_event_(shutdown_event), |
| 63 share_group_(new gl::GLShareGroup()), | 63 share_group_(new gl::GLShareGroup()), |
| 64 mailbox_manager_(gles2::MailboxManager::Create(gpu_preferences)), | 64 mailbox_manager_(gles2::MailboxManager::Create(gpu_preferences)), |
| 65 gpu_memory_manager_(this), | 65 gpu_memory_manager_(this), |
| 66 sync_point_manager_(sync_point_manager), | 66 sync_point_manager_(sync_point_manager), |
| 67 sync_point_client_waiter_( | |
| 68 sync_point_manager->CreateSyncPointClientWaiter()), | |
| 69 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), | 67 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), |
| 70 gpu_feature_info_(gpu_feature_info), | 68 gpu_feature_info_(gpu_feature_info), |
| 71 exiting_for_lost_context_(false), | 69 exiting_for_lost_context_(false), |
| 72 weak_factory_(this) { | 70 weak_factory_(this) { |
| 73 DCHECK(task_runner); | 71 DCHECK(task_runner); |
| 74 DCHECK(io_task_runner); | 72 DCHECK(io_task_runner); |
| 75 if (gpu_preferences_.ui_prioritize_in_gpu_process) | 73 if (gpu_preferences_.ui_prioritize_in_gpu_process) |
| 76 preemption_flag_ = new PreemptionFlag; | 74 preemption_flag_ = new PreemptionFlag; |
| 77 } | 75 } |
| 78 | 76 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 void GpuChannelManager::InternalDestroyGpuMemoryBufferOnIO( | 165 void GpuChannelManager::InternalDestroyGpuMemoryBufferOnIO( |
| 168 gfx::GpuMemoryBufferId id, | 166 gfx::GpuMemoryBufferId id, |
| 169 int client_id) { | 167 int client_id) { |
| 170 gpu_memory_buffer_factory_->DestroyGpuMemoryBuffer(id, client_id); | 168 gpu_memory_buffer_factory_->DestroyGpuMemoryBuffer(id, client_id); |
| 171 } | 169 } |
| 172 | 170 |
| 173 void GpuChannelManager::DestroyGpuMemoryBuffer( | 171 void GpuChannelManager::DestroyGpuMemoryBuffer( |
| 174 gfx::GpuMemoryBufferId id, | 172 gfx::GpuMemoryBufferId id, |
| 175 int client_id, | 173 int client_id, |
| 176 const SyncToken& sync_token) { | 174 const SyncToken& sync_token) { |
| 177 if (sync_token.HasData()) { | 175 if (!sync_point_manager_->WaitOutOfOrder( |
| 178 scoped_refptr<SyncPointClientState> release_state = | 176 sync_token, |
| 179 sync_point_manager()->GetSyncPointClientState( | |
| 180 sync_token.namespace_id(), sync_token.command_buffer_id()); | |
| 181 if (release_state) { | |
| 182 sync_point_client_waiter_->WaitOutOfOrder( | |
| 183 release_state.get(), sync_token.release_count(), | |
| 184 base::Bind(&GpuChannelManager::InternalDestroyGpuMemoryBuffer, | 177 base::Bind(&GpuChannelManager::InternalDestroyGpuMemoryBuffer, |
| 185 base::Unretained(this), id, client_id)); | 178 base::Unretained(this), id, client_id))) { |
| 186 return; | 179 // No sync token or invalid sync token, destroy immediately. |
| 187 } | 180 InternalDestroyGpuMemoryBuffer(id, client_id); |
| 188 } | 181 } |
| 189 | |
| 190 // No sync token or invalid sync token, destroy immediately. | |
| 191 InternalDestroyGpuMemoryBuffer(id, client_id); | |
| 192 } | 182 } |
| 193 | 183 |
| 194 void GpuChannelManager::PopulateShaderCache(const std::string& program_proto) { | 184 void GpuChannelManager::PopulateShaderCache(const std::string& program_proto) { |
| 195 if (program_cache()) | 185 if (program_cache()) |
| 196 program_cache()->LoadProgram(program_proto); | 186 program_cache()->LoadProgram(program_proto); |
| 197 } | 187 } |
| 198 | 188 |
| 199 uint32_t GpuChannelManager::GetUnprocessedOrderNum() const { | 189 uint32_t GpuChannelManager::GetUnprocessedOrderNum() const { |
| 200 uint32_t unprocessed_order_num = 0; | 190 uint32_t unprocessed_order_num = 0; |
| 201 for (auto& kv : gpu_channels_) { | 191 for (auto& kv : gpu_channels_) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 } | 277 } |
| 288 } | 278 } |
| 289 if (!stub || !stub->decoder()->MakeCurrent()) | 279 if (!stub || !stub->decoder()->MakeCurrent()) |
| 290 return; | 280 return; |
| 291 glFinish(); | 281 glFinish(); |
| 292 DidAccessGpu(); | 282 DidAccessGpu(); |
| 293 } | 283 } |
| 294 #endif | 284 #endif |
| 295 | 285 |
| 296 } // namespace gpu | 286 } // namespace gpu |
| OLD | NEW |