Commit Graph

77 Commits

Author SHA1 Message Date
Adel Gadllah
5de85051c3 Make sure GLX_SGI_swap_control is set up correctly
glXSwapIntervalSGI only affects buffer swaps to the
current GLX drawable.

That means that calling it once in clutter_backend_glx_get_features
isn't sufficent, so set it up in clutter_backend_glx_ensure_context to
make sure it affects buffer swaps for the current drawable.

http://bugzilla.openedhand.com/show_bug.cgi?id=2044

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-22 11:23:55 +00:00
José Dapena Paz
6bd1846d6c Fix argb initialisation.
Fix clutter initialisation if argb visuals are enabled, setting a border
color on creating the dummy window. This should avoid BadMatch happening
when the depth of the root window visual is not the same of the depth
of the argb visual.

http://bugzilla.openedhand.com/show_bug.cgi?id=2011

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-10 00:13:37 +00:00
Robert Bragg
c0d5af5de5 Adds initial clipped redraw support to Clutter
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.
2010-03-02 17:19:11 +00:00
Emmanuele Bassi
79acb088e7 Remove mentions of the FSF address
Since using addresses that might change is something that finally
the FSF acknowledge as a plausible scenario (after changing address
twice), the license blurb in the source files should use the URI
for getting the license in case the library did not come with it.

Not that URIs cannot possibly change, but at least it's easier to
set up a redirection at the same place.

As a side note: this commit closes the oldes bug in Clutter's bug
report tool.

http://bugzilla.openedhand.com/show_bug.cgi?id=521
2010-03-01 12:56:10 +00:00
Emmanuele Bassi
9db135c4ef glx: Clean up sync-to-vblank mechanism discovery
The code has gotten really complicated to follow.

As soon as we have a sync-to-vblank mechanism we should just bail out.

Also, __GL_SYNC_TO_VBLANK (which is used by nVidia) should be assumed
equivalent to a CLUTTER_VBLANK_GLX_SWAP.
2010-02-25 18:56:39 +00:00
Emmanuele Bassi
a9941e9499 debug: Split debugging notes from behavioural modifiers
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
2010-02-23 14:39:23 +00:00
Robert Bragg
8c9472bc4c cogl: deprecates cogl_check_extension
OpenGL is an implementation detail for Cogl so it's not appropriate to
expose OpenGL extensions through the Cogl API.

Note: Clutter is currently still using this API, because it is still
doing raw GL calls in ClutterGLXTexturePixmap, so this introduces a
couple of (legitimate) build warnings while compiling Clutter.
2010-02-12 14:05:00 +00:00
Robert Bragg
1899dbdc27 backend-glx: Fix glXQueryVersion test
This fixes some backwards logic for asserting that we have a GLX major
version == 1 and a minor version >= 2. (NB: Although we technically
depend on GLX 1.3 features, we still have to support drivers that report
GLX 1.2 because there are a lot of mesa drivers out there incorrectly
report GLX 1.2 even though they export extensions that depend on GLX
1.3)
2010-02-10 15:04:53 +00:00
Robert Bragg
4a9f08639f debug: Adds CLUTTER_DEBUG=disable-swap-events option
This allows us to forcibly disable the use of the GLX_INTEL_swap_events
extension for testing or debugging purposes.
2010-02-09 22:19:41 +00:00
Robert Bragg
5d702853b8 glx backend: Adds support for GLX_INTEL_swap_event
If your OpenGL driver supports GLX_INTEL_swap_event that means when
glXSwapBuffers is called it returns immediatly and an XEvent is sent when
the actual swap has finished.

