[gtk/wip/chergert/glproto] track number of texture uploads as metric
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto] track number of texture uploads as metric
- Date: Wed, 3 Feb 2021 20:49:15 +0000 (UTC)
commit 0135e67fe1a483941754a952783d0ed4604ec2ad
Author: Christian Hergert <chergert redhat com>
Date: Wed Feb 3 13:00:40 2021 -0800
track number of texture uploads as metric
gsk/next/gskglcommandqueue.c | 5 +++++
gsk/next/gskglcommandqueueprivate.h | 6 +++++-
gsk/next/gskglglyphlibrary.c | 2 ++
gsk/next/gskgliconlibrary.c | 2 ++
4 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index fd51a69be2..c1d7d16303 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -970,6 +970,7 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
gdk_profiler_set_int_counter (self->metrics.n_binds, n_binds);
gdk_profiler_set_int_counter (self->metrics.n_uniforms, n_uniforms);
gdk_profiler_set_int_counter (self->metrics.n_fbos, n_fbos);
+ gdk_profiler_set_int_counter (self->metrics.n_uploads, self->n_uploads);
#ifdef G_ENABLE_DEBUG
{
@@ -1040,6 +1041,7 @@ gsk_gl_command_queue_end_frame (GskGLCommandQueue *self)
self->batch_draws->len = 0;
self->batch_uniforms->len = 0;
self->batch_binds->len = 0;
+ self->n_uploads = 0;
self->tail_batch_index = -1;
self->in_frame = FALSE;
}
@@ -1200,6 +1202,8 @@ gsk_gl_command_queue_upload_texture (GskGLCommandQueue *self,
data_stride = cairo_image_surface_get_stride (surface);
}
+ self->n_uploads++;
+
bpp = gdk_memory_format_bytes_per_pixel (data_format);
/* Swtich to texture0 as 2D. We'll restore it later. */
@@ -1245,6 +1249,7 @@ gsk_gl_command_queue_set_profiler (GskGLCommandQueue *self,
self->metrics.n_binds = gdk_profiler_define_int_counter ("attachments", "Number of texture
attachments");
self->metrics.n_fbos = gdk_profiler_define_int_counter ("fbos", "Number of framebuffers attached");
self->metrics.n_uniforms = gdk_profiler_define_int_counter ("uniforms", "Number of uniforms changed");
+ self->metrics.n_uploads = gdk_profiler_define_int_counter ("uploads", "Number of texture uploads");
}
#endif
}
diff --git a/gsk/next/gskglcommandqueueprivate.h b/gsk/next/gskglcommandqueueprivate.h
index d43962fcbb..2c2e8904b9 100644
--- a/gsk/next/gskglcommandqueueprivate.h
+++ b/gsk/next/gskglcommandqueueprivate.h
@@ -243,7 +243,7 @@ struct _GskGLCommandQueue
*/
int tail_batch_index;
- /* Various GSK and GDK metrics */
+ /* Various GSK and GDK metric counter ids */
struct {
GQuark n_frames;
GQuark cpu_time;
@@ -251,8 +251,12 @@ struct _GskGLCommandQueue
guint n_binds;
guint n_fbos;
guint n_uniforms;
+ guint n_uploads;
} metrics;
+ /* Counter for uploads on the frame */
+ guint n_uploads;
+
/* If we're inside a begin/end_frame pair */
guint in_frame : 1;
diff --git a/gsk/next/gskglglyphlibrary.c b/gsk/next/gskglglyphlibrary.c
index 296385a8ba..fffc83452f 100644
--- a/gsk/next/gskglglyphlibrary.c
+++ b/gsk/next/gskglglyphlibrary.c
@@ -269,6 +269,8 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
gdk_gl_context_pop_debug_group (gdk_gl_context_get_current ());
+ GSK_GL_TEXTURE_LIBRARY (self)->driver->command_queue->n_uploads++;
+
if (gdk_profiler_is_running ())
{
char message[64];
diff --git a/gsk/next/gskgliconlibrary.c b/gsk/next/gskgliconlibrary.c
index 7d536b3aad..d0d9f150ed 100644
--- a/gsk/next/gskgliconlibrary.c
+++ b/gsk/next/gskgliconlibrary.c
@@ -207,6 +207,8 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
cairo_surface_destroy (surface);
g_free (free_data);
+ GSK_GL_TEXTURE_LIBRARY (self)->driver->command_queue->n_uploads++;
+
if (gdk_profiler_is_running ())
{
char message[64];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]