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

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

Issue 2440093003: WIP GPU scheduler + delayed activation / tile draw
Patch Set: SignalSyncToken -> IsFenceSyncReleased Created 4 years 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 "gpu/command_buffer/service/command_executor.h" 5 #include "gpu/command_buffer/service/command_executor.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 int32_t CommandExecutor::GetGetOffset() { 146 int32_t CommandExecutor::GetGetOffset() {
147 return parser_->get(); 147 return parser_->get();
148 } 148 }
149 149
150 void CommandExecutor::SetCommandProcessedCallback( 150 void CommandExecutor::SetCommandProcessedCallback(
151 const base::Closure& callback) { 151 const base::Closure& callback) {
152 command_processed_callback_ = callback; 152 command_processed_callback_ = callback;
153 } 153 }
154 154
155 void CommandExecutor::SetPreemptionCallback(
156 const PreemptionCallback& callback) {
157 preemption_callback_ = callback;
158 }
159
155 bool CommandExecutor::IsPreempted() { 160 bool CommandExecutor::IsPreempted() {
156 if (!preemption_flag_.get()) 161 if (preemption_callback_.is_null())
157 return false; 162 return false;
158 163
159 if (!was_preempted_ && preemption_flag_->IsSet()) { 164 bool preempt = preemption_callback_.Run();
165
166 if (!was_preempted_ && preempt) {
160 TRACE_COUNTER_ID1("gpu", "CommandExecutor::Preempted", this, 1); 167 TRACE_COUNTER_ID1("gpu", "CommandExecutor::Preempted", this, 1);
161 was_preempted_ = true; 168 was_preempted_ = true;
162 } else if (was_preempted_ && !preemption_flag_->IsSet()) { 169 } else if (was_preempted_ && !preempt) {
163 TRACE_COUNTER_ID1("gpu", "CommandExecutor::Preempted", this, 0); 170 TRACE_COUNTER_ID1("gpu", "CommandExecutor::Preempted", this, 0);
164 was_preempted_ = false; 171 was_preempted_ = false;
165 } 172 }
166 173
167 return preemption_flag_->IsSet(); 174 return preempt;
168 } 175 }
169 176
170 bool CommandExecutor::HasMoreIdleWork() const { 177 bool CommandExecutor::HasMoreIdleWork() const {
171 return (decoder_ && decoder_->HasMoreIdleWork()); 178 return (decoder_ && decoder_->HasMoreIdleWork());
172 } 179 }
173 180
174 void CommandExecutor::PerformIdleWork() { 181 void CommandExecutor::PerformIdleWork() {
175 if (!decoder_) 182 if (!decoder_)
176 return; 183 return;
177 decoder_->PerformIdleWork(); 184 decoder_->PerformIdleWork();
178 } 185 }
179 186
180 bool CommandExecutor::HasPollingWork() const { 187 bool CommandExecutor::HasPollingWork() const {
181 return (decoder_ && decoder_->HasPollingWork()); 188 return (decoder_ && decoder_->HasPollingWork());
182 } 189 }
183 190
184 void CommandExecutor::PerformPollingWork() { 191 void CommandExecutor::PerformPollingWork() {
185 if (!decoder_) 192 if (!decoder_)
186 return; 193 return;
187 decoder_->PerformPollingWork(); 194 decoder_->PerformPollingWork();
188 } 195 }
189 196
190 } // namespace gpu 197 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/command_executor.h ('k') | gpu/command_buffer/service/gpu_preferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698