Merge branch 'master' into msvc-support-master

This commit is contained in:
Chun-wei Fan 2011-11-16 09:15:16 +08:00
commit d3a9bf201b
11 changed files with 295 additions and 253 deletions

View File

@ -52,15 +52,10 @@ typedef enum {
/* Try the GCC extension for valists in macros */
#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \
{ _clutter_profile_trace_message ("[" #type "] " \
{ _clutter_profile_trace_message ("[" #type "]:" \
G_STRLOC ": " x, ##a); } \
} G_STMT_END
#define CLUTTER_TIMESTAMP(type,x,a...) G_STMT_START { \
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \
{ g_message ("[" #type "]" " %li:" G_STRLOC ": " \
x, clutter_get_timestamp(), ##a); } \
} G_STMT_END
#else /* !__GNUC__ */
/* Try the C99 version; unfortunately, this does not allow us to pass
* empty arguments to the macro, which means we have to
@ -70,25 +65,13 @@ typedef enum {
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \
{ \
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
_clutter_profile_trace_message ("[" #type "] " \
G_STRLOC ": %s",_fmt); \
_clutter_profile_trace_message ("[" #type "]:" \
G_STRLOC ": %s",_fmt); \
g_free (_fmt); \
} \
} G_STMT_END
#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { \
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \
{ \
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
g_message ("[" #type "]" " %li:" G_STRLOC ": %s", \
clutter_get_timestamp(), _fmt); \
g_free (_fmt); \
} \
} G_STMT_END
} } G_STMT_END
#endif
#define CLUTTER_MARK() CLUTTER_NOTE(MISC, "== mark ==")
#define CLUTTER_DBG(x) { a }
#define CLUTTER_GLERR() G_STMT_START { \
if (clutter_debug_flags & CLUTTER_DEBUG_GL) { \
@ -102,9 +85,7 @@ typedef enum {
#define CLUTTER_NOTE(type,...) G_STMT_START { } G_STMT_END
#define CLUTTER_MARK() G_STMT_START { } G_STMT_END
#define CLUTTER_DBG(x) G_STMT_START { } G_STMT_END
#define CLUTTER_GLERR() G_STMT_START { } G_STMT_END
#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { } G_STMT_END
#define CLUTTER_HAS_DEBUG(type) FALSE
#endif /* CLUTTER_ENABLE_DEBUG */
@ -113,6 +94,11 @@ extern guint clutter_debug_flags;
extern guint clutter_pick_debug_flags;
extern guint clutter_paint_debug_flags;
void _clutter_debug_messagev (const char *format,
va_list var_args);
void _clutter_debug_message (const char *format,
...);
G_END_DECLS
#endif /* __CLUTTER_DEBUG_H__ */

View File

@ -74,13 +74,13 @@ struct _ClutterDeformEffectPrivate
gint x_tiles;
gint y_tiles;
CoglHandle vbo;
CoglAttributeBuffer *buffer;
CoglHandle indices;
CoglHandle back_indices;
gint n_indices;
CoglPrimitive *primitive;
CoglTextureVertex *vertices;
CoglPrimitive *lines_primitive;
gint n_vertices;
gulong allocation_id;
@ -170,12 +170,14 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
{
ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect);
ClutterDeformEffectPrivate *priv = self->priv;
gboolean is_depth_enabled, is_cull_enabled;
CoglHandle material;
gint n_tiles;
CoglPipeline *pipeline;
CoglDepthState depth_state;
if (priv->is_dirty)
{
gboolean mapped_buffer;
CoglVertexP3T2C4 *verts;
ClutterActor *actor;
gfloat width, height;
guint opacity;
@ -190,125 +192,127 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
if (!clutter_offscreen_effect_get_target_size (effect, &width, &height))
clutter_actor_get_size (actor, &width, &height);
/* XXX ideally, the sub-classes should tell us what they
* changed in the texture vertices; we then would be able to
* avoid resubmitting the same data, if it did not change. for
* the time being, we resubmit everything
*/
verts = cogl_buffer_map (COGL_BUFFER (priv->buffer),
COGL_BUFFER_ACCESS_WRITE,
COGL_BUFFER_MAP_HINT_DISCARD);
/* If the map failed then we'll resort to allocating a temporary
buffer */
if (verts == NULL)
{
mapped_buffer = FALSE;
verts = g_malloc (sizeof (*verts) * priv->n_vertices);
}
else
mapped_buffer = TRUE;
for (i = 0; i < priv->y_tiles + 1; i++)
{
for (j = 0; j < priv->x_tiles + 1; j++)
{
CoglTextureVertex *vertex;
CoglVertexP3T2C4 *vertex_out;
CoglTextureVertex vertex;
vertex = &priv->vertices[(i * (priv->x_tiles + 1)) + j];
/* CoglTextureVertex isn't an ideal structure to use for
this because it contains a CoglColor. The internal
layout of CoglColor is mean to be private so Clutter
can not pass a pointer to it as a vertex
attribute. Also it contains padding so we end up
storing more data in the vertex buffer than we need
to. Instead we let the application modify a dummy
vertex and then copy the details back out to a more
well-defined struct */
vertex->tx = (float) j / priv->x_tiles;
vertex->ty = (float) i / priv->y_tiles;
vertex.tx = (float) j / priv->x_tiles;
vertex.ty = (float) i / priv->y_tiles;
vertex->x = width * vertex->tx;
vertex->y = height * vertex->ty;
vertex->z = 0.0f;
vertex.x = width * vertex.tx;
vertex.y = height * vertex.ty;
vertex.z = 0.0f;
cogl_color_init_from_4ub (&vertex->color, 255, 255, 255, opacity);
cogl_color_init_from_4ub (&vertex.color, 255, 255, 255, opacity);
_clutter_deform_effect_deform_vertex (self, width, height, vertex);
_clutter_deform_effect_deform_vertex (self,
width, height,
&vertex);
vertex_out = verts + i * (priv->x_tiles + 1) + j;
vertex_out->x = vertex.x;
vertex_out->y = vertex.y;
vertex_out->z = vertex.z;
vertex_out->s = vertex.tx;
vertex_out->t = vertex.ty;
vertex_out->r = cogl_color_get_red_byte (&vertex.color);
vertex_out->g = cogl_color_get_green_byte (&vertex.color);
vertex_out->b = cogl_color_get_blue_byte (&vertex.color);
vertex_out->a = cogl_color_get_alpha_byte (&vertex.color);
}
}
/* XXX in theory, the sub-classes should tell us what they changed
* in the texture vertices; we then would be able to avoid resubmitting
* the same data, if it did not change. for the time being, we resubmit
* everything
*/
cogl_vertex_buffer_add (priv->vbo, "gl_Vertex",
3,
COGL_ATTRIBUTE_TYPE_FLOAT,
FALSE,
sizeof (CoglTextureVertex),
&priv->vertices->x);
cogl_vertex_buffer_add (priv->vbo, "gl_MultiTexCoord0",
2,
COGL_ATTRIBUTE_TYPE_FLOAT,
FALSE,
sizeof (CoglTextureVertex),
&priv->vertices->tx);
cogl_vertex_buffer_add (priv->vbo, "gl_Color",
4,
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE,
FALSE,
sizeof (CoglTextureVertex),
&priv->vertices->color);
if (mapped_buffer)
cogl_buffer_unmap (COGL_BUFFER (priv->buffer));
else
{
cogl_buffer_set_data (COGL_BUFFER (priv->buffer),
0, /* offset */
verts,
sizeof (*verts) * priv->n_vertices);
g_free (verts);
}
priv->is_dirty = FALSE;
}
/* enable depth test, if it's not already enabled */
is_depth_enabled = cogl_get_depth_test_enabled ();
if (!is_depth_enabled)
cogl_set_depth_test_enabled (TRUE);
material = clutter_offscreen_effect_get_target (effect);
pipeline = COGL_PIPELINE (material);
/* enable backface culling if it's not already enabled and if
* we have a back material
*/
is_cull_enabled = cogl_get_backface_culling_enabled ();
if (priv->back_material != COGL_INVALID_HANDLE && !is_cull_enabled)
cogl_set_backface_culling_enabled (TRUE);
else if (priv->back_material == COGL_INVALID_HANDLE && is_cull_enabled)
cogl_set_backface_culling_enabled (FALSE);
/* enable depth testing */
cogl_depth_state_init (&depth_state);
cogl_depth_state_set_test_enabled (&depth_state, TRUE);
cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL);
n_tiles = (priv->x_tiles + 1) * (priv->y_tiles + 1);
/* enable backface culling if we have a back material */
if (priv->back_material != COGL_INVALID_HANDLE)
cogl_pipeline_set_cull_face_mode (pipeline,
COGL_PIPELINE_CULL_FACE_MODE_BACK);
/* draw the front */
material = clutter_offscreen_effect_get_target (effect);
if (material != COGL_INVALID_HANDLE)
{
cogl_set_source (material);
cogl_vertex_buffer_draw_elements (priv->vbo,
COGL_VERTICES_MODE_TRIANGLE_STRIP,
priv->indices,
0,
n_tiles,
0,
priv->n_indices);
cogl_push_source (pipeline);
cogl_primitive_draw (priv->primitive);
cogl_pop_source ();
}
/* draw the back */
material = priv->back_material;
if (material != COGL_INVALID_HANDLE)
if (priv->back_material != COGL_INVALID_HANDLE)
{
cogl_set_source (priv->back_material);
cogl_vertex_buffer_draw_elements (priv->vbo,
COGL_VERTICES_MODE_TRIANGLE_STRIP,
priv->back_indices,
0,
n_tiles,
0,
priv->n_indices);
CoglPipeline *back_pipeline;
/* We probably shouldn't be modifying the user's material so
instead we make a temporary copy */
back_pipeline = cogl_pipeline_copy (priv->back_material);
cogl_pipeline_set_depth_state (back_pipeline, &depth_state, NULL);
cogl_pipeline_set_cull_face_mode (pipeline,
COGL_PIPELINE_CULL_FACE_MODE_FRONT);
cogl_push_source (back_pipeline);
cogl_primitive_draw (priv->primitive);
cogl_pop_source ();
cogl_object_unref (back_pipeline);
}
/* restore the previous state */
if (!is_depth_enabled)
cogl_set_depth_test_enabled (FALSE);
if (priv->back_material != COGL_INVALID_HANDLE && !is_cull_enabled)
cogl_set_backface_culling_enabled (FALSE);
else if (priv->back_material == COGL_INVALID_HANDLE && is_cull_enabled)
cogl_set_backface_culling_enabled (TRUE);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DEFORM_TILES))
if (G_UNLIKELY (priv->lines_primitive != NULL))
{
cogl_set_source_color4f (1.0, 0, 0, 1.0);
cogl_vertex_buffer_draw_elements (priv->vbo,
COGL_VERTICES_MODE_LINE_STRIP,
priv->indices,
0,
n_tiles,
0,
priv->n_indices);
cogl_vertex_buffer_draw_elements (priv->vbo,
COGL_VERTICES_MODE_LINE_STRIP,
priv->back_indices,
0,
n_tiles,
0,
priv->n_indices);
cogl_primitive_draw (priv->lines_primitive);
}
}
@ -317,39 +321,43 @@ clutter_deform_effect_free_arrays (ClutterDeformEffect *self)
{
ClutterDeformEffectPrivate *priv = self->priv;
if (priv->vbo != COGL_INVALID_HANDLE)
if (priv->buffer)
{
cogl_handle_unref (priv->vbo);
priv->vbo = COGL_INVALID_HANDLE;
cogl_object_unref (priv->buffer);
priv->buffer = NULL;
}
if (priv->indices != COGL_INVALID_HANDLE)
if (priv->primitive)
{
cogl_handle_unref (priv->indices);
priv->indices = COGL_INVALID_HANDLE;
cogl_object_unref (priv->primitive);
priv->primitive = NULL;
}
g_free (priv->vertices);
priv->vertices = NULL;
if (priv->lines_primitive)
{
cogl_object_unref (priv->lines_primitive);
priv->lines_primitive = NULL;
}
}
static void
clutter_deform_effect_init_arrays (ClutterDeformEffect *self)
{
ClutterDeformEffectPrivate *priv = self->priv;
GLushort *static_indices, *static_back_indices;
GLushort *idx, *back_idx;
gint x, y, direction;
gint n_tiles;
gint x, y, direction, n_indices;
CoglAttribute *attributes[3];
guint16 *static_indices;
CoglIndices *indices;
guint16 *idx;
int i;
clutter_deform_effect_free_arrays (self);
priv->n_indices = (2 + 2 * priv->x_tiles)
* priv->y_tiles
+ (priv->y_tiles - 1);
n_indices = ((2 + 2 * priv->x_tiles)
* priv->y_tiles
+ (priv->y_tiles - 1));
static_indices = g_new (GLushort, priv->n_indices);
static_back_indices = g_new (GLushort, priv->n_indices);
static_indices = g_new (guint16, n_indices);
#define MESH_INDEX(x,y) ((y) * (priv->x_tiles + 1) + (x))
@ -361,11 +369,6 @@ clutter_deform_effect_init_arrays (ClutterDeformEffect *self)
idx[1] = MESH_INDEX (0, 1);
idx += 2;
back_idx = static_back_indices;
back_idx[0] = MESH_INDEX (priv->x_tiles, 0);
back_idx[1] = MESH_INDEX (priv->x_tiles, 1);
back_idx += 2;
for (y = 0; y < priv->y_tiles; y++)
{
for (x = 0; x < priv->x_tiles; x++)
@ -374,21 +377,14 @@ clutter_deform_effect_init_arrays (ClutterDeformEffect *self)
{
idx[0] = MESH_INDEX (x + 1, y);
idx[1] = MESH_INDEX (x + 1, y + 1);
back_idx[0] = MESH_INDEX (priv->x_tiles - (x + 1), y);
back_idx[1] = MESH_INDEX (priv->x_tiles - (x + 1), y + 1);
}
else
{
idx[0] = MESH_INDEX (priv->x_tiles - x - 1, y);
idx[1] = MESH_INDEX (priv->x_tiles - x - 1, y + 1);
back_idx[0] = MESH_INDEX (x + 1, y);
back_idx[1] = MESH_INDEX (x + 1, y + 1);
}
idx += 2;
back_idx += 2;
}
if (y == (priv->y_tiles - 1))
@ -399,45 +395,83 @@ clutter_deform_effect_init_arrays (ClutterDeformEffect *self)
idx[0] = MESH_INDEX (priv->x_tiles, y + 1);
idx[1] = MESH_INDEX (priv->x_tiles, y + 1);
idx[2] = MESH_INDEX (priv->x_tiles, y + 2);
back_idx[0] = MESH_INDEX (0, y + 1);
back_idx[1] = MESH_INDEX (0, y + 1);
back_idx[2] = MESH_INDEX (0, y + 2);
}
else
{
idx[0] = MESH_INDEX (0, y + 1);
idx[1] = MESH_INDEX (0, y + 1);
idx[2] = MESH_INDEX (0, y + 2);
back_idx[0] = MESH_INDEX (priv->x_tiles, y + 1);
back_idx[1] = MESH_INDEX (priv->x_tiles, y + 1);
back_idx[2] = MESH_INDEX (priv->x_tiles, y + 2);
}
idx += 3;
back_idx += 3;
direction = !direction;
}
#undef MESH_INDEX
priv->indices =
cogl_vertex_buffer_indices_new (COGL_INDICES_TYPE_UNSIGNED_SHORT,
static_indices,
priv->n_indices);
priv->back_indices =
cogl_vertex_buffer_indices_new (COGL_INDICES_TYPE_UNSIGNED_SHORT,
static_back_indices,
priv->n_indices);
indices = cogl_indices_new (COGL_INDICES_TYPE_UNSIGNED_SHORT,
static_indices,
n_indices);
g_free (static_indices);
g_free (static_back_indices);
n_tiles = (priv->x_tiles + 1) * (priv->y_tiles + 1);
priv->vertices = g_new (CoglTextureVertex, n_tiles);
priv->vbo = cogl_vertex_buffer_new (n_tiles);
priv->n_vertices = (priv->x_tiles + 1) * (priv->y_tiles + 1);
priv->buffer =
cogl_attribute_buffer_new (sizeof (CoglVertexP3T2C4) *
priv->n_vertices,
NULL);
/* The application is expected to continuously modify the vertices
so we should give a hint to Cogl about that */
cogl_buffer_set_update_hint (COGL_BUFFER (priv->buffer),
COGL_BUFFER_UPDATE_HINT_DYNAMIC);
attributes[0] = cogl_attribute_new (priv->buffer,
"cogl_position_in",
sizeof (CoglVertexP3T2C4),
G_STRUCT_OFFSET (CoglVertexP3T2C4, x),
3, /* n_components */
COGL_ATTRIBUTE_TYPE_FLOAT);
attributes[1] = cogl_attribute_new (priv->buffer,
"cogl_tex_coord0_in",
sizeof (CoglVertexP3T2C4),
G_STRUCT_OFFSET (CoglVertexP3T2C4, s),
2, /* n_components */
COGL_ATTRIBUTE_TYPE_FLOAT);
attributes[2] = cogl_attribute_new (priv->buffer,
"cogl_color_in",
sizeof (CoglVertexP3T2C4),
G_STRUCT_OFFSET (CoglVertexP3T2C4, r),
4, /* n_components */
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
priv->primitive =
cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLE_STRIP,
priv->n_vertices,
attributes,
3 /* n_attributes */);
cogl_primitive_set_indices (priv->primitive,
indices,
n_indices);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DEFORM_TILES))
{
priv->lines_primitive =
cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_LINE_STRIP,
priv->n_vertices,
attributes,
2 /* n_attributes */);
cogl_primitive_set_indices (priv->lines_primitive,
indices,
n_indices);
}
cogl_object_unref (indices);
for (i = 0; i < 3; i++)
cogl_object_unref (attributes[i]);
priv->is_dirty = TRUE;
}

