| OLD | NEW |
| 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 Loading... |
| 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 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 GLsizei viewport_max_height_; | 1659 GLsizei viewport_max_height_; |
| 1659 | 1660 |
| 1660 // Command buffer stats. | 1661 // Command buffer stats. |
| 1661 base::TimeDelta total_processing_commands_time_; | 1662 base::TimeDelta total_processing_commands_time_; |
| 1662 | 1663 |
| 1663 // States related to each manager. | 1664 // States related to each manager. |
| 1664 DecoderTextureState texture_state_; | 1665 DecoderTextureState texture_state_; |
| 1665 DecoderFramebufferState framebuffer_state_; | 1666 DecoderFramebufferState framebuffer_state_; |
| 1666 | 1667 |
| 1667 scoped_ptr<GPUTracer> gpu_tracer_; | 1668 scoped_ptr<GPUTracer> gpu_tracer_; |
| 1669 scoped_ptr<GPUStateTracer> gpu_state_tracer_; |
| 1668 | 1670 |
| 1669 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; | 1671 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; |
| 1670 | 1672 |
| 1671 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); | 1673 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); |
| 1672 }; | 1674 }; |
| 1673 | 1675 |
| 1674 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor( | 1676 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor( |
| 1675 const char* function_name, GLES2DecoderImpl* decoder) | 1677 const char* function_name, GLES2DecoderImpl* decoder) |
| 1676 : function_name_(function_name), | 1678 : function_name_(function_name), |
| 1677 decoder_(decoder) { | 1679 decoder_(decoder) { |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 const gfx::Size& size, | 2124 const gfx::Size& size, |
| 2123 const DisallowedFeatures& disallowed_features, | 2125 const DisallowedFeatures& disallowed_features, |
| 2124 const char* allowed_extensions, | 2126 const char* allowed_extensions, |
| 2125 const std::vector<int32>& attribs) { | 2127 const std::vector<int32>& attribs) { |
| 2126 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); | 2128 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); |
| 2127 DCHECK(context->IsCurrent(surface.get())); | 2129 DCHECK(context->IsCurrent(surface.get())); |
| 2128 DCHECK(!context_.get()); | 2130 DCHECK(!context_.get()); |
| 2129 | 2131 |
| 2130 set_initialized(); | 2132 set_initialized(); |
| 2131 gpu_tracer_ = GPUTracer::Create(); | 2133 gpu_tracer_ = GPUTracer::Create(); |
| 2134 gpu_state_tracer_ = GPUStateTracer::Create(&state_); |
| 2132 | 2135 |
| 2133 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2136 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 2134 switches::kEnableGPUDebugging)) { | 2137 switches::kEnableGPUDebugging)) { |
| 2135 set_debug(true); | 2138 set_debug(true); |
| 2136 } | 2139 } |
| 2137 | 2140 |
| 2138 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2141 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 2139 switches::kEnableGPUCommandLogging)) { | 2142 switches::kEnableGPUCommandLogging)) { |
| 2140 set_log_commands(true); | 2143 set_log_commands(true); |
| 2141 } | 2144 } |
| (...skipping 6426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8568 int this_frame_number = frame_number_++; | 8571 int this_frame_number = frame_number_++; |
| 8569 // TRACE_EVENT for gpu tests: | 8572 // TRACE_EVENT for gpu tests: |
| 8570 TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency", | 8573 TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency", |
| 8571 TRACE_EVENT_SCOPE_THREAD, | 8574 TRACE_EVENT_SCOPE_THREAD, |
| 8572 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), | 8575 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), |
| 8573 "width", (is_offscreen ? offscreen_size_.width() : | 8576 "width", (is_offscreen ? offscreen_size_.width() : |
| 8574 surface_->GetSize().width())); | 8577 surface_->GetSize().width())); |
| 8575 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", | 8578 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", |
| 8576 "offscreen", is_offscreen, | 8579 "offscreen", is_offscreen, |
| 8577 "frame", this_frame_number); | 8580 "frame", this_frame_number); |
| 8581 gpu_state_tracer_->TakeSnapshot(); |
| 8582 |
| 8578 // If offscreen then don't actually SwapBuffers to the display. Just copy | 8583 // If offscreen then don't actually SwapBuffers to the display. Just copy |
| 8579 // the rendered frame to another frame buffer. | 8584 // the rendered frame to another frame buffer. |
| 8580 if (is_offscreen) { | 8585 if (is_offscreen) { |
| 8581 TRACE_EVENT2("gpu", "Offscreen", | 8586 TRACE_EVENT2("gpu", "Offscreen", |
| 8582 "width", offscreen_size_.width(), "height", offscreen_size_.height()); | 8587 "width", offscreen_size_.width(), "height", offscreen_size_.height()); |
| 8583 if (offscreen_size_ != offscreen_saved_color_texture_->size()) { | 8588 if (offscreen_size_ != offscreen_saved_color_texture_->size()) { |
| 8584 // Workaround for NVIDIA driver bug on OS X; crbug.com/89557, | 8589 // Workaround for NVIDIA driver bug on OS X; crbug.com/89557, |
| 8585 // crbug.com/94163. TODO(kbr): figure out reproduction so Apple will | 8590 // crbug.com/94163. TODO(kbr): figure out reproduction so Apple will |
| 8586 // fix this. | 8591 // fix this. |
| 8587 if (workarounds().needs_offscreen_buffer_workaround) { | 8592 if (workarounds().needs_offscreen_buffer_workaround) { |
| (...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10264 return error::kNoError; | 10269 return error::kNoError; |
| 10265 } | 10270 } |
| 10266 | 10271 |
| 10267 // Include the auto-generated part of this file. We split this because it means | 10272 // Include the auto-generated part of this file. We split this because it means |
| 10268 // we can easily edit the non-auto generated parts right here in this file | 10273 // we can easily edit the non-auto generated parts right here in this file |
| 10269 // instead of having to edit some template or the code generator. | 10274 // instead of having to edit some template or the code generator. |
| 10270 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10275 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10271 | 10276 |
| 10272 } // namespace gles2 | 10277 } // namespace gles2 |
| 10273 } // namespace gpu | 10278 } // namespace gpu |
| OLD | NEW |