1
0
Fork 0
Commit graph

185 commits

Author SHA1 Message Date
Emmanuele Bassi
f1ebfe30ce stage-manager: Store the stage manager into the main context
Use the main context to store the stage manager singleton, instead of a
static pointer inside clutter-stage-manager.c.
2011-11-14 15:43:20 +00:00
Emmanuele Bassi
e8562089f6 main: Add a sync-to-vblank global flag
It replaces the per-backend CLUTTER_VBLANK environment variable.
2011-11-10 14:55:02 +00:00
Emmanuele Bassi
1776ac8ed5 Remove internal usage of ClutterGeometry in StageWindow
The ClutterGeometry type is a poor substitute of cairo_rectangle_int_t,
with unsigned integers for width and height to complicate matters.

Let's remove the internal usage of ClutterGeometry and switch to the
rectangle type from Cairo.

https://bugzilla.gnome.org/show_bug.cgi?id=656663
2011-09-26 12:05:55 +01:00
Emmanuele Bassi
63a05fca9d Lock the main context when modifying the repaint functions list
The repaint functions list can (and should) be manipulated from
different threads, but it currently doesn't prevent multiple threads
from accessing it concurrently. We should have a simple lock and take it
when adding and removing elements from the list; the invocation is still
performed under the Big Clutter Lock™, so it doesn't require special
handling.
2011-09-01 17:12:46 +01:00
Robert Bragg
32487af55b Adds a CLUTTER_NEARBYINT macro for float rounding
This is a replacement for the nearbyint function which always rounds to
the nearest integer. nearbyint is a C99 function so it might not always
be available but also it seems in glibc it is defined as a function call
so this macro could end up faster anyway. We can't just add 0.5 because
it will break for negative numbers.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-07-14 13:54:05 +01:00
Emmanuele Bassi
d5ea422c8f stage: Maintain the motion event delivery invariants
It is possible, by calling clutter_set_motion_events_enabled() prior to
the creation of any stage, to control the per-actor motion event
delivery flag on each newly created stage. Since we deprecated the
global accessor functions in favour of the per-Stage ones, we need to
remove the call to clutter_get_motion_events_enabled() inside the
ClutterStage instance initialization, and replace it with an internal
function.

This code will go away when we can finally break API and remove the
deprecated functions.
2011-06-20 13:53:09 +01:00
Emmanuele Bassi
2b81d90dd7 Eliminate G_CONST_RETURN
The G_CONST_RETURN define in GLib is, and has always been, a bit fuzzy.

We always used it to conform to the platform, at least for public-facing
API.

At first I assumed it has something to do with brain-damaged compilers
or with weird platforms where const was not really supported; sadly,
it's something much, much worse: it's a define that can be toggled at
compile-time to remove const from the signature of public API. This is a
truly terrifying feature that I assume was added in the past century,
and whose inception clearly had something to do with massive doses of
absynthe and opium — because any other explanation would make the
existence of such a feature even worse than assuming drugs had anything
to do with it.

Anyway, and pleasing the gods, this dubious feature is being
removed/deprecated in GLib; see bug:

  https://bugzilla.gnome.org/show_bug.cgi?id=644611

Before deprecation, though, we should just remove its usage from the
whole API. We should especially remove its usage from Cally's internals,
since there it never made sense in the first place.
2011-06-07 16:06:24 +01:00
Neil Roberts
7d233241f1 Fix include location for cogl-pango.h
In Cogl, cogl-pango.h has moved to <cogl-pango/cogl-pango.h>. When
using the experimental 2.0 API (which Clutter does) it is no longer
possible to include it under the old name of <cogl/cogl-pango.h> so we
need to update the include location.
2011-05-16 16:04:27 +01:00
Emmanuele Bassi
043f804452 Make the pick id pool per Stage
The id pool used for the actor's id should be a per-stage field. At some
point, we might have a Stage mapped to multiple framebuffers, or each
Stage mapped to a different framebuffer; also, on backend with low
color precision we don't want to exhaust the size of the available ids
with a global pool. Finally, it's yet another thing we can remove from
the global Clutter context.

Having the id pool allocated per-stage, and the pick id assigned on
Actor:mapped will make the whole pick-id more reliable and future proof.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2633

