1
0
Fork 0

cogl/frame-info: Add VSYNC flag

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
This commit is contained in:
Ivan Molodetskikh 2021-01-30 21:14:27 +03:00 committed by Marge Bot
parent 93ef83a96c
commit 47183a94eb
5 changed files with 20 additions and 1 deletions

View file

@ -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

View file

@ -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)
{

View file

@ -144,6 +144,9 @@ gboolean cogl_frame_info_is_hw_clock (CoglFrameInfo *info);
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);

View file

@ -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);

View file

@ -265,7 +265,7 @@ page_flip_feedback_flipped (MetaKmsCrtc *kms_crtc,
MetaCrtc *crtc;
MetaGpuKms *gpu_kms;
int64_t presentation_time_us;
CoglFrameInfoFlag flags = COGL_FRAME_INFO_FLAG_NONE;
CoglFrameInfoFlag flags = COGL_FRAME_INFO_FLAG_VSYNC;
page_flip_time = (struct timeval) {
.tv_sec = tv_sec,