View File

@ -462,11 +462,23 @@ clutter_config_read (void)
* Return value: %TRUE if Clutter should show the FPS.
*
* Since: 0.4
*
* Deprecated: 1.10: This function does not do anything. Use the environment
* variable or the configuration file to determine whether Clutter should
* print out the FPS counter on the console.
*/
gboolean
clutter_get_show_fps (void)
{
return clutter_show_fps;
return FALSE;
}
gboolean
_clutter_context_get_show_fps (void)
{
ClutterMainContext *context = _clutter_context_get_default ();
return context->show_fps;
}
/**
@ -1291,18 +1303,16 @@ clutter_threads_leave (void)
/**
* clutter_get_debug_enabled:
*
* Check if clutter has debugging turned on.
* Check if Clutter has debugging enabled.
*
* Return value: TRUE if debugging is turned on, FALSE otherwise.
* Return value: %FALSE
*
* Deprecated: 1.10: This function does not do anything.
*/
gboolean
clutter_get_debug_enabled (void)
{
#ifdef CLUTTER_ENABLE_DEBUG
return clutter_debug_flags != 0;
#else
return FALSE;
#endif
}
void
@ -1393,11 +1403,6 @@ clutter_context_get_default_unlocked (void)
ctx->settings = clutter_settings_get_default ();
_clutter_settings_set_backend (ctx->settings, ctx->backend);
#ifdef CLUTTER_ENABLE_DEBUG
ctx->timer = g_timer_new ();
g_timer_start (ctx->timer);
#endif
ctx->motion_events_per_actor = TRUE;
ctx->last_repaint_id = 1;
}
@ -1422,30 +1427,30 @@ _clutter_context_get_default (void)
/**
* clutter_get_timestamp:
*
* Returns the approximate number of microseconds passed since clutter was
* Returns the approximate number of microseconds passed since Clutter was
* intialised.
*
* Return value: Number of microseconds since clutter_init() was called.
* This function shdould not be used by application code.
*
* The output of this function depends on whether Clutter was configured to
* enable its debugging code paths, so it's less useful than intended.
*
* Since Clutter 1.10, this function is an alias to g_get_monotonic_time()
* if Clutter was configured to enable the debugging code paths.
*
* Return value: Number of microseconds since clutter_init() was called, or
* zero if Clutter was not configured with debugging code paths.
*
* Deprecated: 1.10: Use #GTimer or g_get_monotonic_time() for a proper
* timing source
*/
gulong
clutter_get_timestamp (void)
{
#ifdef CLUTTER_ENABLE_DEBUG
ClutterMainContext *ctx;
gdouble seconds;
_clutter_context_lock ();
ctx = clutter_context_get_default_unlocked ();
/* FIXME: may need a custom timer for embedded setups */
seconds = g_timer_elapsed (ctx->timer, NULL);
_clutter_context_unlock ();
return (gulong)(seconds / 1.0e-6);
return (gulong) g_get_monotonic_time ();
#else
return 0;
return 0L;
#endif
}
@ -1772,10 +1777,10 @@ post_parse_hook (GOptionContext *context,
}
clutter_context->frame_rate = clutter_default_fps;
clutter_context->show_fps = clutter_show_fps;
clutter_context->options_parsed = TRUE;
/*
* If not asked to defer display setup, call clutter_init_real(),
/* If not asked to defer display setup, call clutter_init_real(),
* which in turn calls the backend post parse hooks.
*/
if (!clutter_context->defer_display_setup)
@ -2641,7 +2646,7 @@ _clutter_process_event (ClutterEvent *event)
if (stage == NULL)
return;
CLUTTER_TIMESTAMP (EVENT, "Event received");
CLUTTER_NOTE (EVENT, "Event received");
context->last_event_time = clutter_event_get_time (event);
@ -3720,3 +3725,29 @@ _clutter_get_sync_to_vblank (void)
{
return clutter_sync_to_vblank;
}
void
_clutter_debug_messagev (const char *format,
va_list var_args)
{
gchar *stamp, *fmt;
stamp = g_strdup_printf ("[%16" G_GINT64_FORMAT "]",
g_get_monotonic_time ());
fmt = g_strconcat (stamp, ":", format, NULL);
g_free (stamp);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, var_args);
g_free (fmt);
}
void
_clutter_debug_message (const char *format, ...)
{
va_list args;
va_start (args, format);
_clutter_debug_messagev (format, args);
va_end (args);
}