Clutter can use the events that notify swap completion as a means to
throttle rendering in the master clock without blocking the CPU and so it
should help improve the performance of CPU bound applications.
2010-02-09 22:19:41 +00:00
Robert Bragg
848db1ee4c glx backend: when running with GLX 1.3 then create GLXWindows for stages
Some extensions only support GLX versions > 1.3 and may not support
old style X Windows as GLXDrawables, so we now create GLXWindows for
stages when possible.
2010-02-09 22:19:41 +00:00
Neil Roberts
1f70da62a7 glx: Create a colormap for the dummy window
Otherwise X will fail to create the window and throw a BadMatch error
at least on NVidia.
2010-02-04 16:35:42 +00:00
Emmanuele Bassi
466b00a806 glx: Clarify *why* we need the dummy window
The reason why we have a dummy, offscreen Window when we create the
GLX context is that GLX does not like it when you ask the context for
features if it's not made current to a Drawable. Maybe in the future
it will allow us to do so, but right now we have to make do with what
GLX offers us.
2010-02-04 13:59:39 +00:00
Emmanuele Bassi
ea5e33cf3a glx: Do not leak a XVisualInfo
The XVisualInfo we retrieve for the dummy window should be freed after
we used it.
2010-02-04 13:56:33 +00:00
Emmanuele Bassi
479fdffc7d glx: Fix error messages and debug notes
Instead of using g_critical() inside the create_context() implementation
of the ClutterBackendGLX we should use the passed GError, so that the
error message can bubble up to the caller.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
d2c091e62d glx: Create the dummy Window with the GLX context
Since we must guarantee that Cogl has a GL context to query, it is too
late to use the "dummy Window" trick from within the get_features()
virtual function implementation.

Instead, we can create a dummy Window from create_context() itself and
leave it around - basically trading a default stage with a dummy X
window.

We need to have the dummy X window around all the time so that the
GLX context can be selected and made current.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
6fbed66add Delay default stage creation
The default stage creation should be delayed as much as possible,
ideally at the end of the init() process.
2010-02-03 16:34:27 +00:00
Robert Bragg
0057755854 profiling: Adds initial UProf support across clutter
UProf is a small library that aims to help applications/libraries provide
domain specific reports about performance.  It currently provides high
precision timer primitives (rdtsc on x86) and simple counters, the ability
to link statistics between optional components at runtime and makes report
generation easy.

This adds initial accounting for:
- Total mainloop time
- Painting
- Picking
- Layouting
- Idle time

The timing done by uprof is of wall clock time. It's not based on stochastic
samples we simply sample a counter at the start and end.  When dealing with
the complexities of GPU drivers and with various kinds of IO this form of
profiling can be quite enlightening as it will be able to represent where
your application is blocking unlike tools such as sysprof.

To enable uprof accounting you must configure Clutter with --enable-profile
and have uprof-0.2 installed from git://git.moblin.org/uprof

If you want to see a report of statistics when Clutter applications exit you
should export CLUTTER_PROFILE_OUTPUT_REPORT=1 before running them.

Just a final word of caution; this stuff is new and the manual nature of
adding uprof instrumentation means it is prone to some errors when modifying
code.  This just means that when you question strange results don't rule out
a mistake in the instrumentation.  Obviously though we hope the benfits out
weigh e.g.  by focusing on very key stats and by having automatic reporting.
2010-01-08 20:19:49 +00:00
Emmanuele Bassi
5157da9fc8 x11: Switch back to RGB visuals by default
Since asking for ARGB by default is still somewhat experimental on X11
and not every toolkit or complex widgets (like WebKit) still do not like
dealing with ARGB visuals, we should switch back to RGB by default - now
that at least we know it works.

For applications (and toolkit integration libraries) that want to enable
the ClutterStage:use-alpha property there is a new function:

  void clutter_x11_set_use_argb_visual (gboolean use_argb);

which needs to be called before clutter_init().

The CLUTTER_DISABLE_ARGB_VISUAL environment variable can still be used
to force this value off at run-time.
2010-01-08 15:09:21 +00:00
Neil Roberts
821e622de6 Don't set the GLX_TRANSPARENT_TYPE attribute to choose an FBConfig
When Clutter tries to pick an ARGB visual it tried to set the
GLX_TRANSPARENT_TYPE attribute of the FBConfig to
GLX_TRANSPARENT_RGB. However the code to do this was broken so that it
was actually trying to set the non-existant attribute number 0x8008
instead. Mesa silently ignored this so it appeared as if it was
working but the Nvidia drivers do not like it.

