[mutter] clutter/cogl: Take over global frame count responsibility
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/cogl: Take over global frame count responsibility
- Date: Thu, 2 Jul 2020 20:52:59 +0000 (UTC)
commit c00a8e98a3cea96db9ff859d59640f00623bff58
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri May 22 22:30:45 2020 +0200
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
clutter/clutter/cogl/clutter-stage-cogl.c | 28 +++++++++++++++++++++++--
cogl/cogl/cogl-frame-info-private.h | 2 +-
cogl/cogl/cogl-frame-info.c | 3 ++-
src/backends/native/meta-renderer-native.c | 20 +++---------------
src/backends/native/meta-renderer-native.h | 2 --
src/backends/native/meta-stage-native.c | 11 ----------
src/backends/x11/meta-stage-x11.c | 9 --------
src/backends/x11/nested/meta-stage-x11-nested.c | 2 +-
8 files changed, 33 insertions(+), 44 deletions(-)
---
diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c
index 44cb37acc5..565f2f9fbb 100644
--- a/clutter/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/clutter/cogl/clutter-stage-cogl.c
@@ -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;
diff --git a/cogl/cogl/cogl-frame-info-private.h b/cogl/cogl/cogl-frame-info-private.h
index 585e2c2e74..13d8561750 100644
--- a/cogl/cogl/cogl-frame-info-private.h
+++ b/cogl/cogl/cogl-frame-info-private.h
@@ -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 */
diff --git a/cogl/cogl/cogl-frame-info.c b/cogl/cogl/cogl-frame-info.c
index a6e9f32609..b5da21110f 100644
--- a/cogl/cogl/cogl-frame-info.c
+++ b/cogl/cogl/cogl-frame-info.c
@@ -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);
}
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 8d50a828de..255a4ce727 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -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,
diff --git a/src/backends/native/meta-renderer-native.h b/src/backends/native/meta-renderer-native.h
index 3ea2c9cc0d..91afca766e 100644
--- a/src/backends/native/meta-renderer-native.h
+++ b/src/backends/native/meta-renderer-native.h
@@ -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,
diff --git a/src/backends/native/meta-stage-native.c b/src/backends/native/meta-stage-native.c
index 9a3d11cb9d..4b0551d915 100644
--- a/src/backends/native/meta-stage-native.c
+++ b/src/backends/native/meta-stage-native.c
@@ -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;
}
diff --git a/src/backends/x11/meta-stage-x11.c b/src/backends/x11/meta-stage-x11.c
index c5ed60b16e..2367454ed5 100644
--- a/src/backends/x11/meta-stage-x11.c
+++ b/src/backends/x11/meta-stage-x11.c
@@ -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
diff --git a/src/backends/x11/nested/meta-stage-x11-nested.c b/src/backends/x11/nested/meta-stage-x11-nested.c
index 00683a5698..be0ece2fa0 100644
--- a/src/backends/x11/nested/meta-stage-x11-nested.c
+++ b/src/backends/x11/nested/meta-stage-x11-nested.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]