View File

@ -98,9 +98,6 @@ gint clutter_main_level (void);
void clutter_do_event (ClutterEvent *event);
/* Debug utility functions */
gboolean clutter_get_debug_enabled (void);
gboolean clutter_get_show_fps (void);
gulong clutter_get_timestamp (void);
gboolean clutter_get_accessibility_enabled (void);
/* Threading functions */

View File

@ -134,9 +134,6 @@ struct _ClutterMainContext
/* the main event queue */
GQueue *events_queue;
/* timer used to print the FPS count */
GTimer *timer;
ClutterPickMode pick_mode;
/* mapping between reused integer ids and actors */
@ -180,6 +177,7 @@ struct _ClutterMainContext
guint motion_events_per_actor : 1;
guint defer_display_setup : 1;
guint options_parsed : 1;
guint show_fps : 1;
};
/* shared between clutter-main.c and clutter-frame-source.c */
@ -206,6 +204,7 @@ ClutterActor * _clutter_context_peek_shader_stack (void);
guint32 _clutter_context_acquire_id (gpointer key);
void _clutter_context_release_id (guint32 id_);
gboolean _clutter_context_get_motion_events_enabled (void);
gboolean _clutter_context_get_show_fps (void);
const gchar *_clutter_gettext (const gchar *str);