It appears that the TRANSPARENT_TYPE attribute is not neccessary for
getting an ARGB visual anyway and instead it is intended to support
color-key transparency. Therefore we can just remove it and get all of
the FBConfigs. Then if we need an ARGB visual we can just walk the
list to look for one with depth == 32.

The fbconfig is now stored in a single variable instead of having a
separate variable for the rgb and rgba configs because the old code
only ever retrieved one of them anyway.
2010-01-07 15:58:53 +00:00
Emmanuele Bassi
e6ca2d891a glx: Always request an ARGB visual
When requesting the GLXFBConfig for creating the GLX context, we should
always request one that links to an ARGB visual instead of a plain RGB
one.

By using an ARGB visual we allow the ClutterStage:use-alpha property to
work as intended when running Clutter under a compositing manager.

The default behaviour of requesting an ARGB visual can be disabled by
using the:

  CLUTTER_DISABLE_ARGB_VISUAL

Environment variable.
2009-12-01 16:25:54 +00:00
Robert Bragg
3187e19642 [x11 backend] remove data duplicated between backends and stages
Make backends the canonical point of reference for the xdisplay, the xscreen
number, the x root window and the xvisinfo for creating foreign stages.
2009-10-16 18:58:48 +01:00
Robert Bragg
63414ab233 [glx backend] white space fixes
Simply removes lots of trailing white spaces
2009-10-16 18:58:48 +01:00
Robert Bragg
45a668bef8 [glx backend] use FBConfigs instead of Visuals for GL context creation
This replaces calls to the old (glx 1.2) functions glXChooseVisual,
glXCreateContext, glXMakeCurrent with the 1.3+ fbconfig varients
glXChooseFBConfig, glXCreateNewContext, glXMakeContextCurrent.
2009-10-16 18:58:48 +01:00
Robert Bragg
15d7a86621 [backends] Remove the idea of offscreen stages from all backends
The only backend that tried to implement offscreen stages was the GLX backend
and even this has apparently be broken for some time without anyone noticing.

The property still remains and since the property already clearly states that
it may not work I don't expect anyone to notice.

This simplifies quite a bit of the GLX code which is very desireable from the
POV that we want to start migrating window system code down to Cogl and the
simpler the code is the more straight forward this work will be.

In the future when Cogl has a nicely designed API for framebuffer objects then
re-implementing offscreen stages cleanly for *all* backends should be quite
straightforward.
2009-10-16 18:58:47 +01:00
Emmanuele Bassi
6988744db7 [stage] Rework the Stage implementation class
Instead of using ClutterActor for the base class of the Stage
implementation we should extend the StageWindow interface with
the required bits (geometry, realization) and use a simple object
class.

This require a wee bit of changes across Backend, Stage and
StageWindow, even though it's mostly re-shuffling.

First of all, StageWindow should get new virtual functions:

  * geometry:
    - resize()
    - get_geometry()

  * realization
    - realize()
    - unrealize()

This covers all the bits that we use from ClutterActor currently
inside the stage implementations.

The ClutterBackend::create_stage() virtual function should create
a StageWindow, and not an Actor (it should always have been; the
fact that it returned an Actor was a leak of the black magic going
on underneath). Since we never guaranteed ABI compatibility for
the Backend class, this is not a problem.

Internally to ClutterStage we can finally drop the shenanigans of
setting/unsetting actor flags on the implementation: if the realization
succeeds, for instance, we set the REALIZED flag on the Stage and
we're done.

As an initial proof of concept, the X11 and GLX stage implementations
have been ported to the New World Order(tm) and show no regressions.
2009-09-08 10:52:58 +01:00
Emmanuele Bassi
172074fd29 [glx] Perform more checks before calling glXMakeCurrent
Right now we just check for a NULL stage before calling glXMakeCurrent().

