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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 813573003: Fixed GPU tracing so the categories do not get mixed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also export GPUTracer Created 6 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
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 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 base::TimeDelta total_processing_commands_time_; 1871 base::TimeDelta total_processing_commands_time_;
1872 1872
1873 // States related to each manager. 1873 // States related to each manager.
1874 DecoderTextureState texture_state_; 1874 DecoderTextureState texture_state_;
1875 DecoderFramebufferState framebuffer_state_; 1875 DecoderFramebufferState framebuffer_state_;
1876 1876
1877 scoped_ptr<GPUTracer> gpu_tracer_; 1877 scoped_ptr<GPUTracer> gpu_tracer_;
1878 scoped_ptr<GPUStateTracer> gpu_state_tracer_; 1878 scoped_ptr<GPUStateTracer> gpu_state_tracer_;
1879 const unsigned char* cb_command_trace_category_; 1879 const unsigned char* cb_command_trace_category_;
1880 const unsigned char* gpu_decoder_category_; 1880 const unsigned char* gpu_decoder_category_;
1881 const unsigned char* gpu_group_marker_category_;
1882 int gpu_trace_level_; 1881 int gpu_trace_level_;
1883 bool gpu_trace_commands_; 1882 bool gpu_trace_commands_;
1884 bool gpu_debug_commands_; 1883 bool gpu_debug_commands_;
1885 1884
1886 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; 1885 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_;
1887 1886
1888 // Used to validate multisample renderbuffers if needed 1887 // Used to validate multisample renderbuffers if needed
1889 GLuint validation_texture_; 1888 GLuint validation_texture_;
1890 GLuint validation_fbo_multisample_; 1889 GLuint validation_fbo_multisample_;
1891 GLuint validation_fbo_; 1890 GLuint validation_fbo_;
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 switches::kEnableGPUServiceLoggingGPU)), 2388 switches::kEnableGPUServiceLoggingGPU)),
2390 viewport_max_width_(0), 2389 viewport_max_width_(0),
2391 viewport_max_height_(0), 2390 viewport_max_height_(0),
2392 texture_state_(group_->feature_info() 2391 texture_state_(group_->feature_info()
2393 ->workarounds() 2392 ->workarounds()
2394 .texsubimage2d_faster_than_teximage2d), 2393 .texsubimage2d_faster_than_teximage2d),
2395 cb_command_trace_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( 2394 cb_command_trace_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
2396 TRACE_DISABLED_BY_DEFAULT("cb_command"))), 2395 TRACE_DISABLED_BY_DEFAULT("cb_command"))),
2397 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( 2396 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
2398 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))), 2397 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))),
2399 gpu_group_marker_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
2400 TRACE_DISABLED_BY_DEFAULT("gpu_group_marker"))),
2401 gpu_trace_level_(2), 2398 gpu_trace_level_(2),
2402 gpu_trace_commands_(false), 2399 gpu_trace_commands_(false),
2403 gpu_debug_commands_(false), 2400 gpu_debug_commands_(false),
2404 validation_texture_(0), 2401 validation_texture_(0),
2405 validation_fbo_multisample_(0), 2402 validation_fbo_multisample_(0),
2406 validation_fbo_(0) { 2403 validation_fbo_(0) {
2407 DCHECK(group); 2404 DCHECK(group);
2408 2405
2409 attrib_0_value_.v[0] = 0.0f; 2406 attrib_0_value_.v[0] = 0.0f;
2410 attrib_0_value_.v[1] = 0.0f; 2407 attrib_0_value_.v[1] = 0.0f;
(...skipping 8587 matching lines...) Expand 10 before | Expand all | Expand 10 after
10998 length ? std::string(marker, length) : std::string(marker)); 10995 length ? std::string(marker, length) : std::string(marker));
10999 } 10996 }
11000 10997
11001 void GLES2DecoderImpl::DoPushGroupMarkerEXT( 10998 void GLES2DecoderImpl::DoPushGroupMarkerEXT(
11002 GLsizei length, const GLchar* marker) { 10999 GLsizei length, const GLchar* marker) {
11003 if (!marker) { 11000 if (!marker) {
11004 marker = ""; 11001 marker = "";
11005 } 11002 }
11006 std::string name = length ? std::string(marker, length) : std::string(marker); 11003 std::string name = length ? std::string(marker, length) : std::string(marker);
11007 debug_marker_manager_.PushGroup(name); 11004 debug_marker_manager_.PushGroup(name);
11008 if (*gpu_group_marker_category_) { 11005 gpu_tracer_->Begin(TRACE_DISABLED_BY_DEFAULT("gpu_group_marker"), name,
11009 gpu_tracer_->Begin(TRACE_DISABLED_BY_DEFAULT("gpu_group_marker"), name, 11006 kTraceGroupMarker);
11010 kTraceGroupMarker);
11011 }
11012 } 11007 }
11013 11008
11014 void GLES2DecoderImpl::DoPopGroupMarkerEXT(void) { 11009 void GLES2DecoderImpl::DoPopGroupMarkerEXT(void) {
11015 debug_marker_manager_.PopGroup(); 11010 debug_marker_manager_.PopGroup();
11016 if (*gpu_group_marker_category_) { 11011 gpu_tracer_->End(kTraceGroupMarker);
11017 gpu_tracer_->End(kTraceGroupMarker);
11018 }
11019 } 11012 }
11020 11013
11021 void GLES2DecoderImpl::DoBindTexImage2DCHROMIUM( 11014 void GLES2DecoderImpl::DoBindTexImage2DCHROMIUM(
11022 GLenum target, GLint image_id) { 11015 GLenum target, GLint image_id) {
11023 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM"); 11016 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM");
11024 11017
11025 if (target == GL_TEXTURE_CUBE_MAP) { 11018 if (target == GL_TEXTURE_CUBE_MAP) {
11026 LOCAL_SET_GL_ERROR( 11019 LOCAL_SET_GL_ERROR(
11027 GL_INVALID_ENUM, 11020 GL_INVALID_ENUM,
11028 "glBindTexImage2DCHROMIUM", "invalid target"); 11021 "glBindTexImage2DCHROMIUM", "invalid target");
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
11116 return error::kInvalidArguments; 11109 return error::kInvalidArguments;
11117 } 11110 }
11118 11111
11119 std::string category_name; 11112 std::string category_name;
11120 std::string trace_name; 11113 std::string trace_name;
11121 if (!category_bucket->GetAsString(&category_name) || 11114 if (!category_bucket->GetAsString(&category_name) ||
11122 !name_bucket->GetAsString(&trace_name)) { 11115 !name_bucket->GetAsString(&trace_name)) {
11123 return error::kInvalidArguments; 11116 return error::kInvalidArguments;
11124 } 11117 }
11125 11118
11126 TRACE_EVENT_COPY_ASYNC_BEGIN0(category_name.c_str(), trace_name.c_str(),
11127 this);
11128 if (!gpu_tracer_->Begin(category_name, trace_name, kTraceCHROMIUM)) { 11119 if (!gpu_tracer_->Begin(category_name, trace_name, kTraceCHROMIUM)) {
11129 LOCAL_SET_GL_ERROR( 11120 LOCAL_SET_GL_ERROR(
11130 GL_INVALID_OPERATION, 11121 GL_INVALID_OPERATION,
11131 "glTraceBeginCHROMIUM", "unable to create begin trace"); 11122 "glTraceBeginCHROMIUM", "unable to create begin trace");
11132 return error::kNoError; 11123 return error::kNoError;
11133 } 11124 }
11134 return error::kNoError; 11125 return error::kNoError;
11135 } 11126 }
11136 11127
11137 void GLES2DecoderImpl::DoTraceEndCHROMIUM() { 11128 void GLES2DecoderImpl::DoTraceEndCHROMIUM() {
11138 if (gpu_tracer_->CurrentCategory().empty() || 11129 if (!gpu_tracer_->End(kTraceCHROMIUM)) {
11139 gpu_tracer_->CurrentName().empty()) { 11130 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
11140 LOCAL_SET_GL_ERROR( 11131 "glTraceEndCHROMIUM", "no trace begin found");
11141 GL_INVALID_OPERATION,
11142 "glTraceEndCHROMIUM", "no trace begin found");
11143 return; 11132 return;
11144 } 11133 }
11145 TRACE_EVENT_COPY_ASYNC_END0(gpu_tracer_->CurrentCategory().c_str(),
11146 gpu_tracer_->CurrentName().c_str(), this);
11147 gpu_tracer_->End(kTraceCHROMIUM);
11148 } 11134 }
11149 11135
11150 void GLES2DecoderImpl::DoDrawBuffersEXT( 11136 void GLES2DecoderImpl::DoDrawBuffersEXT(
11151 GLsizei count, const GLenum* bufs) { 11137 GLsizei count, const GLenum* bufs) {
11152 if (count > static_cast<GLsizei>(group_->max_draw_buffers())) { 11138 if (count > static_cast<GLsizei>(group_->max_draw_buffers())) {
11153 LOCAL_SET_GL_ERROR( 11139 LOCAL_SET_GL_ERROR(
11154 GL_INVALID_VALUE, 11140 GL_INVALID_VALUE,
11155 "glDrawBuffersEXT", "greater than GL_MAX_DRAW_BUFFERS_EXT"); 11141 "glDrawBuffersEXT", "greater than GL_MAX_DRAW_BUFFERS_EXT");
11156 return; 11142 return;
11157 } 11143 }
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
11561 } 11547 }
11562 } 11548 }
11563 11549
11564 // Include the auto-generated part of this file. We split this because it means 11550 // Include the auto-generated part of this file. We split this because it means
11565 // we can easily edit the non-auto generated parts right here in this file 11551 // we can easily edit the non-auto generated parts right here in this file
11566 // instead of having to edit some template or the code generator. 11552 // instead of having to edit some template or the code generator.
11567 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 11553 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
11568 11554
11569 } // namespace gles2 11555 } // namespace gles2
11570 } // namespace gpu 11556 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698