View File

@ -1,11 +1,11 @@
#ifdef CLUTTER_ENABLE_PROFILE
#include <stdlib.h>
/* XXX - we need this for g_atexit() */
#define G_DISABLE_DEPRECATION_WARNINGS
#include "clutter-profile.h"
#include <stdlib.h>
UProfContext *_clutter_uprof_context;
static UProfReport *clutter_uprof_report;
@ -287,12 +287,10 @@ _clutter_profile_trace_message (const char *format, ...)
va_list ap;
va_start (ap, format);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, ap);
_clutter_debug_messagev (format, ap);
va_end (ap);
if (_clutter_uprof_context)
if (_clutter_uprof_context != NULL)
uprof_context_vtrace_message (_clutter_uprof_context, format, ap);
}
#endif

View File

@ -19,12 +19,8 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef _CLUTTER_PROFILE_H_
#define _CLUTTER_PROFILE_H_
#ifndef __CLUTTER_PROFILE_H__
#define __CLUTTER_PROFILE_H__
#include <glib.h>
@ -39,7 +35,8 @@ typedef enum {
#include <uprof.h>
extern UProfContext *_clutter_uprof_context;
extern UProfContext * _clutter_uprof_context;
extern guint clutter_profile_flags;
#define CLUTTER_STATIC_TIMER UPROF_STATIC_TIMER
#define CLUTTER_STATIC_COUNTER UPROF_STATIC_COUNTER
@ -48,35 +45,27 @@ extern UProfContext *_clutter_uprof_context;
#define CLUTTER_TIMER_START UPROF_TIMER_START
#define CLUTTER_TIMER_STOP UPROF_TIMER_STOP
void
_clutter_uprof_init (void);
void
_clutter_profile_suspend (void);
void
_clutter_profile_resume (void);
void
_clutter_profile_trace_message (const char *format, ...);
void _clutter_uprof_init (void);
void _clutter_profile_suspend (void);
void _clutter_profile_resume (void);
void _clutter_profile_trace_message (const char *format, ...);
#else /* CLUTTER_ENABLE_PROFILE */
#define CLUTTER_STATIC_TIMER(A,B,C,D,E) extern void _clutter_dummy_decl (void)
#define CLUTTER_STATIC_COUNTER(A,B,C,D) extern void _clutter_dummy_decl (void)
#define CLUTTER_COUNTER_INC(A,B) G_STMT_START{ (void)0; }G_STMT_END
#define CLUTTER_COUNTER_DEC(A,B) G_STMT_START{ (void)0; }G_STMT_END
#define CLUTTER_TIMER_START(A,B) G_STMT_START{ (void)0; }G_STMT_END
#define CLUTTER_TIMER_STOP(A,B) G_STMT_START{ (void)0; }G_STMT_END
#define CLUTTER_COUNTER_INC(A,B) G_STMT_START{ (void)0; }G_STMT_END
#define CLUTTER_COUNTER_DEC(A,B) G_STMT_START{ (void)0; }G_STMT_END
#define CLUTTER_TIMER_START(A,B) G_STMT_START{ (void)0; }G_STMT_END
#define CLUTTER_TIMER_STOP(A,B) G_STMT_START{ (void)0; }G_STMT_END
#define _clutter_profile_suspend() G_STMT_START {} G_STMT_END
#define _clutter_profile_resume() G_STMT_START {} G_STMT_END
#define _clutter_profile_suspend() G_STMT_START {} G_STMT_END
#define _clutter_profile_resume() G_STMT_START {} G_STMT_END
#define _clutter_profile_trace_message g_message
#define _clutter_profile_trace_message _clutter_debug_message
#endif /* CLUTTER_ENABLE_PROFILE */
extern guint clutter_profile_flags;
G_END_DECLS
#endif /* _CLUTTER_PROFILE_H_ */

View File

@ -1034,16 +1034,16 @@ clutter_stage_do_redraw (ClutterStage *stage)
ClutterActor *actor = CLUTTER_ACTOR (stage);
ClutterStagePrivate *priv = stage->priv;
CLUTTER_TIMESTAMP (SCHEDULER, "Redraw started for %s[%p]",
_clutter_actor_get_debug_name (actor),
stage);
CLUTTER_NOTE (PAINT, "Redraw started for stage '%s'[%p]",
_clutter_actor_get_debug_name (actor),
stage);
_clutter_stage_set_pick_buffer_valid (stage, FALSE, -1);
priv->picks_per_frame = 0;
_clutter_backend_ensure_context (backend, stage);
if (clutter_get_show_fps ())
if (_clutter_context_get_show_fps ())
{
if (priv->fps_timer == NULL)
priv->fps_timer = g_timer_new ();
@ -1053,7 +1053,7 @@ clutter_stage_do_redraw (ClutterStage *stage)
_clutter_backend_redraw (backend, stage);
if (clutter_get_show_fps ())
if (_clutter_context_get_show_fps ())
{
priv->timer_n_frames += 1;
@ -1068,9 +1068,9 @@ clutter_stage_do_redraw (ClutterStage *stage)
}
}
CLUTTER_TIMESTAMP (SCHEDULER, "Redraw finished for %s[%p]",
_clutter_actor_get_debug_name (actor),
stage);
CLUTTER_NOTE (PAINT, "Redraw finished for stage '%s'[%p]",
_clutter_actor_get_debug_name (actor),
stage);
}
/**

View File

@ -1759,13 +1759,11 @@ clutter_texture_async_load_complete (ClutterTexture *self,
static gboolean
texture_repaint_upload_func (gpointer user_data)
{
gulong start_time;
g_mutex_lock (&upload_list_mutex);
if (upload_list != NULL)
{
start_time = clutter_get_timestamp ();
gint64 start_time = g_get_monotonic_time ();
/* continue uploading textures as long as we havent spent more
* then 5ms doing so this stage redraw cycle.
@ -1794,7 +1792,8 @@ texture_repaint_upload_func (gpointer user_data)
upload_list = g_list_remove (upload_list, async_data);
clutter_texture_async_data_free (async_data);
}
while (upload_list && clutter_get_timestamp () < start_time + 5 * 1000);
while (upload_list != NULL &&
g_get_monotonic_time () < start_time + 5 * 1000000L);
}
if (upload_list != NULL)

View File

@ -600,9 +600,9 @@ clutter_timeline_do_frame (ClutterTimeline *timeline)
g_object_ref (timeline);
CLUTTER_TIMESTAMP (SCHEDULER, "Timeline [%p] activated (cur: %ld)\n",
timeline,
(long) priv->elapsed_time);
CLUTTER_NOTE (SCHEDULER, "Timeline [%p] activated (cur: %ld)\n",
timeline,
(long) priv->elapsed_time);
/* Advance time */
if (priv->direction == CLUTTER_TIMELINE_FORWARD)

View File

@ -51,6 +51,15 @@ void clutter_ungrab_pointer_for_device (gint
CLUTTER_DEPRECATED
void clutter_set_default_frame_rate (guint frames_per_sec);
CLUTTER_DEPRECATED
gulong clutter_get_timestamp (void);
CLUTTER_DEPRECATED
gboolean clutter_get_debug_enabled (void);
CLUTTER_DEPRECATED
gboolean clutter_get_show_fps (void);
G_END_DECLS
#endif /* __CLUTTER_MAIN_DEPRECATED_H__ */