https://bugzilla.gnome.org/show_bug.cgi?id=647876
2011-05-06 17:47:41 +01:00
Robert Bragg
223e14811c Removes Cogl from the repository
Cogl has now been split out into a standalone project with a separate
repository at git://git.gnome.org/cogl. From now on the Clutter build
will now simply look for a cogl-1.0 pkg-config file to find a suitable
Cogl library to link against at build time.
2011-05-06 15:44:08 +01:00
Robert Bragg
70767f08dc Adds a --with-system-cogl config option for Clutter
This makes it possible to build Clutter against a standalone build of
Cogl instead of having the Clutter build traverse into the clutter/cogl
subdirectory.
2011-04-11 17:54:36 +01:00
Robert Bragg
ec0b781466 stage: Move _clutter_do_pick to clutter-stage.c
This moves the implementation of _clutter_do_pick to clutter-stage.c and
renames it _clutter_stage_do_pick. This function can be compared to
_clutter_stage_do_update/redraw in that it prepares for and starts a
traversal of a scenegraph descending from a given stage. Since it is
desirable that this function should have access to the private state of
the stage it is awkward to maintain outside of clutter-stage.c.

Besides moving _clutter_do_pick this patch is also able to remove the
following private state accessors from clutter-stage-private.h:
_clutter_stage_set_pick_buffer_valid,
_clutter_stage_get_pick_buffer_valid,
_clutter_stage_increment_picks_per_frame_counter,
_clutter_stage_reset_picks_per_frame_counter and
_clutter_stage_get_picks_per_frame_counter.
2011-04-11 14:31:31 +01:00
Robert Bragg
19b8622983 Optimize culling by doing culling in eye-coordinates
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.
2011-03-07 13:26:20 +00:00
Robert Bragg
013b2433f0 viewport: consistently use floats for viewports
OpenGL < 4.0 only supports integer based viewports and internally we
have a mixture of code using floats and integers for viewports. This
patch switches all viewports throughout clutter and cogl to be
represented using floats considering that in the future we may want to
take advantage of floating point viewports with modern hardware/drivers.
2011-03-07 13:26:19 +00:00
Jasper St. Pierre
0c576c0c33 Remove private helper #define's
Finish off the second half of 09a830d294.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2596
2011-03-03 11:47:49 +00:00
Emmanuele Bassi
7e42da123f Clean up clutter-private.h
Move macros at the top, and clean up whitespace.
2011-02-18 16:53:58 +00:00
Emmanuele Bassi
3e5aa9ed63 Add private header for event-related API 2011-02-18 16:35:36 +00:00
Emmanuele Bassi
d27b335b61 Move ClutterEffect private symbols to a private header
No point in cluttering up clutter-private.h even more than necessary.
2011-02-18 16:00:39 +00:00
Emmanuele Bassi
37fe8c509a Clean up usage of CLUTTER_CONTEXT and remove the macro
Only allow access to the ClutterMainContext through the private
_clutter_context_get_default() function, so we can easily grep
it and remove the unwanted usage of the global context.
2011-02-18 15:47:35 +00:00
Emmanuele Bassi
689aac56c9 Wrap id-pool access
The ClutterIdPool is held by the ClutterMainContext; we should hide its
direct usage into sensible private API.
2011-02-18 15:46:13 +00:00
Emmanuele Bassi
2593bbaadc Wrap shader stack into private functions
The shader stack held by ClutterMainContext should only be accessed
using functions, and not directly.

Since it's a stack, we can use stack-like operations: push, pop and
peek.
2011-02-18 15:44:17 +00:00
Emmanuele Bassi
28b0f8b938 stage: Make the redraw_count a stage counter
We don't care about redraws issued on stages that are not currently
being repainted.
2011-02-18 14:38:54 +00:00
Emmanuele Bassi
4635c8f9fd Make _clutter_pixel_to_id() private
It's only used in the same file that declares it.
2011-02-18 14:38:24 +00:00
Emmanuele Bassi
92ddaa9c13 stage: Move stage redraw logic into clutter-stage.c
The _clutter_do_redraw() function should really be moved inside
ClutterStage, since all it does is calling private stage and
backend functions. This also allows us to change a long-standing
issue with a global fps counter for all stages, instead of a\
per-stage one.
2011-02-18 12:56:17 +00:00
Emmanuele Bassi
89a0d514b4 Continue hiding the ClutterMainContext
We should strive to make the main context as transparent as possible,
and hide accessing its data through private functions.
2011-02-18 12:56:13 +00:00
Emmanuele Bassi
95f6359f64 Intern clutter_get_actor_by_gid() implementation
As the prelude to deprecation of the function in 1.8, let's move the
implementation to an internal function, and use that instead of the
public facing one.
2011-02-09 15:27:24 +00:00
Emmanuele Bassi
719e3b7e20 Clean up ClutterMainContext and clutter-private.h
Do a better job at documenting the main context structure fields; remove
unused members; clean up the declarations.
2011-02-09 13:36:54 +00:00
Emmanuele Bassi
ef4688fd0e Avoid direct access to the main context events queue
The GQueue that stores the global events queue is handled all over the
place:

  • the structure is created in _clutter_backend_init_events();
  • the queue is handled in clutter-event.c, clutter-stage.c and
    clutter-backend.c;
  • ClutterStage::dispose cleans up the events associated with
    the stage being destroyed;
  • the queue is destroyed in ClutterBackend::dispose.

