[gtk] wayland: Add profiler marks around surface handling



commit dfea9bf0e8f30eab1532c74b55904a960f74435f
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 22 14:51:40 2020 -0500

    wayland: Add profiler marks around surface handling
    
    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 | 2 ++
 gdk/wayland/gdksurface-wayland.c   | 4 ++++
 2 files changed, 6 insertions(+)
---
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index c6b2116b26..ec647c7764 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -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);
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 7aa8125048..ac42a28145 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -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;


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