[gtk/gtk-3-24: 1/2] Fix profiling output when rendering with OpenGL



commit e417fa1b7aa08b4dec686460cc4c25a06578f96a
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Aug 23 23:18:32 2019 +0300

    Fix profiling output when rendering with OpenGL
    
    I was not getting any gtk+ profile markers output from the frame clock
    when I was profiling an OpenGL app (gnome-hexgl). I debugged this and
    it turns out that the profiling depends on getting the _NET_WM_FRAME_TIMINGS
    event from the compositor, and once we switched to OpenGL rendering
    this never appeared.
    
    It turns out the reason it didn't is that the compositor only does
    so if the client increases the counter tied to the window, and the
    x11 gdk code has this optimization where if we do a draw pass
    but nothing is actually drawn we don't update the counter.
    
    Unfortunately the detection of whether something was draw or not
    is based on some cairo surface hack that breaks when we render with
    OpenGL instead. The fix is to just always update the counter if
    we're drawing with OpenGL.

 gdk/x11/gdkwindow-x11.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 4de412315d..1fe7b90cd0 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -270,6 +270,16 @@ hook_surface_changed (GdkWindow *window)
 {
   GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
 
+  /* The hooking we do below doesn't work if we're rendering with
+   * OpenGL (the cairo surface is not touched) so just always
+   * do the frame.
+   */
+  if (window->current_paint.use_gl)
+    {
+      window_pre_damage (window);
+      return;
+    }
+
   if (impl->cairo_surface)
     {
       cairo_surface_set_mime_data (impl->cairo_surface,


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