OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/command_buffer/service/in_process_command_buffer.h" | 5 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 delayed_work_pending_(false), | 198 delayed_work_pending_(false), |
199 image_factory_(nullptr), | 199 image_factory_(nullptr), |
200 gpu_control_client_(nullptr), | 200 gpu_control_client_(nullptr), |
201 #if DCHECK_IS_ON() | 201 #if DCHECK_IS_ON() |
202 context_lost_(false), | 202 context_lost_(false), |
203 #endif | 203 #endif |
204 last_put_offset_(-1), | 204 last_put_offset_(-1), |
205 gpu_memory_buffer_manager_(nullptr), | 205 gpu_memory_buffer_manager_(nullptr), |
206 next_fence_sync_release_(1), | 206 next_fence_sync_release_(1), |
207 flushed_fence_sync_release_(0), | 207 flushed_fence_sync_release_(0), |
208 flush_event_(false, false), | 208 flush_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 209 base::WaitableEvent::InitialState::NOT_SIGNALED), |
209 service_(GetInitialService(service)), | 210 service_(GetInitialService(service)), |
210 fence_sync_wait_event_(false, false), | 211 fence_sync_wait_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 212 base::WaitableEvent::InitialState::NOT_SIGNALED), |
211 client_thread_weak_ptr_factory_(this), | 213 client_thread_weak_ptr_factory_(this), |
212 gpu_thread_weak_ptr_factory_(this) { | 214 gpu_thread_weak_ptr_factory_(this) { |
213 DCHECK(service_.get()); | 215 DCHECK(service_.get()); |
214 next_image_id_.GetNext(); | 216 next_image_id_.GetNext(); |
215 } | 217 } |
216 | 218 |
217 InProcessCommandBuffer::~InProcessCommandBuffer() { | 219 InProcessCommandBuffer::~InProcessCommandBuffer() { |
218 Destroy(); | 220 Destroy(); |
219 } | 221 } |
220 | 222 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 gpu_preference, | 277 gpu_preference, |
276 &capabilities, | 278 &capabilities, |
277 share_group, | 279 share_group, |
278 image_factory); | 280 image_factory); |
279 | 281 |
280 base::Callback<bool(void)> init_task = | 282 base::Callback<bool(void)> init_task = |
281 base::Bind(&InProcessCommandBuffer::InitializeOnGpuThread, | 283 base::Bind(&InProcessCommandBuffer::InitializeOnGpuThread, |
282 base::Unretained(this), | 284 base::Unretained(this), |
283 params); | 285 params); |
284 | 286 |
285 base::WaitableEvent completion(true, false); | 287 base::WaitableEvent completion( |
| 288 base::WaitableEvent::ResetPolicy::MANUAL, |
| 289 base::WaitableEvent::InitialState::NOT_SIGNALED); |
286 bool result = false; | 290 bool result = false; |
287 QueueTask( | 291 QueueTask( |
288 base::Bind(&RunTaskWithResult<bool>, init_task, &result, &completion)); | 292 base::Bind(&RunTaskWithResult<bool>, init_task, &result, &completion)); |
289 completion.Wait(); | 293 completion.Wait(); |
290 | 294 |
291 gpu_memory_buffer_manager_ = gpu_memory_buffer_manager; | 295 gpu_memory_buffer_manager_ = gpu_memory_buffer_manager; |
292 | 296 |
293 if (result) { | 297 if (result) { |
294 capabilities_ = capabilities; | 298 capabilities_ = capabilities; |
295 capabilities_.image = capabilities_.image && gpu_memory_buffer_manager_; | 299 capabilities_.image = capabilities_.image && gpu_memory_buffer_manager_; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 428 |
425 image_factory_ = params.image_factory; | 429 image_factory_ = params.image_factory; |
426 | 430 |
427 return true; | 431 return true; |
428 } | 432 } |
429 | 433 |
430 void InProcessCommandBuffer::Destroy() { | 434 void InProcessCommandBuffer::Destroy() { |
431 CheckSequencedThread(); | 435 CheckSequencedThread(); |
432 client_thread_weak_ptr_factory_.InvalidateWeakPtrs(); | 436 client_thread_weak_ptr_factory_.InvalidateWeakPtrs(); |
433 gpu_control_client_ = nullptr; | 437 gpu_control_client_ = nullptr; |
434 base::WaitableEvent completion(true, false); | 438 base::WaitableEvent completion( |
| 439 base::WaitableEvent::ResetPolicy::MANUAL, |
| 440 base::WaitableEvent::InitialState::NOT_SIGNALED); |
435 bool result = false; | 441 bool result = false; |
436 base::Callback<bool(void)> destroy_task = base::Bind( | 442 base::Callback<bool(void)> destroy_task = base::Bind( |
437 &InProcessCommandBuffer::DestroyOnGpuThread, base::Unretained(this)); | 443 &InProcessCommandBuffer::DestroyOnGpuThread, base::Unretained(this)); |
438 QueueTask( | 444 QueueTask( |
439 base::Bind(&RunTaskWithResult<bool>, destroy_task, &result, &completion)); | 445 base::Bind(&RunTaskWithResult<bool>, destroy_task, &result, &completion)); |
440 completion.Wait(); | 446 completion.Wait(); |
441 } | 447 } |
442 | 448 |
443 bool InProcessCommandBuffer::DestroyOnGpuThread() { | 449 bool InProcessCommandBuffer::DestroyOnGpuThread() { |
444 CheckSequencedThread(); | 450 CheckSequencedThread(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 flush_event_.Wait(); | 610 flush_event_.Wait(); |
605 GetStateFast(); | 611 GetStateFast(); |
606 } | 612 } |
607 } | 613 } |
608 | 614 |
609 void InProcessCommandBuffer::SetGetBuffer(int32_t shm_id) { | 615 void InProcessCommandBuffer::SetGetBuffer(int32_t shm_id) { |
610 CheckSequencedThread(); | 616 CheckSequencedThread(); |
611 if (last_state_.error != gpu::error::kNoError) | 617 if (last_state_.error != gpu::error::kNoError) |
612 return; | 618 return; |
613 | 619 |
614 base::WaitableEvent completion(true, false); | 620 base::WaitableEvent completion( |
| 621 base::WaitableEvent::ResetPolicy::MANUAL, |
| 622 base::WaitableEvent::InitialState::NOT_SIGNALED); |
615 base::Closure task = | 623 base::Closure task = |
616 base::Bind(&InProcessCommandBuffer::SetGetBufferOnGpuThread, | 624 base::Bind(&InProcessCommandBuffer::SetGetBufferOnGpuThread, |
617 base::Unretained(this), shm_id, &completion); | 625 base::Unretained(this), shm_id, &completion); |
618 QueueTask(task); | 626 QueueTask(task); |
619 completion.Wait(); | 627 completion.Wait(); |
620 | 628 |
621 { | 629 { |
622 base::AutoLock lock(state_after_last_flush_lock_); | 630 base::AutoLock lock(state_after_last_flush_lock_); |
623 state_after_last_flush_ = command_buffer_->GetLastState(); | 631 state_after_last_flush_ = command_buffer_->GetLastState(); |
624 } | 632 } |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 framebuffer_completeness_cache_ = | 1067 framebuffer_completeness_cache_ = |
1060 new gpu::gles2::FramebufferCompletenessCache; | 1068 new gpu::gles2::FramebufferCompletenessCache; |
1061 return framebuffer_completeness_cache_; | 1069 return framebuffer_completeness_cache_; |
1062 } | 1070 } |
1063 | 1071 |
1064 SyncPointManager* GpuInProcessThread::sync_point_manager() { | 1072 SyncPointManager* GpuInProcessThread::sync_point_manager() { |
1065 return sync_point_manager_; | 1073 return sync_point_manager_; |
1066 } | 1074 } |
1067 | 1075 |
1068 } // namespace gpu | 1076 } // namespace gpu |
OLD | NEW |