We can, though, get a valid stage without an implementation attached to
it while we are disposing a stage after a CLUTTER_DELETE event, since the
events processing is performed on a vblank-locked basis.
2009-08-21 12:05:52 +01:00
Emmanuele Bassi
6e6d0a5ea6 [glx] Explicitly set the depth size for GLX visuals
When requesting a GLX visual from the X server we should explicitly
set the GL_DEPTH_SIZE and the GL_ALPHA_SIZE bits, otherwise some
functionality might just not work, or work unreliably.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1723
2009-07-27 15:08:03 +01:00
Emmanuele Bassi
07453a5861 [glx] Make the wait_for_vblank function private
Nobody should be using the function to wait for the vblank outside
of the GLX backend.
2009-07-13 15:31:38 +01:00
Owen W. Taylor
5425a6e311 Call glFinish() before manually waiting for VBLANK
If we manually wait for the VBLANK with:

  - SGI_video_sync
  - Direct usage of the DRM ioctl

Then we should call glFinish() first, or otherwise the swap-buffers
may be delayed by pending drawing and cause a tear.

http://bugzilla.openedhand.com/show_bug.cgi?id=1636

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-13 15:18:12 +01:00
Robert Bragg
6d9498da7c Adds a cogl_flush() to give developers breaking into raw GL a fighting chance
This function should only need to be called in exceptional circumstances
since Cogl can normally determine internally when a flush is necessary.

As an optimization Cogl drawing functions may batch up primitives
internally, so if you are trying to use raw GL outside of Cogl you stand a
better chance of being successful if you ask Cogl to flush any batched
geometry before making your state changes.

cogl_flush() ensures that the underlying driver is issued all the commands
necessary to draw the batched primitives.  It provides no guarantees about
when the driver will complete the rendering.

This provides no guarantees about the GL state upon returning and to avoid
confusing Cogl you should aim to restore any changes you make before
resuming use of Cogl.

If you are making state changes with the intention of affecting Cogl drawing
primitives you are 100% on your own since you stand a good chance of
conflicting with Cogl internals.  For example clutter-gst which currently
uses direct GL calls to bind ARBfp programs will very likely break when Cogl
starts to use ARBfb programs internally for the material API, but for now it
can use cogl_flush() to at least ensure that the ARBfp program isn't applied
to additional primitives.

This does not provide a robust generalized solution supporting safe use of
raw GL, its use is very much discouraged.
2009-06-30 17:13:38 +01:00
Robert Bragg
845ff67301 [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes
Previously the journal was always flushed at the end of
_cogl_rectangles_with_multitexture_coords, (i.e.  the end of any
cogl_rectangle* calls) but now we have broadened the potential for batching
geometry.  In ideal circumstances we will only flush once per scene.

In summary the journal works like this:

When you use any of the cogl_rectangle* APIs then nothing is emitted to the
GPU at this point, we just log one or more quads into the journal.  A
journal entry consists of the quad coordinates, an associated material
reference, and a modelview matrix.  Ideally the journal only gets flushed
once at the end of a scene, but in fact there are things to consider that
may cause unwanted flushing, including:

- modifying materials mid-scene
    This is because each quad in the journal has an associated material
    reference (i.e. not copy), so if you try and modify a material that is
    already referenced in the journal we force a flush first)

    NOTE: For now this means you should avoid using cogl_set_source_color()
	      since that currently uses a single shared material. Later we
	  should change it to use a pool of materials that is recycled
	  when the journal is flushed.

- modifying any state that isn't currently logged, such as depth, fog and
  backface culling enables.

The first thing that happens when flushing, is to upload all the vertex data
associated with the journal into a single VBO.

We then go through a process of splitting up the journal into batches that
have compatible state so they can be emitted to the GPU together.  This is
currently broken up into 3 levels so we can stagger the state changes:

