This stubs out an xlib event handling mechanism for Cogl. The intention
is for Clutter to use this to forward all x11 events to Cogl. As we move
winsys functionality down into Cogl, Cogl will become responsible for
handling a number of X events: ConfigureNotify events for onscreen
framebuffers, swap events and Damage events for cogl_x11_texture_pixmap.
This exposes the ./configured window system/backend options to Cogl via
a set of new COGL_HAS_XYZ_SUPPORT defines:
COGL_HAS_{X11,XLIB,GLX,EGL,EGL_PLATFORM_XYZ,OSX,WIN32,WGL}_SUPPORT
Commit e2a990d renamed these types to new names from EGL 1.3. However
it still works to use the old names under EGL 1.3 so let's just use
those to keep compatibility.
clutter_backend_egl_dispose now chains up before disposing its own
resources so that ClutterBackendX11 will destroy all of the stages
before we destroy the egl context. Otherwise the actors may try to
make GL calls during destruction which causes a crash.
GLES 2 doesn't have GL_MAX_TEXTURE_UNITS. Instead the cogl backend
uses GL_MAX_TEXTURE_IMAGE_UNITS with a maximum limit of 16. The same
restriction is now used in the test.
Some EGL drivers, such as the PowerVR simulator (and some proprietary drivers)
return zero when the EGLConfig is queried for the EGL_NATIVE_VISUAL_ID
attribute via eglGetConfigAttrib().
This patch detects and attempts to work around that situation by picking a
visual with the same color depth.
http://bugzilla.openedhand.com/show_bug.cgi?id=2123
After the EGL context is created it now also creates an invisible 1x1
window and a corresponding surface so that the context can be
immediately made current. This is similar to changes for the GLX
backend introduced in d2c091e62.
http://bugzilla.openedhand.com/show_bug.cgi?id=2056
The AM_PATH_GLIB_2_0 doesn't automatically cause the configure script
to fail if the test fails. This wouldn't usually cause any problems
because we later check for the right glib version using
PKG_CHECK_MODULES directly. However AM_PATH_GLIB_2_0 is more thorough
when checking because it also tries to run a program against the
library to read the version. If the macro fails but the pkg-config
check passes then nothing will define GLIB_GENMARSHAL and the build
step will fail in a confusing way.
This adds a check for the result and gives an AC_MSG_ERROR if it
fails. The glib dependencies have been moved out of CLUTTER_DEPS to
AM_PATH_GLIB_2_0.
http://bugzilla.openedhand.com/show_bug.cgi?id=2127
Previously it would only try to set the blend equation if the RGB and
alpha blending functions were different. However it's completely valid
to use a non-standard blending function when the functions are the
same. This patch moves the blending equation to outside the if
statement.
Previously it would only set the blend constant if glBlendFuncSeparate
was used but it is perfectly acceptable to use the blend constant when
the same factor is used for each. It now sets the blend constant
whenever one of the factors would use the constant.
When a single statement is used to specify the factors for both the
RGB and alpha parts it previously split up the statement into
two. This works but it ends up unnecessarily using glBlendFuncSeparate
when glBlendFunc would suffice.
For example, the blend statement
RGBA = ADD(SRC_COLOR*(SRC_COLOR), DST_COLOR*(1-SRC_COLOR))
would get split into the two statements
RGBA = ADD(SRC_COLOR*(SRC_COLOR[RGB]), DST_COLOR*(1-SRC_COLOR[RGB]))
A = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))
That translates to:
glBlendFuncSeparate (GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR,
GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
This patch makes it so that arg_to_gl_blend_factor can handle the
combined RGBA mask instead. That way the single statement gets
translated to the equivalent call:
glBlendFunc (GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
If a cached layout didn't actually match the layout we're looking for,
it would be returned anyway. Remove this return so that it can correctly
continue looking and get a cache miss if appropriate.
http://bugzilla.openedhand.com/show_bug.cgi?id=2109
Previously a path copy was implemented such that only the array of
path nodes was shared with the source and the rest of the data is
copied. This was so that the copy could avoid a deep copy if the
source path is appended to because the copy keeps track of its own
length. This optimisation is probably not worthwhile because it makes
the copies less cheap. Instead the CoglPath struct now just contains a
single pointer to a new CoglPathData struct which is separately
ref-counted. When the path is modified it will be copied if the ref
count on the data is not 1.
This adds a simple test for ClutterCairoTexture that draws two
rectangles to the cairo surface in an idle callback and then verifies
that they appeared at the right colours in the paint callback. If that
succeeds then the second time the idle callback is invoked it will
replace one of the rectangles with a sub region update and the
following paint callback will again verify the rectangles.
This patch combines a number of fixes and improvements to the
layout caching logic in ClutterText.
* Fix: The width must always be set on the PangoLayout when painting.
This is necessary because the layout aligns in the width, and
even when we think we are left-aligned, the auto-dir feature
of PangoLayout may result in right-alignment.
* Fix: We should only ever try to reuse a cached layout based
on its logical width if layout.width was -1 when computing
that logical width. If the layout was already ellipsized,
then comparing the logical width to the new width we are
trying to wrap to doesn't make sense. (If "abc" ellipsizes
to a 15-pixel wide "..." for a width of 1 pixel, that doesn't
mean that we should use "..." for a width of 15 pixels. Maybe
"abc" itself is 15 pixels wide.)
* Improvement: rather than looking up cached layouts based on the
input allocation_width/allocation_height, look them up based
on the actual width/height/ellipsize that we pass to create
a layout. This is simpler and improves the chance we'll get
a cache hit when appropriate even if there are small floating
point differences.
Note because of the first fix this is less aggressive than dd40732
in caching layouts; get_preferred_width() and painting can't share
a layout since get_preferred_width() needs to pass a width of -1
to Pango and painting needs to pass the real width.
The patch has been updated from the clutter-1.2 branch to current
master; using the profiling instrumentation it is possible to verify
with test-text-field that the hit/miss counters go from:
Name Total Per Frame
---- ----- ---------
Text layout cache hit counter 13 6
Text layout cache miss counter 11 5
before applying the patch, to:
Name Total Per Frame
---- ----- ---------
Text layout cache miss counter 4 2
Text layout cache hit counter 3 1
after applying the patch.
https://bugzilla.gnome.org/show_bug.cgi?id=618104http://bugzilla.openedhand.com/show_bug.cgi?id=2109
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This reverts commit 716ec82db8.
The Cogl pixel buffer API currently has problems if an atlas texture
is created or the format needs to be converted. The atlas problem
doesn't currently show because the atlas rejects BGR textures anyway
but we may want to change this soon. The problem with format
conversion would happen under GLES because that does not support BGR
textures at all so Cogl has to do the conversion. However it doesn't
currently show either because GLES has no support for buffer objects
anyway.
It's also questionable whether the patch would give any performance
benefit because Cairo needs read/write access which implies the buffer
can't be put in write-optimised memory.
Conflicts:
clutter/clutter-cairo-texture.c
http://bugzilla.openedhand.com/show_bug.cgi?id=1982
Since framebuffer state is not flushed prior to replaying the journal,
the trick of marking the framebuffer dirty prior to calling
glBindFramebuffer() doesn't work... the outstanding journal entries
will get replayed to the newly created framebuffer.
Fix this by flushing the journal as well.
http://bugzilla.openedhand.com/show_bug.cgi?id=2110
Signed-off-by: Robert Bragg <robert@linux.intel.com>
In clutter_cairo_texture_create_region it tries to destroy the old
texture before mapping the PBO by setting the texture on the first
layer of the material to COGL_INVALID_HANDLE. However it was using the
material API incorrectly so it ended up showing a warning and doing
nothing.
Instead of asking gtester to run ./test-conformance directly we now tell
it to run a list of wrapper scripts. This results in each test being
spawned in a separate process avoiding leakage of state between tests
which has been a big problem with the conformance tests for quite a
while now.
Otherwise it seems that rounding errors will cause the fragments at
the edge of the quad to blend with neighbouring quarters of the
texture which cause the test to fail.
A few of the tests connected to the paint signal but never
disconnected it. Most of these handlers had a call to g_main_quit in
them which meant that it could sometimes cause subsequent tests to
exit after the first frame is painted. Most of the tests don't
validate any of the results until after a couple of frames have been
rendered so this ended up skipping out the test entirely.
To workaround this the test setup function now disconnects all
handlers for the paint signal on the default stage before the test is
run.
The on_paint function for test-cogl-readpixels tries to temporarily
set the projection, modelview and viewport to its own values. However
it was never restoring the saved values so it could affect the results
of subsequent tests.
If the clip stack is empty then _cogl_clip_stack_flush exits
immediately. This was missing out the assignment of *stencil_used_p at
the bottom of the function. If a path is then used after the clip is
cleared then it would think it needs to merge with the clip so the
stencil would not be cleared correctly.
The code for implementing ClutterColor as GParamSpec and the
color↔string transformation functions were assuming that ClutterColor
owns the data in the GValue struct and directly reading
data[0].v_pointer to get a pointer to the color. However ClutterColor
is actually a boxed type and the format of the data array is meant to
be internal to GObject so it is not safe to poke around in it
directly. This patch changes it to use g_value_get_boxed to get the
pointer.
Also, boxed types allow a NULL value to be stored and not all of the
code was coping with this. This patch also attempts to fix that.
http://bugzilla.openedhand.com/show_bug.cgi?id=2068
ClutterColor has long had a GTypeValueTable struct around and the
functions defined to be implemented as a fundamental type. However the
struct was never actually used anywhere and ClutterColor is actually
defined as a boxed type. This patch removes the table because it is
very confusing to have code lying around that is not used.
http://bugzilla.openedhand.com/show_bug.cgi?id=2068
Duplicate the existing ease-in/interpolation mode for the property when
removing, replacing the first key for a property or adding a new first
key for a property.
When inserting or modifying keys of a running animator the internal
iterators per property could go out of sync. Reinitializing the
iterators if the timeline is running avoids this.
In 91cde78a7 I accidentally changed the function names that get looked
up for the framebuffer extension under GLES so that they didn't have
any suffix. The spec for extension specifies that they should have the
OES suffix.
A server that supports GLX_BufferSwapComplete will always send
these events, so we should just silently ignore them if we've
chosen not to take advantage of the INTEL_swap_event GLX
extension.
http://bugzilla.openedhand.com/show_bug.cgi?id=2102
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
clutter_container_create_child_meta() uses CLUTTER_IS_ACTOR on the
container parameter instead of the actor parameter.
http://bugzilla.openedhand.com/show_bug.cgi?id=2087
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
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.
Whether events come from the main loop source or from
clutter_x11_handle_event(), we need to feed them to the backend
virtual handle_event function. This fixes problems with clients
using clutter_x11_handle_event() hanging because
GLXBufferSwapComplete events aren't received.
http://bugzilla.openedhand.com/show_bug.cgi?id=2101