OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gles2/command_buffer_local.h" | 5 #include "components/mus/gles2/command_buffer_local.h" |
6 | 6 |
7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 316 |
317 void CommandBufferLocal::EnsureWorkVisible() { | 317 void CommandBufferLocal::EnsureWorkVisible() { |
318 // This is only relevant for out-of-process command buffers. | 318 // This is only relevant for out-of-process command buffers. |
319 } | 319 } |
320 | 320 |
321 gpu::CommandBufferNamespace CommandBufferLocal::GetNamespaceID() const { | 321 gpu::CommandBufferNamespace CommandBufferLocal::GetNamespaceID() const { |
322 DCHECK(CalledOnValidThread()); | 322 DCHECK(CalledOnValidThread()); |
323 return gpu::CommandBufferNamespace::MOJO_LOCAL; | 323 return gpu::CommandBufferNamespace::MOJO_LOCAL; |
324 } | 324 } |
325 | 325 |
326 uint64_t CommandBufferLocal::GetCommandBufferID() const { | 326 gpu::CommandBufferId CommandBufferLocal::GetCommandBufferID() const { |
327 DCHECK(CalledOnValidThread()); | 327 DCHECK(CalledOnValidThread()); |
328 return driver_->GetCommandBufferID(); | 328 return driver_->GetCommandBufferID(); |
329 } | 329 } |
330 | 330 |
331 int32_t CommandBufferLocal::GetExtraCommandBufferData() const { | 331 int32_t CommandBufferLocal::GetExtraCommandBufferData() const { |
332 DCHECK(CalledOnValidThread()); | 332 DCHECK(CalledOnValidThread()); |
333 return 0; | 333 return 0; |
334 } | 334 } |
335 | 335 |
336 uint64_t CommandBufferLocal::GenerateFenceSyncRelease() { | 336 uint64_t CommandBufferLocal::GenerateFenceSyncRelease() { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 base::Bind(&CommandBufferLocal::MakeProgressOnGpuThread, | 414 base::Bind(&CommandBufferLocal::MakeProgressOnGpuThread, |
415 base::Unretained(this), base::Unretained(&event), | 415 base::Unretained(this), base::Unretained(&event), |
416 base::Unretained(&state))); | 416 base::Unretained(&state))); |
417 event.Wait(); | 417 event.Wait(); |
418 if (state.generation - last_state_.generation < 0x80000000U) | 418 if (state.generation - last_state_.generation < 0x80000000U) |
419 last_state_ = state; | 419 last_state_ = state; |
420 } | 420 } |
421 | 421 |
422 void CommandBufferLocal::InitializeOnGpuThread(base::WaitableEvent* event, | 422 void CommandBufferLocal::InitializeOnGpuThread(base::WaitableEvent* event, |
423 bool* result) { | 423 bool* result) { |
424 driver_.reset(new CommandBufferDriver(gpu::CommandBufferNamespace::MOJO_LOCAL, | 424 driver_.reset(new CommandBufferDriver( |
425 ++g_next_command_buffer_id, widget_, | 425 gpu::CommandBufferNamespace::MOJO_LOCAL, |
426 gpu_state_)); | 426 gpu::CommandBufferId::FromUnsafeValue(++g_next_command_buffer_id), |
| 427 widget_, gpu_state_)); |
427 const size_t kSharedStateSize = sizeof(gpu::CommandBufferSharedState); | 428 const size_t kSharedStateSize = sizeof(gpu::CommandBufferSharedState); |
428 void* memory = nullptr; | 429 void* memory = nullptr; |
429 mojo::ScopedSharedBufferHandle duped; | 430 mojo::ScopedSharedBufferHandle duped; |
430 *result = CreateMapAndDupSharedBuffer(kSharedStateSize, &memory, | 431 *result = CreateMapAndDupSharedBuffer(kSharedStateSize, &memory, |
431 &shared_state_handle_, &duped); | 432 &shared_state_handle_, &duped); |
432 | 433 |
433 if (!*result) { | 434 if (!*result) { |
434 event->Signal(); | 435 event->Signal(); |
435 return; | 436 return; |
436 } | 437 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 client_->DidLoseContext(); | 526 client_->DidLoseContext(); |
526 } | 527 } |
527 | 528 |
528 void CommandBufferLocal::UpdateVSyncParametersOnClientThread(int64_t timebase, | 529 void CommandBufferLocal::UpdateVSyncParametersOnClientThread(int64_t timebase, |
529 int64_t interval) { | 530 int64_t interval) { |
530 if (client_) | 531 if (client_) |
531 client_->UpdateVSyncParameters(timebase, interval); | 532 client_->UpdateVSyncParameters(timebase, interval); |
532 } | 533 } |
533 | 534 |
534 } // namespace mus | 535 } // namespace mus |
OLD | NEW |