[clutter/wip/frame-synchronization: 2/2] Call cogl_onscreen_begin_frame()
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/frame-synchronization: 2/2] Call cogl_onscreen_begin_frame()
- Date: Mon, 7 Jan 2013 17:31:54 +0000 (UTC)
commit 845a1aacc3f83a56c2408e7c67300cb028c45b4b
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Tue Nov 13 12:46:43 2012 -0500
Call cogl_onscreen_begin_frame()
cogl_onscreen_begin_frame() will be called implicitly called
by Cogl if it isn't called before we swap to end the frame, but
to get proper frame boundaries we should call it at the beginning
of the frame and pass in the frame time.
clutter/clutter-master-clock.c | 12 ++++++++++++
clutter/clutter-stage-private.h | 2 ++
clutter/clutter-stage-window.c | 13 +++++++++++++
clutter/clutter-stage-window.h | 4 ++++
clutter/clutter-stage.c | 11 +++++++++++
clutter/cogl/clutter-stage-cogl.c | 11 +++++++++++
6 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-master-clock.c b/clutter/clutter-master-clock.c
index acd5dc8..a2f6f52 100644
--- a/clutter/clutter-master-clock.c
+++ b/clutter/clutter-master-clock.c
@@ -345,6 +345,16 @@ master_clock_next_frame_delay (ClutterMasterClock *master_clock)
}
static void
+master_clock_begin_frame (ClutterMasterClock *master_clock,
+ GSList *stages)
+{
+ GSList *l;
+
+ for (l = stages; l != NULL; l = l->next)
+ _clutter_stage_begin_frame (l->data, master_clock->cur_tick);
+}
+
+static void
master_clock_process_events (ClutterMasterClock *master_clock,
GSList *stages)
{
@@ -573,6 +583,8 @@ clutter_clock_dispatch (GSource *source,
master_clock->idle = FALSE;
+ master_clock_begin_frame (master_clock, stages);
+
/* Each frame is split into three separate phases: */
/* 1. process all the events; each stage goes through its events queue
diff --git a/clutter/clutter-stage-private.h b/clutter/clutter-stage-private.h
index 9ccba3f..4e01c19 100644
--- a/clutter/clutter-stage-private.h
+++ b/clutter/clutter-stage-private.h
@@ -69,6 +69,8 @@ void _clutter_stage_update_input_devices (ClutterStage *stage);
void _clutter_stage_schedule_update (ClutterStage *stage);
gint64 _clutter_stage_get_update_time (ClutterStage *stage);
void _clutter_stage_clear_update_time (ClutterStage *stage);
+void _clutter_stage_begin_frame (ClutterStage *stage,
+ gint64 frame_time);
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
ClutterActor *_clutter_stage_do_pick (ClutterStage *stage,
diff --git a/clutter/clutter-stage-window.c b/clutter/clutter-stage-window.c
index ffa30a1..b1cc397 100644
--- a/clutter/clutter-stage-window.c
+++ b/clutter/clutter-stage-window.c
@@ -175,6 +175,19 @@ _clutter_stage_window_clear_update_time (ClutterStageWindow *window)
}
void
+_clutter_stage_window_begin_frame (ClutterStageWindow *window,
+ gint64 frame_time)
+{
+ ClutterStageWindowIface *iface;
+
+ g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
+
+ iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
+ if (iface->begin_frame != NULL)
+ iface->begin_frame (window, frame_time);
+}
+
+void
_clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
{
diff --git a/clutter/clutter-stage-window.h b/clutter/clutter-stage-window.h
index 27ecee0..dde77b0 100644
--- a/clutter/clutter-stage-window.h
+++ b/clutter/clutter-stage-window.h
@@ -62,6 +62,8 @@ struct _ClutterStageWindowIface
int sync_delay);
gint64 (* get_update_time) (ClutterStageWindow *stage_window);
void (* clear_update_time) (ClutterStageWindow *stage_window);
+ void (* begin_frame) (ClutterStageWindow *stage_window,
+ gint64 frame_time);
void (* add_redraw_clip) (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *stage_rectangle);
@@ -110,6 +112,8 @@ void _clutter_stage_window_schedule_update (ClutterStageWin
int sync_delay);
gint64 _clutter_stage_window_get_update_time (ClutterStageWindow *window);
void _clutter_stage_window_clear_update_time (ClutterStageWindow *window);
+void _clutter_stage_window_begin_frame (ClutterStageWindow *window,
+ gint64 frame_time);
void _clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip);
diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c
index 10ee07e..7a83f8c 100644
--- a/clutter/clutter-stage.c
+++ b/clutter/clutter-stage.c
@@ -3880,6 +3880,17 @@ _clutter_stage_clear_update_time (ClutterStage *stage)
_clutter_stage_window_clear_update_time (stage_window);
}
+void
+_clutter_stage_begin_frame (ClutterStage *stage,
+ gint64 frame_time)
+{
+ ClutterStageWindow *stage_window;
+
+ stage_window = _clutter_stage_get_window (stage);
+ if (stage_window)
+ _clutter_stage_window_begin_frame (stage_window, frame_time);
+}
+
/**
* clutter_stage_set_no_clear_hint:
* @stage: a #ClutterStage
diff --git a/clutter/cogl/clutter-stage-cogl.c b/clutter/cogl/clutter-stage-cogl.c
index b8f091f..14a4ced 100644
--- a/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/cogl/clutter-stage-cogl.c
@@ -223,6 +223,16 @@ clutter_stage_cogl_clear_update_time (ClutterStageWindow *stage_window)
stage_cogl->update_time = -1;
}
+static void
+clutter_stage_cogl_begin_frame (ClutterStageWindow *stage_window,
+ gint64 frame_time)
+{
+ ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
+
+ if (stage_cogl->onscreen != NULL)
+ cogl_onscreen_begin_frame (stage_cogl->onscreen, frame_time);
+}
+
static ClutterActor *
clutter_stage_cogl_get_wrapper (ClutterStageWindow *stage_window)
{
@@ -596,6 +606,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
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;
+ iface->begin_frame = clutter_stage_cogl_begin_frame;
iface->add_redraw_clip = clutter_stage_cogl_add_redraw_clip;
iface->has_redraw_clips = clutter_stage_cogl_has_redraw_clips;
iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]