1) we break the journal up according to changes in the number of material layers
   associated with logged quads. The number of layers in a material determines
   the stride of the associated vertices, so we have to update our vertex
   array offsets at this level. (i.e. calling gl{Vertex,Color},Pointer etc)
2) we further split batches up according to material compatability. (e.g.
   materials with different textures) We flush material state at this level.
3) Finally we split batches up according to modelview changes. At this level
   we update the modelview matrix and actually emit the actual draw command.

This commit is largely about putting the initial design in-place; this will be
followed by other changes that take advantage of the extended batching.
2009-06-30 17:13:34 +01:00
Emmanuele Bassi
b05d4be19d Use GLib variant of strcasecmp()
The GLib version of strcasecmp() ignores any non-ASCII character,
unlike the original which is locale-dependent.
2009-05-25 12:42:17 +01:00
Emmanuele Bassi
aa1246e891 [backend] Abstract the GL context creation
This is the another step into abstracting the backend operations
that are currently spread all across the board back into the
backend implementations where they belong.

The GL context creation, for instance, is demanded to the stage
realization which makes it a critical path for every operation
that is GL-context bound. This usually does not make any difference
since we realize the default stage, but at some point we might
start looking into avoiding the default stage realization in order
to make the Clutter startup faster.

It also makes the code maintainable because every part is self
contained and can be reworked with the minimum amount of pain.
2009-05-13 22:21:48 +01:00
Emmanuele Bassi
e59a19bd03 [x11] Abstract XVisualInfo creation
The XVisualInfo for GL is created when a stage is being realized.
When embedding Clutter inside another toolkit we might not want to
realize a stage to extract the XVisualInfo, then set the stage
window using a foreign X Window -- which will cause a re-realization.

Instead, we should abstract as much as possible into the X11 backend.

Unfortunately, the XVisualInfo for GL is requested using GLX API; for
this reason we have to create a ClutterBackendX11 method that we
override inside the ClutterBackendGLX implementation.

This also allows us to move a little bit of complexity from out of
the stage realization, which is currently a very delicate and hard
to debug section.
2009-05-13 21:49:45 +01:00
Emmanuele Bassi
5bcde25cbb Tentative fix for multi-stage support on GLX
The fix for bug 1138 broke multi-stage support on GLX, causing
X11 to segfault with the following stack trace:

Backtrace:
0: /usr/X11R6/bin/X(xf86SigHandler+0x7e) [0x80c91fe]
1: [0xb7eea400]
2: /usr/lib/xorg/modules/extensions//libglx.so [0xb7ae880c]
3: /usr/lib/xorg/modules/extensions//libglx.so [0xb7aec0d6]
4: /usr/X11R6/bin/X [0x8154c24]
5: /usr/X11R6/bin/X(Dispatch+0x314) [0x808de54]
6: /usr/X11R6/bin/X(main+0x4b5) [0x8074795]
7: /lib/i686/cmov/libc.so.6(__libc_start_main+0xe5) [0xb7c75775]
8: /usr/X11R6/bin/X(FontFileCompleteXLFD+0x21d) [0x8073a81]

which I can only track down to clutter_backend_glx_ensure_current()
being passed a NULL stage -- something that happens when a stage
is not correct realized. That should lead to a glXMakeCurrent(None)
and not to a segmentation fault, though.
2009-05-08 17:17:48 +01:00
Emmanuele Bassi
ccca24ab76 Remove usage of the grave accent as quotation mark
See:

  http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

This should make Thomas happy.
2009-03-17 14:13:31 +00:00
Takao Fujiwara
8e6423a1b6 Bug 1397 - Allow localizing the command line help
Clutter has a set of command line options that are added to every
application by means of clutter_init() or by obtaining the Clutter
GOptionGroup and using g_option_context_parse(). Thus, every Clutter
application will automatically have an --help command line switch
showing the list of options and their description.

