Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 253943002: Remove CommandBuffer::GetState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: I forgot Poland^Wmojo Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <queue> 7 #include <queue>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 476 }
477 477
478 CommandBuffer::State InProcessCommandBuffer::GetStateFast() { 478 CommandBuffer::State InProcessCommandBuffer::GetStateFast() {
479 CheckSequencedThread(); 479 CheckSequencedThread();
480 base::AutoLock lock(state_after_last_flush_lock_); 480 base::AutoLock lock(state_after_last_flush_lock_);
481 if (state_after_last_flush_.generation - last_state_.generation < 0x80000000U) 481 if (state_after_last_flush_.generation - last_state_.generation < 0x80000000U)
482 last_state_ = state_after_last_flush_; 482 last_state_ = state_after_last_flush_;
483 return last_state_; 483 return last_state_;
484 } 484 }
485 485
486 CommandBuffer::State InProcessCommandBuffer::GetState() {
487 CheckSequencedThread();
488 return GetStateFast();
489 }
490
491 CommandBuffer::State InProcessCommandBuffer::GetLastState() { 486 CommandBuffer::State InProcessCommandBuffer::GetLastState() {
492 CheckSequencedThread(); 487 CheckSequencedThread();
493 return last_state_; 488 return last_state_;
494 } 489 }
495 490
496 int32 InProcessCommandBuffer::GetLastToken() { 491 int32 InProcessCommandBuffer::GetLastToken() {
497 CheckSequencedThread(); 492 CheckSequencedThread();
498 GetStateFast(); 493 GetStateFast();
499 return last_state_.token; 494 return last_state_.token;
500 } 495 }
501 496
502 void InProcessCommandBuffer::FlushOnGpuThread(int32 put_offset) { 497 void InProcessCommandBuffer::FlushOnGpuThread(int32 put_offset) {
503 CheckSequencedThread(); 498 CheckSequencedThread();
504 ScopedEvent handle_flush(&flush_event_); 499 ScopedEvent handle_flush(&flush_event_);
505 base::AutoLock lock(command_buffer_lock_); 500 base::AutoLock lock(command_buffer_lock_);
506 command_buffer_->Flush(put_offset); 501 command_buffer_->Flush(put_offset);
507 { 502 {
508 // Update state before signaling the flush event. 503 // Update state before signaling the flush event.
509 base::AutoLock lock(state_after_last_flush_lock_); 504 base::AutoLock lock(state_after_last_flush_lock_);
510 state_after_last_flush_ = command_buffer_->GetState(); 505 state_after_last_flush_ = command_buffer_->GetLastState();
511 } 506 }
512 DCHECK((!error::IsError(state_after_last_flush_.error) && !context_lost_) || 507 DCHECK((!error::IsError(state_after_last_flush_.error) && !context_lost_) ||
513 (error::IsError(state_after_last_flush_.error) && context_lost_)); 508 (error::IsError(state_after_last_flush_.error) && context_lost_));
514 509
515 // If we've processed all pending commands but still have pending queries, 510 // If we've processed all pending commands but still have pending queries,
516 // pump idle work until the query is passed. 511 // pump idle work until the query is passed.
517 if (put_offset == state_after_last_flush_.get_offset && 512 if (put_offset == state_after_last_flush_.get_offset &&
518 gpu_scheduler_->HasMoreWork()) { 513 gpu_scheduler_->HasMoreWork()) {
519 service_->ScheduleIdleWork( 514 service_->ScheduleIdleWork(
520 base::Bind(&InProcessCommandBuffer::ScheduleMoreIdleWork, 515 base::Bind(&InProcessCommandBuffer::ScheduleMoreIdleWork,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 if (last_state_.error != gpu::error::kNoError) 566 if (last_state_.error != gpu::error::kNoError)
572 return; 567 return;
573 568
574 { 569 {
575 base::AutoLock lock(command_buffer_lock_); 570 base::AutoLock lock(command_buffer_lock_);
576 command_buffer_->SetGetBuffer(shm_id); 571 command_buffer_->SetGetBuffer(shm_id);
577 last_put_offset_ = 0; 572 last_put_offset_ = 0;
578 } 573 }
579 { 574 {
580 base::AutoLock lock(state_after_last_flush_lock_); 575 base::AutoLock lock(state_after_last_flush_lock_);
581 state_after_last_flush_ = command_buffer_->GetState(); 576 state_after_last_flush_ = command_buffer_->GetLastState();
582 } 577 }
583 } 578 }
584 579
585 scoped_refptr<Buffer> InProcessCommandBuffer::CreateTransferBuffer(size_t size, 580 scoped_refptr<Buffer> InProcessCommandBuffer::CreateTransferBuffer(size_t size,
586 int32* id) { 581 int32* id) {
587 CheckSequencedThread(); 582 CheckSequencedThread();
588 base::AutoLock lock(command_buffer_lock_); 583 base::AutoLock lock(command_buffer_lock_);
589 return command_buffer_->CreateTransferBuffer(size, id); 584 return command_buffer_->CreateTransferBuffer(size, id);
590 } 585 }
591 586
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } 755 }
761 #endif 756 #endif
762 757
763 // static 758 // static
764 void InProcessCommandBuffer::SetGpuMemoryBufferFactory( 759 void InProcessCommandBuffer::SetGpuMemoryBufferFactory(
765 GpuMemoryBufferFactory* factory) { 760 GpuMemoryBufferFactory* factory) {
766 g_gpu_memory_buffer_factory = factory; 761 g_gpu_memory_buffer_factory = factory;
767 } 762 }
768 763
769 } // namespace gpu 764 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.h ('k') | gpu/command_buffer/tests/gl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698