| Flutter Impeller |

gpu_tracer_gles.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_GPU_TRACER_GLES_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_GPU_TRACER_GLES_H_
7
8 #include <cstdint>
9 #include <deque>
10 #include <thread>
11
12 #include "impeller/renderer/backend/gles/proc_table_gles.h"
13
14 namespace impeller {
15
16 /// @brief Trace GPU execution times using GL_EXT_disjoint_timer_query on GLES.
17 ///
18 /// Note: there are a substantial number of GPUs where usage of the this API is
19 /// known to cause crashes. As a result, this functionality is disabled by
20 /// default and can only be enabled in debug/profile mode via a specific opt-in
21 /// flag that is exposed in the Android manifest.
22 ///
23 /// To enable, add the following metadata to the application's Android manifest:
24 /// <meta-data
25 /// android:name="io.flutter.embedding.android.EnableOpenGLGPUTracing"
26 /// android:value="false" />
27 class GPUTracerGLES {
28 public:
29 GPUTracerGLES(const ProcTableGLES& gl, bool enable_tracing);
30
31 ~GPUTracerGLES() = default;
32
33 /// @brief Record the thread id of the raster thread.
34 void RecordRasterThread();
35
36 /// @brief Record the start of a frame workload, if one hasn't already been
37 /// started.
38 void MarkFrameStart(const ProcTableGLES& gl);
39
40 /// @brief Record the end of a frame workload.
41 void MarkFrameEnd(const ProcTableGLES& gl);
42
43 private:
44 void ProcessQueries(const ProcTableGLES& gl);
45
46 std::deque<uint32_t> pending_traces_;
47 std::optional<uint32_t> active_frame_ = std::nullopt;
48 std::thread::id raster_thread_;
49
50 bool enabled_ = false;
51 };
52
53 } // namespace impeller
54
55 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_GPU_TRACER_GLES_H_
impeller::GPUTracerGLES::GPUTracerGLES
GPUTracerGLES(const ProcTableGLES &gl, bool enable_tracing)
Definition: gpu_tracer_gles.cc:11
impeller::GPUTracerGLES::MarkFrameEnd
void MarkFrameEnd(const ProcTableGLES &gl)
Record the end of a frame workload.
Definition: gpu_tracer_gles.cc:75
impeller::GPUTracerGLES::MarkFrameStart
void MarkFrameStart(const ProcTableGLES &gl)
Record the start of a frame workload, if one hasn't already been started.
Definition: gpu_tracer_gles.cc:19
impeller::GPUTracerGLES::~GPUTracerGLES
~GPUTracerGLES()=default
impeller::GPUTracerGLES::RecordRasterThread
void RecordRasterThread()
Record the thread id of the raster thread.
Definition: gpu_tracer_gles.cc:39
impeller::ProcTableGLES
Definition: proc_table_gles.h:217
proc_table_gles.h
impeller::GPUTracerGLES
Trace GPU execution times using GL_EXT_disjoint_timer_query on GLES.
Definition: gpu_tracer_gles.h:27
impeller
Definition: aiks_context.cc:10