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

Side by Side Diff: gpu/command_buffer/client/cmd_buffer_helper.cc

Issue 8956001: Disable 5ms flusher on Android to reduce kernel thrashing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file contains the implementation of the command buffer helper class. 5 // This file contains the implementation of the command buffer helper class.
6 6
7 #include "../client/cmd_buffer_helper.h" 7 #include "../client/cmd_buffer_helper.h"
8 #include "../common/command_buffer.h" 8 #include "../common/command_buffer.h"
9 #include "../common/trace_event.h" 9 #include "../common/trace_event.h"
10 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 172 }
173 // Force a flush if the buffer is getting half full, or even earlier if the 173 // Force a flush if the buffer is getting half full, or even earlier if the
174 // reader is known to be idle. 174 // reader is known to be idle.
175 int32 pending = 175 int32 pending =
176 (put_ + usable_entry_count_ - last_put_sent_) % usable_entry_count_; 176 (put_ + usable_entry_count_ - last_put_sent_) % usable_entry_count_;
177 int32 limit = usable_entry_count_ / 177 int32 limit = usable_entry_count_ /
178 ((get_offset() == last_put_sent_) ? 16 : 2); 178 ((get_offset() == last_put_sent_) ? 16 : 2);
179 if (pending > limit) { 179 if (pending > limit) {
180 Flush(); 180 Flush();
181 } else if (commands_issued_ % kCommandsPerFlushCheck == 0) { 181 } else if (commands_issued_ % kCommandsPerFlushCheck == 0) {
182 #if !defined(OS_ANDROID)
182 // Allow this command buffer to be pre-empted by another if a "reasonable" 183 // Allow this command buffer to be pre-empted by another if a "reasonable"
183 // amount of work has been done. 184 // amount of work has been done. On highend machines, this reduces the
185 // latency of GPU commands. However, on Android, this can cause the
186 // kernel to thrash between generating GPU commands and executing them.
184 clock_t current_time = clock(); 187 clock_t current_time = clock();
185 if (current_time - last_flush_time_ > kFlushDelay * CLOCKS_PER_SEC) 188 if (current_time - last_flush_time_ > kFlushDelay * CLOCKS_PER_SEC)
186 Flush(); 189 Flush();
190 #endif
187 } 191 }
188 } 192 }
189 193
190 CommandBufferEntry* CommandBufferHelper::GetSpace(uint32 entries) { 194 CommandBufferEntry* CommandBufferHelper::GetSpace(uint32 entries) {
191 ++commands_issued_; 195 ++commands_issued_;
192 WaitForAvailableEntries(entries); 196 WaitForAvailableEntries(entries);
193 CommandBufferEntry* space = &entries_[put_]; 197 CommandBufferEntry* space = &entries_[put_];
194 put_ += entries; 198 put_ += entries;
195 GPU_DCHECK_LE(put_, usable_entry_count_); 199 GPU_DCHECK_LE(put_, usable_entry_count_);
196 if (put_ == usable_entry_count_) { 200 if (put_ == usable_entry_count_) {
197 cmd::Jump::Set(&entries_[put_], 0); 201 cmd::Jump::Set(&entries_[put_], 0);
198 put_ = 0; 202 put_ = 0;
199 } 203 }
200 return space; 204 return space;
201 } 205 }
202 206
203 error::Error CommandBufferHelper::GetError() { 207 error::Error CommandBufferHelper::GetError() {
204 CommandBuffer::State state = command_buffer_->GetState(); 208 CommandBuffer::State state = command_buffer_->GetState();
205 return static_cast<error::Error>(state.error); 209 return static_cast<error::Error>(state.error);
206 } 210 }
207 211
208 } // namespace gpu 212 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698