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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 128123002: gpu: Early return GpuCommandBufferStub::OnWaitSyncPoint() if the sync point is retired. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 11 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
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 } 761 }
762 762
763 void GpuCommandBufferStub::OnRetireSyncPoint(uint32 sync_point) { 763 void GpuCommandBufferStub::OnRetireSyncPoint(uint32 sync_point) {
764 DCHECK(!sync_points_.empty() && sync_points_.front() == sync_point); 764 DCHECK(!sync_points_.empty() && sync_points_.front() == sync_point);
765 sync_points_.pop_front(); 765 sync_points_.pop_front();
766 GpuChannelManager* manager = channel_->gpu_channel_manager(); 766 GpuChannelManager* manager = channel_->gpu_channel_manager();
767 manager->sync_point_manager()->RetireSyncPoint(sync_point); 767 manager->sync_point_manager()->RetireSyncPoint(sync_point);
768 } 768 }
769 769
770 bool GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) { 770 bool GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) {
771 GpuChannelManager* manager = channel_->gpu_channel_manager();
772 if (manager->sync_point_manager()->IsSyncPointRetired(sync_point))
773 return true;
774
771 if (sync_point_wait_count_ == 0) { 775 if (sync_point_wait_count_ == 0) {
772 TRACE_EVENT_ASYNC_BEGIN1("gpu", "WaitSyncPoint", this, 776 TRACE_EVENT_ASYNC_BEGIN1("gpu", "WaitSyncPoint", this,
773 "GpuCommandBufferStub", this); 777 "GpuCommandBufferStub", this);
774 } 778 }
775 scheduler_->SetScheduled(false); 779 scheduler_->SetScheduled(false);
776 ++sync_point_wait_count_; 780 ++sync_point_wait_count_;
777 GpuChannelManager* manager = channel_->gpu_channel_manager();
778 manager->sync_point_manager()->AddSyncPointCallback( 781 manager->sync_point_manager()->AddSyncPointCallback(
779 sync_point, 782 sync_point,
780 base::Bind(&GpuCommandBufferStub::OnSyncPointRetired, 783 base::Bind(&GpuCommandBufferStub::OnSyncPointRetired,
781 this->AsWeakPtr())); 784 this->AsWeakPtr()));
782 return scheduler_->IsScheduled(); 785 return scheduler_->IsScheduled();
783 } 786 }
784 787
785 void GpuCommandBufferStub::OnSyncPointRetired() { 788 void GpuCommandBufferStub::OnSyncPointRetired() {
786 --sync_point_wait_count_; 789 --sync_point_wait_count_;
787 if (sync_point_wait_count_ == 0) { 790 if (sync_point_wait_count_ == 0) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 if (decoder_) 964 if (decoder_)
962 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); 965 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB);
963 command_buffer_->SetParseError(gpu::error::kLostContext); 966 command_buffer_->SetParseError(gpu::error::kLostContext);
964 } 967 }
965 968
966 uint64 GpuCommandBufferStub::GetMemoryUsage() const { 969 uint64 GpuCommandBufferStub::GetMemoryUsage() const {
967 return GetMemoryManager()->GetClientMemoryUsage(this); 970 return GetMemoryManager()->GetClientMemoryUsage(this);
968 } 971 }
969 972
970 } // namespace content 973 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/sync_point_manager.h » ('j') | content/common/gpu/sync_point_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698