diff --git a/clutter/egl/clutter-backend-cex100.c b/clutter/egl/clutter-backend-cex100.c index d93d5bc1b..caf31a611 100644 --- a/clutter/egl/clutter-backend-cex100.c +++ b/clutter/egl/clutter-backend-cex100.c @@ -38,6 +38,7 @@ #include "clutter-cex100.h" static gdl_plane_id_t gdl_plane = GDL_PLANE_ID_UPP_C; +static guint gdl_n_buffers = CLUTTER_CEX100_TRIPLE_BUFFERING; G_DEFINE_TYPE (ClutterBackendCex100, clutter_backend_cex100, @@ -122,17 +123,8 @@ gdl_plane_init (gdl_display_id_t dpy, if (rc == GDL_SUCCESS) rc = gdl_plane_set_attr (GDL_PLANE_DST_RECT, &dstRect); -#if 0 - /* - * Change the number of back buffers for the eglWindowSurface, Default - * value is 3, could be changed to 2, means one front buffer and one back - * buffer. - * - * TODO: Make a new API to tune that; - */ if (rc == GDL_SUCCESS) - rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES, 2); -#endif + rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES, gdl_n_buffers); if (rc == GDL_SUCCESS) rc = gdl_plane_config_end (GDL_FALSE); @@ -365,3 +357,12 @@ clutter_cex100_set_plane (gdl_plane_id_t plane) gdl_plane = plane; } + +void +clutter_cex100_set_buffering_mode (ClutterCex100BufferingMode mode) +{ + g_return_if_fail (mode == CLUTTER_CEX100_DOUBLE_BUFFERING || + mode == CLUTTER_CEX100_TRIPLE_BUFFERING); + + gdl_n_buffers = mode; +} diff --git a/clutter/egl/clutter-cex100.h.in b/clutter/egl/clutter-cex100.h.in index 835365f42..54a53738b 100644 --- a/clutter/egl/clutter-cex100.h.in +++ b/clutter/egl/clutter-cex100.h.in @@ -59,6 +59,33 @@ G_BEGIN_DECLS */ void clutter_cex100_set_plane (gdl_plane_id_t plane); +/** + * ClutterCex100BufferingMode: + * @CLUTTER_CEX100_DOUBLE_BUFFERING: The GDL plane will be double buffered + * @CLUTTER_CEX100_TRIPLE_BUFFERING: The GDL plane will be triple buffered + * + * Enum passed to clutter_cex100_set_buffering_mode(). + */ +typedef enum /*< prefix=CLUTTER_CEX100 >*/ +{ + CLUTTER_CEX100_DOUBLE_BUFFERING = 2, + CLUTTER_CEX100_TRIPLE_BUFFERING = 3 +} ClutterCex100BufferingMode; + +/** + * clutter_cex100_set_buffering_mode: + * @mode: a #ClutterCex100BufferingMode + * + * Configure the buffering mode of the underlying GDL plane. The GDL + * surface used by Clutter to draw can be backed up by either one or two + * back buffers thus being double or triple buffered, respectively. + * + * Clutter defaults to #CLUTTER_CEX100_TRIPLE_BUFFERING. + * + * This function has to be called before clutter_init() + */ +void clutter_cex100_set_buffering_mode (ClutterCex100BufferingMode mode); + G_END_DECLS #endif /* __CLUTTER_CEX100_H__ */ diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt index 7844a8c0c..3059a74fe 100644 --- a/doc/reference/clutter/clutter-sections.txt +++ b/doc/reference/clutter/clutter-sections.txt @@ -1839,6 +1839,8 @@ clutter_eglx_display Intel CE3100, CE4100 Specific Support clutter-cex100 clutter_cex100_set_plane +ClutterCex100BufferingMode +clutter_cex100_set_buffering_mode