Since we need to have access to it in different places we cannot put it
inside ClutterBackendPrivate, hence it should stay in ClutterMainContext;
but we should still manage it from just one place - preferably by the
ClutterEvent API only.
2011-02-09 13:34:25 +00:00
Emmanuele Bassi
a3102a777e docs: Fill out documentation for new symbols 2011-01-21 10:25:44 +00:00
Emmanuele Bassi
1b1e77b469 event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.

The new design for handling X11 event translation works this way:

  - ClutterBackend::translate_event() has been added as the central
    point used by a ClutterBackend implementation to translate a
    native event into a ClutterEvent;

  - ClutterEventTranslator is a private interface that should be
    implemented by backend-specific objects, like stage
    implementations and ClutterDeviceManager sub-classes, and
    allows dealing with class-specific event translation;

  - ClutterStageX11 implements EventTranslator, and deals with the
    stage-relative X11 events coming from the X11 event source;

  - ClutterStageGLX overrides EventTranslator, in order to
    deal with the INTEL_GLX_swap_event extension, and it chains up
    to the X11 default implementation;

  - ClutterDeviceManagerX11 has been split into two separate classes,
    one that deals with core and (optionally) XI1 events, and the
    other that deals with XI2 events; the selection is done at run-time,
    since the core+XI1 and XI2 mechanisms are mutually exclusive.

All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-21 10:25:43 +00:00
Emmanuele Bassi
38912ee4d9 Deprecate ClutterFrameSource
The FrameSource API hasn't been used internally since 1.0; since it's
not part of the paint clock, it is of limited use.
2010-11-06 20:11:16 +00:00
Emmanuele Bassi
46c597a1f6 Clean up clutter-private.h/6
Move all Actor private API to a separate file.
2010-10-21 12:22:17 +01:00
Emmanuele Bassi
cf3a29f224 Clean up clutter-private.h/5
Move PaintVolume private API to a separate header.
2010-10-21 12:22:17 +01:00
Emmanuele Bassi
43edfc9400 Clean up clutter-private.h/4
Move the private Backend API to a separate header.

This also allows us to finally move the class vtable and instance
structure to a separate file and plug the visibility hole that left
the Backend class bare for everyone to poke into.
2010-10-21 12:22:17 +01:00
Emmanuele Bassi
8613013ab0 Clean up clutter-private.h/3
Move Stage private API to a separate header.
2010-10-21 11:33:26 +01:00
Emmanuele Bassi
999c063784 Clean up clutter-private.h/2
Move StageManager private API to a different header.
2010-10-21 11:30:19 +01:00
Emmanuele Bassi
c1771d152e Clean up clutter-private.h/1
Move DeviceManager/InputDevice private API to a different header.
2010-10-21 10:54:14 +01:00
Emmanuele Bassi
7dd09e2186 Use G_DEFINE_BOXED_TYPE for all boxed types
We actually need a couple more macros for registering GValue
transformation functions. Those should be added to upstream
GLib.
2010-10-18 11:26:45 +01:00
Emmanuele Bassi
09a830d294 Remove conditional wrappers for property installation/notification
For the time being, just keep the #define's.
2010-10-18 11:26:45 +01:00
Emmanuele Bassi
f753b0c4a1 Wrap g_object_class_install_properties()
GObject ≥ 2.26.0 added a nice convenience call for installing properties
from an array of GParamSpec. Since we're already storing all GParamSpec
in an array in order to use them with g_object_notify_by_pspec(), this
turns out nicely for us.

Since we do not depend on GLib 2.26 (yet), we need to provide a simple
private wrapper that implements the fall back to the default
g_object_class_install_property() call.

ClutterDragAction has been converted as a proof of concept.
2010-09-30 10:33:24 +01:00
Robert Bragg
51fca9d968 actor: Adds private _clutter_actor_traverse API
This adds two internal functions relating to explicit traversal of the
scenegraph:
_clutter_actor_foreach_child
_clutter_actor_traverse

_clutter_actor_foreach_child just iterates the immediate children of an
actor, and with a new ClutterForeachCallback type it allows the
callbacks to break iteration early.

_clutter_actor_traverse traverses the given actor and all of its
decendants. Again traversal can be stopped early if a callback returns
FALSE.

