From 02d7fca716fbeb880debd491b9c82dc4055266dc Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 30 Jan 2021 21:14:46 +0300 Subject: [PATCH] clutter/frame-info: Add VSYNC flag Part-of: --- 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 36aafd0a5..9f25e5472 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 5a1093430..5e81899b0 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),