summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorjbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 22:55:38 +0000
committerjbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 22:55:38 +0000
commit43ed3a7d4a4a043220dd01677ec2fc39451df852 (patch)
treee06617271d1bcf9e046b402fc8419fa07b4a93d8 /gpu
parent3e3ce571d775271ebbf0026f27eea5fddbaf3481 (diff)
downloadchromium_src-43ed3a7d4a4a043220dd01677ec2fc39451df852.zip
chromium_src-43ed3a7d4a4a043220dd01677ec2fc39451df852.tar.gz
chromium_src-43ed3a7d4a4a043220dd01677ec2fc39451df852.tar.bz2
Put GL-command tracing behind a flag because it's too heavy normally.
We always want to trace some of the heavier GL commands, so those have been re-added from https://chromiumcodereview.appspot.com/10443048/. Turns out that with --trace-gl on, the trace buffer typically fills up after ~3 seconds, so the default behavior should probably be to not trace these. R=apatrick Review URL: https://chromiumcodereview.appspot.com/10442090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139664 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/cmd_parser.cc13
-rw-r--r--gpu/command_buffer/service/cmd_parser.h1
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc6
-rw-r--r--gpu/command_buffer/service/gpu_switches.cc3
-rw-r--r--gpu/command_buffer/service/gpu_switches.h1
5 files changed, 22 insertions, 2 deletions
diff --git a/gpu/command_buffer/service/cmd_parser.cc b/gpu/command_buffer/service/cmd_parser.cc
index 31b2571..a58d5a5 100644
--- a/gpu/command_buffer/service/cmd_parser.cc
+++ b/gpu/command_buffer/service/cmd_parser.cc
@@ -7,7 +7,9 @@
#include "gpu/command_buffer/service/cmd_parser.h"
#include "base/logging.h"
+#include "base/command_line.h"
#include "base/debug/trace_event.h"
+#include "gpu/command_buffer/service/gpu_switches.h"
namespace gpu {
@@ -16,7 +18,10 @@ CommandParser::CommandParser(AsyncAPIInterface* handler)
put_(0),
buffer_(NULL),
entry_count_(0),
- handler_(handler) {
+ handler_(handler),
+ trace_gl_commands_(false) {
+ trace_gl_commands_ =
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kTraceGL);
}
void CommandParser::SetBuffer(
@@ -60,7 +65,8 @@ error::Error CommandParser::ProcessCommand() {
return error::kOutOfBounds;
}
- TRACE_EVENT0("cb_command", handler_->GetCommandName(header.command));
+ if (trace_gl_commands_)
+ TRACE_EVENT_BEGIN0("cb_command", handler_->GetCommandName(header.command));
error::Error result = handler_->DoCommand(
header.command, header.size - 1, buffer_ + get);
@@ -75,6 +81,9 @@ error::Error CommandParser::ProcessCommand() {
// If get was not set somewhere else advance it.
if (get == get_)
get_ = (get + header.size) % entry_count_;
+
+ if (trace_gl_commands_)
+ TRACE_EVENT_END0("cb_command", handler_->GetCommandName(header.command));
return result;
}
diff --git a/gpu/command_buffer/service/cmd_parser.h b/gpu/command_buffer/service/cmd_parser.h
index de2fe29..c808c4e 100644
--- a/gpu/command_buffer/service/cmd_parser.h
+++ b/gpu/command_buffer/service/cmd_parser.h
@@ -69,6 +69,7 @@ class GPU_EXPORT CommandParser {
CommandBufferEntry* buffer_;
int32 entry_count_;
AsyncAPIInterface* handler_;
+ bool trace_gl_commands_;
};
// This class defines the interface for an asynchronous API handler, that
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 946e2c7..11bd915 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -4527,6 +4527,7 @@ void GLES2DecoderImpl::DoRenderbufferStorage(
}
void GLES2DecoderImpl::DoLinkProgram(GLuint program) {
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoLinkProgram");
ProgramManager::ProgramInfo* info = GetProgramInfoNotShader(
program, "glLinkProgram");
if (!info) {
@@ -5597,6 +5598,7 @@ error::Error GLES2DecoderImpl::HandleShaderSourceBucket(
}
void GLES2DecoderImpl::DoCompileShader(GLuint client_id) {
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompileShader");
ShaderManager::ShaderInfo* info = GetShaderInfoNotProgram(
client_id, "glCompileShader");
if (!info) {
@@ -6354,6 +6356,7 @@ error::Error GLES2DecoderImpl::HandlePixelStorei(
error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM(
uint32 immediate_data_size, const gles2::PostSubBufferCHROMIUM& c) {
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM");
if (!context_->HasExtension("GL_CHROMIUM_post_sub_buffer")) {
SetGLError(GL_INVALID_OPERATION,
"glPostSubBufferCHROMIUM: command not supported by surface");
@@ -6992,6 +6995,7 @@ error::Error GLES2DecoderImpl::DoTexImage2D(
error::Error GLES2DecoderImpl::HandleTexImage2D(
uint32 immediate_data_size, const gles2::TexImage2D& c) {
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexImage2D");
tex_image_2d_failed_ = true;
GLenum target = static_cast<GLenum>(c.target);
GLint level = static_cast<GLint>(c.level);
@@ -7355,6 +7359,7 @@ void GLES2DecoderImpl::DoTexSubImage2D(
error::Error GLES2DecoderImpl::HandleTexSubImage2D(
uint32 immediate_data_size, const gles2::TexSubImage2D& c) {
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexSubImage2D");
GLboolean internal = static_cast<GLboolean>(c.internal);
if (internal == GL_TRUE && tex_image_2d_failed_)
return error::kNoError;
@@ -8625,6 +8630,7 @@ void GLES2DecoderImpl::DoTexStorage2DEXT(
GLenum internal_format,
GLsizei width,
GLsizei height) {
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoTexStorage2DEXT");
if (!texture_manager()->ValidForTarget(target, 0, width, height, 1) ||
TextureManager::ComputeMipMapCount(width, height, 1) < levels) {
SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT: dimensions out of range");
diff --git a/gpu/command_buffer/service/gpu_switches.cc b/gpu/command_buffer/service/gpu_switches.cc
index c38ecc0..cf4ad08 100644
--- a/gpu/command_buffer/service/gpu_switches.cc
+++ b/gpu/command_buffer/service/gpu_switches.cc
@@ -34,6 +34,8 @@ const char kEnforceGLMinimums[] = "enforce-gl-minimums";
// affected systems.
const char kForceGLFinishWorkaround[] = "force-glfinish-workaround";
+const char kTraceGL[] = "trace-gl";
+
const char* kGpuSwitches[] = {
kCompileShaderAlwaysSucceeds,
kDisableGLErrorLimit,
@@ -43,6 +45,7 @@ const char* kGpuSwitches[] = {
kEnableGPUDebugging,
kEnforceGLMinimums,
kForceGLFinishWorkaround,
+ kTraceGL,
};
const int kNumGpuSwitches = arraysize(kGpuSwitches);
diff --git a/gpu/command_buffer/service/gpu_switches.h b/gpu/command_buffer/service/gpu_switches.h
index 2d64652..e2b5484 100644
--- a/gpu/command_buffer/service/gpu_switches.h
+++ b/gpu/command_buffer/service/gpu_switches.h
@@ -20,6 +20,7 @@ GPU_EXPORT extern const char kEnableGPUCommandLogging[];
GPU_EXPORT extern const char kEnableGPUDebugging[];
GPU_EXPORT extern const char kEnforceGLMinimums[];
GPU_EXPORT extern const char kForceGLFinishWorkaround[];
+GPU_EXPORT extern const char kTraceGL[];
GPU_EXPORT extern const char* kGpuSwitches[];
GPU_EXPORT extern const int kNumGpuSwitches;