mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
clutter/cogl: Take over global frame count responsibility
The native backend had a plain counter, and the X11 backend used the CoglOnscreen of the screen; change it into a plain counter in ClutterStageCogl. This also moves the global frame count setting to the frame info constuctor. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
parent
2a6e8bda8d
commit
c00a8e98a3
@ -60,12 +60,18 @@ typedef struct _ClutterStageViewCoglPrivate
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterStageViewCogl, clutter_stage_view_cogl,
|
||||
CLUTTER_TYPE_STAGE_VIEW)
|
||||
|
||||
typedef struct _ClutterStageCoglPrivate
|
||||
{
|
||||
int64_t global_frame_counter;
|
||||
} ClutterStageCoglPrivate;
|
||||
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterStageCogl,
|
||||
_clutter_stage_cogl,
|
||||
G_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (ClutterStageCogl)
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
||||
clutter_stage_window_iface_init));
|
||||
|
||||
@ -158,6 +164,16 @@ clutter_stage_cogl_realize (ClutterStageWindow *stage_window)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int64_t
|
||||
clutter_stage_cogl_get_frame_counter (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
ClutterStageCoglPrivate *priv =
|
||||
_clutter_stage_cogl_get_instance_private (stage_cogl);
|
||||
|
||||
return priv->global_frame_counter;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window,
|
||||
gint sync_delay)
|
||||
@ -361,6 +377,9 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
cairo_region_t *swap_region,
|
||||
gboolean swap_with_damage)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
ClutterStageCoglPrivate *priv =
|
||||
_clutter_stage_cogl_get_instance_private (stage_cogl);
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
||||
|
||||
clutter_stage_view_before_swap_buffer (view, swap_region);
|
||||
@ -384,7 +403,8 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
damage[i * 4 + 3] = rect.height;
|
||||
}
|
||||
|
||||
frame_info = cogl_frame_info_new ();
|
||||
frame_info = cogl_frame_info_new (priv->global_frame_counter);
|
||||
priv->global_frame_counter++;
|
||||
|
||||
/* push on the screen */
|
||||
if (n_rects > 0 && !swap_with_damage)
|
||||
@ -750,6 +770,8 @@ clutter_stage_cogl_scanout_view (ClutterStageCogl *stage_cogl,
|
||||
ClutterStageView *view,
|
||||
CoglScanout *scanout)
|
||||
{
|
||||
ClutterStageCoglPrivate *priv =
|
||||
_clutter_stage_cogl_get_instance_private (stage_cogl);
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
CoglOnscreen *onscreen;
|
||||
CoglFrameInfo *frame_info;
|
||||
@ -758,7 +780,8 @@ clutter_stage_cogl_scanout_view (ClutterStageCogl *stage_cogl,
|
||||
|
||||
onscreen = COGL_ONSCREEN (framebuffer);
|
||||
|
||||
frame_info = cogl_frame_info_new ();
|
||||
frame_info = cogl_frame_info_new (priv->global_frame_counter);
|
||||
priv->global_frame_counter++;
|
||||
|
||||
cogl_onscreen_direct_scanout (onscreen, scanout, frame_info);
|
||||
}
|
||||
@ -821,6 +844,7 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
iface->resize = clutter_stage_cogl_resize;
|
||||
iface->show = clutter_stage_cogl_show;
|
||||
iface->hide = clutter_stage_cogl_hide;
|
||||
iface->get_frame_counter = clutter_stage_cogl_get_frame_counter;
|
||||
iface->schedule_update = clutter_stage_cogl_schedule_update;
|
||||
iface->get_update_time = clutter_stage_cogl_get_update_time;
|
||||
iface->clear_update_time = clutter_stage_cogl_clear_update_time;
|
||||
|
@ -46,6 +46,6 @@ struct _CoglFrameInfo
|
||||
};
|
||||
|
||||
COGL_EXPORT
|
||||
CoglFrameInfo *cogl_frame_info_new (void);
|
||||
CoglFrameInfo *cogl_frame_info_new (int64_t global_frame_counter);
|
||||
|
||||
#endif /* __COGL_FRAME_INFO_PRIVATE_H */
|
||||
|
@ -39,11 +39,12 @@ COGL_OBJECT_DEFINE (FrameInfo, frame_info);
|
||||
COGL_GTYPE_DEFINE_CLASS (FrameInfo, frame_info);
|
||||
|
||||
CoglFrameInfo *
|
||||
cogl_frame_info_new (void)
|
||||
cogl_frame_info_new (int64_t global_frame_counter)
|
||||
{
|
||||
CoglFrameInfo *info;
|
||||
|
||||
info = g_slice_new0 (CoglFrameInfo);
|
||||
info->global_frame_counter = global_frame_counter;
|
||||
|
||||
return _cogl_frame_info_object_new (info);
|
||||
}
|
||||
|
@ -224,7 +224,6 @@ struct _MetaRendererNative
|
||||
|
||||
CoglClosure *swap_notify_idle;
|
||||
|
||||
int64_t frame_counter;
|
||||
gboolean pending_unset_disabled_crtcs;
|
||||
|
||||
GList *power_save_page_flip_onscreens;
|
||||
@ -2105,9 +2104,6 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||
wait_for_pending_flips (onscreen);
|
||||
COGL_TRACE_END (MetaRendererNativeSwapBuffersWait);
|
||||
|
||||
frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos);
|
||||
frame_info->global_frame_counter = renderer_native->frame_counter;
|
||||
|
||||
update_secondary_gpu_state_pre_swap_buffers (onscreen);
|
||||
|
||||
parent_vtable->onscreen_swap_buffers_with_damage (onscreen,
|
||||
@ -2148,7 +2144,8 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||
|
||||
ensure_crtc_modes (onscreen, kms_update);
|
||||
|
||||
onscreen_native->pending_queue_swap_notify_frame_count = renderer_native->frame_counter;
|
||||
onscreen_native->pending_queue_swap_notify_frame_count =
|
||||
cogl_frame_info_get_global_frame_counter (frame_info);
|
||||
meta_onscreen_native_flip_crtcs (onscreen, kms_update);
|
||||
|
||||
/*
|
||||
@ -2320,9 +2317,6 @@ meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
|
||||
|
||||
wait_for_pending_flips (onscreen);
|
||||
|
||||
frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos);
|
||||
frame_info->global_frame_counter = renderer_native->frame_counter;
|
||||
|
||||
renderer_gpu_data = meta_renderer_native_get_gpu_data (renderer_native,
|
||||
render_gpu);
|
||||
|
||||
@ -2334,7 +2328,7 @@ meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
|
||||
ensure_crtc_modes (onscreen, kms_update);
|
||||
|
||||
onscreen_native->pending_queue_swap_notify_frame_count =
|
||||
renderer_native->frame_counter;
|
||||
cogl_frame_info_get_global_frame_counter (frame_info);
|
||||
meta_onscreen_native_flip_crtcs (onscreen, kms_update);
|
||||
|
||||
meta_kms_post_pending_update_sync (kms);
|
||||
@ -3309,8 +3303,6 @@ meta_renderer_native_finish_frame (MetaRendererNative *renderer_native)
|
||||
MetaKms *kms = meta_backend_native_get_kms (backend_native);
|
||||
MetaKmsUpdate *kms_update = NULL;
|
||||
|
||||
renderer_native->frame_counter++;
|
||||
|
||||
if (renderer_native->pending_unset_disabled_crtcs)
|
||||
{
|
||||
GList *l;
|
||||
@ -3350,12 +3342,6 @@ meta_renderer_native_finish_frame (MetaRendererNative *renderer_native)
|
||||
}
|
||||
}
|
||||
|
||||
int64_t
|
||||
meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native)
|
||||
{
|
||||
return renderer_native->frame_counter;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
create_secondary_egl_config (MetaEgl *egl,
|
||||
MetaRendererNativeMode mode,
|
||||
|
@ -55,8 +55,6 @@ MetaGpuKms * meta_renderer_native_get_primary_gpu (MetaRendererNative *renderer_
|
||||
|
||||
void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native);
|
||||
|
||||
int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native);
|
||||
|
||||
gboolean meta_onscreen_native_is_buffer_scanout_compatible (CoglOnscreen *onscreen,
|
||||
uint32_t drm_format,
|
||||
uint64_t drm_modifier,
|
||||
|
@ -186,16 +186,6 @@ meta_stage_native_get_views (ClutterStageWindow *stage_window)
|
||||
return meta_renderer_get_views (renderer);
|
||||
}
|
||||
|
||||
static int64_t
|
||||
meta_stage_native_get_frame_counter (ClutterStageWindow *stage_window)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
|
||||
|
||||
return meta_renderer_native_get_frame_counter (renderer_native);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stage_native_finish_frame (ClutterStageWindow *stage_window)
|
||||
{
|
||||
@ -225,6 +215,5 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
iface->can_clip_redraws = meta_stage_native_can_clip_redraws;
|
||||
iface->get_geometry = meta_stage_native_get_geometry;
|
||||
iface->get_views = meta_stage_native_get_views;
|
||||
iface->get_frame_counter = meta_stage_native_get_frame_counter;
|
||||
iface->finish_frame = meta_stage_native_finish_frame;
|
||||
}
|
||||
|
@ -480,14 +480,6 @@ meta_stage_x11_get_views (ClutterStageWindow *stage_window)
|
||||
return meta_renderer_get_views (renderer);
|
||||
}
|
||||
|
||||
static int64_t
|
||||
meta_stage_x11_get_frame_counter (ClutterStageWindow *stage_window)
|
||||
{
|
||||
MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
|
||||
|
||||
return cogl_onscreen_get_frame_counter (stage_x11->onscreen);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stage_x11_finalize (GObject *object)
|
||||
{
|
||||
@ -548,7 +540,6 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
iface->unrealize = meta_stage_x11_unrealize;
|
||||
iface->can_clip_redraws = meta_stage_x11_can_clip_redraws;
|
||||
iface->get_views = meta_stage_x11_get_views;
|
||||
iface->get_frame_counter = meta_stage_x11_get_frame_counter;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -194,7 +194,7 @@ meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window)
|
||||
draw_view (stage_nested, renderer_view, texture);
|
||||
}
|
||||
|
||||
frame_info = cogl_frame_info_new ();
|
||||
frame_info = cogl_frame_info_new (0);
|
||||
cogl_onscreen_swap_buffers (stage_x11->onscreen, frame_info);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user