summaryrefslogtreecommitdiff
path: root/cogl
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2021-01-30 21:14:27 +0300
committerMarge Bot <marge-bot@gnome.org>2021-03-08 09:48:11 +0000
commit47183a94eb36b196212401e9e5473a8b3915ca2b (patch)
tree6b9e84cb739e3c837e90ab7ba71d35fdc2071a03 /cogl
parent93ef83a96c054868d98fa49af8990b56f221dccf (diff)
downloadmutter-47183a94eb36b196212401e9e5473a8b3915ca2b.tar.gz
cogl/frame-info: Add VSYNC flag
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
Diffstat (limited to 'cogl')
-rw-r--r--cogl/cogl/cogl-frame-info-private.h8
-rw-r--r--cogl/cogl/cogl-frame-info.c6
-rw-r--r--cogl/cogl/cogl-frame-info.h3
-rw-r--r--cogl/cogl/winsys/cogl-onscreen-glx.c2
4 files changed, 19 insertions, 0 deletions
diff --git a/cogl/cogl/cogl-frame-info-private.h b/cogl/cogl/cogl-frame-info-private.h
index 675b6da45..81904f7a4 100644
--- a/cogl/cogl/cogl-frame-info-private.h
+++ b/cogl/cogl/cogl-frame-info-private.h
@@ -48,6 +48,14 @@ typedef enum _CoglFrameInfoFlag
* fullscreen surface and a surface on a hardware overlay.
*/
COGL_FRAME_INFO_FLAG_ZERO_COPY = 1 << 2,
+ /*
+ * 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.
+ */
+ COGL_FRAME_INFO_FLAG_VSYNC = 1 << 3,
} CoglFrameInfoFlag;
struct _CoglFrameInfo
diff --git a/cogl/cogl/cogl-frame-info.c b/cogl/cogl/cogl-frame-info.c
index 24a100bfa..a31d91689 100644
--- a/cogl/cogl/cogl-frame-info.c
+++ b/cogl/cogl/cogl-frame-info.c
@@ -101,6 +101,12 @@ cogl_frame_info_is_zero_copy (CoglFrameInfo *info)
return !!(info->flags & COGL_FRAME_INFO_FLAG_ZERO_COPY);
}
+gboolean
+cogl_frame_info_is_vsync (CoglFrameInfo *info)
+{
+ return !!(info->flags & COGL_FRAME_INFO_FLAG_VSYNC);
+}
+
unsigned int
cogl_frame_info_get_sequence (CoglFrameInfo *info)
{
diff --git a/cogl/cogl/cogl-frame-info.h b/cogl/cogl/cogl-frame-info.h
index 62a9bb0ea..7278a08ca 100644
--- a/cogl/cogl/cogl-frame-info.h
+++ b/cogl/cogl/cogl-frame-info.h
@@ -145,6 +145,9 @@ COGL_EXPORT
gboolean cogl_frame_info_is_zero_copy (CoglFrameInfo *info);
COGL_EXPORT
+gboolean cogl_frame_info_is_vsync (CoglFrameInfo *info);
+
+COGL_EXPORT
unsigned int cogl_frame_info_get_sequence (CoglFrameInfo *info);
G_END_DECLS
diff --git a/cogl/cogl/winsys/cogl-onscreen-glx.c b/cogl/cogl/winsys/cogl-onscreen-glx.c
index df8922b5d..8bbb508b7 100644
--- a/cogl/cogl/winsys/cogl-onscreen-glx.c
+++ b/cogl/cogl/winsys/cogl-onscreen-glx.c
@@ -472,6 +472,7 @@ _cogl_winsys_wait_for_vblank (CoglOnscreen *onscreen)
if (glx_display->can_vblank_wait)
{
CoglFrameInfo *info = cogl_onscreen_peek_tail_frame_info (onscreen);
+ info->flags |= COGL_FRAME_INFO_FLAG_VSYNC;
if (glx_renderer->glXWaitForMsc)
{
@@ -987,6 +988,7 @@ cogl_onscreen_glx_notify_swap_buffers (CoglOnscreen *onscreen,
set_sync_pending (onscreen);
info = cogl_onscreen_peek_head_frame_info (onscreen);
+ info->flags |= COGL_FRAME_INFO_FLAG_VSYNC;
ust_is_monotonic = is_ust_monotonic (context->display->renderer,
onscreen_glx->glxwin);