GNOME Bugzilla – Bug 744668
GDK: integrate the MasterClock mechanism with GdkFrameClock
Last modified: 2015-02-17 19:14:15 UTC
Attached are a couple of to implement a special MasterClock for the GDK backend, so we can be synchronized with the compositor from a Clutter application. I left some code in comment in clutter/gdk/clutter-master-clock-gdk.c, this is because I'm still looking for ideas to support CLUTTER_DEBUG_CONTINUOUS_REDRAW. Maybe this only option is to have something similar in GdkFrameClock.
Created attachment 297031 [details] [review] main: Make the MasterClock an interface Move the implementation of the MasterClock into MasterClockDefault, so backends can provide their own implementation.
Created attachment 297032 [details] [review] gdk: implement a MasterClock based on GdkFrameClock
fun segfault that happens when closing examples/canvas:
+ Trace 234660
the stage pointer is valid, but the private data is garbage: (gdb) print stage $1 = (ClutterStage *) 0x216e480 (gdb) print stage->priv $2 = (ClutterStagePrivate *) 0x630 (gdb) print *stage->priv Cannot access memory at address 0x630 which means that some reference is leaking, as the frame clock is trying to update a closed stage.
Created attachment 297035 [details] [review] main: Make the MasterClock an interface Move the implementation of the MasterClock into MasterClockDefault, so backends can provide their own implementation.
Created attachment 297036 [details] [review] gdk: implement a MasterClock based on GdkFrameClock
It was just that the default master clock uses the peek_stages() that allows the list to be modified as run the clock update. Therefore in the latest step, when updating the stages, the list might have become empty. The GDK master clock didn't handle that case :( Thanks!
Review of attachment 297035 [details] [review]: looks generally good; some minor coding style nitpicking. ::: clutter/clutter-master-clock.c @@ +46,1 @@ +G_DEFINE_INTERFACE (ClutterMasterClock, clutter_master_clock, G_TYPE_OBJECT); remove the trailing semi-colon. @@ +56,3 @@ ClutterMainContext *context = _clutter_context_get_default (); + if (G_UNLIKELY (context->master_clock == NULL)) { coding style: braces on a new line. @@ +129,3 @@ } +void _clutter_master_clock_set_paused (ClutterMasterClock *master_clock, coding style: new line between return value and function name.
Created attachment 297045 [details] [review] main: Make the MasterClock an interface Move the implementation of the MasterClock into MasterClockDefault, so backends can provide their own implementation.
Review of attachment 297036 [details] [review]: looks generally okay; a couple nitpicks. ::: clutter/gdk/clutter-master-clock-gdk.h @@ +25,3 @@ +#define __CLUTTER_MASTER_CLOCK_GDK_H__ + +#include <clutter/clutter-timeline.h> unnecessary include; you can use <glib-object.h> or <clutter/clutter-types.h>. @@ +42,3 @@ +}; + +GType _clutter_master_clock_gdk_get_type (void) G_GNUC_CONST; no need to use a leading underscore.
Review of attachment 297045 [details] [review]: looks good.
Created attachment 297051 [details] [review] gdk: implement a MasterClock based on GdkFrameClock
Removed the commented code and put a g_warning instead, saying continuous-redraw is not supported with the GDK backend.
Review of attachment 297051 [details] [review]: looks good.
Review of attachment 297045 [details] [review]: Pushed to master.
Review of attachment 297051 [details] [review]: Pushed to master too. Thanks!