clutter: Add ClutterFrameInfo::view_frame_counter
And plumb it through from ClutterFrame::frame_count. Preparation for later changes, no functional change intended. v2: * Rename to view_frame_counter. (Jonas Ådahl) Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4306>
This commit is contained in:
parent
7bcbd253c2
commit
84135e51b0
@ -121,6 +121,7 @@ typedef enum
|
||||
struct _ClutterFrameInfo
|
||||
{
|
||||
int64_t global_frame_counter;
|
||||
int64_t view_frame_counter;
|
||||
int64_t presentation_time; /* microseconds; CLOCK_MONOTONIC */
|
||||
int64_t target_presentation_time; /* microseconds; CLOCK_MONOTONIC */
|
||||
float refresh_rate;
|
||||
|
@ -68,6 +68,7 @@ struct _CoglFrameInfo
|
||||
float refresh_rate;
|
||||
|
||||
int64_t global_frame_counter;
|
||||
int64_t view_frame_counter;
|
||||
|
||||
CoglFrameInfoFlag flags;
|
||||
|
||||
@ -84,7 +85,8 @@ struct _CoglFrameInfo
|
||||
|
||||
COGL_EXPORT
|
||||
CoglFrameInfo *cogl_frame_info_new (CoglContext *context,
|
||||
int64_t global_frame_counter);
|
||||
int64_t global_frame_counter,
|
||||
int64_t view_frame_counter);
|
||||
|
||||
COGL_EXPORT
|
||||
void cogl_frame_info_set_target_presentation_time (CoglFrameInfo *info,
|
||||
|
@ -61,13 +61,15 @@ cogl_frame_info_class_init (CoglFrameInfoClass *class)
|
||||
|
||||
CoglFrameInfo *
|
||||
cogl_frame_info_new (CoglContext *context,
|
||||
int64_t global_frame_counter)
|
||||
int64_t global_frame_counter,
|
||||
int64_t view_frame_counter)
|
||||
{
|
||||
CoglFrameInfo *info;
|
||||
|
||||
info = g_object_new (COGL_TYPE_FRAME_INFO, NULL);
|
||||
info->context = context;
|
||||
info->global_frame_counter = global_frame_counter;
|
||||
info->view_frame_counter = view_frame_counter;
|
||||
|
||||
return info;
|
||||
}
|
||||
@ -111,6 +113,12 @@ cogl_frame_info_get_global_frame_counter (CoglFrameInfo *info)
|
||||
return info->global_frame_counter;
|
||||
}
|
||||
|
||||
int64_t
|
||||
cogl_frame_info_get_view_frame_counter (CoglFrameInfo *info)
|
||||
{
|
||||
return info->view_frame_counter;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cogl_frame_info_get_is_symbolic (CoglFrameInfo *info)
|
||||
{
|
||||
|
@ -124,6 +124,9 @@ float cogl_frame_info_get_refresh_rate (CoglFrameInfo *info);
|
||||
COGL_EXPORT
|
||||
int64_t cogl_frame_info_get_global_frame_counter (CoglFrameInfo *info);
|
||||
|
||||
COGL_EXPORT
|
||||
int64_t cogl_frame_info_get_view_frame_counter (CoglFrameInfo *info);
|
||||
|
||||
COGL_EXPORT
|
||||
gboolean cogl_frame_info_get_is_symbolic (CoglFrameInfo *info);
|
||||
|
||||
|
@ -63,7 +63,8 @@ GType meta_stage_impl_get_type (void) G_GNUC_CONST;
|
||||
MetaBackend * meta_stage_impl_get_backend (MetaStageImpl *stage_impl);
|
||||
|
||||
void meta_stage_impl_add_onscreen_frame_info (MetaStageImpl *stage_impl,
|
||||
ClutterStageView *view);
|
||||
ClutterStageView *view,
|
||||
ClutterFrame *frame);
|
||||
|
||||
void meta_stage_impl_rebuild_views (MetaStageImpl *stage_impl);
|
||||
|
||||
|
@ -276,7 +276,8 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
|
||||
|
||||
frame_info =
|
||||
cogl_frame_info_new (cogl_context, priv->global_frame_counter);
|
||||
cogl_frame_info_new (cogl_context, priv->global_frame_counter,
|
||||
frame->frame_count);
|
||||
priv->global_frame_counter++;
|
||||
|
||||
if (clutter_frame_get_target_presentation_time (frame,
|
||||
@ -319,7 +320,8 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
framebuffer);
|
||||
|
||||
cogl_framebuffer_flush (framebuffer);
|
||||
meta_stage_view_perform_fake_swap (view, priv->global_frame_counter);
|
||||
meta_stage_view_perform_fake_swap (view, priv->global_frame_counter,
|
||||
frame->frame_count);
|
||||
priv->global_frame_counter++;
|
||||
}
|
||||
}
|
||||
@ -760,7 +762,8 @@ meta_stage_impl_scanout_view (MetaStageImpl *stage_impl,
|
||||
|
||||
onscreen = COGL_ONSCREEN (framebuffer);
|
||||
|
||||
frame_info = cogl_frame_info_new (cogl_context, priv->global_frame_counter);
|
||||
frame_info = cogl_frame_info_new (cogl_context, priv->global_frame_counter,
|
||||
frame->frame_count);
|
||||
|
||||
if (!cogl_onscreen_direct_scanout (onscreen,
|
||||
scanout,
|
||||
@ -818,7 +821,8 @@ meta_stage_impl_redraw_view (ClutterStageWindow *stage_window,
|
||||
|
||||
void
|
||||
meta_stage_impl_add_onscreen_frame_info (MetaStageImpl *stage_impl,
|
||||
ClutterStageView *stage_view)
|
||||
ClutterStageView *stage_view,
|
||||
ClutterFrame *frame)
|
||||
{
|
||||
MetaStageImplPrivate *priv =
|
||||
meta_stage_impl_get_instance_private (stage_impl);
|
||||
@ -826,7 +830,8 @@ meta_stage_impl_add_onscreen_frame_info (MetaStageImpl *stage_impl,
|
||||
CoglContext *cogl_context = cogl_framebuffer_get_context (framebuffer);
|
||||
CoglFrameInfo *frame_info;
|
||||
|
||||
frame_info = cogl_frame_info_new (cogl_context, priv->global_frame_counter);
|
||||
frame_info = cogl_frame_info_new (cogl_context, priv->global_frame_counter,
|
||||
frame->frame_count);
|
||||
priv->global_frame_counter++;
|
||||
|
||||
cogl_onscreen_add_frame_info (COGL_ONSCREEN (framebuffer), frame_info);
|
||||
|
@ -37,4 +37,5 @@ struct _MetaStageViewClass
|
||||
|
||||
ClutterDamageHistory * meta_stage_view_get_damage_history (MetaStageView *view);
|
||||
void meta_stage_view_perform_fake_swap (MetaStageView *view,
|
||||
int64_t counter);
|
||||
int64_t global_frame_counter,
|
||||
int64_t view_frame_counter);
|
||||
|
@ -72,6 +72,7 @@ frame_cb (CoglOnscreen *onscreen,
|
||||
|
||||
clutter_frame_info = (ClutterFrameInfo) {
|
||||
.global_frame_counter = cogl_frame_info_get_global_frame_counter (frame_info),
|
||||
.view_frame_counter = cogl_frame_info_get_view_frame_counter (frame_info),
|
||||
.refresh_rate = cogl_frame_info_get_refresh_rate (frame_info),
|
||||
.presentation_time =
|
||||
cogl_frame_info_get_presentation_time_us (frame_info),
|
||||
@ -202,7 +203,8 @@ notify_presented_idle (gpointer user_data)
|
||||
|
||||
void
|
||||
meta_stage_view_perform_fake_swap (MetaStageView *view,
|
||||
int64_t counter)
|
||||
int64_t global_frame_counter,
|
||||
int64_t view_frame_counter)
|
||||
{
|
||||
ClutterStageView *clutter_view = CLUTTER_STAGE_VIEW (view);
|
||||
MetaStageViewPrivate *priv =
|
||||
@ -212,7 +214,8 @@ meta_stage_view_perform_fake_swap (MetaStageView *view,
|
||||
closure = g_new0 (NotifyPresentedClosure, 1);
|
||||
closure->view = clutter_view;
|
||||
closure->frame_info = (ClutterFrameInfo) {
|
||||
.global_frame_counter = counter,
|
||||
.global_frame_counter = global_frame_counter,
|
||||
.view_frame_counter = view_frame_counter,
|
||||
.refresh_rate = clutter_stage_view_get_refresh_rate (clutter_view),
|
||||
.presentation_time = g_get_monotonic_time (),
|
||||
.flags = CLUTTER_FRAME_INFO_FLAG_NONE,
|
||||
|
@ -147,6 +147,7 @@ maybe_post_next_frame (CoglOnscreen *onscreen);
|
||||
|
||||
static void
|
||||
post_nonprimary_plane_update (MetaOnscreenNative *onscreen_native,
|
||||
ClutterFrame *frame,
|
||||
MetaKmsUpdate *kms_update);
|
||||
|
||||
static gboolean
|
||||
@ -1670,7 +1671,7 @@ maybe_post_next_frame (CoglOnscreen *onscreen)
|
||||
region))
|
||||
{
|
||||
kms_update = meta_frame_native_steal_kms_update (frame_native);
|
||||
post_nonprimary_plane_update (onscreen_native, kms_update);
|
||||
post_nonprimary_plane_update (onscreen_native, frame, kms_update);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1897,7 +1898,8 @@ meta_onscreen_native_get_window_handles (CoglOnscreen *onscreen,
|
||||
}
|
||||
|
||||
static void
|
||||
add_onscreen_frame_info (MetaCrtc *crtc)
|
||||
add_onscreen_frame_info (MetaCrtc *crtc,
|
||||
ClutterFrame *frame)
|
||||
{
|
||||
MetaGpu *gpu = meta_crtc_get_gpu (crtc);
|
||||
MetaBackend *backend = meta_gpu_get_backend (gpu);
|
||||
@ -1907,7 +1909,8 @@ add_onscreen_frame_info (MetaCrtc *crtc)
|
||||
MetaRendererView *view = meta_renderer_get_view_for_crtc (renderer, crtc);
|
||||
|
||||
meta_stage_impl_add_onscreen_frame_info (META_STAGE_IMPL (stage_window),
|
||||
CLUTTER_STAGE_VIEW (view));
|
||||
CLUTTER_STAGE_VIEW (view),
|
||||
frame);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2122,13 +2125,14 @@ meta_onscreen_native_finish_frame (CoglOnscreen *onscreen,
|
||||
onscreen_native->needs_flush = FALSE;
|
||||
}
|
||||
|
||||
post_nonprimary_plane_update (onscreen_native, kms_update);
|
||||
post_nonprimary_plane_update (onscreen_native, frame, kms_update);
|
||||
|
||||
clutter_frame_set_result (frame, CLUTTER_FRAME_RESULT_PENDING_PRESENTED);
|
||||
}
|
||||
|
||||
static void
|
||||
post_nonprimary_plane_update (MetaOnscreenNative *onscreen_native,
|
||||
ClutterFrame *frame,
|
||||
MetaKmsUpdate *kms_update)
|
||||
{
|
||||
MetaCrtc *crtc = onscreen_native->crtc;
|
||||
@ -2148,7 +2152,7 @@ post_nonprimary_plane_update (MetaOnscreenNative *onscreen_native,
|
||||
NULL,
|
||||
g_object_ref (onscreen_native->view),
|
||||
g_object_unref);
|
||||
add_onscreen_frame_info (crtc);
|
||||
add_onscreen_frame_info (crtc, frame);
|
||||
|
||||
meta_topic (META_DEBUG_KMS,
|
||||
"Posting non-primary plane update for CRTC %u (%s)",
|
||||
|
@ -178,7 +178,7 @@ meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window,
|
||||
draw_view (stage_nested, renderer_view, texture);
|
||||
}
|
||||
|
||||
frame_info = cogl_frame_info_new (context, 0);
|
||||
frame_info = cogl_frame_info_new (context, 0, frame->frame_count);
|
||||
cogl_onscreen_egl_maybe_create_timestamp_query (stage_x11->onscreen,
|
||||
frame_info);
|
||||
cogl_onscreen_swap_buffers (stage_x11->onscreen, frame_info, frame);
|
||||
|
Loading…
x
Reference in New Issue
Block a user