| 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> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <stack> | 12 #include <stack> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/at_exit.h" | 16 #include "base/at_exit.h" |
| 17 #include "base/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/debug/trace_event.h" | 19 #include "base/debug/trace_event.h" |
| 20 #include "base/debug/trace_event_synthetic_delay.h" |
| 20 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
| 23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 24 #define GLES2_GPU_SERVICE 1 | 25 #define GLES2_GPU_SERVICE 1 |
| 25 #include "gpu/command_buffer/common/debug_marker_manager.h" | 26 #include "gpu/command_buffer/common/debug_marker_manager.h" |
| 26 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 27 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 27 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 28 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 28 #include "gpu/command_buffer/common/id_allocator.h" | 29 #include "gpu/command_buffer/common/id_allocator.h" |
| 29 #include "gpu/command_buffer/common/mailbox.h" | 30 #include "gpu/command_buffer/common/mailbox.h" |
| (...skipping 8907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8937 int this_frame_number = frame_number_++; | 8938 int this_frame_number = frame_number_++; |
| 8938 // TRACE_EVENT for gpu tests: | 8939 // TRACE_EVENT for gpu tests: |
| 8939 TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency", | 8940 TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency", |
| 8940 TRACE_EVENT_SCOPE_THREAD, | 8941 TRACE_EVENT_SCOPE_THREAD, |
| 8941 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), | 8942 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), |
| 8942 "width", (is_offscreen ? offscreen_size_.width() : | 8943 "width", (is_offscreen ? offscreen_size_.width() : |
| 8943 surface_->GetSize().width())); | 8944 surface_->GetSize().width())); |
| 8944 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", | 8945 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", |
| 8945 "offscreen", is_offscreen, | 8946 "offscreen", is_offscreen, |
| 8946 "frame", this_frame_number); | 8947 "frame", this_frame_number); |
| 8948 { |
| 8949 TRACE_EVENT_SYNTHETIC_DELAY("gpu.SwapBuffers"); |
| 8950 } |
| 8951 |
| 8947 bool is_tracing; | 8952 bool is_tracing; |
| 8948 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), | 8953 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), |
| 8949 &is_tracing); | 8954 &is_tracing); |
| 8950 if (is_tracing) { | 8955 if (is_tracing) { |
| 8951 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); | 8956 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); |
| 8952 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( | 8957 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( |
| 8953 is_offscreen ? offscreen_size_ : surface_->GetSize()); | 8958 is_offscreen ? offscreen_size_ : surface_->GetSize()); |
| 8954 } | 8959 } |
| 8955 | 8960 |
| 8956 // If offscreen then don't actually SwapBuffers to the display. Just copy | 8961 // If offscreen then don't actually SwapBuffers to the display. Just copy |
| (...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10637 DoDidUseTexImageIfNeeded(texture, texture->target()); | 10642 DoDidUseTexImageIfNeeded(texture, texture->target()); |
| 10638 } | 10643 } |
| 10639 | 10644 |
| 10640 // Include the auto-generated part of this file. We split this because it means | 10645 // Include the auto-generated part of this file. We split this because it means |
| 10641 // we can easily edit the non-auto generated parts right here in this file | 10646 // we can easily edit the non-auto generated parts right here in this file |
| 10642 // instead of having to edit some template or the code generator. | 10647 // instead of having to edit some template or the code generator. |
| 10643 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10648 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10644 | 10649 |
| 10645 } // namespace gles2 | 10650 } // namespace gles2 |
| 10646 } // namespace gpu | 10651 } // namespace gpu |
| OLD | NEW |