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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 11416117: Hookup the GPUTrace events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 9837ebbbd0c9c99ac8fa2980c3e456c72466f76a..452213fc2ba64dcff8acba90040145aa14d0b816 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -40,7 +40,7 @@
#include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
#include "gpu/command_buffer/service/gles2_cmd_validation.h"
#include "gpu/command_buffer/service/gpu_switches.h"
-#include "gpu/command_buffer/service/gpu_trace.h"
+#include "gpu/command_buffer/service/gpu_tracer.h"
#include "gpu/command_buffer/service/image_manager.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/memory_tracking.h"
@@ -1581,7 +1581,7 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
base::TimeDelta total_texture_upload_time_;
base::TimeDelta total_processing_commands_time_;
- std::stack<linked_ptr<GPUTrace> > gpu_trace_stack_;
+ scoped_ptr<GPUTracer> gpu_tracer_;
DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl);
};
@@ -2012,6 +2012,8 @@ bool GLES2DecoderImpl::Initialize(
DCHECK(context->IsCurrent(surface.get()));
DCHECK(!context_.get());
+ gpu_tracer_ = GPUTracer::Create();
+
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableGPUDebugging)) {
set_debug(true);
@@ -6503,6 +6505,9 @@ error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM(
"glPostSubBufferCHROMIUM", "command not supported by surface");
return error::kNoError;
}
+
+ gpu_tracer_->Process();
+
if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) {
return error::kNoError;
} else {
@@ -8186,6 +8191,8 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
return error::kDeferCommandUntilLater;
}
+ gpu_tracer_->Process();
+
int this_frame_number = frame_number_++;
// TRACE_EVENT for gpu tests:
TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency",
@@ -9342,6 +9349,7 @@ void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM(
error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM(
uint32 immediate_data_size, const gles2::TraceBeginCHROMIUM& c) {
+
jonathan.backer 2012/12/03 14:23:14 nit: nix extra new line
dsinclair 2012/12/03 16:47:42 Done.
Bucket* bucket = GetBucket(c.bucket_id);
if (!bucket || bucket->size() == 0) {
return error::kInvalidArguments;
@@ -9351,23 +9359,26 @@ error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM(
return error::kInvalidArguments;
}
- linked_ptr<GPUTrace> trace(new GPUTrace(command_name));
- trace->EnableStartTrace();
- gpu_trace_stack_.push(trace);
+ TRACE_EVENT_COPY_ASYNC_BEGIN0("gpu", command_name.c_str(), this);
+
+ if (!gpu_tracer_->Begin(command_name)) {
+ SetGLError(GL_INVALID_OPERATION,
+ "glTraceBeginCHROMIUM", "unable to create begin trace");
+ return error::kNoError;
+ }
return error::kNoError;
}
void GLES2DecoderImpl::DoTraceEndCHROMIUM() {
- if (gpu_trace_stack_.empty()) {
+ if (!gpu_tracer_->CurrentName()) {
SetGLError(GL_INVALID_OPERATION,
"glTraceEndCHROMIUM", "no trace begin found");
return;
}
- linked_ptr<GPUTrace> trace = gpu_trace_stack_.top();
- trace->EnableEndTrace();
- gpu_trace_stack_.pop();
+ TRACE_EVENT_COPY_ASYNC_END0("gpu", gpu_tracer_->CurrentName(), this);
+ gpu_tracer_->End();
}
// Include the auto-generated part of this file. We split this because it means

Powered by Google App Engine
This is Rietveld 408576698