summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 22:07:34 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 22:07:34 +0000
commit3a69c6fe533cb089bd3d33fad753a265f413718e (patch)
tree822cb521c2366081f96eaa860f1643cb4f546abc
parent8c5bef217802a407314e5f518df411fb31c02c4e (diff)
downloadchromium_src-3a69c6fe533cb089bd3d33fad753a265f413718e.zip
chromium_src-3a69c6fe533cb089bd3d33fad753a265f413718e.tar.gz
chromium_src-3a69c6fe533cb089bd3d33fad753a265f413718e.tar.bz2
Trace whenever renderer waits for command buffer space.
This lets us determine whether the renderer is spinning waiting for command buffer space to open up. BUG= TEST= Review URL: http://codereview.chromium.org/6833005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81655 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper.cc29
-rw-r--r--gpu/gpu.gyp9
2 files changed, 27 insertions, 11 deletions
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.cc b/gpu/command_buffer/client/cmd_buffer_helper.cc
index b525021..d3eaca1 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "../client/cmd_buffer_helper.h"
#include "../common/command_buffer.h"
+#include "gpu/common/gpu_trace_event.h"
namespace gpu {
@@ -121,21 +122,27 @@ void CommandBufferHelper::WaitForAvailableEntries(int32 count) {
// need to make sure get wraps first, actually that get is 1 or more (since
// put will wrap to 0 after we add the jump).
GPU_DCHECK_LE(1, put_);
- while (get_ > put_ || get_ == 0) {
- // Do not loop forever if the flush fails, meaning the command buffer
- // reader has shutdown.
- if (!FlushSync())
- return;
+ if (get_ > put_ || get_ == 0) {
+ GPU_TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForAvailableEntries");
+ while (get_ > put_ || get_ == 0) {
+ // Do not loop forever if the flush fails, meaning the command buffer
+ // reader has shutdown.
+ if (!FlushSync())
+ return;
+ }
}
// Insert a jump back to the beginning.
cmd::Jump::Set(&entries_[put_], 0);
put_ = 0;
}
- while (AvailableEntries() < count) {
- // Do not loop forever if the flush fails, meaning the command buffer reader
- // has shutdown.
- if (!FlushSync())
- return;
+ if (AvailableEntries() < count) {
+ GPU_TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForAvailableEntries1");
+ while (AvailableEntries() < count) {
+ // Do not loop forever if the flush fails, meaning the command buffer
+ // reader has shutdown.
+ if (!FlushSync())
+ return;
+ }
}
// Force a flush if the buffer is getting half full, or even earlier if the
// reader is known to be idle.
diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp
index 547c670..e33c78ca 100644
--- a/gpu/gpu.gyp
+++ b/gpu/gpu.gyp
@@ -150,8 +150,17 @@
{
'target_name': 'command_buffer_client',
'type': 'static_library',
+ 'include_dirs': [
+ '..',
+ ],
+ 'all_dependent_settings': {
+ 'include_dirs': [
+ '..',
+ ],
+ },
'dependencies': [
'command_buffer_common',
+ 'gpu_common',
],
'sources': [
'command_buffer/client/cmd_buffer_helper.cc',