At the moment, Clutter does not enable localization of the help,
thus making it less than useful on non-English locales.

This patch enables the machinery to create a localization file and
load it when initializing Clutter, by means of the GLib macros and
locale.h API we already use.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-01-06 12:15:02 +00:00
Emmanuele Bassi
91f2653b71 2008-10-31 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1200 - Crash with invalid DISPLAY

	* clutter/clutter-main.c: Use the ClutterBackend wrapper API
	instead of directly checking the class structure.

	* clutter/glx/clutter-backend-glx.c: Return the correct value
	in case of failure.

	* clutter/x11/clutter-backend-x11.c: Bail out if XOpenDisplay()
	failed.
2008-10-31 12:48:26 +00:00
Emmanuele Bassi
d141f781ec 2008-05-13 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/glx/clutter-stage-glx.c:
	(clutter_stage_glx_unrealize): Move the shaders release from here...

	* clutter/glx/clutter-backend-glx.c:
	(clutter_backend_glx_dispose): ... to here. Shaders should be
	released when the GL context is being destroyed, and that only
	happens when the backend is being disposed, now that we support
	multiple stages.
2008-05-13 10:42:36 +00:00
Emmanuele Bassi
87ccdacdaf 2008-05-13 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-backend.c:
	(_clutter_backend_create_stage): Call _clutter_stage_set_window()
	ourselves, thus removing yet another action that backends must
	implement and might get wrong; also cuts a backend-agnostic piece
	of code duplication.

	* clutter/eglnative/clutter-backend-egl.c:
	(clutter_backend_egl_create_stage): Update the EGL native backend.

	* clutter/eglx/clutter-backend-egl.c:
	(clutter_backend_egl_create_stage): Update the EGLX backend.

	* clutter/fruity/clutter-backend-fruity.c:
	(clutter_backend_egl_create_stage): Update the fruity backend

	* clutter/glx/clutter-backend-glx.c:
	(clutter_backend_glx_create_stage): Update the GLX backend.

	* clutter/sdl/clutter-backend-sdl.c:
	(clutter_backend_sdl_create_stage): Update the SDL backend.

	* HACKING.backends: Update the ::create_stage() description.
