diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-09-25 21:02:21 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-09-25 21:02:21 -0400 |
commit | ae2c645a2a2557faf6e9d34f8b8fb70237b88c77 (patch) | |
tree | eb8256652f4bf7c626bd98153a03d612c40429a4 /gsk | |
parent | cfbd6b4b994f58997c0ee1b44ff9325648ecf660 (diff) | |
download | gtk+-ae2c645a2a2557faf6e9d34f8b8fb70237b88c77.tar.gz |
gsk: report fallback pixels as a profile counter
This makes the value show up in the inspector without
any extra work. We report the number per-frame, since
that makes the most sense.
Diffstat (limited to 'gsk')
-rw-r--r-- | gsk/gskvulkanrenderer.c | 4 | ||||
-rw-r--r-- | gsk/gskvulkanrenderpass.c | 32 |
2 files changed, 28 insertions, 8 deletions
diff --git a/gsk/gskvulkanrenderer.c b/gsk/gskvulkanrenderer.c index 15ac1344f1..6666880e7f 100644 --- a/gsk/gskvulkanrenderer.c +++ b/gsk/gskvulkanrenderer.c @@ -26,6 +26,7 @@ struct _GskVulkanTextureData { #ifdef G_ENABLE_DEBUG typedef struct { GQuark frames; + GQuark fallback_pixels; } ProfileCounters; typedef struct { @@ -199,6 +200,7 @@ gsk_vulkan_renderer_render_texture (GskRenderer *renderer, #ifdef G_ENABLE_DEBUG profiler = gsk_renderer_get_profiler (renderer); + gsk_profiler_counter_set (profiler, self->profile_counters.fallback_pixels, 0); gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time); #endif @@ -304,6 +306,8 @@ gsk_vulkan_renderer_init (GskVulkanRenderer *self) #ifdef G_ENABLE_DEBUG self->profile_counters.frames = gsk_profiler_add_counter (profiler, "frames", "Frames", FALSE); + self->profile_counters.fallback_pixels = gsk_profiler_add_counter (profiler, "fallback-pixels", "Fallback pixels", TRUE); + self->profile_timers.cpu_time = gsk_profiler_add_timer (profiler, "cpu-time", "CPU time", FALSE, TRUE); #endif } diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c index 2fd633b5c9..3cb7e6603d 100644 --- a/gsk/gskvulkanrenderpass.c +++ b/gsk/gskvulkanrenderpass.c @@ -3,8 +3,10 @@ #include "gskvulkanrenderpassprivate.h" #include "gskdebugprivate.h" +#include "gskprofilerprivate.h" #include "gskrendernodeprivate.h" #include "gskrenderer.h" +#include "gskrendererprivate.h" #include "gskroundedrectprivate.h" #include "gskvulkanblendmodepipelineprivate.h" #include "gskvulkanblendpipelineprivate.h" @@ -105,7 +107,7 @@ struct _GskVulkanRenderPass GArray *render_ops; - gsize fallback_pixels; + GQuark fallback_pixels; }; GskVulkanRenderPass * @@ -116,6 +118,9 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context) self = g_slice_new0 (GskVulkanRenderPass); self->vulkan = g_object_ref (context); self->render_ops = g_array_new (FALSE, FALSE, sizeof (GskVulkanOp)); +#ifdef G_ENABLE_DEBUG + self->fallback_pixels = g_quark_from_static_string ("fallback-pixels"); +#endif return self; } @@ -123,9 +128,6 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context) void gsk_vulkan_render_pass_free (GskVulkanRenderPass *self) { - GSK_NOTE (FALLBACK, - g_print ("Uploaded %ld fallback pixels\n", self->fallback_pixels)); - g_array_unref (self->render_ops); g_object_unref (self->vulkan); @@ -571,8 +573,15 @@ gsk_vulkan_render_pass_get_node_as_texture (GskVulkanRenderPass *self, GSK_NOTE (FALLBACK, g_print ("Node as texture not implemented. Using %gx%g fallback surface\n", ceil (bounds->size.width), - ceil (bounds->size.height)); - self->fallback_pixels += ceil (bounds->size.width) * ceil (bounds->size.height)); + ceil (bounds->size.height))); +#ifdef G_ENABLE_DEBUG + { + GskProfiler *profiler = gsk_renderer_get_profiler (gsk_vulkan_render_get_renderer (render)); + gsk_profiler_counter_add (profiler, + self->fallback_pixels, + ceil (bounds->size.width) * ceil (bounds->size.height)); + } +#endif /* XXX: We could intersect bounds with clip bounds here */ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, @@ -617,8 +626,15 @@ gsk_vulkan_render_pass_upload_fallback (GskVulkanRenderPass *self, (op->type == GSK_VULKAN_OP_FALLBACK_ROUNDED_CLIP ? "fallback-rounded-clip" : "fallback"), node->name ? node->name : node->node_class->type_name, node, ceil (node->bounds.size.width), - ceil (node->bounds.size.height)); - self->fallback_pixels += ceil (node->bounds.size.width) * ceil (node->bounds.size.height)); + ceil (node->bounds.size.height))); +#ifdef G_ENABLE_DEBUG + { + GskProfiler *profiler = gsk_renderer_get_profiler (gsk_vulkan_render_get_renderer (render)); + gsk_profiler_counter_add (profiler, + self->fallback_pixels, + ceil (node->bounds.size.width) * ceil (node->bounds.size.height)); + } +#endif /* XXX: We could intersect bounds with clip bounds here */ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, |