cex100: Add an API to configure the buffering mode of the GDL plane

GDL planes can be double or triple buffered. Let the user choose between
the two modes befored initalizing Clutter.
This commit is contained in:
Damien Lespiau 2010-08-28 12:06:11 +01:00
parent 01fcd11efd
commit 0a0a59cf7b
3 changed files with 40 additions and 10 deletions

View File

@ -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;
}

View File

@ -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.
*
* <note>This function has to be called before clutter_init()</note>
*/
void clutter_cex100_set_buffering_mode (ClutterCex100BufferingMode mode);
G_END_DECLS
#endif /* __CLUTTER_CEX100_H__ */

View File

@ -1839,6 +1839,8 @@ clutter_eglx_display
<TITLE>Intel CE3100, CE4100 Specific Support</TITLE>
<FILE>clutter-cex100</FILE>
clutter_cex100_set_plane
ClutterCex100BufferingMode
clutter_cex100_set_buffering_mode
</SECTION>
<SECTION>