The first intended use for _clutter_actor_traverse is to maintain a
cache pointer to the stage for all actors. In this case we will need to
update the pointer for all descendants of an actor when an actor is
reparented in any way.
2010-09-29 15:13:01 +01:00
Robert Bragg
9a1abbc713 actor: Adds private _clutter_actor_get_n_children
This adds a private getter to query the number of children an actor has.
One use planned for this API is to avoid calling get_paint_volume on
such actors. (It's not clear what the best semantics for
get_paint_volume are for actors with children, so we are considering
leaving the semantics undefined for the initial clutter 1.4 release)
2010-09-29 15:13:01 +01:00
Robert Bragg
3b789490d2 actor: defer queue-redraw signaling
Instead of immediately, recursively emitting the "queue-redraw" signal
when clutter_actor_queue_redraw is called we now defer this process
until all stage updates are complete. This allows us to aggregate
repeated _queue_redraw requests for the same actor avoiding redundant
paint volume transformations. By deferring we also increase the
likelihood that the actor will have a valid paint volume since it will
have an up to date allocation; this in turn means we will more often be
able to automatically queue clipped redraws which can have a big impact
on performance.

Here's an outline of the actor queue redraw mechanism:

The process starts in clutter_actor_queue_redraw or
_clutter_actor_queue_redraw_with_clip.

These functions queue an entry in a list associated with the stage which
is a list of actors that queued a redraw while updating the timelines,
performing layouting and processing other mainloop sources before the
next paint starts.

We aim to minimize the processing done at this point because there is a
good chance other events will happen while updating the scenegraph that
would invalidate any expensive work we might otherwise try to do here.
For example we don't try and resolve the screen space bounding box of an
actor at this stage so as to minimize how much of the screen redraw
because it's possible something else will happen which will force a full
redraw anyway.

When all updates are complete and we come to paint the stage (see
_clutter_stage_do_update) then we iterate this list and actually emit
the "queue-redraw" signals for each of the listed actors which will
bubble up to the stage for each actor and at that point we will
transform the actors paint volume into screen coordinates to determine
the clip region for what needs to be redrawn in the next paint.

Note: actors are allowed to queue a redraw in reseponse to a
queue-redraw signal so we repeat the processing of the list until it
remains empty. An example of when this happens is for Clone actors or
clutter_texture_new_from_actor actors which need to queue a redraw if
their source queues a redraw.
2010-09-29 15:13:00 +01:00
Robert Bragg
7d8effd5e2 paint_volume: add private api to change reference actor
For Clone actors we will need a way to report the volume of the source
actor as the volume of the clone actor. To make this work though we need
to be able to replace the reference to the source actor with a reference
to the clone actor instead. This adds a private
_clutter_paint_volume_set_reference_actor function to do that.
2010-09-29 15:13:00 +01:00
Robert Bragg
2d895816be paint_volume: Adds _clutter_paint_volume_set_from_volume
This adds a way to initialize a paint volume from another source paint
volume. This lets us for instance pass the contents of one paint volume
back through the out param of a get_paint_volume implementation.
2010-09-29 15:13:00 +01:00
Emmanuele Bassi
16f7ee13f2 Move default paint volume computation into a function
This should reduce the amount of copy and paste for actor sub-classes
that use the default paint volume from the allocation.
2010-09-29 15:13:00 +01:00
Robert Bragg
3040b140bc paint_volume: Splits out clutter_paint_volume code
This splits out all the clutter_paint_volume code from clutter-actor.c
into clutter-paint-volume.c. Since clutter-actor.c and
clutter-paint-volume.c both needed the functionality of
_fully_transform_vertices, this function has now been moved to
clutter-utils.c as _clutter_util_fully_transform_vertices.
2010-09-29 15:13:00 +01:00
Robert Bragg
b499696d83 Use paint volumes to do automatic culling
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.
2010-09-29 15:12:58 +01:00
Robert Bragg
13c4d7b95d actor: make _transform_and_project_box static
This makes _clutter_actor_transform_and_project_box a static function
and removes the prototype from clutter-private.h since it is no longer
used outside clutter-actor.c
2010-09-29 15:12:58 +01:00
Robert Bragg
1ea7145efc Queue clipped redraws work in terms of paint volumes
There is an internal _clutter_actor_queue_redraw_with_clip API that gets
used for texture-from-pixmap to minimize what we redraw in response to
Damage events. It was previously working in terms of a ClutterActorBox
but it has now been changed so an actor can queue a redraw of volume
instead.

The plan is that clutter_actor_queue_redraw will start to transparently
use _clutter_actor_queue_redraw_with_clip when it can determine a paint
volume for the actor.
2010-09-29 15:12:57 +01:00