2008-05-13 10:37:17 +00:00
Emmanuele Bassi
101a3cac4e 2008-05-12 Emmanuele Bassi <ebassi@openedhand.com>
Rework the stage wrapper/implementation relation: remove
	duplicated code and all the bookkeeping from the backends into
	ClutterStage whenever possible, to reduce the amount of	work a
	backend must do (and possibly get wrong). Thanks to Tommi
	Komulainen.

	* clutter/clutter-main.c:
	(clutter_init_with_args), (clutter_init): Realize the default
	stage after creation. The default stage is special, because we
	use it in the initialization sequence. This removes the burden
	from the backends and reduces the things a backend can get
	wrong.

	* clutter/clutter-stage.c:
	(clutter_stage_show): Make sure to realize the implementation if
	it hasn't been realized yet.

	(clutter_stage_realize): Set the REALIZED flag and call
	clutter_stage_ensure_current() if the implementation was
	successfully realized.

	(clutter_stage_unrealized): Call clutter_stage_ensure_current()
	on unrealize.

	* clutter/glx/clutter-backend-glx.c:
	(clutter_backend_glx_create_stage): Do not realize the stage anymore
	when creating it, and let the normal realization sequence take
	place.

	(clutter_backend_glx_ensure_context): Trap for X11 errors.

	* clutter/glx/clutter-stage-glx.c:
	(clutter_stage_glx_realize): Chain up to the X11 implementation
	so that we can set up the window state (title, cursor visibility)
	when we actually have a X window. Also, do not call
	clutter_stage_ensure_current(), and rely on the wrapper to do
	it for us. This means we can drop setting the REALIZED flag on
	the wrapper.

	(clutter_stage_glx_unrealize): Do not call
	clutter_stage_ensure_current() ourselves, and rely on the wrapper
	to do it for us.

	* clutter/x11/clutter-stage-x11.c:
	(set_wm_title),	(set_cursor_visible): Move the WM title and
	cursor visibility code inside their own functions.

	(clutter_stage_x11_realize): Set the window title and whether the
	cursor is visible or not after realizing the stage.

	(clutter_stage_x11_set_cursor_visible),
	(clutter_stage_x11_set_title): Call set_wm_title() and
	set_cursor_visible().

	(clutter_stage_x11_finalize): Free the title string.

	* clutter/x11/clutter-stage-x11.h: Save more of the stage state,
	so that we can set it even when the stage hasn't been realized
	yet.

	* clutter/eglnative/clutter-backend-egl.c:
	(clutter_backend_egl_create_stage):
	* clutter/eglnative/clutter-stage-egl.c:
	(clutter_stage_egl_unrealize),
	(clutter_stage_egl_realize): Update the eglnative backend.

	* clutter/eglx/clutter-backend-egl.c:
	(clutter_backend_egl_ensure_context),
	(clutter_backend_egl_create_stage):
	* clutter/eglx/clutter-stage-egl.c:
	(clutter_stage_egl_unrealize),
	(clutter_stage_egl_realize): Update the eglx backend.

	* clutter/sdl/clutter-backend-sdl.c:
	(clutter_backend_sdl_create_stage):
	* clutter/sdl/clutter-stage-sdl.c:
	(clutter_stage_sdl_realize): Update the sdl backend.

	* clutter/fruity/clutter-backend-fruity.c:
	(clutter_backend_fruity_create_stage):
	* clutter/sdl/clutter-stage-fruity.c:
	(clutter_stage_fruity_realize): Update the fruity backend.

	* tests/test-multistage.c (on_button_press): Bail out if
	clutter_stage_new() returns NULL.

	* HACKING.backends: Update backend writing documentation.
2008-05-12 15:26:37 +00:00
Neil Roberts
6409b1adeb Merged clutter-ivan branch into trunk.
svn merge \
 https://svn.o-hand.com/repos/clutter/trunk/clutter@2509 \
 https://svn.o-hand.com/repos/clutter/branches/clutter-ivan@HEAD
2008-04-25 13:37:36 +00:00
Matthew Allum
c2cb5bf64a 2008-04-15 Matthew Allum <mallum@openedhand.com>
Work related to #873;

        * clutter/glx/clutter-backend-glx.c:
        * clutter/glx/clutter-backend-glx.h:
        * clutter/x11/clutter-x11-texture-pixmap.c:
        * clutter/x11/clutter-x11-texture-pixmap.h:
        General cleanup of texture pixmap code, adding;
          - Pixmap dimentions and depth now auto probed, read only props.
          - More X safety traps
          - Add support for optionally tracking damage and automatically
            updating texture.

        * clutter/glx/clutter-glx-texture-pixmap.c:
        * clutter/glx/clutter-glx-texture-pixmap.h:
        General cleanup and some safety additions. Needs more work so
        'proper' subclass - dependent on new COGL.

        * clutter/x11/clutter-backend-x11.c: (clutter_x11_remove_filter):
        Invert g_return_if check.

        * configure.ac:
        Pull in XComposite and XDamage (at least for now)

        * tests/Makefile.am:
        * tests/test-pixmap.c:
        Add a modified test from Johan for above.
2008-04-15 21:18:13 +00:00
Emmanuele Bassi
0535283b77 2008-04-10 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/eglx/clutter-backend-egl.c:
	(clutter_backend_egl_ensure_context): Sync up with the GLX
	backend.

	(clutter_backend_egl_create_stage): Dumb compilation fix.

	* clutter/glx/clutter-backend-glx.c:
	(clutter_backend_glx_create_stage): Unref the stage if we are
	erroring out.
