diff options
author | dsinclair@chromium.org <dsinclair@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-20 23:02:14 +0000 |
---|---|---|
committer | dsinclair@chromium.org <dsinclair@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-20 23:02:14 +0000 |
commit | fb97b6684216126e278b1bf023d63b35abd80684 (patch) | |
tree | 4b9eed6a6a79aace14e425571e05ddfdbe50f70b /gpu/command_buffer/client | |
parent | 6190bfd4b47b85f57b45f8de9a33fda6af592de2 (diff) | |
download | chromium_src-fb97b6684216126e278b1bf023d63b35abd80684.zip chromium_src-fb97b6684216126e278b1bf023d63b35abd80684.tar.gz chromium_src-fb97b6684216126e278b1bf023d63b35abd80684.tar.bz2 |
Hookup the GPUTrace events.
Add a factory to GPUTrace to produce either a GL_ARB_timer_query GPUTrace object
or a SystemTime GPUTrace object.
Hookup GPUTraceController to GLES2DecoderImpl to process any received traces.
BUG=111509
Review URL: https://chromiumcodereview.appspot.com/11416117
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183648 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/client')
4 files changed, 22 insertions, 19 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 4a9fc0b..e046f4c 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -3270,10 +3270,29 @@ void GLES2Implementation::TraceBeginCHROMIUM(const char* name) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTraceBeginCHROMIUM(" << name << ")"); - + if (current_trace_name_.get()) { + SetGLError(GL_INVALID_OPERATION, "glTraceBeginCHROMIUM", + "trace already running"); + return; + } + TRACE_EVENT_COPY_ASYNC_BEGIN0("gpu", name, this); SetBucketAsCString(kResultBucketId, name); helper_->TraceBeginCHROMIUM(kResultBucketId); helper_->SetBucketSize(kResultBucketId, 0); + current_trace_name_.reset(new std::string(name)); +} + +void GLES2Implementation::TraceEndCHROMIUM() { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTraceEndCHROMIUM(" << ")"); + if (!current_trace_name_.get()) { + SetGLError(GL_INVALID_OPERATION, "glTraceEndCHROMIUM", + "missing begin trace"); + return; + } + helper_->TraceEndCHROMIUM(); + TRACE_EVENT_COPY_ASYNC_END0("gpu", current_trace_name_->c_str(), this); + current_trace_name_.reset(); } void* GLES2Implementation::MapBufferCHROMIUM(GLuint target, GLenum access) { diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h index 2dc28a9..7124c73 100644 --- a/gpu/command_buffer/client/gles2_implementation.h +++ b/gpu/command_buffer/client/gles2_implementation.h @@ -591,6 +591,8 @@ class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface { ErrorMessageCallback* error_message_callback_; + scoped_ptr<std::string> current_trace_name_; + DISALLOW_COPY_AND_ASSIGN(GLES2Implementation); }; diff --git a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h index 0fc3a4d..9f93010 100644 --- a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h @@ -1672,13 +1672,6 @@ void GLES2Implementation::ReleaseTexImage2DCHROMIUM( CheckGLError(); } -void GLES2Implementation::TraceEndCHROMIUM() { - GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTraceEndCHROMIUM(" << ")"); - helper_->TraceEndCHROMIUM(); - CheckGLError(); -} - void GLES2Implementation::DiscardFramebufferEXT( GLenum target, GLsizei count, const GLenum* attachments) { GPU_CLIENT_SINGLE_THREAD_CHECK(); diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h index 2de2e54..a63c284 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h @@ -1759,17 +1759,6 @@ TEST_F(GLES2ImplementationTest, ReleaseTexImage2DCHROMIUM) { EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } -TEST_F(GLES2ImplementationTest, TraceEndCHROMIUM) { - struct Cmds { - TraceEndCHROMIUM cmd; - }; - Cmds expected; - expected.cmd.Init(); - - gl_->TraceEndCHROMIUM(); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - TEST_F(GLES2ImplementationTest, DiscardFramebufferEXT) { struct Cmds { DiscardFramebufferEXTImmediate cmd; |