| OLD | NEW |
| 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/gpu_scheduler.h" | 5 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 54 } |
| 55 | 55 |
| 56 parser_->set_put(command_buffer_->GetPutOffset()); | 56 parser_->set_put(command_buffer_->GetPutOffset()); |
| 57 if (state.error != error::kNoError) | 57 if (state.error != error::kNoError) |
| 58 return; | 58 return; |
| 59 | 59 |
| 60 // One of the unschedule fence tasks might have unscheduled us. | 60 // One of the unschedule fence tasks might have unscheduled us. |
| 61 if (!IsScheduled()) | 61 if (!IsScheduled()) |
| 62 return; | 62 return; |
| 63 | 63 |
| 64 base::TimeTicks begin_time(base::TimeTicks::HighResNow()); | 64 base::TimeTicks begin_time(base::TimeTicks::Now()); |
| 65 error::Error error = error::kNoError; | 65 error::Error error = error::kNoError; |
| 66 if (decoder_) | 66 if (decoder_) |
| 67 decoder_->BeginDecoding(); | 67 decoder_->BeginDecoding(); |
| 68 while (!parser_->IsEmpty()) { | 68 while (!parser_->IsEmpty()) { |
| 69 if (IsPreempted()) | 69 if (IsPreempted()) |
| 70 break; | 70 break; |
| 71 | 71 |
| 72 DCHECK(IsScheduled()); | 72 DCHECK(IsScheduled()); |
| 73 | 73 |
| 74 error = parser_->ProcessCommands(CommandParser::kParseCommandsSlice); | 74 error = parser_->ProcessCommands(CommandParser::kParseCommandsSlice); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 95 if (unscheduled_count_ > 0) | 95 if (unscheduled_count_ > 0) |
| 96 break; | 96 break; |
| 97 } | 97 } |
| 98 | 98 |
| 99 if (decoder_) { | 99 if (decoder_) { |
| 100 if (!error::IsError(error) && decoder_->WasContextLost()) { | 100 if (!error::IsError(error) && decoder_->WasContextLost()) { |
| 101 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); | 101 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); |
| 102 command_buffer_->SetParseError(error::kLostContext); | 102 command_buffer_->SetParseError(error::kLostContext); |
| 103 } | 103 } |
| 104 decoder_->EndDecoding(); | 104 decoder_->EndDecoding(); |
| 105 decoder_->AddProcessingCommandsTime( | 105 decoder_->AddProcessingCommandsTime(base::TimeTicks::Now() - begin_time); |
| 106 base::TimeTicks::HighResNow() - begin_time); | |
| 107 } | 106 } |
| 108 } | 107 } |
| 109 | 108 |
| 110 void GpuScheduler::SetScheduled(bool scheduled) { | 109 void GpuScheduler::SetScheduled(bool scheduled) { |
| 111 TRACE_EVENT2("gpu", "GpuScheduler:SetScheduled", "this", this, | 110 TRACE_EVENT2("gpu", "GpuScheduler:SetScheduled", "this", this, |
| 112 "new unscheduled_count_", | 111 "new unscheduled_count_", |
| 113 unscheduled_count_ + (scheduled? -1 : 1)); | 112 unscheduled_count_ + (scheduled? -1 : 1)); |
| 114 if (scheduled) { | 113 if (scheduled) { |
| 115 // If the scheduler was rescheduled after a timeout, ignore the subsequent | 114 // If the scheduler was rescheduled after a timeout, ignore the subsequent |
| 116 // calls to SetScheduled when they eventually arrive until they are all | 115 // calls to SetScheduled when they eventually arrive until they are all |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 243 |
| 245 rescheduled_count_ = 0; | 244 rescheduled_count_ = 0; |
| 246 | 245 |
| 247 while (unscheduled_count_) | 246 while (unscheduled_count_) |
| 248 SetScheduled(true); | 247 SetScheduled(true); |
| 249 | 248 |
| 250 rescheduled_count_ = new_count; | 249 rescheduled_count_ = new_count; |
| 251 } | 250 } |
| 252 | 251 |
| 253 } // namespace gpu | 252 } // namespace gpu |
| OLD | NEW |