The CoglOutput object represents one output such as a monitor or
laptop panel, with information about attributes of the output such as
the position of the output within the global coordinate space, and
the refresh rate.
We don't yet publically export the ability to get output information but
we track it for the GLX backend, where we'll use it to track the refresh
rate.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit d7ef9d8d71488d0e6874f1ffc6e48700d5c82a31)
The libraries prefixes where never set in the configure script and
GDKPIXBUF_PREFIX had a typo.
(cherry picked from commit 5d8c0e13ed0572f806fdff2bff1d5904ed3bf69b)
This allows us to catch the use of undefined macros (that default to 0)
in preprocessor conditionals.
(cherry picked from commit 53ddc20fe9cd1400d18274e521932f84a4aecc5b)
Some variables (notably multiline ones) are not really supposed to be
substituted by automake. Let's take COGL_DEFINES for instance, you get:
COGL_DEFINES =
#define COGL_HAS_GLIB_SUPPORT
#define COGL_HAS_GTYPE_SUPPORT
#define COGL_HAS_GL
#define CLUTTER_COGL_HAS_GL
#define COGL_HAS_GLX_SUPPORT
#define COGL_HAS_SDL
...
This only works because the '#' character makes it look like a comment
and COGL_DEFINES becomes an empty variable
Automake allows to exclude variables from the list of substitutions,
let's use it for those two.
(cherry picked from commit e0a9d8d775c90c60b6e63b52771e896da3641a40)
This fixes some problems which were stopping --disable-glib from
working properly:
• A lot of the public headers were including glib.h. This shouldn't be
necessary because the API doesn't expose any glib types. Otherwise
any apps would require glib in order to get the header.
• The public headers were using G_BEGIN_DECLS. There is now a
replacement macro called COGL_BEGIN_DECLS which is defined in
cogl-types.h.
• A similar fix has been done for G_GNUC_NULL_TERMINATED and
G_GNUC_DEPRECATED.
• The CFLAGS were not including $(builddir)/deps/glib which was
preventing it finding the generated glibconfig.h when building out
of tree.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 4138b3141c2f39cddaea3d72bfc04342ed5092d0)
The GDK pixbuf support requires being able to propagate errors from
GDKPixbuf as GErrors. This won't work if we are using the builtin
version of GLib because any attempt to call g_error_free from within
Cogl will use the internal version which will free the error using the
wrong slice allocator. It probably doesn't make much sense to build
without glib but with gdk-pixbuf so there's not much point in trying
to work around this situation.
Previously if you specified --enable-gdk-pixbuf but gdk-pixbuf was not
available it would silently disable it. This pach also fixes it so
that it will report an error in that case.
If --enable-gdk-pixbuf is not specified it will now default to
enabling it only if both glib is enabled and gdk-pixbuf is available.
This patch looks slightly longer than it ought to be because it moves
the check for glib up to above the descisions about the image backend.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 8b1eabdc08da89a57792f9eb666e893a6cbb4e26)
glib's configure.ac uses libtool to determine the extension of shared
libraries. So let's generate the libtool file early in configure.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit ae457e0e2463bcec4f5891778e8ada9924f91be7)
This option will generate a libcogl2 DSO that depends on the least
possible external libraries.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 6357960e1b91081546adf1bb110067d7db4d7400)
This commit pushes --disable-glib to the extreme of embedding the par of
glib cogl depends on in tree to be able to generate a DSO that does not
depend on an external glib.
To do so, it:
- keeps a lot of glib's configure.ac in as-glibconfig.m4
- pulls the code cogl depends on and the necessary dependencies
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Instead of using the variable to use in Makefile.ams.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 016f2276823a8a8cde33d3e7062c61469921a9f1)
--disable-nls can be used to compile cogl without i18n support. Let's
indicate the i18n enabling status so curious people can deduce it can be
compiled out.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 1ccaafa31dbc0c9b9184d61079b2deff913d8e25)
It seems logical to first look for the compiler and then run the rest of
configure script (which will use the compiler with small snippets).
Same goes for the libtool initializaton, you might as well do it not too
far from the automake one.
This also happens to be preparatory work to compile cogl with an in-tree
copy of some glib files as the glib's configure script needs those
checks early.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit ba452ea4a48e48324ee7382b7ccb9065c255f55a)
As far as I can tell the --symbol-prefix option wasn't there before
glib 2.32's glib-mkenums. So cogl effectively depends on glib 2.32.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 4e952532a29b2566caf658705f815b7aec732265)
When building COGL with multiple backends it can be useful to force a
default driver to be selected. For example while for Debian we do want to
build the GL renderer on ARM, GLESv2 is much more suitable as the
default renderer on that platform.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 8a43aa7167b56784f7b50c557391b990861d594f)
gbm_bo_get_pitch was renamed to gbm_bo_get_stride to be consistent with
how the terms pitch and stride are used throughout mesa. This updates
the Cogl backend to use the new gbm_bo_get_stride name.
For compatibility with previous version of libgbm we now explicitly
check the version of libgbm in configure.ac and expose
COGL_GBM_{MAJOR,MINOR,MICRO} defines to the code so we can conditionally
use the older gbm_bo_get_pitch() name with older versions.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 47c6247095e2f1f8725c4eb08d38c9de15e283cd)
Since fallback for vblank wait via manual drm ioctl was removed in
commit 3bc70687ac there is no need to
check for libdrm anymore.
https://bugzilla.gnome.org/show_bug.cgi?id=678316
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit b84047a578b7746e421cd553e781788925cff90f)
This adds the AC_GNU_SOURCE macro to configure.ac to ensure _GNU_SOURCE
is defined while compiling Cogl. This is required to use memmem for
example.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 1ed717dc12fc4d2cb49010232de93ff46684aa6a)
memmem is a GNU libc extension that works like strstr except that the
size of the needle and the haystack are passed into the function
instead of using null-terminated strings.
This patch adds a wrapper function called 'cogl_util_memmem' so that
we can use this function. There is a configure check and if the
function is not available then a fallback implementation will be used.
Otherwise cogl_util_memmem is just defined to memmem.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 1dd1b0a67f6238e13f7f9253fb03addada0541b7)
Otherwise, X11 identifiers may leak and cause havoc in big applications
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit ed0cdca0eca815543619fe72fbd42d662d53f92d)
This adds an alternate version of the SDL winsys using the SDL 2 API.
The two versions are mutually exclusive and share the same
CoglWinsysID. Version 2 of SDL fits a little bit better with Cogl
because it supports multiple windows and the video subsystem can be
initialised entirely independently of the rest of the subsystems.
The SDL2 winsys creates an invisible dummy window in order to bind the
GL context after creating the Cogl display. This is similar to how the
X11 winsys's work.
SDL2 seems to support compiling with support for both GL and GLES.
However there doesn't seem to be a way to select between the two
backends outside of SDL. In fact if you do compile them both in it
seems to break down because it will always try to use the window
system functions from the GLES backend because those are filled in
second in the vtable. However when creating the window it will always
prefer to use the GL function to choose a visual. This function gets
confused because the GL backend has not been initialised at that
point. The Cogl backend therefore just leaves it up to SDL to pick a
sensible backend. It will then verify that it picked a GL library
which matches the Cogl driver by checking the string from
glGetString(GL_VERSION).
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 6cb5ab41355e7bfe28f367cf4afa39a7afcfeec2)
When --disable-debug is passed to the configure script it was actually
still defining COGL_ENABLE_DEBUG so very little would end up being
disabled. If COGL_ENABLE_DEBUG actually got defined it would also fail
to compile because _cogl_debug_instances and COGL_DEBUG_N_LONGS from
cogl-debug.h were only defined if debugging is enabled but they are
used regardless.
This patch also makes it so that the _COGL_RETURN_IF_FAIL family of
macros that are used when glib support is disabled are now disabled if
debugging is disabled. When the glib macros are used they are already
disabled because we additionally define G_DISABLE_CHECKS.
'COGL_HANDLE_DEBUG' has been removed from the list of defines passed
when debugging is enabled because CoglHandle has already been removed
and it is not used anywhere in the code.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 9811a0101c9cbb4ab95c55a2b41fd10ff4c77d9f)
This adds a library that can be used instead of libGLESv2.so to provide
symbols for the GLES 2.0 api. This can be used for convenience when
using the cogl_gles2_context_ api since you don't need to manually go
through a CoglGLES2Vtable when calling the gles2 api so it should be
easier to port existing gles2 code to integrate with Cogl.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 80d7599a2acefca7d01d8d7de9df524278ef72c5)
-Create a pre-defined cogl/cogl-gl-header.h(.win32) that is to be used on
any Windows builds, and adapt the MSVC build process to set up and use
that file.
-Fix up glib-mkenums code generation .bat file that is generated during
"make"/"make dist", like the autotools-based builds.
-Since cogl/cogl-defines.h now contain versionioning info, and it no longer
directly includes the GL headers, update the pre-configured
cogl-defines.h[.win32|.win32_SDL] and use autotools to fill in the
versioning info during "make"/"make dist".
-Fix up cogl/cogl-pango.rc.in so that they reflect the cogl-2.x versioning
stuff correctly and versioning info can be filled in correctly during
"make"/"make dist"
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 7ff42bb1c5280b0f53370f8d94ef5f10c9f39e2f)
The stock 1.2.x version of SDL only supports regular OpenGL. The
version on WebOS is specially patched to add some extra API to request
a GLES1 or GLES2 context. This patch adds a configure check to detect
when Cogl is being built with the patched version of SDL. In that case
it will additionally allow the gles1 and gles2 drivers and set the
right video mode attributes to get the corresponding context.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 3726c60deab2bd94617a562abb63f735627a25e4)
This makes the test-cogl-perf test from clutter into a standalone Cogl
benchmark.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 1684a040b238ebae140e827f4003f2d2867c04f3)
The check for whether the compiler supports _Static_assert didn't work
properly because the AC_TRY_COMPILE function puts the source
definition in its own main function. The test therefore ends up
declaring a nested main function which GCC allows. If _Static_assert
isn't available then it just looks like an implicit declaration of a
function which only causes a warning in GCC so it would still compile.
This patch changes it to use AC_COMPILE_IFELSE instead. This macro
makes it possible to specify the complete source code so
_Static_assert can be called from the global scope. AC_LANG_PROGRAM is
used to generate the program. For extra aesthetics it now also
generates a 'checking for...' message while the script is running.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 9657938c3083a782234e1e9f05ab5ae88a6bc5ab)
This adds a _COGL_STATIC_ASSERT macro that can be used for compile time
assertions in C code. If supported by the compiler this macro uses
_Static_assert so that a message can be printed out if the assertion
fails.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 465b39a764f2720e77678cafa56acb0e69007ffd)
This splits the GL header inclusion from cogl-defines.h into a
separate headear called cogl-gl-header.h which we will only include
internally. That way we don't leak GL declarations out of our public
headers. The texture functions that were using GLenum and GLuint in
the public header have now changed to just use unsigned int. Note
however that if an EGL winsys is enabled then it will still publicly
include an EGL header. This is a bit more awkward to fix because we
have public API which returns an EGLDisplay and we can't determine
what type that is.
There is also a conformance test which just verifies that no GL header
has been included while compiling. The test isn't added to
test-conform-main because it doesn't actually test anything at
runtime.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit ef5680d3fda5df929dbd0b420c8f598ded58dfee)
It looks like the then-clause of the AS_IF macro needs to be in square
brackets otherwise the configure script gets generated wrong and you
get this output when you run it:
configure: line 17339: COGL_PANGO_DEP_CFLAGS: command not found
configure: line 17340: C: command not found
configure: line 17341: COGL_PANGO_DEP_LIBS: command not found
configure: line 17342: linker: command not found
Reviewed-by: Robert Bragg <robert@linux.intel.com>
The KMS platform accesses all of it's GL symbols via the indirection
through the Cogl context so there is no need to link against it
directly. This helps when trying to use Cogl with GLES where pulling
in Xlib via libGL is potentially a problem.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This option to GCC makes it give a warning whenever a global function
is defined without a declaration. This should catch cases were we've
defined a function but forgot to put it in a header. In that case it
is either only used within one file so we should make it static or we
should declare it in a header.
The following changes where made to fix problems:
• Some functions were made static
• cogl-path.h (the one containing the 1.0 API) was split into two
files, one defining the functions and one defining the enums so that
cogl-path.c can include the enum and function declarations from the
2.0 API as well as the function declarations from the 1.0 API.
• cogl2-clip-state has been removed. This only had one experimental
function called cogl_clip_push_from_path but as this is unstable we
might as well remove it favour of the equivalent cogl_framebuffer_*
API.
• The GLX, SDL and WGL winsys's now have a private header to define
their get_vtable function instead of directly declaring in the C
file where it is called.
• All places that were calling COGL_OBJECT_DEFINE need to have the
cogl_is_whatever function declared so these have been added either
as a public function or in a private header.
• Some files that were not including the header containing their
function declarations have been fixed to do so.
• Any unused error quark functions have been removed. If we later want
them we should add them back one by one and add a declaration for
them in a header.
• _cogl_is_framebuffer has been renamed to cogl_is_framebuffer and
made a public function with a declaration in cogl-framebuffer.h
• Similarly for CoglOnscreen.
• cogl_vdraw_indexed_attributes is called
cogl_framebuffer_vdraw_indexed_attributes in the header. The
definition has been changed to match the header.
• cogl_index_buffer_allocate has been removed. This had no declaration
and I'm not sure what it's supposed to do.
• CoglJournal has been changed to use the internal CoglObject macro so
that it won't define an exported cogl_is_journal symbol.
• The _cogl_blah_pointer_from_handle functions have been removed.
CoglHandle isn't used much anymore anyway and in the few places
where it is used I think it's safe to just use the implicit cast
from void* to the right type.
• The test-utils.h header for the conformance tests explicitly
disables the -Wmissing-declaration option using a pragma because all
of the tests declare their main function without a header. Any
mistakes relating to missing declarations aren't really important
for the tests.
• cogl_quaternion_init_from_quaternion and init_from_matrix have been
given declarations in cogl-quaternion.h
Reviewed-by: Robert Bragg <robert@linux.intel.com>