summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer
diff options
context:
space:
mode:
authorscheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 02:23:58 +0000
committerscheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 02:23:58 +0000
commit366ae2448ddfcd11eb827205aa56c8c0c00442bb (patch)
treee86ee956eabead718e6f0fdf0e2f64bd6292688f /gpu/command_buffer
parentdc2bfb7bfa996045733f6afc849a4923589a53b7 (diff)
downloadchromium_src-366ae2448ddfcd11eb827205aa56c8c0c00442bb.zip
chromium_src-366ae2448ddfcd11eb827205aa56c8c0c00442bb.tar.gz
chromium_src-366ae2448ddfcd11eb827205aa56c8c0c00442bb.tar.bz2
Merge gpu_trace_event back into base/debug/trace_event.
Initial land attempt at http://codereview.chromium.org/6551019/ gpu_trace_event fork at http://codereview.chromium.org/6691013 - gpu_trace_event renamed to base/debug/trace_event and modified as appropriate for base::debug - Unit Tests implemented for trace_event - gpu_common library removed (was added only for gpu_trace_event) - Existing calls to trace_event suffixed with _ETW to make ETW calls (see decisions and incremental plans at end of 6551019) - GPU trace calls renamed to new calls. - Tracing switch removed from test_shell, as linux log file support removed. BUG=79509 TEST=trace_event_win_unittest and about:gpu Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=84284 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=84486 Review URL: http://codereview.chromium.org/6862002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer')
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper.cc12
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc42
-rw-r--r--gpu/command_buffer/common/trace_event.h30
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc14
-rw-r--r--gpu/command_buffer/service/gpu_scheduler.cc4
5 files changed, 66 insertions, 36 deletions
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.cc b/gpu/command_buffer/client/cmd_buffer_helper.cc
index 1054055..f31afa3 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper.cc
@@ -6,7 +6,7 @@
#include "../client/cmd_buffer_helper.h"
#include "../common/command_buffer.h"
-#include "gpu/common/gpu_trace_event.h"
+#include "../common/trace_event.h"
namespace gpu {
@@ -62,7 +62,7 @@ void CommandBufferHelper::Flush() {
// Calls Flush() and then waits until the buffer is empty. Break early if the
// error is set.
bool CommandBufferHelper::Finish() {
- GPU_TRACE_EVENT0("gpu", "CommandBufferHelper::Finish");
+ TRACE_EVENT0("gpu", "CommandBufferHelper::Finish");
do {
// Do not loop forever if the flush fails, meaning the command buffer reader
// has shutdown.
@@ -84,7 +84,7 @@ int32 CommandBufferHelper::InsertToken() {
cmd::SetToken& cmd = GetCmdSpace<cmd::SetToken>();
cmd.Init(token_);
if (token_ == 0) {
- GPU_TRACE_EVENT0("gpu", "CommandBufferHelper::InsertToken(wrapped)");
+ TRACE_EVENT0("gpu", "CommandBufferHelper::InsertToken(wrapped)");
// we wrapped
Finish();
GPU_DCHECK_EQ(token_, last_token_read_);
@@ -95,7 +95,7 @@ int32 CommandBufferHelper::InsertToken() {
// Waits until the current token value is greater or equal to the value passed
// in argument.
void CommandBufferHelper::WaitForToken(int32 token) {
- GPU_TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForToken");
+ TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForToken");
// Return immediately if corresponding InsertToken failed.
if (token < 0)
return;
@@ -131,7 +131,7 @@ void CommandBufferHelper::WaitForAvailableEntries(int32 count) {
// put will wrap to 0 after we add the jump).
GPU_DCHECK_LE(1, put_);
if (get_ > put_ || get_ == 0) {
- GPU_TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForAvailableEntries");
+ 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.
@@ -144,7 +144,7 @@ void CommandBufferHelper::WaitForAvailableEntries(int32 count) {
put_ = 0;
}
if (AvailableEntries() < count) {
- GPU_TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForAvailableEntries1");
+ TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForAvailableEntries1");
while (AvailableEntries() < count) {
// Do not loop forever if the flush fails, meaning the command buffer
// reader has shutdown.
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 6b85a55..3810919 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -9,7 +9,7 @@
#include "../client/mapped_memory.h"
#include "../common/gles2_cmd_utils.h"
#include "../common/id_allocator.h"
-#include "gpu/common/gpu_trace_event.h"
+#include "../common/trace_event.h"
#if defined(__native_client__) && !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
#define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS
@@ -491,7 +491,7 @@ GLES2Implementation::~GLES2Implementation() {
}
void GLES2Implementation::WaitForCmd() {
- GPU_TRACE_EVENT0("gpu", "GLES2::WaitForCmd");
+ TRACE_EVENT0("gpu", "GLES2::WaitForCmd");
helper_->CommandBufferHelper::Finish();
}
@@ -500,7 +500,7 @@ GLenum GLES2Implementation::GetError() {
}
GLenum GLES2Implementation::GetGLError() {
- GPU_TRACE_EVENT0("gpu", "GLES2::GetGLError");
+ TRACE_EVENT0("gpu", "GLES2::GetGLError");
// Check the GL error first, then our wrapped error.
typedef gles2::GetError::Result Result;
Result* result = GetResultAs<Result*>();
@@ -533,7 +533,7 @@ void GLES2Implementation::SetGLError(GLenum error, const char* msg) {
void GLES2Implementation::GetBucketContents(uint32 bucket_id,
std::vector<int8>* data) {
- GPU_TRACE_EVENT0("gpu", "GLES2::GetBucketContents");
+ TRACE_EVENT0("gpu", "GLES2::GetBucketContents");
GPU_DCHECK(data);
typedef cmd::GetBucketSize::Result Result;
Result* result = GetResultAs<Result*>();
@@ -674,7 +674,7 @@ void GLES2Implementation::Flush() {
}
void GLES2Implementation::Finish() {
- GPU_TRACE_EVENT0("gpu", "GLES2::Finish");
+ TRACE_EVENT0("gpu", "GLES2::Finish");
// Insert the cmd to call glFinish
helper_->Finish();
// Finish our command buffer
@@ -717,7 +717,7 @@ void GLES2Implementation::CopyTextureToParentTextureCHROMIUM(
void GLES2Implementation::GenSharedIdsCHROMIUM(
GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) {
- GPU_TRACE_EVENT0("gpu", "GLES2::GenSharedIdsCHROMIUM");
+ TRACE_EVENT0("gpu", "GLES2::GenSharedIdsCHROMIUM");
GLint* id_buffer = transfer_buffer_.AllocTyped<GLint>(n);
helper_->GenSharedIdsCHROMIUM(namespace_id, id_offset, n,
transfer_buffer_id_,
@@ -729,7 +729,7 @@ void GLES2Implementation::GenSharedIdsCHROMIUM(
void GLES2Implementation::DeleteSharedIdsCHROMIUM(
GLuint namespace_id, GLsizei n, const GLuint* ids) {
- GPU_TRACE_EVENT0("gpu", "GLES2::DeleteSharedIdsCHROMIUM");
+ TRACE_EVENT0("gpu", "GLES2::DeleteSharedIdsCHROMIUM");
GLint* id_buffer = transfer_buffer_.AllocTyped<GLint>(n);
memcpy(id_buffer, ids, sizeof(*ids) * n);
helper_->DeleteSharedIdsCHROMIUM(namespace_id, n,
@@ -741,7 +741,7 @@ void GLES2Implementation::DeleteSharedIdsCHROMIUM(
void GLES2Implementation::RegisterSharedIdsCHROMIUM(
GLuint namespace_id, GLsizei n, const GLuint* ids) {
- GPU_TRACE_EVENT0("gpu", "GLES2::RegisterSharedIdsCHROMIUM");
+ TRACE_EVENT0("gpu", "GLES2::RegisterSharedIdsCHROMIUM");
GLint* id_buffer = transfer_buffer_.AllocTyped<GLint>(n);
memcpy(id_buffer, ids, sizeof(*ids) * n);
helper_->RegisterSharedIdsCHROMIUM(namespace_id, n,
@@ -767,7 +767,7 @@ void GLES2Implementation::GetVertexAttribPointerv(
}
#endif // defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
- GPU_TRACE_EVENT0("gpu", "GLES2::GetVertexAttribPointerv");
+ TRACE_EVENT0("gpu", "GLES2::GetVertexAttribPointerv");
typedef gles2::GetVertexAttribPointerv::Result Result;
Result* result = GetResultAs<Result*>();
result->SetNumResults(0);
@@ -779,7 +779,7 @@ void GLES2Implementation::GetVertexAttribPointerv(
GLint GLES2Implementation::GetAttribLocation(
GLuint program, const char* name) {
- GPU_TRACE_EVENT0("gpu", "GLES2::GetAttribLocation");
+ TRACE_EVENT0("gpu", "GLES2::GetAttribLocation");
typedef GetAttribLocationBucket::Result Result;
Result* result = GetResultAs<Result*>();
*result = -1;
@@ -793,7 +793,7 @@ GLint GLES2Implementation::GetAttribLocation(
GLint GLES2Implementation::GetUniformLocation(
GLuint program, const char* name) {
- GPU_TRACE_EVENT0("gpu", "GLES2::GetUniformLocation");
+ TRACE_EVENT0("gpu", "GLES2::GetUniformLocation");
typedef GetUniformLocationBucket::Result Result;
Result* result = GetResultAs<Result*>();
*result = -1;
@@ -1104,7 +1104,7 @@ void GLES2Implementation::GetActiveAttrib(
SetGLError(GL_INVALID_VALUE, "glGetActiveAttrib: bufsize < 0");
return;
}
- GPU_TRACE_EVENT0("gpu", "GLES2::GetActiveAttrib");
+ TRACE_EVENT0("gpu", "GLES2::GetActiveAttrib");
// Clear the bucket so if we the command fails nothing will be in it.
helper_->SetBucketSize(kResultBucketId, 0);
typedef gles2::GetActiveAttrib::Result Result;
@@ -1145,7 +1145,7 @@ void GLES2Implementation::GetActiveUniform(
SetGLError(GL_INVALID_VALUE, "glGetActiveUniform: bufsize < 0");
return;
}
- GPU_TRACE_EVENT0("gpu", "GLES2::GetActiveUniform");
+ TRACE_EVENT0("gpu", "GLES2::GetActiveUniform");
// Clear the bucket so if we the command fails nothing will be in it.
helper_->SetBucketSize(kResultBucketId, 0);
typedef gles2::GetActiveUniform::Result Result;
@@ -1185,7 +1185,7 @@ void GLES2Implementation::GetAttachedShaders(
SetGLError(GL_INVALID_VALUE, "glGetAttachedShaders: maxcount < 0");
return;
}
- GPU_TRACE_EVENT0("gpu", "GLES2::GetAttachedShaders");
+ TRACE_EVENT0("gpu", "GLES2::GetAttachedShaders");
typedef gles2::GetAttachedShaders::Result Result;
uint32 size = Result::ComputeSize(maxcount);
Result* result = transfer_buffer_.AllocTyped<Result>(size);
@@ -1206,7 +1206,7 @@ void GLES2Implementation::GetAttachedShaders(
void GLES2Implementation::GetShaderPrecisionFormat(
GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
- GPU_TRACE_EVENT0("gpu", "GLES2::GetShaderPrecisionFormat");
+ TRACE_EVENT0("gpu", "GLES2::GetShaderPrecisionFormat");
typedef gles2::GetShaderPrecisionFormat::Result Result;
Result* result = static_cast<Result*>(result_buffer_);
result->success = false;
@@ -1258,7 +1258,7 @@ const GLubyte* GLES2Implementation::GetString(GLenum name) {
void GLES2Implementation::GetUniformfv(
GLuint program, GLint location, GLfloat* params) {
- GPU_TRACE_EVENT0("gpu", "GLES2::GetUniformfv");
+ TRACE_EVENT0("gpu", "GLES2::GetUniformfv");
typedef gles2::GetUniformfv::Result Result;
Result* result = static_cast<Result*>(result_buffer_);
result->SetNumResults(0);
@@ -1270,7 +1270,7 @@ void GLES2Implementation::GetUniformfv(
void GLES2Implementation::GetUniformiv(
GLuint program, GLint location, GLint* params) {
- GPU_TRACE_EVENT0("gpu", "GLES2::GetUniformiv");
+ TRACE_EVENT0("gpu", "GLES2::GetUniformiv");
typedef gles2::GetUniformiv::Result Result;
Result* result = static_cast<Result*>(result_buffer_);
result->SetNumResults(0);
@@ -1297,7 +1297,7 @@ void GLES2Implementation::ReadPixels(
// and that when we copy the results to the user's buffer we need to not
// write those padding bytes but leave them as they are.
- GPU_TRACE_EVENT0("gpu", "GLES2::ReadPixels");
+ TRACE_EVENT0("gpu", "GLES2::ReadPixels");
typedef gles2::ReadPixels::Result Result;
Result* result = static_cast<Result*>(result_buffer_);
int8* dest = reinterpret_cast<int8*>(pixels);
@@ -1537,7 +1537,7 @@ void GLES2Implementation::GetVertexAttribfv(
return;
}
#endif
- GPU_TRACE_EVENT0("gpu", "GLES2::GetVertexAttribfv");
+ TRACE_EVENT0("gpu", "GLES2::GetVertexAttribfv");
typedef GetVertexAttribfv::Result Result;
Result* result = GetResultAs<Result*>();
result->SetNumResults(0);
@@ -1556,7 +1556,7 @@ void GLES2Implementation::GetVertexAttribiv(
return;
}
#endif
- GPU_TRACE_EVENT0("gpu", "GLES2::GetVertexAttribiv");
+ TRACE_EVENT0("gpu", "GLES2::GetVertexAttribiv");
typedef GetVertexAttribiv::Result Result;
Result* result = GetResultAs<Result*>();
result->SetNumResults(0);
@@ -1568,7 +1568,7 @@ void GLES2Implementation::GetVertexAttribiv(
GLboolean GLES2Implementation::CommandBufferEnableCHROMIUM(
const char* feature) {
- GPU_TRACE_EVENT0("gpu", "GLES2::CommandBufferEnableCHROMIUM");
+ TRACE_EVENT0("gpu", "GLES2::CommandBufferEnableCHROMIUM");
typedef CommandBufferEnableCHROMIUM::Result Result;
Result* result = GetResultAs<Result*>();
*result = 0;
diff --git a/gpu/command_buffer/common/trace_event.h b/gpu/command_buffer/common/trace_event.h
new file mode 100644
index 0000000..9327063
--- /dev/null
+++ b/gpu/command_buffer/common/trace_event.h
@@ -0,0 +1,30 @@
+// 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.
+
+#ifndef GPU_COMMAND_BUFFER_COMMON_TRACE_EVENT_H_
+#define GPU_COMMAND_BUFFER_COMMON_TRACE_EVENT_H_
+#pragma once
+
+#if !defined(__native_client__)
+
+#include "base/debug/trace_event.h"
+
+#else
+
+#define TRACE_EVENT0(x0, x1) { }
+#define TRACE_EVENT1(x0, x1, x2, x3) { }
+#define TRACE_EVENT2(x0, x1, x2, x3, x4, x5) { }
+#define TRACE_EVENT_INSTANT0(x0, x1) { }
+#define TRACE_EVENT_INSTANT1(x0, x1, x2, x3) { }
+#define TRACE_EVENT_INSTANT2(x0, x1, x2, x3, x4, x5) { }
+#define TRACE_BEGIN0(x0, x1) { }
+#define TRACE_BEGIN1(x0, x1, x2, x3) { }
+#define TRACE_BEGIN2(x0, x1, x2, x3, x4, x5) { }
+#define TRACE_END0(x0, x1) { }
+#define TRACE_END1(x0, x1, x2, x3) { }
+#define TRACE_END2(x0, x1, x2, x3, x4, x5) { }
+
+#endif // __native_client__
+
+#endif // GPU_COMMAND_BUFFER_COMMON_TRACE_EVENT_H_
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 13e73c1..ccaf5c3 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -22,6 +22,7 @@
#include "gpu/command_buffer/common/gles2_cmd_format.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/common/id_allocator.h"
+#include "gpu/command_buffer/common/trace_event.h"
#include "gpu/command_buffer/service/buffer_manager.h"
#include "gpu/command_buffer/service/cmd_buffer_engine.h"
#include "gpu/command_buffer/service/context_group.h"
@@ -34,7 +35,6 @@
#include "gpu/command_buffer/service/shader_manager.h"
#include "gpu/command_buffer/service/shader_translator.h"
#include "gpu/command_buffer/service/texture_manager.h"
-#include "gpu/common/gpu_trace_event.h"
#include "gpu/GLES2/gles2_command_buffer.h"
#include "ui/gfx/gl/gl_context.h"
#include "ui/gfx/gl/gl_implementation.h"
@@ -5576,7 +5576,7 @@ error::Error GLES2DecoderImpl::DoTexImage2D(
error::Error GLES2DecoderImpl::HandleTexImage2D(
uint32 immediate_data_size, const gles2::TexImage2D& c) {
- GPU_TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexImage2D");
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexImage2D");
tex_image_2d_failed_ = true;
GLenum target = static_cast<GLenum>(c.target);
GLint level = static_cast<GLint>(c.level);
@@ -5890,7 +5890,7 @@ void GLES2DecoderImpl::DoTexSubImage2D(
error::Error GLES2DecoderImpl::HandleTexSubImage2D(
uint32 immediate_data_size, const gles2::TexSubImage2D& c) {
- GPU_TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexSubImage2D");
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexSubImage2D");
GLboolean internal = static_cast<GLboolean>(c.internal);
if (internal == GL_TRUE && tex_image_2d_failed_)
return error::kNoError;
@@ -6314,7 +6314,7 @@ error::Error GLES2DecoderImpl::HandleShaderBinary(
error::Error GLES2DecoderImpl::HandleSwapBuffers(
uint32 immediate_data_size, const gles2::SwapBuffers& c) {
- GPU_TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleSwapBuffers");
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleSwapBuffers");
// If offscreen then don't actually SwapBuffers to the display. Just copy
// the rendered frame to another frame buffer.
if (offscreen_target_frame_buffer_.get()) {
@@ -6360,7 +6360,7 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
return error::kNoError;
}
} else {
- GPU_TRACE_EVENT0("gpu", "GLContext::SwapBuffers");
+ TRACE_EVENT0("gpu", "GLContext::SwapBuffers");
if (!context_->SwapBuffers()) {
LOG(ERROR) << "Context lost because SwapBuffers failed.";
return error::kLostContext;
@@ -6376,7 +6376,7 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
error::Error GLES2DecoderImpl::HandleSetLatchCHROMIUM(
uint32 immediate_data_size, const gles2::SetLatchCHROMIUM& c) {
- GPU_TRACE_EVENT0("gpu", "SetLatch");
+ TRACE_EVENT0("gpu", "SetLatch");
// Ensure the side effects of previous commands are visible to other contexts.
// There is no need to do this for ANGLE because it uses a
// single D3D device for all contexts.
@@ -6403,7 +6403,7 @@ error::Error GLES2DecoderImpl::HandleSetLatchCHROMIUM(
error::Error GLES2DecoderImpl::HandleWaitLatchCHROMIUM(
uint32 immediate_data_size, const gles2::WaitLatchCHROMIUM& c) {
- GPU_TRACE_EVENT0("gpu", "WaitLatch");
+ TRACE_EVENT0("gpu", "WaitLatch");
int32 shm_id = gpu::kLatchSharedMemoryId;
uint32 latch_id = c.latch_id;
uint32 shm_offset = 0;
diff --git a/gpu/command_buffer/service/gpu_scheduler.cc b/gpu/command_buffer/service/gpu_scheduler.cc
index 67ff504..54579389a 100644
--- a/gpu/command_buffer/service/gpu_scheduler.cc
+++ b/gpu/command_buffer/service/gpu_scheduler.cc
@@ -6,8 +6,8 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
+#include "base/debug/trace_event.h"
#include "base/message_loop.h"
-#include "gpu/common/gpu_trace_event.h"
#include "ui/gfx/gl/gl_context.h"
#include "ui/gfx/gl/gl_bindings.h"
@@ -128,7 +128,7 @@ void GpuScheduler::PutChanged(bool sync) {
}
void GpuScheduler::ProcessCommands() {
- GPU_TRACE_EVENT0("gpu", "GpuScheduler:ProcessCommands");
+ TRACE_EVENT0("gpu", "GpuScheduler:ProcessCommands");
CommandBuffer::State state = command_buffer_->GetState();
if (state.error != error::kNoError)
return;