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 8821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8851 int this_frame_number = frame_number_++; | 8852 int this_frame_number = frame_number_++; |
8852 // TRACE_EVENT for gpu tests: | 8853 // TRACE_EVENT for gpu tests: |
8853 TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency", | 8854 TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency", |
8854 TRACE_EVENT_SCOPE_THREAD, | 8855 TRACE_EVENT_SCOPE_THREAD, |
8855 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), | 8856 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), |
8856 "width", (is_offscreen ? offscreen_size_.width() : | 8857 "width", (is_offscreen ? offscreen_size_.width() : |
8857 surface_->GetSize().width())); | 8858 surface_->GetSize().width())); |
8858 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", | 8859 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", |
8859 "offscreen", is_offscreen, | 8860 "offscreen", is_offscreen, |
8860 "frame", this_frame_number); | 8861 "frame", this_frame_number); |
| 8862 { |
| 8863 TRACE_EVENT_SYNTHETIC_DELAY("gpu.SwapBuffers"); |
| 8864 } |
| 8865 |
8861 bool is_tracing; | 8866 bool is_tracing; |
8862 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), | 8867 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), |
8863 &is_tracing); | 8868 &is_tracing); |
8864 if (is_tracing) { | 8869 if (is_tracing) { |
8865 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); | 8870 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); |
8866 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( | 8871 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( |
8867 is_offscreen ? offscreen_size_ : surface_->GetSize()); | 8872 is_offscreen ? offscreen_size_ : surface_->GetSize()); |
8868 } | 8873 } |
8869 | 8874 |
8870 // If offscreen then don't actually SwapBuffers to the display. Just copy | 8875 // If offscreen then don't actually SwapBuffers to the display. Just copy |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10543 DoDidUseTexImageIfNeeded(texture, texture->target()); | 10548 DoDidUseTexImageIfNeeded(texture, texture->target()); |
10544 } | 10549 } |
10545 | 10550 |
10546 // Include the auto-generated part of this file. We split this because it means | 10551 // Include the auto-generated part of this file. We split this because it means |
10547 // we can easily edit the non-auto generated parts right here in this file | 10552 // we can easily edit the non-auto generated parts right here in this file |
10548 // instead of having to edit some template or the code generator. | 10553 // instead of having to edit some template or the code generator. |
10549 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10554 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10550 | 10555 |
10551 } // namespace gles2 | 10556 } // namespace gles2 |
10552 } // namespace gpu | 10557 } // namespace gpu |
OLD | NEW |