diff mbox series

[2/3] ui/gtk: calling gd_gl_frame_counter at every draw/swap

Message ID 20210726222551.28795-2-dongwon.kim@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] ui/gtk: adds status bar for expressing ups and fps | expand

Commit Message

Kim, Dongwon July 26, 2021, 10:25 p.m. UTC
For FPS calculation, gd_gl_frame_counter is called at every
draw(gtk-gl-area) or swap(gtk-egl) activity.

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
 ui/gtk-egl.c     | 2 ++
 ui/gtk-gl-area.c | 1 +
 2 files changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 2a2e6d3a17..ac56f5b9f4 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -89,6 +89,7 @@  void gd_egl_draw(VirtualConsole *vc)
 
         eglSwapBuffers(qemu_egl_display, vc->gfx.esurface);
 
+        gd_gl_count_frame(&vc->gfx.dcl, false);
         vc->gfx.scale_x = (double)ww / surface_width(vc->gfx.ds);
         vc->gfx.scale_y = (double)wh / surface_height(vc->gfx.ds);
     }
@@ -290,6 +291,7 @@  void gd_egl_scanout_flush(DisplayChangeListener *dcl,
     }
 
     eglSwapBuffers(qemu_egl_display, vc->gfx.esurface);
+    gd_gl_count_frame(&vc->gfx.dcl, false);
 }
 
 void gtk_egl_init(DisplayGLMode mode)
diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index dd5783fec7..a18b6ff425 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -72,6 +72,7 @@  void gd_gl_area_draw(VirtualConsole *vc)
     }
 
     glFlush();
+    gd_gl_count_frame(&vc->gfx.dcl, false);
     graphic_hw_gl_flushed(vc->gfx.dcl.con);
 }