[mutter] clutter/frame-info: Add VSYNC flag



commit 02d7fca716fbeb880debd491b9c82dc4055266dc
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Sat Jan 30 21:14:46 2021 +0300

    clutter/frame-info: Add VSYNC flag
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>

 clutter/clutter/clutter-stage.h           | 8 ++++++++
 clutter/clutter/cogl/clutter-stage-cogl.c | 3 +++
 2 files changed, 11 insertions(+)
---
diff --git a/clutter/clutter/clutter-stage.h b/clutter/clutter/clutter-stage.h
index 36aafd0a58..9f25e54726 100644
--- a/clutter/clutter/clutter-stage.h
+++ b/clutter/clutter/clutter-stage.h
@@ -127,6 +127,14 @@ typedef enum
    * fullscreen surface and a surface on a hardware overlay.
    */
   CLUTTER_FRAME_INFO_FLAG_ZERO_COPY = 1 << 1,
+  /*
+   * The presentation was synchronized to the "vertical retrace" by the display
+   * hardware such that tearing does not happen. Relying on user space
+   * scheduling is not acceptable for this flag. If presentation is done by a
+   * copy to the active frontbuffer, then it must guarantee that tearing cannot
+   * happen.
+   */
+  CLUTTER_FRAME_INFO_FLAG_VSYNC = 1 << 2,
 } ClutterFrameInfoFlag;
 
 /**
diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c
index 5a10934307..5e81899b06 100644
--- a/clutter/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/clutter/cogl/clutter-stage-cogl.c
@@ -835,6 +835,9 @@ frame_cb (CoglOnscreen  *onscreen,
       if (cogl_frame_info_is_zero_copy (frame_info))
         flags |= CLUTTER_FRAME_INFO_FLAG_ZERO_COPY;
 
+      if (cogl_frame_info_is_vsync (frame_info))
+        flags |= CLUTTER_FRAME_INFO_FLAG_VSYNC;
+
       clutter_frame_info = (ClutterFrameInfo) {
         .frame_counter = cogl_frame_info_get_global_frame_counter (frame_info),
         .refresh_rate = cogl_frame_info_get_refresh_rate (frame_info),


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