mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
cogl/frame-info: Add HW_CLOCK flag
A flag indicating whether the presentation timestamp was provided by the display hardware (rather than sampled in user space). It will be used for the presentation-time Wayland protocol. This is definitely the case for page_flip_handler(), and I'm assuming this is also the case for the two instances in the GLX code. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
This commit is contained in:
parent
d54dc1ae7c
commit
9d54ef3994
@ -38,6 +38,8 @@ typedef enum _CoglFrameInfoFlag
|
||||
{
|
||||
COGL_FRAME_INFO_FLAG_NONE = 0,
|
||||
COGL_FRAME_INFO_FLAG_SYMBOLIC = 1 << 0,
|
||||
/* presentation_time timestamp was provided by the hardware */
|
||||
COGL_FRAME_INFO_FLAG_HW_CLOCK = 1 << 1,
|
||||
} CoglFrameInfoFlag;
|
||||
|
||||
struct _CoglFrameInfo
|
||||
|
@ -88,3 +88,9 @@ cogl_frame_info_get_is_symbolic (CoglFrameInfo *info)
|
||||
{
|
||||
return !!(info->flags & COGL_FRAME_INFO_FLAG_SYMBOLIC);
|
||||
}
|
||||
|
||||
gboolean
|
||||
cogl_frame_info_is_hw_clock (CoglFrameInfo *info)
|
||||
{
|
||||
return !!(info->flags & COGL_FRAME_INFO_FLAG_HW_CLOCK);
|
||||
}
|
||||
|
@ -140,6 +140,9 @@ int64_t cogl_frame_info_get_global_frame_counter (CoglFrameInfo *info);
|
||||
COGL_EXPORT
|
||||
gboolean cogl_frame_info_get_is_symbolic (CoglFrameInfo *info);
|
||||
|
||||
COGL_EXPORT
|
||||
gboolean cogl_frame_info_is_hw_clock (CoglFrameInfo *info);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_FRAME_INFO_H */
|
||||
|
@ -485,6 +485,7 @@ _cogl_winsys_wait_for_vblank (CoglOnscreen *onscreen)
|
||||
info->presentation_time = ust_to_nanoseconds (ctx->display->renderer,
|
||||
drawable,
|
||||
ust);
|
||||
info->flags |= COGL_FRAME_INFO_FLAG_HW_CLOCK;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -978,6 +979,7 @@ cogl_onscreen_glx_notify_swap_buffers (CoglOnscreen *onscreen,
|
||||
ust_to_nanoseconds (context->display->renderer,
|
||||
onscreen_glx->glxwin,
|
||||
swap_event->ust);
|
||||
info->flags |= COGL_FRAME_INFO_FLAG_HW_CLOCK;
|
||||
}
|
||||
|
||||
set_complete_pending (onscreen);
|
||||
|
@ -167,9 +167,10 @@ meta_onscreen_native_swap_drm_fb (CoglOnscreen *onscreen)
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_update_frame_info (MetaCrtc *crtc,
|
||||
CoglFrameInfo *frame_info,
|
||||
int64_t time_ns)
|
||||
maybe_update_frame_info (MetaCrtc *crtc,
|
||||
CoglFrameInfo *frame_info,
|
||||
int64_t time_ns,
|
||||
CoglFrameInfoFlag flags)
|
||||
{
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcModeInfo *crtc_mode_info;
|
||||
@ -187,6 +188,7 @@ maybe_update_frame_info (MetaCrtc *crtc,
|
||||
{
|
||||
frame_info->presentation_time = time_ns;
|
||||
frame_info->refresh_rate = refresh_rate;
|
||||
frame_info->flags |= flags;
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +209,8 @@ meta_onscreen_native_notify_frame_complete (CoglOnscreen *onscreen)
|
||||
static void
|
||||
notify_view_crtc_presented (MetaRendererView *view,
|
||||
MetaKmsCrtc *kms_crtc,
|
||||
int64_t time_ns)
|
||||
int64_t time_ns,
|
||||
CoglFrameInfoFlag flags)
|
||||
{
|
||||
ClutterStageView *stage_view = CLUTTER_STAGE_VIEW (view);
|
||||
CoglFramebuffer *framebuffer =
|
||||
@ -222,7 +225,7 @@ notify_view_crtc_presented (MetaRendererView *view,
|
||||
frame_info = cogl_onscreen_peek_head_frame_info (onscreen);
|
||||
|
||||
crtc = META_CRTC (meta_crtc_kms_from_kms_crtc (kms_crtc));
|
||||
maybe_update_frame_info (crtc, frame_info, time_ns);
|
||||
maybe_update_frame_info (crtc, frame_info, time_ns, flags);
|
||||
|
||||
meta_onscreen_native_notify_frame_complete (onscreen);
|
||||
|
||||
@ -266,7 +269,8 @@ page_flip_feedback_flipped (MetaKmsCrtc *kms_crtc,
|
||||
};
|
||||
|
||||
notify_view_crtc_presented (view, kms_crtc,
|
||||
timeval_to_nanoseconds (&page_flip_time));
|
||||
timeval_to_nanoseconds (&page_flip_time),
|
||||
COGL_FRAME_INFO_FLAG_HW_CLOCK);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -303,7 +307,7 @@ page_flip_feedback_mode_set_fallback (MetaKmsCrtc *kms_crtc,
|
||||
gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
||||
now_ns = meta_gpu_kms_get_current_time_ns (gpu_kms);
|
||||
|
||||
notify_view_crtc_presented (view, kms_crtc, now_ns);
|
||||
notify_view_crtc_presented (view, kms_crtc, now_ns, COGL_FRAME_INFO_FLAG_NONE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -331,7 +335,7 @@ page_flip_feedback_discarded (MetaKmsCrtc *kms_crtc,
|
||||
gpu_kms = META_GPU_KMS (meta_crtc_get_gpu (crtc));
|
||||
now_ns = meta_gpu_kms_get_current_time_ns (gpu_kms);
|
||||
|
||||
notify_view_crtc_presented (view, kms_crtc, now_ns);
|
||||
notify_view_crtc_presented (view, kms_crtc, now_ns, COGL_FRAME_INFO_FLAG_NONE);
|
||||
}
|
||||
|
||||
static const MetaKmsPageFlipListenerVtable page_flip_listener_vtable = {
|
||||
|
Loading…
Reference in New Issue
Block a user