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

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

Issue 23926013: gpu: Record GL state to trace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build failure. Created 7 years, 3 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 | « base/debug/trace_event.h ('k') | gpu/command_buffer/service/gpu_state_tracer.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 24 matching lines...) Expand all
35 #include "gpu/command_buffer/service/buffer_manager.h" 35 #include "gpu/command_buffer/service/buffer_manager.h"
36 #include "gpu/command_buffer/service/cmd_buffer_engine.h" 36 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
37 #include "gpu/command_buffer/service/context_group.h" 37 #include "gpu/command_buffer/service/context_group.h"
38 #include "gpu/command_buffer/service/context_state.h" 38 #include "gpu/command_buffer/service/context_state.h"
39 #include "gpu/command_buffer/service/error_state.h" 39 #include "gpu/command_buffer/service/error_state.h"
40 #include "gpu/command_buffer/service/feature_info.h" 40 #include "gpu/command_buffer/service/feature_info.h"
41 #include "gpu/command_buffer/service/framebuffer_manager.h" 41 #include "gpu/command_buffer/service/framebuffer_manager.h"
42 #include "gpu/command_buffer/service/gl_utils.h" 42 #include "gpu/command_buffer/service/gl_utils.h"
43 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" 43 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
44 #include "gpu/command_buffer/service/gles2_cmd_validation.h" 44 #include "gpu/command_buffer/service/gles2_cmd_validation.h"
45 #include "gpu/command_buffer/service/gpu_state_tracer.h"
45 #include "gpu/command_buffer/service/gpu_switches.h" 46 #include "gpu/command_buffer/service/gpu_switches.h"
46 #include "gpu/command_buffer/service/gpu_tracer.h" 47 #include "gpu/command_buffer/service/gpu_tracer.h"
47 #include "gpu/command_buffer/service/image_manager.h" 48 #include "gpu/command_buffer/service/image_manager.h"
48 #include "gpu/command_buffer/service/mailbox_manager.h" 49 #include "gpu/command_buffer/service/mailbox_manager.h"
49 #include "gpu/command_buffer/service/memory_tracking.h" 50 #include "gpu/command_buffer/service/memory_tracking.h"
50 #include "gpu/command_buffer/service/program_manager.h" 51 #include "gpu/command_buffer/service/program_manager.h"
51 #include "gpu/command_buffer/service/query_manager.h" 52 #include "gpu/command_buffer/service/query_manager.h"
52 #include "gpu/command_buffer/service/renderbuffer_manager.h" 53 #include "gpu/command_buffer/service/renderbuffer_manager.h"
53 #include "gpu/command_buffer/service/shader_manager.h" 54 #include "gpu/command_buffer/service/shader_manager.h"
54 #include "gpu/command_buffer/service/shader_translator.h" 55 #include "gpu/command_buffer/service/shader_translator.h"
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 GLsizei viewport_max_height_; 1658 GLsizei viewport_max_height_;
1658 1659
1659 // Command buffer stats. 1660 // Command buffer stats.
1660 base::TimeDelta total_processing_commands_time_; 1661 base::TimeDelta total_processing_commands_time_;
1661 1662
1662 // States related to each manager. 1663 // States related to each manager.
1663 DecoderTextureState texture_state_; 1664 DecoderTextureState texture_state_;
1664 DecoderFramebufferState framebuffer_state_; 1665 DecoderFramebufferState framebuffer_state_;
1665 1666
1666 scoped_ptr<GPUTracer> gpu_tracer_; 1667 scoped_ptr<GPUTracer> gpu_tracer_;
1668 scoped_ptr<GPUStateTracer> gpu_state_tracer_;
1667 1669
1668 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; 1670 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_;
1669 1671
1670 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); 1672 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl);
1671 }; 1673 };
1672 1674
1673 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor( 1675 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor(
1674 const char* function_name, GLES2DecoderImpl* decoder) 1676 const char* function_name, GLES2DecoderImpl* decoder)
1675 : function_name_(function_name), 1677 : function_name_(function_name),
1676 decoder_(decoder) { 1678 decoder_(decoder) {
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2120 bool offscreen, 2122 bool offscreen,
2121 const gfx::Size& size, 2123 const gfx::Size& size,
2122 const DisallowedFeatures& disallowed_features, 2124 const DisallowedFeatures& disallowed_features,
2123 const std::vector<int32>& attribs) { 2125 const std::vector<int32>& attribs) {
2124 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); 2126 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize");
2125 DCHECK(context->IsCurrent(surface.get())); 2127 DCHECK(context->IsCurrent(surface.get()));
2126 DCHECK(!context_.get()); 2128 DCHECK(!context_.get());
2127 2129
2128 set_initialized(); 2130 set_initialized();
2129 gpu_tracer_ = GPUTracer::Create(); 2131 gpu_tracer_ = GPUTracer::Create();
2132 gpu_state_tracer_ = GPUStateTracer::Create(&state_);
2130 2133
2131 if (CommandLine::ForCurrentProcess()->HasSwitch( 2134 if (CommandLine::ForCurrentProcess()->HasSwitch(
2132 switches::kEnableGPUDebugging)) { 2135 switches::kEnableGPUDebugging)) {
2133 set_debug(true); 2136 set_debug(true);
2134 } 2137 }
2135 2138
2136 if (CommandLine::ForCurrentProcess()->HasSwitch( 2139 if (CommandLine::ForCurrentProcess()->HasSwitch(
2137 switches::kEnableGPUCommandLogging)) { 2140 switches::kEnableGPUCommandLogging)) {
2138 set_log_commands(true); 2141 set_log_commands(true);
2139 } 2142 }
(...skipping 4864 matching lines...) Expand 10 before | Expand all | Expand 10 after
7004 7007
7005 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( 7008 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM(
7006 uint32 immediate_data_size, const cmds::PostSubBufferCHROMIUM& c) { 7009 uint32 immediate_data_size, const cmds::PostSubBufferCHROMIUM& c) {
7007 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); 7010 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM");
7008 if (!surface_->HasExtension("GL_CHROMIUM_post_sub_buffer")) { 7011 if (!surface_->HasExtension("GL_CHROMIUM_post_sub_buffer")) {
7009 LOCAL_SET_GL_ERROR( 7012 LOCAL_SET_GL_ERROR(
7010 GL_INVALID_OPERATION, 7013 GL_INVALID_OPERATION,
7011 "glPostSubBufferCHROMIUM", "command not supported by surface"); 7014 "glPostSubBufferCHROMIUM", "command not supported by surface");
7012 return error::kNoError; 7015 return error::kNoError;
7013 } 7016 }
7017 bool is_tracing;
7018 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"),
7019 &is_tracing);
7020 if (is_tracing) {
7021 bool is_offscreen = !!offscreen_target_frame_buffer_.get();
7022 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId());
7023 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer(
7024 is_offscreen ? offscreen_size_ : surface_->GetSize());
7025 }
7014 if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) { 7026 if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) {
7015 return error::kNoError; 7027 return error::kNoError;
7016 } else { 7028 } else {
7017 LOG(ERROR) << "Context lost because PostSubBuffer failed."; 7029 LOG(ERROR) << "Context lost because PostSubBuffer failed.";
7018 return error::kLostContext; 7030 return error::kLostContext;
7019 } 7031 }
7020 } 7032 }
7021 7033
7022 error::Error GLES2DecoderImpl::GetAttribLocationHelper( 7034 error::Error GLES2DecoderImpl::GetAttribLocationHelper(
7023 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, 7035 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset,
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after
8596 int this_frame_number = frame_number_++; 8608 int this_frame_number = frame_number_++;
8597 // TRACE_EVENT for gpu tests: 8609 // TRACE_EVENT for gpu tests:
8598 TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency", 8610 TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency",
8599 TRACE_EVENT_SCOPE_THREAD, 8611 TRACE_EVENT_SCOPE_THREAD,
8600 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), 8612 "GLImpl", static_cast<int>(gfx::GetGLImplementation()),
8601 "width", (is_offscreen ? offscreen_size_.width() : 8613 "width", (is_offscreen ? offscreen_size_.width() :
8602 surface_->GetSize().width())); 8614 surface_->GetSize().width()));
8603 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", 8615 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers",
8604 "offscreen", is_offscreen, 8616 "offscreen", is_offscreen,
8605 "frame", this_frame_number); 8617 "frame", this_frame_number);
8618 bool is_tracing;
8619 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"),
8620 &is_tracing);
8621 if (is_tracing) {
8622 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId());
8623 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer(
8624 is_offscreen ? offscreen_size_ : surface_->GetSize());
8625 }
8626
8606 // If offscreen then don't actually SwapBuffers to the display. Just copy 8627 // If offscreen then don't actually SwapBuffers to the display. Just copy
8607 // the rendered frame to another frame buffer. 8628 // the rendered frame to another frame buffer.
8608 if (is_offscreen) { 8629 if (is_offscreen) {
8609 TRACE_EVENT2("gpu", "Offscreen", 8630 TRACE_EVENT2("gpu", "Offscreen",
8610 "width", offscreen_size_.width(), "height", offscreen_size_.height()); 8631 "width", offscreen_size_.width(), "height", offscreen_size_.height());
8611 if (offscreen_size_ != offscreen_saved_color_texture_->size()) { 8632 if (offscreen_size_ != offscreen_saved_color_texture_->size()) {
8612 // Workaround for NVIDIA driver bug on OS X; crbug.com/89557, 8633 // Workaround for NVIDIA driver bug on OS X; crbug.com/89557,
8613 // crbug.com/94163. TODO(kbr): figure out reproduction so Apple will 8634 // crbug.com/94163. TODO(kbr): figure out reproduction so Apple will
8614 // fix this. 8635 // fix this.
8615 if (workarounds().needs_offscreen_buffer_workaround) { 8636 if (workarounds().needs_offscreen_buffer_workaround) {
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after
10292 return error::kNoError; 10313 return error::kNoError;
10293 } 10314 }
10294 10315
10295 // Include the auto-generated part of this file. We split this because it means 10316 // Include the auto-generated part of this file. We split this because it means
10296 // we can easily edit the non-auto generated parts right here in this file 10317 // we can easily edit the non-auto generated parts right here in this file
10297 // instead of having to edit some template or the code generator. 10318 // instead of having to edit some template or the code generator.
10298 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10319 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10299 10320
10300 } // namespace gles2 10321 } // namespace gles2
10301 } // namespace gpu 10322 } // namespace gpu
OLDNEW
« no previous file with comments | « base/debug/trace_event.h ('k') | gpu/command_buffer/service/gpu_state_tracer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698