Since we have a _clutter_debug_message() function compiled in
unconditionally we have no further need for the equivalent conditional
version defined in clutter-profile.[ch]: we can simply do the work in
one function.
Make it consistent across the various build options (with or without
profiling enabled), and add a timestamp using the monotonic clock to
every debug message.
The CLUTTER_DEBUG class of debugging flags is meant for debugging notes,
while the CLUTTER_PAINT debugging flags are for changing the output of
the paint cycle. Painting the DeformEffect tiles should go in the latter.
When testing the performance of an application, it's often useful to
force it to continuously redraw instead of going idle to help measure
the frame rate. This just adds a CLUTTER_PAINT=continuous-redraw which
causes the master clock to queue a redraw on all of the stages
just before it prepares its source.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Out-of-band transforms are considered to be all actor transforms done
directly with the Cogl API instead of via ClutterActor::apply_transform.
By running with CLUTTER_DEBUG=oob-transform then Clutter will explicitly
try to detect when un-expected transforms have been applied to the
modelview matrix stack.
Out-of-band transforms can lead to awkward bugs in Clutter applications
because Clutter itself doesn't know about them and this can disrupt
Clutter's input handling and calculations of actor paint-volumes
which can lead to visual artifacts.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
This adds CLUTTER_PAINT=disable-offscreen-redirect to help diagnose
problems with the correct opacity changes. This just makes it so that
it never installs the flatten effect so it will never automatically
redirect an actor offscreen.
This implements a variation of frustum culling whereby we convert screen
space clip rectangles into eye space mini-frustums so that we don't have
to repeatedly transform actor paint-volumes all the way into screen
coordinates to perform culling, we just have to apply the modelview
transform and then determine each points distance from the planes that
make up the clip frustum.
By avoiding the projective transform, perspective divide and viewport
scale for each point culled this makes culling much cheaper.
Implementation of event loop which works with GLib events, native OS X
events and Clutter events.
The event loop source code comes from the equivalent code in the Quartz
GDK backend from GTK+ 2.22.1, which is LGPL v2.1+ and thus compatible
with Clutter's licensing terms.
The code has been tested with libsoup, which did not work before together
with Clutter.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
http://bugzilla.clutter-project.org/show_bug.cgi?id=2490
This uses actor paint volumes to perform culling during
clutter_actor_paint.
When performing a clipped redraw (because only a few localized actors
changed) then as we traverse the scenegraph painting the actors we can
now ignore actors that don't intersect the clip region. Early testing
shows this can have a big performance benefit; e.g. 100% fps improvement
for test-state with culling enabled and we hope that there are even much
more compelling examples than that in the real world,
Most Clutter applications are 2Dish interfaces and have quite a lot of
actors that get continuously painted when anything is animated. The
dynamic actors are often localized to an area of user focus though so
with culling we can completely avoid painting any of the static actors
outside the current clip region.
Obviously the cost of culling has to be offset against the cost of
painting to determine if it's a win, but our (limited) testing suggests
it should be a win for most applications.
Note: we hope we will be able to also bring another performance bump
from culling with another iteration - hopefully in the 1.6 cycle - to
avoid doing the culling in screen space and instead do it in the stage's
model space. This will hopefully let us minimize the cost of
transforming the actor volumes for culling.
This adds a debug option to visualize the paint volumes of all actors.
When CLUTTER_PAINT=paint-volumes is exported in the environment before
running a Clutter application then all actors will have their bounding
volume drawn in green with a label corresponding to the actors type.
When building with --enable-profile we now depend on the uprof-0.3
developer release which brings a few improvements:
» It lets us "fix" how we initialize uprof so that instead of using a shared
object constructor/destructor (which was a hack used when first adding
uprof support to Clutter) we can now initialize as part of clutter's
normal initialization code. As a side note though, I found that the way
Clutter initializes has some quite serious problems whenever it
involves GOptionGroups. It is not able to guarantee the initialization
of dependencies like uprof and Cogl. For this reason we still use the
contructor/destructor approach to initialize uprof in Cogl.
» uprof-0.3 provides a better API for adding custom columns when reporting
timer and counter statistics which lets us remove quite a lot of manual
report generation code in clutter-profile.c.
» uprof-0.3 provides a shared context for tracking mainloop timer
statistics. This means any mainloop based library following the same
"Mainloop" timer naming convention can use the shared context and no
matter who ends up owning the final mainloop the statistics will always
be in the same place. This allows profiling of Clutter with an
external mainloop such as with the Mutter compositor.
» uprof-0.3 can export statistics over dbus and comes with an ncurses
based ui to vizualize timer and counter stats live.
The latest version of uprof can be cloned from:
git://github.com/rib/UProf.git
Debugging code is not meant to be run in the nominal code path. Use
G_UNLIKELY to be reduce the number of bubbles in the instruction
pipeline.
Took the opportunity to re-indent the macros.
A new (internal only currently) API, _clutter_actor_queue_clipped_redraw
can be used to queue a redraw along with a clip rectangle in actor
coordinates. This clip rectangle propagates up to the stage and clutter
backend which may optionally use the information to optimize stage
redraws. The GLX backend in particular may scissor the next redraw to
the clip rectangle and use GLX_MESA_copy_sub_buffer to present the stage
subregion.
The intention is that any actors that can naturally determine the bounds
of updates should queue clipped redraws to reduce the cost of updating
small regions of the screen.
Notes:
» If GLX_MESA_copy_sub_buffer isn't available then the GLX backend
ignores any clip rectangles.
» queuing multiple clipped redraws will result in the bounding box of
each clip rectangle being used.
» If a clipped redraw has a height > 300 pixels then it's promoted into
a full stage redraw, so that the GPU doesn't end up blocking too long
waiting for the vsync to reach the optimal position to avoid tearing.
» Note: no empirical data was used to come up with this threshold so
we may need to tune this.
» Currently only ClutterX11TexturePixmap makes use of this new API. This
is done via a new "queue-damage-redraw" signal that is emitted when
the pixmap is updated. The default handler queues a clipped redraw
with the assumption that the pixmap is being painted as a rectangle
covering the actors transformed allocation. If you subclass
ClutterX11TexturePixmap and change how it's painted you now also
need to override the signal handler and queue your own redraw.
Technically this is a semantic break, but it's assumed that no one
is currently doing this.
This still leaves a few unsolved issues with regards to optimizing sub
stage redraws that need to be addressed in further work so this can only
be considered a stepping stone a this point:
» Because we have no reliable way to determine if the painting of any
given actor is being modified any optimizations implemented using
_clutter_actor_queue_redraw_with_clip must be overridable by a
subclass, and technically must be opt-in for existing classes to avoid
a change in semantics. E.g. consider that a user connects to the paint
signal for ClutterTexture and paints a circle instead of a rectangle.
In this case any original logic to queue clipped redraws would be
incorrect.
» Currently only the implementation of an actor has enough information
with which to queue clipped redraws. E.g. It is not possible for
generic code in clutter-actor.c to queue a clipped redraw when hiding
an actor because actors have no way to report a "paint box". (remember
actors can draw outside their allocation and actors with depth may
also be projected outside of their allocation)
» The current plan is to add a actor_class->get_paint_cuboid()
virtual so actors can report a bounding cube for everything they
would draw in their current state and use that to queue clipped
redraws against the stage by projecting the paint cube into stage
coordinates.
» Our heuristics for promoting clipped redraws into full redraws to
avoid blocking the GPU while we wait for the vsync need improving:
» vsync issues aren't relevant for redirected/composited applications
so they should use different heuristics. In this case we instead
need to trade off the cost of blitting when using glXCopySubBuffer
vs promoting to a full redraw and flipping instead.
Some of the ClutterDebugFlags are not meant as a logging facility: they
actually change Clutter's behaviour at run-time.
It would be useful to have this distinction ratified, and thus split
ClutterDebugFlags into two: one DebugFlags for logging facilities and
another set of flags for behavioural changes.
This split is warranted because:
• it should be possible to do "CLUTTER_DEBUG=all" and only have
log messages on the output
• it should be possible to use behavioural modifiers even on a
Clutter that has been compiled without debugging messages
support
The commit adds two new debugging flags:
ClutterPickDebugFlags - controlled by the CLUTTER_PICK environment
variable
ClutterPaintDebugFlags - controlled by the CLUTTER_PAINT environment
variable
The PickDebugFlags are:
nop-picking
dump-pick-buffers
While the PaintDebugFlags is:
disable-swap-events
The mechanism is equivalent to the CLUTTER_DEBUG environment variable,
but it does not depend on the debug level selected when configuring and
compiling Clutter. The picking and painting debugging flags are
initialized at clutter_init() time.
http://bugzilla.openedhand.com/show_bug.cgi?id=1991
Now if you export CLUTTER_DEBUG=dump-pick-buffers clutter will write out a
png, e.g. pick-buffer-00000.png, each time _clutter_to_pick() is called.
It's a rather crude way to debug the picking (realtime visualization in a
second stage would probably be nicer) but it we've used this approach
successfully numerous times when debugging Clutter picking issues so it
makes sense to have a debug option for it.
The right gcc define is __GNUC__ not __GNUC_. This typo had the side
effect that we were using the non gcc specific debug macros leading to
a less optmised CLUTTER_NOTE () than one could have dreamed of.
I've found this is something I do quite often when debugging rendering
problems since its a simple way to wipe out lots of geometry and removes a
lot of unpredictable noise when logging geometry passing through the Cogl
journal.
If we need to check that the layout sequence is correct in
terms of order of execution and with respect to caching, then
having a CLUTTER_DEBUG_LAYOUT debug flag would make things
easier.
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
* clutter/clutter-score.h: Rearrange declarations.
* clutter/clutter-score.c: More documentation in the long
description of the ClutterScore section.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add the CLUTTER_DEBUG_SHADER flag,
for debugging the shader calls.
* clutter/clutter-feature.h: Fix the documentation of the
feature flags.
* clutter/Makefile.am: Remove trailing whitespace.
Portability fixes:
* clutter/clutter-private.h:
Bracket #include "unistd.h" with #ifdef HAVE_UNISTD_H
* clutter/clutter-fixed.c:
Use "", not <> for inclusion of local files.
(clutter_sqrtx): forward declare local variables.
* clutter/clutter-debug.h:
Added non-gcc (c99) implementation of variadic debug macros for
when not compiling with gcc.
* clutter/pango/pangoclutter-render.c:
Fixed some strange uses of CLUTTER_NOTE() + stripped trailing
whitespace.
Initial implementation of the UI definition files. (#424)
* clutter/json/Makefile.am:
* clutter/json/*.[ch]: In-tree copy of JSON-GLib, a GLib-based
JSON parser/generator library. We use it in-tree because we might
need to change the API. Ideally, we'd depend on it.
* clutter/clutter.h:
* clutter/clutter-script-private.h:
* clutter/clutter-script.[ch]: ClutterScript, the scenegraph
generator class. It parses JSON streams in form of buffers and
files and builds the scene.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a "script" debug flag
* clutter/Makefile.am: Build glue.
* tests/Makefile.am:
* tests/test-script.c: Add a test case for the ClutterScript.
* configure.ac: Depend on GLib 2.14, so we can use the
g_hash_table_get_key() and g_hash_table_get_values() functions
for the time being; we can probably reimplement those, but we
are going to need 2.14 anyway if we are going to implement a
list model using GSequence.
* clutter/Makefile.am:
* clutter/clutter-debug.h:
* clutter/clutter-fixed.h:
* clutter/clutter-main.c:
* clutter/cogl/gles/Makefile.am:
* clutter/cogl/gles/cogl-defines.h:
* clutter/cogl/gles/cogl.c:
* clutter/egl/clutter-backend-egl.c:
* clutter/egl/clutter-backend-egl.h:
* clutter/egl/clutter-stage-egl.c:
* configure.ac:
Populate most stubs for cogl GL/ES implementation.
(against vincent - see http://svn.o-hand.com/repos/misc/ogles)
Add various fixups to EGL backend.
Code builds and runs (on 16bpp) but yet displays much (is close!)
* clutter/pango/pangoclutter-render.c:
comment out some rouge glBegin/end calls.
* clutter/clutter-actor.c:
* clutter/clutter-alpha.c:
* clutter/clutter-behaviour-opacity.c:
* clutter/clutter-behaviour-scale.c:
* clutter/clutter-clone-texture.c:
* clutter/clutter-feature.c:
* clutter/clutter-label.c:
* clutter/clutter-main.c:
* clutter/clutter-stage.c:
* clutter/clutter-texture.c
* clutter/clutter-timeline.c:
* clutter/clutter-debug.h:
Make CLUTTER_NOTE() just take a string rather than a func.
Add more default context to output.
* configure.ac:
Fix flag and add more help docs for --ebable-debug option.
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.