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

Side by Side Diff: gpu/command_buffer/service/gpu_tracer.h

Issue 1135943002: Pull in various gpu/command_buffer fixes from chromium (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « gpu/command_buffer/service/gpu_switches.cc ('k') | gpu/command_buffer/service/gpu_tracer.cc » ('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 // This file contains the GPUTrace class. 5 // This file contains the GPUTrace class.
6 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ 6 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_
7 #define GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ 7 #define GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_
8 8
9 #include <deque> 9 #include <deque>
10 #include <string> 10 #include <string>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 scoped_refptr<GPUTrace> trace_; 49 scoped_refptr<GPUTrace> trace_;
50 }; 50 };
51 51
52 // Traces GPU Commands. 52 // Traces GPU Commands.
53 class GPU_EXPORT GPUTracer 53 class GPU_EXPORT GPUTracer
54 : public base::SupportsWeakPtr<GPUTracer> { 54 : public base::SupportsWeakPtr<GPUTracer> {
55 public: 55 public:
56 explicit GPUTracer(gles2::GLES2Decoder* decoder); 56 explicit GPUTracer(gles2::GLES2Decoder* decoder);
57 virtual ~GPUTracer(); 57 virtual ~GPUTracer();
58 58
59 void Destroy(bool have_context);
60
59 // Scheduled processing in decoder begins. 61 // Scheduled processing in decoder begins.
60 bool BeginDecoding(); 62 bool BeginDecoding();
61 63
62 // Scheduled processing in decoder ends. 64 // Scheduled processing in decoder ends.
63 bool EndDecoding(); 65 bool EndDecoding();
64 66
65 // Begin a trace marker. 67 // Begin a trace marker.
66 bool Begin(const std::string& category, const std::string& name, 68 bool Begin(const std::string& category, const std::string& name,
67 GpuTracerSource source); 69 GpuTracerSource source);
68 70
69 // End the last started trace marker. 71 // End the last started trace marker.
70 bool End(GpuTracerSource source); 72 bool End(GpuTracerSource source);
71 73
72 virtual bool IsTracing(); 74 virtual bool IsTracing();
73 75
74 // Retrieve the name of the current open trace. 76 // Retrieve the name of the current open trace.
75 // Returns empty string if no current open trace. 77 // Returns empty string if no current open trace.
76 const std::string& CurrentCategory(GpuTracerSource source) const; 78 const std::string& CurrentCategory(GpuTracerSource source) const;
77 const std::string& CurrentName(GpuTracerSource source) const; 79 const std::string& CurrentName(GpuTracerSource source) const;
78 80
79 protected: 81 protected:
80 // Trace Processing. 82 // Trace Processing.
81 virtual scoped_refptr<Outputter> CreateOutputter(const std::string& name); 83 virtual scoped_refptr<Outputter> CreateOutputter(const std::string& name);
82 virtual void PostTask(); 84 virtual void PostTask();
83 85
84 void Process(); 86 void Process();
85 void ProcessTraces(); 87 void ProcessTraces();
88 void ClearFinishedTraces(bool have_context);
86 89
87 void IssueProcessTask(); 90 void IssueProcessTask();
88 91
89 scoped_refptr<gfx::GPUTimingClient> gpu_timing_client_; 92 scoped_refptr<gfx::GPUTimingClient> gpu_timing_client_;
90 scoped_refptr<Outputter> outputter_; 93 scoped_refptr<Outputter> outputter_;
91 std::vector<TraceMarker> markers_[NUM_TRACER_SOURCES]; 94 std::vector<TraceMarker> markers_[NUM_TRACER_SOURCES];
92 std::deque<scoped_refptr<GPUTrace> > traces_; 95 std::deque<scoped_refptr<GPUTrace> > finished_traces_;
93 96
94 const unsigned char* gpu_trace_srv_category; 97 const unsigned char* gpu_trace_srv_category;
95 const unsigned char* gpu_trace_dev_category; 98 const unsigned char* gpu_trace_dev_category;
96 gles2::GLES2Decoder* decoder_; 99 gles2::GLES2Decoder* decoder_;
97 100
98 bool gpu_executing_; 101 bool gpu_executing_;
99 bool process_posted_; 102 bool process_posted_;
100 103
101 private: 104 private:
102 DISALLOW_COPY_AND_ASSIGN(GPUTracer); 105 DISALLOW_COPY_AND_ASSIGN(GPUTracer);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 DISALLOW_COPY_AND_ASSIGN(TraceOutputter); 149 DISALLOW_COPY_AND_ASSIGN(TraceOutputter);
147 }; 150 };
148 151
149 class GPU_EXPORT GPUTrace 152 class GPU_EXPORT GPUTrace
150 : public base::RefCounted<GPUTrace> { 153 : public base::RefCounted<GPUTrace> {
151 public: 154 public:
152 GPUTrace(scoped_refptr<Outputter> outputter, 155 GPUTrace(scoped_refptr<Outputter> outputter,
153 gfx::GPUTimingClient* gpu_timing_client, 156 gfx::GPUTimingClient* gpu_timing_client,
154 const std::string& category, 157 const std::string& category,
155 const std::string& name, 158 const std::string& name,
156 const bool enabled); 159 const bool tracing_service,
160 const bool tracing_device);
157 161
158 void Start(bool trace_service); 162 void Destroy(bool have_context);
159 void End(bool tracing_service); 163
164 void Start();
165 void End();
160 bool IsAvailable(); 166 bool IsAvailable();
161 bool IsEnabled() { return enabled_; } 167 bool IsServiceTraceEnabled() const { return service_enabled_; }
168 bool IsDeviceTraceEnabled() const { return device_enabled_; }
162 void Process(); 169 void Process();
163 170
164 private: 171 private:
165 ~GPUTrace(); 172 ~GPUTrace();
166 173
167 void Output(); 174 void Output();
168 175
169 friend class base::RefCounted<GPUTrace>; 176 friend class base::RefCounted<GPUTrace>;
170 177
171 std::string category_; 178 std::string category_;
172 std::string name_; 179 std::string name_;
173 scoped_refptr<Outputter> outputter_; 180 scoped_refptr<Outputter> outputter_;
174 scoped_ptr<gfx::GPUTimer> gpu_timer_; 181 scoped_ptr<gfx::GPUTimer> gpu_timer_;
175 const bool enabled_ = false; 182 const bool service_enabled_ = false;
183 const bool device_enabled_ = false;
176 184
177 DISALLOW_COPY_AND_ASSIGN(GPUTrace); 185 DISALLOW_COPY_AND_ASSIGN(GPUTrace);
178 }; 186 };
179 187
180 class ScopedGPUTrace { 188 class ScopedGPUTrace {
181 public: 189 public:
182 ScopedGPUTrace(GPUTracer* gpu_tracer, 190 ScopedGPUTrace(GPUTracer* gpu_tracer,
183 GpuTracerSource source, 191 GpuTracerSource source,
184 const std::string& category, 192 const std::string& category,
185 const std::string& name) 193 const std::string& name)
186 : gpu_tracer_(gpu_tracer), source_(source) { 194 : gpu_tracer_(gpu_tracer), source_(source) {
187 gpu_tracer_->Begin(category, name, source_); 195 gpu_tracer_->Begin(category, name, source_);
188 } 196 }
189 197
190 ~ScopedGPUTrace() { gpu_tracer_->End(source_); } 198 ~ScopedGPUTrace() { gpu_tracer_->End(source_); }
191 199
192 private: 200 private:
193 GPUTracer* gpu_tracer_; 201 GPUTracer* gpu_tracer_;
194 GpuTracerSource source_; 202 GpuTracerSource source_;
195 }; 203 };
196 204
197 } // namespace gles2 205 } // namespace gles2
198 } // namespace gpu 206 } // namespace gpu
199 207
200 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ 208 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_switches.cc ('k') | gpu/command_buffer/service/gpu_tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698