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

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: Skip processing of no-op traces. Created 8 years 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
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 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 1592
1593 // Cached values of the currently assigned viewport dimensions. 1593 // Cached values of the currently assigned viewport dimensions.
1594 GLsizei viewport_max_width_; 1594 GLsizei viewport_max_width_;
1595 GLsizei viewport_max_height_; 1595 GLsizei viewport_max_height_;
1596 1596
1597 // Command buffer stats. 1597 // Command buffer stats.
1598 int texture_upload_count_; 1598 int texture_upload_count_;
1599 base::TimeDelta total_texture_upload_time_; 1599 base::TimeDelta total_texture_upload_time_;
1600 base::TimeDelta total_processing_commands_time_; 1600 base::TimeDelta total_processing_commands_time_;
1601 1601
1602 std::stack<linked_ptr<GPUTrace> > gpu_trace_stack_; 1602 scoped_ptr<GPUTracer> gpu_tracer_;
1603 1603
1604 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); 1604 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl);
1605 }; 1605 };
1606 1606
1607 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor(GLES2DecoderImpl* decoder) 1607 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor(GLES2DecoderImpl* decoder)
1608 : decoder_(decoder) { 1608 : decoder_(decoder) {
1609 decoder_->CopyRealGLErrorsToWrapper(); 1609 decoder_->CopyRealGLErrorsToWrapper();
1610 } 1610 }
1611 1611
1612 ScopedGLErrorSuppressor::~ScopedGLErrorSuppressor() { 1612 ScopedGLErrorSuppressor::~ScopedGLErrorSuppressor() {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 const scoped_refptr<gfx::GLContext>& context, 2024 const scoped_refptr<gfx::GLContext>& context,
2025 bool offscreen, 2025 bool offscreen,
2026 const gfx::Size& size, 2026 const gfx::Size& size,
2027 const DisallowedFeatures& disallowed_features, 2027 const DisallowedFeatures& disallowed_features,
2028 const char* allowed_extensions, 2028 const char* allowed_extensions,
2029 const std::vector<int32>& attribs) { 2029 const std::vector<int32>& attribs) {
2030 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); 2030 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize");
2031 DCHECK(context->IsCurrent(surface.get())); 2031 DCHECK(context->IsCurrent(surface.get()));
2032 DCHECK(!context_.get()); 2032 DCHECK(!context_.get());
2033 2033
2034 gpu_tracer_ = GPUTracer::Create();
2035
2034 if (CommandLine::ForCurrentProcess()->HasSwitch( 2036 if (CommandLine::ForCurrentProcess()->HasSwitch(
2035 switches::kEnableGPUDebugging)) { 2037 switches::kEnableGPUDebugging)) {
2036 set_debug(true); 2038 set_debug(true);
2037 } 2039 }
2038 2040
2039 if (CommandLine::ForCurrentProcess()->HasSwitch( 2041 if (CommandLine::ForCurrentProcess()->HasSwitch(
2040 switches::kEnableGPUCommandLogging)) { 2042 switches::kEnableGPUCommandLogging)) {
2041 set_log_commands(true); 2043 set_log_commands(true);
2042 } 2044 }
2043 2045
(...skipping 4578 matching lines...) Expand 10 before | Expand all | Expand 10 after
6622 } 6624 }
6623 6625
6624 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( 6626 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM(
6625 uint32 immediate_data_size, const gles2::PostSubBufferCHROMIUM& c) { 6627 uint32 immediate_data_size, const gles2::PostSubBufferCHROMIUM& c) {
6626 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); 6628 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM");
6627 if (!surface_->HasExtension("GL_CHROMIUM_post_sub_buffer")) { 6629 if (!surface_->HasExtension("GL_CHROMIUM_post_sub_buffer")) {
6628 SetGLError(GL_INVALID_OPERATION, 6630 SetGLError(GL_INVALID_OPERATION,
6629 "glPostSubBufferCHROMIUM", "command not supported by surface"); 6631 "glPostSubBufferCHROMIUM", "command not supported by surface");
6630 return error::kNoError; 6632 return error::kNoError;
6631 } 6633 }
6634
6632 if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) { 6635 if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) {
6633 return error::kNoError; 6636 return error::kNoError;
6634 } else { 6637 } else {
6635 LOG(ERROR) << "Context lost because PostSubBuffer failed."; 6638 LOG(ERROR) << "Context lost because PostSubBuffer failed.";
6636 return error::kLostContext; 6639 return error::kLostContext;
6637 } 6640 }
6638 } 6641 }
6639 6642
6640 error::Error GLES2DecoderImpl::GetAttribLocationHelper( 6643 error::Error GLES2DecoderImpl::GetAttribLocationHelper(
6641 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, 6644 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset,
(...skipping 2828 matching lines...) Expand 10 before | Expand all | Expand 10 after
9470 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( 9473 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM(
9471 uint32 immediate_data_size, const gles2::TraceBeginCHROMIUM& c) { 9474 uint32 immediate_data_size, const gles2::TraceBeginCHROMIUM& c) {
9472 Bucket* bucket = GetBucket(c.bucket_id); 9475 Bucket* bucket = GetBucket(c.bucket_id);
9473 if (!bucket || bucket->size() == 0) { 9476 if (!bucket || bucket->size() == 0) {
9474 return error::kInvalidArguments; 9477 return error::kInvalidArguments;
9475 } 9478 }
9476 std::string command_name; 9479 std::string command_name;
9477 if (!bucket->GetAsString(&command_name)) { 9480 if (!bucket->GetAsString(&command_name)) {
9478 return error::kInvalidArguments; 9481 return error::kInvalidArguments;
9479 } 9482 }
9480 9483 TRACE_EVENT_COPY_ASYNC_BEGIN0("gpu", command_name.c_str(), this);
9481 linked_ptr<GPUTrace> trace(new GPUTrace(command_name)); 9484 if (!gpu_tracer_->Begin(command_name)) {
9482 trace->EnableStartTrace(); 9485 SetGLError(GL_INVALID_OPERATION,
9483 gpu_trace_stack_.push(trace); 9486 "glTraceBeginCHROMIUM", "unable to create begin trace");
9484 9487 return error::kNoError;
9488 }
9485 return error::kNoError; 9489 return error::kNoError;
9486 } 9490 }
9487 9491
9488 void GLES2DecoderImpl::DoTraceEndCHROMIUM() { 9492 void GLES2DecoderImpl::DoTraceEndCHROMIUM() {
9489 if (gpu_trace_stack_.empty()) { 9493 if (gpu_tracer_->CurrentName().empty()) {
9490 SetGLError(GL_INVALID_OPERATION, 9494 SetGLError(GL_INVALID_OPERATION,
9491 "glTraceEndCHROMIUM", "no trace begin found"); 9495 "glTraceEndCHROMIUM", "no trace begin found");
9492 return; 9496 return;
9493 } 9497 }
9494 9498 TRACE_EVENT_COPY_ASYNC_END0("gpu", gpu_tracer_->CurrentName().c_str(), this);
9495 linked_ptr<GPUTrace> trace = gpu_trace_stack_.top(); 9499 gpu_tracer_->End();
9496 trace->EnableEndTrace();
9497 gpu_trace_stack_.pop();
9498 } 9500 }
9499 9501
9500 error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM( 9502 error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM(
9501 uint32 immediate_data_size, const gles2::AsyncTexImage2DCHROMIUM& c) { 9503 uint32 immediate_data_size, const gles2::AsyncTexImage2DCHROMIUM& c) {
9502 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM"); 9504 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM");
9503 9505
9504 // TODO: This is a copy of HandleTexImage2D validation. Merge 9506 // TODO: This is a copy of HandleTexImage2D validation. Merge
9505 // as much of it as possible. 9507 // as much of it as possible.
9506 tex_image_2d_failed_ = true; 9508 tex_image_2d_failed_ = true;
9507 GLenum target = static_cast<GLenum>(c.target); 9509 GLenum target = static_cast<GLenum>(c.target);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
9587 return error::kNoError; 9589 return error::kNoError;
9588 } 9590 }
9589 9591
9590 // Include the auto-generated part of this file. We split this because it means 9592 // Include the auto-generated part of this file. We split this because it means
9591 // we can easily edit the non-auto generated parts right here in this file 9593 // we can easily edit the non-auto generated parts right here in this file
9592 // instead of having to edit some template or the code generator. 9594 // instead of having to edit some template or the code generator.
9593 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 9595 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
9594 9596
9595 } // namespace gles2 9597 } // namespace gles2
9596 } // namespace gpu 9598 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698