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

Side by Side 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: Update the autogen'd files. Created 7 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.h ('k') | gpu/command_buffer/service/gpu_trace.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 22 matching lines...) Expand all
33 #include "gpu/command_buffer/service/buffer_manager.h" 33 #include "gpu/command_buffer/service/buffer_manager.h"
34 #include "gpu/command_buffer/service/cmd_buffer_engine.h" 34 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
35 #include "gpu/command_buffer/service/context_group.h" 35 #include "gpu/command_buffer/service/context_group.h"
36 #include "gpu/command_buffer/service/context_state.h" 36 #include "gpu/command_buffer/service/context_state.h"
37 #include "gpu/command_buffer/service/feature_info.h" 37 #include "gpu/command_buffer/service/feature_info.h"
38 #include "gpu/command_buffer/service/framebuffer_manager.h" 38 #include "gpu/command_buffer/service/framebuffer_manager.h"
39 #include "gpu/command_buffer/service/gl_utils.h" 39 #include "gpu/command_buffer/service/gl_utils.h"
40 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" 40 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
41 #include "gpu/command_buffer/service/gles2_cmd_validation.h" 41 #include "gpu/command_buffer/service/gles2_cmd_validation.h"
42 #include "gpu/command_buffer/service/gpu_switches.h" 42 #include "gpu/command_buffer/service/gpu_switches.h"
43 #include "gpu/command_buffer/service/gpu_trace.h" 43 #include "gpu/command_buffer/service/gpu_tracer.h"
44 #include "gpu/command_buffer/service/image_manager.h" 44 #include "gpu/command_buffer/service/image_manager.h"
45 #include "gpu/command_buffer/service/mailbox_manager.h" 45 #include "gpu/command_buffer/service/mailbox_manager.h"
46 #include "gpu/command_buffer/service/memory_tracking.h" 46 #include "gpu/command_buffer/service/memory_tracking.h"
47 #include "gpu/command_buffer/service/program_manager.h" 47 #include "gpu/command_buffer/service/program_manager.h"
48 #include "gpu/command_buffer/service/query_manager.h" 48 #include "gpu/command_buffer/service/query_manager.h"
49 #include "gpu/command_buffer/service/renderbuffer_manager.h" 49 #include "gpu/command_buffer/service/renderbuffer_manager.h"
50 #include "gpu/command_buffer/service/shader_manager.h" 50 #include "gpu/command_buffer/service/shader_manager.h"
51 #include "gpu/command_buffer/service/shader_translator.h" 51 #include "gpu/command_buffer/service/shader_translator.h"
52 #include "gpu/command_buffer/service/shader_translator_cache.h" 52 #include "gpu/command_buffer/service/shader_translator_cache.h"
53 #include "gpu/command_buffer/service/stream_texture.h" 53 #include "gpu/command_buffer/service/stream_texture.h"
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 1700
1701 // Cached values of the currently assigned viewport dimensions. 1701 // Cached values of the currently assigned viewport dimensions.
1702 GLsizei viewport_max_width_; 1702 GLsizei viewport_max_width_;
1703 GLsizei viewport_max_height_; 1703 GLsizei viewport_max_height_;
1704 1704
1705 // Command buffer stats. 1705 // Command buffer stats.
1706 int texture_upload_count_; 1706 int texture_upload_count_;
1707 base::TimeDelta total_texture_upload_time_; 1707 base::TimeDelta total_texture_upload_time_;
1708 base::TimeDelta total_processing_commands_time_; 1708 base::TimeDelta total_processing_commands_time_;
1709 1709
1710 std::stack<linked_ptr<GPUTrace> > gpu_trace_stack_; 1710 scoped_ptr<GPUTracer> gpu_tracer_;
1711 1711
1712 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); 1712 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl);
1713 }; 1713 };
1714 1714
1715 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor(GLES2DecoderImpl* decoder) 1715 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor(GLES2DecoderImpl* decoder)
1716 : decoder_(decoder) { 1716 : decoder_(decoder) {
1717 decoder_->CopyRealGLErrorsToWrapper(); 1717 decoder_->CopyRealGLErrorsToWrapper();
1718 } 1718 }
1719 1719
1720 ScopedGLErrorSuppressor::~ScopedGLErrorSuppressor() { 1720 ScopedGLErrorSuppressor::~ScopedGLErrorSuppressor() {
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2162 const scoped_refptr<gfx::GLContext>& context, 2162 const scoped_refptr<gfx::GLContext>& context,
2163 bool offscreen, 2163 bool offscreen,
2164 const gfx::Size& size, 2164 const gfx::Size& size,
2165 const DisallowedFeatures& disallowed_features, 2165 const DisallowedFeatures& disallowed_features,
2166 const char* allowed_extensions, 2166 const char* allowed_extensions,
2167 const std::vector<int32>& attribs) { 2167 const std::vector<int32>& attribs) {
2168 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); 2168 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize");
2169 DCHECK(context->IsCurrent(surface.get())); 2169 DCHECK(context->IsCurrent(surface.get()));
2170 DCHECK(!context_.get()); 2170 DCHECK(!context_.get());
2171 2171
2172 gpu_tracer_ = GPUTracer::Create();
2173
2172 if (CommandLine::ForCurrentProcess()->HasSwitch( 2174 if (CommandLine::ForCurrentProcess()->HasSwitch(
2173 switches::kEnableGPUDebugging)) { 2175 switches::kEnableGPUDebugging)) {
2174 set_debug(true); 2176 set_debug(true);
2175 } 2177 }
2176 2178
2177 if (CommandLine::ForCurrentProcess()->HasSwitch( 2179 if (CommandLine::ForCurrentProcess()->HasSwitch(
2178 switches::kEnableGPUCommandLogging)) { 2180 switches::kEnableGPUCommandLogging)) {
2179 set_log_commands(true); 2181 set_log_commands(true);
2180 } 2182 }
2181 2183
(...skipping 7688 matching lines...) Expand 10 before | Expand all | Expand 10 after
9870 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( 9872 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM(
9871 uint32 immediate_data_size, const gles2::TraceBeginCHROMIUM& c) { 9873 uint32 immediate_data_size, const gles2::TraceBeginCHROMIUM& c) {
9872 Bucket* bucket = GetBucket(c.bucket_id); 9874 Bucket* bucket = GetBucket(c.bucket_id);
9873 if (!bucket || bucket->size() == 0) { 9875 if (!bucket || bucket->size() == 0) {
9874 return error::kInvalidArguments; 9876 return error::kInvalidArguments;
9875 } 9877 }
9876 std::string command_name; 9878 std::string command_name;
9877 if (!bucket->GetAsString(&command_name)) { 9879 if (!bucket->GetAsString(&command_name)) {
9878 return error::kInvalidArguments; 9880 return error::kInvalidArguments;
9879 } 9881 }
9880 9882 TRACE_EVENT_COPY_ASYNC_BEGIN0("gpu", command_name.c_str(), this);
9881 linked_ptr<GPUTrace> trace(new GPUTrace(command_name)); 9883 if (!gpu_tracer_->Begin(command_name)) {
9882 trace->EnableStartTrace(); 9884 SetGLError(GL_INVALID_OPERATION,
9883 gpu_trace_stack_.push(trace); 9885 "glTraceBeginCHROMIUM", "unable to create begin trace");
9884 9886 return error::kNoError;
9887 }
9885 return error::kNoError; 9888 return error::kNoError;
9886 } 9889 }
9887 9890
9888 void GLES2DecoderImpl::DoTraceEndCHROMIUM() { 9891 void GLES2DecoderImpl::DoTraceEndCHROMIUM() {
9889 if (gpu_trace_stack_.empty()) { 9892 if (gpu_tracer_->CurrentName().empty()) {
9890 SetGLError(GL_INVALID_OPERATION, 9893 SetGLError(GL_INVALID_OPERATION,
9891 "glTraceEndCHROMIUM", "no trace begin found"); 9894 "glTraceEndCHROMIUM", "no trace begin found");
9892 return; 9895 return;
9893 } 9896 }
9894 9897 TRACE_EVENT_COPY_ASYNC_END0("gpu", gpu_tracer_->CurrentName().c_str(), this);
9895 linked_ptr<GPUTrace> trace = gpu_trace_stack_.top(); 9898 gpu_tracer_->End();
9896 trace->EnableEndTrace();
9897 gpu_trace_stack_.pop();
9898 } 9899 }
9899 9900
9900 bool GLES2DecoderImpl::ValidateAsyncTransfer( 9901 bool GLES2DecoderImpl::ValidateAsyncTransfer(
9901 const char* function_name, 9902 const char* function_name,
9902 TextureManager::TextureInfo* info, 9903 TextureManager::TextureInfo* info,
9903 GLenum target, 9904 GLenum target,
9904 GLint level, 9905 GLint level,
9905 const void * data) { 9906 const void * data) {
9906 // We only support async uploads to 2D textures for now. 9907 // We only support async uploads to 2D textures for now.
9907 if (GL_TEXTURE_2D != target) { 9908 if (GL_TEXTURE_2D != target) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
10095 return error::kNoError; 10096 return error::kNoError;
10096 } 10097 }
10097 10098
10098 // Include the auto-generated part of this file. We split this because it means 10099 // Include the auto-generated part of this file. We split this because it means
10099 // we can easily edit the non-auto generated parts right here in this file 10100 // we can easily edit the non-auto generated parts right here in this file
10100 // instead of having to edit some template or the code generator. 10101 // instead of having to edit some template or the code generator.
10101 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10102 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10102 10103
10103 } // namespace gles2 10104 } // namespace gles2
10104 } // namespace gpu 10105 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.h ('k') | gpu/command_buffer/service/gpu_trace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698