wayland: Add profiler marks around surface handling
authorMatthias Clasen <mclasen@redhat.com>
Wed, 22 Jan 2020 19:51:40 +0000 (14:51 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 22 Jan 2020 20:12:03 +0000 (15:12 -0500)
Add marks for when we do commits, swap buffer or
receive frame events. These are the low-level start
and end points of the frame cycle, and it is useful
to see them in the profiler.

gdk/wayland/gdkglcontext-wayland.c
gdk/wayland/gdksurface-wayland.c

index c6b2116b26bfa97d932170785df95c1a0ca96f60..ec647c77643c55f6dad6b1b1665203521134eb79 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "gdkinternals.h"
 #include "gdksurfaceprivate.h"
+#include "gdkprofilerprivate.h"
 
 #include "gdkintl.h"
 
@@ -238,6 +239,7 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
   gdk_wayland_surface_sync (surface);
   gdk_wayland_surface_request_frame (surface);
 
+  gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "swap buffers");
   if (display_wayland->have_egl_swap_buffers_with_damage)
     {
       int i, j, n_rects = cairo_region_num_rectangles (painted);
index 7aa8125048928c3e7f8f7ced567d21ec5ded2f20..ac42a281453469e3c9b369b9f9e951c3619f5936 100644 (file)
@@ -357,6 +357,7 @@ frame_callback (void               *data,
   GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
   GdkFrameTimings *timings;
 
+  gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "frame event");
   GDK_DISPLAY_NOTE (GDK_DISPLAY (display_wayland), EVENTS, g_message ("frame %p", surface));
 
   wl_callback_destroy (callback);
@@ -477,6 +478,7 @@ on_frame_clock_after_paint (GdkFrameClock *clock,
        * before we need to stage any changes, then we can take it back and
        * use it again.
        */
+      gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "surface commit");
       wl_surface_commit (impl->display_server.wl_surface);
 
       impl->pending_commit = FALSE;
@@ -1508,6 +1510,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
   if (impl->hint == GDK_SURFACE_TYPE_HINT_DIALOG)
     _gdk_wayland_screen_add_orphan_dialog (surface);
 
+  gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "surface commit");
   wl_surface_commit (impl->display_server.wl_surface);
 }
 
@@ -2302,6 +2305,7 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface     *surface,
         }
     }
 
+  gdk_profiler_add_mark (g_get_monotonic_time () * 1000, 0, "wayland", "surface commit");
   wl_surface_commit (impl->display_server.wl_surface);
 
   impl->popup_parent = parent;