2008-04-10 19:58:47 +00:00
Emmanuele Bassi
7fd5d5d10d 2008-04-04 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-backend.c: Add more debug messages

	* clutter/clutter-stage.h:
	* clutter/clutter-stage.c:
	(clutter_stage_is_default): Add a function to check if the
	stage is the default one.

	* clutter/glx/clutter-backend-glx.c:
	* clutter/glx/clutter-stage-glx.c:
	* clutter/x11/clutter-stage-x11.c: Keep the stage wrapper
	and implementation flags in sync, to ensure that the GL
	context is always set.
2008-04-04 17:26:26 +00:00
Emmanuele Bassi
f859135082 2008-04-04 Emmanuele Bassi <ebassi@openedhand.com>
Bug #864 - Allow instantiating and subclassing of ClutterStage

	* clutter/Makefile.am: Add clutter-stage-window.[ch]

	* clutter/clutter-stage-manager.c:
	(_clutter_stage_manager_remove_stage): Do not warn if removing
	a stage we don't manage, as we might be invoked multiple times
	during a ClutterState dispose sequence.

	* clutter/clutter-actor.c:
	* clutter/clutter-backend.[ch]:
	* clutter/clutter-main.c:
	* clutter/clutter-private.h:
	* clutter/clutter-stage.[ch]: Make ClutterStage a proxy actor,
	with a private actor implementing the ClutterStageWindow
	interface for handling the per-backend realization, painting
	and unrealization, plus all the windowing system abstraction.

	* clutter/x11/clutter-event-x11.c:
	* clutter/x11/clutter-stage-x11.[ch]: Port the X11 backend
	to the new backend and stage API and semantics.

	* clutter/glx/clutter-backend-glx.c:
	* clutter/glx/clutter-stage-glx.c: Port the GLX backend to
	the new backend and stage API and semantics.

	* clutter/eglx/clutter-backend-egl.[ch]:
	* clutter/eglx/clutter-stage-egl.[ch]: Port the EGLX backend
	to the new backend and stage API and semantics (untested).

	* tests/test-multistage.c (on_button_press): Rename
	clutter_stage_create_new() to clutter_stage_new().
2008-04-04 15:02:11 +00:00
Emmanuele Bassi
6fa02d3aa0 2008-04-03 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/glx/clutter-backend-glx.c:
	(clutter_backend_glx_get_features): Assert if we don't have a
	GL context here or if it's not matched to a drawable. Asserting
	might seem too drastic, but if we don't have a valid GL context
	here then Clutter will segfault anyway, and I'll take an assert()
	over a hard to read, deep in GLX guts backtrace any day (and
	twice on a monday).

	* clutter/x11/clutter-backend-x11.c:
	(clutter_backend_x11_get_features): No need for a variable here.
2008-04-03 03:04:41 +00:00
Matthew Allum
c158a93a84 2008-04-01 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-backend.c:
        * clutter/glx/clutter-backend-glx.c:
        * clutter/glx/clutter-stage-glx.c:
        Allow NULL to be passed to _clutter_backend_ensure_context
        which essentially clears GL context. This is hooked into stage
        unrealisation.  Isn't yet quite bulletproof.
        Fixes issues with gtk-embed crasher (thanks to Neil).
2008-04-01 14:04:46 +00:00
Matthew Allum
244eedb5bd 2008-03-31 Matthew Allum <mallum@openedhand.com>
* README:
        Add notes on new multistage feature.

        * clutter/clutter-stage-manager.c:
        Dont ref contained stages.

        * clutter/clutter-stage.c:
        Automatically remove stage from stage manager on finalisation.
        Cleans up warnings when a stage is destroyed.

        * clutter/clutter-backend.h:
        * clutter/glx/clutter-backend-glx.c:
        Minor formatting cleanups.

        * clutter/glx/clutter-stage-glx.c:
        * configure.ac:
        * clutter/clutter-version.h.in:
        Add a general CLUTTER_STAGE_TYPE define, should be useful for
        evntual stage subclassing and creating with g_object_new()
2008-03-31 17:15:02 +00:00