[gtk/wip/chergert/glproto: 348/493] add marks for texture uploads




commit 920844ac14a278a20a3f6152606cd1a5d5abf521
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 2 13:48:51 2021 -0800

    add marks for texture uploads

 gsk/next/gskglcommandqueue.c | 8 ++++++++
 gsk/next/gskglglyphlibrary.c | 9 +++++++++
 gsk/next/gskgliconlibrary.c  | 9 +++++++++
 3 files changed, 26 insertions(+)
---
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index 3b5c4ffffe..b9e69e4356 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -1308,6 +1308,7 @@ gsk_gl_command_queue_upload_texture (GskGLCommandQueue *self,
                                      int                min_filter,
                                      int                mag_filter)
 {
+  G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
   cairo_surface_t *surface = NULL;
   GdkMemoryFormat data_format;
   const guchar *data;
@@ -1370,6 +1371,13 @@ gsk_gl_command_queue_upload_texture (GskGLCommandQueue *self,
 
   g_clear_pointer (&surface, cairo_surface_destroy);
 
+  if (gdk_profiler_is_running ())
+    {
+      char message[64];
+      g_snprintf (message, sizeof message, "Size %dx%d", width, height);
+      gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload Texture", message);
+    }
+
   return texture_id;
 }
 
diff --git a/gsk/next/gskglglyphlibrary.c b/gsk/next/gskglglyphlibrary.c
index ef0ded5690..296385a8ba 100644
--- a/gsk/next/gskglglyphlibrary.c
+++ b/gsk/next/gskglglyphlibrary.c
@@ -22,6 +22,7 @@
 
 #include <gdk/gdkglcontextprivate.h>
 #include <gdk/gdkmemorytextureprivate.h>
+#include <gdk/gdkprofilerprivate.h>
 
 #include "gskglcommandqueueprivate.h"
 #include "gskgldriverprivate.h"
@@ -185,6 +186,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary     *self,
                                    int                    height,
                                    double                 device_scale)
 {
+  G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
   cairo_scaled_font_t *scaled_font;
   GskGLTextureAtlas *atlas;
   cairo_surface_t *surface;
@@ -266,6 +268,13 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary     *self,
   g_free (free_data);
 
   gdk_gl_context_pop_debug_group (gdk_gl_context_get_current ());
+
+  if (gdk_profiler_is_running ())
+    {
+      char message[64];
+      g_snprintf (message, sizeof message, "Size %dx%d", width, height);
+      gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload Glyph", message);
+    }
 }
 
 gboolean
diff --git a/gsk/next/gskgliconlibrary.c b/gsk/next/gskgliconlibrary.c
index 6fd27a0b1e..7d536b3aad 100644
--- a/gsk/next/gskgliconlibrary.c
+++ b/gsk/next/gskgliconlibrary.c
@@ -22,6 +22,7 @@
 
 #include <gdk/gdkglcontextprivate.h>
 #include <gdk/gdkmemorytextureprivate.h>
+#include <gdk/gdkprofilerprivate.h>
 #include <gdk/gdktextureprivate.h>
 
 #include "gskglcommandqueueprivate.h"
@@ -73,6 +74,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
                          GdkTexture           *key,
                          const GskGLIconData **out_value)
 {
+  G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
   cairo_surface_t *surface;
   GskGLIconData *icon_data;
   GdkGLContext *context;
@@ -204,4 +206,11 @@ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
 
   cairo_surface_destroy (surface);
   g_free (free_data);
+
+  if (gdk_profiler_is_running ())
+    {
+      char message[64];
+      g_snprintf (message, sizeof message, "Size %dx%d", width, height);
+      gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload Icon", message);
+    }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]