1
0
Fork 0
Commit graph

1254 commits

Author SHA1 Message Date
Robert Bragg
0f33c942f2 kms: gracefully handle NULL save_state at cleanup
If we failed to save any crtc state then we skip trying to restore the
old state at cleanup.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-08 17:00:25 +00:00
Robert Bragg
1a638b6fd6 kms: Adds api to get at the kms file descriptor
This adds a cogl_kms_renderer_get_kms_fd() function that lets developers
access the kms file descriptor being used for controlling the kernel
mode setting.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-08 17:00:25 +00:00
Robert Bragg
6b7af18313 renderer: fix s/contraint/constraint/ typo
The recent patch to add an api for explicitly constraining how a
renderer backend is chosen had a typo which this patch fixes.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-08 17:00:25 +00:00
Robert Bragg
161fad2860 texture-2d/wayland: destroy transient EGLImages
When creating a texture from a wayland buffer we create an intermediate
EGLImage that we then create a GL texture from, but we were never
destroying that EGLImage. This patch ensures we destroy the image right
after we've created the texture so we don't leak a reference to the
underlying buffer.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-08 17:00:25 +00:00
Neil Roberts
99c651d2b4 Move the add_swap_buffers_callback functions out of the winsys
Instead of having each winsys implement its own list of callbacks the
list is now just attached directly to the CoglOnscreen using code in
cogl-onscreen.c. The winsys's can invoke this list of callbacks by
calling _cogl_onscreen_notify_swap_buffers(). All of the winsys's
would probably have a very similar implementation for this anyway and
I don't think it makes much sense to try and save the cost of a list
pointer in the CoglOnscreen struct.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-08 17:00:25 +00:00
Neil Roberts
77c3b1b905 Add cogl_primitive_get_indices()
This adds a public getter for the indices property of CoglPrimitive.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-07 15:25:36 +00:00
Neil Roberts
354e923cbf Add cogl_primitive_foreach_attribute()
This adds a public function to iterate the attributes of a
CoglPrimitive. Previously there was no way to query back the
attributes but there was methods to query back all of the other
properties.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-07 15:25:36 +00:00
Neil Roberts
146803c191 Add cogl_primitive_copy()
This adds a public function to make a copy of a primitive. The copy is
shallow which means it will share the same attributes and attribute
buffers. This could be useful for code that wants to have multiple
similar primitives with slightly modified properties.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-07 15:25:35 +00:00
Neil Roberts
55427a18a6 Make _cogl_pipeline_get_layer_texture public
There was no other way to get a pointer to the texture attached to a
pipeline layer apart from the using the CoglMaterial API but I think
this was just an oversight so we should add this in. It is already
maked in the sections file for the gtk-doc.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-07 15:25:35 +00:00
Neil Roberts
ec1bb4ce39 When internally using an FBO, check for allocation errors
Both the cogl_texture_get_data and _cogl_blit_begin implementations
will internally try to create an FBO for a texture and have fallbacks
if the FBO fails. However neither of them were catching errors when
allocating the framebuffer so the fallback wouldn't work properly.
This patch just adds an explicit call to cogl_framebuffer_allocate for
these uses and causes it to use the next fallback if it fails.

Based on a patch by Adel Gadllah.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-07 15:13:11 +00:00
Neil Roberts
43bc0a4b0d texture: Flush the dependent journals on get_data
When calling cogl_texture_get_data we need to ensure that any
framebuffers rendering to the texture have flushed their journals.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-31 12:01:20 +00:00
Neil Roberts
d42f1873fc framebuffer: Flush the journal on destruction
Instead of flushing the journal whenever the current framebuffer on a
context is changed it is now flushed whenever the framebuffer is about
to be destroyed instead. To do this it implements a custom unref
function which detects when there is going to be exactly one reference
on the framebuffer and then flushes its journal. The journal now
always has a reference on the framebuffer whenever it is non-empty.
That means the unref will only cause a flush if the only thing keeping
the framebuffer alive is the entries in the journal.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-27 17:23:03 +00:00
Neil Roberts
688a3e196b object: Add a virtual pointer for the unref function
The virtual function gets called in cogl_object_unref. Any definition
of a CoglObject type can replace the default unref function by using
COGL_OBJECT_DEFINE_WITH_CODE to directly manipulate the
CoglObjectClass struct. The generated object constructors set the
pointer to the default implementation. The default implementation is
exported in the private header so that any overriding implementations
can chain up to it.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-27 17:22:57 +00:00
Neil Roberts
139421de19 object: Remove the type member of CoglObjectClass
Unlike in GObject the type number for a CoglObject is entirely an
internal implementation detail so there is no need to make a GQuark to
make it safe to export out of the library. Instead we can just
directly use a fixed pointer address as the identifier for the type.
This patch makes it use the address of the class struct of the
identifier. This should make it faster to do type checks because it
does not need to call a function every time it wants to get the type
number.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-27 17:18:32 +00:00
Neil Roberts
c39333a2c6 object: Reorder the CoglObject members by size
This moves the pointer members of CoglObject to the top and the int
members to the bottom so that there won't be any padding inserted on
64-bit machines. This reduces the size of the struct from 80 bytes to
72.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-27 17:18:32 +00:00
Emmanuele Bassi
417878538b Move GLES2 prototypes to their header
Some GLSL-related function prototypes are GLES2-only: GL implementations
are not required to provide them.

While Mesa is perfectly happy to return a dummy function pointer for
functions it doesn't support, other platforms are more picky, and will
return NULL.

In this particular case, this commit fixes GLSL support on OSX.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-01-27 16:37:55 +00:00
Neil Roberts
5936bfb395 cogl-poll: Add a missing G_END_DECLS to the header
I accidentally left this out so I guess that would break apps using
C++.

https://bugzilla.gnome.org/show_bug.cgi?id=668385
2012-01-24 14:04:26 +00:00
Robert Bragg
b2d05f32c2 profile: use atexit not g_atexit
g_atexit has been deprecated so we simply use atexit instead now.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-01-16 23:27:36 +00:00
Robert Bragg
87ce1b21f9 wayland: perform buffer resizes lazily at swap buffers
Resizing a wayland client framebuffer should not affect the viewport
of additional primitives drawn to that framebuffer before the next swap
buffers request nor should querying the framebuffer's width and height
be affected until the next swap buffers request completes.

This patch changes cogl_wayland_onscreen_resize() so it only saves the
new geometry as "pending" state internal to the given CoglOnscreen. Only
when cogl_framebuffer_swap_buffers() is next called will the pending
size be flushed to the wayland egl api.
2012-01-16 18:27:20 +00:00
Robert Bragg
e1bd0b2090 Swaps a few uses of gint for int
We've avoiding using the redundant glib typedefs such as guint, gint
gpointer etc and prefer to use the equivalent C types so this patch
removes a few uses of gint that slipped past review.
2012-01-16 18:27:20 +00:00
Robert Bragg
3161f1b0e6 template: Allow configuration of swap throttle
This adds cogl_onscreen_template_set_swap_throttled() api that allows
developers to specify their preference for swap buffer throttling
up-front as part of the onscreen template that is used to create a
CoglDisplay when initializing Cogl. This is desirable because some
platforms may not support configuring swap throttling on a per
framebuffer basis and also since applications often want to apply the
same policy to all onscreen framebuffers anyway.
2012-01-16 18:27:20 +00:00
Robert Bragg
1e03780510 matrix: Remove _EXP symbol mangling and add gtk-doc
We are in the process of removing all _EXP suffix mangling for
experimental APIs (Ref: c6528c4b6c) and adding missing gtk-doc
comments so that we can instead rely on the "Stability: unstable"
markers in the gtk-doc comments. This patch tackles the matrix api
symbols.
2012-01-16 18:27:20 +00:00
Robert Bragg
ec8591535c snippets: Remove _EXP symbol mangling and add gtk-doc
We are in the process of removing all _EXP suffix mangling for
experimental APIs (Ref: c6528c4b6c) and adding missing gtk-doc
comments so that we can instead rely on the "Stability: unstable"
markers in the gtk-doc comments. This patch tackles the snippet api
symbols.
2012-01-16 18:27:20 +00:00
Robert Bragg
60ab0c0a6c framebuffer: Remove _EXP symbol mangling and add gtk-doc
We are in the process of removing all _EXP suffix mangling for
experimental APIs (Ref: c6528c4b6c) and adding missing gtk-doc
comments so that we can instead rely on the "Stability: unstable"
markers in the gtk-doc comments. This patch tackles the cogl framebuffer
symbols.
2012-01-16 18:27:20 +00:00
Robert Bragg
2d70f5eb73 cogl.h: Remove _EXP symbol mangling and add gtk-doc
We are in the process of removing all _EXP suffix mangling for
experimental APIs (Ref: c6528c4b6c) and adding missing gtk-doc
comments so that we can instead rely on the "Stability: unstable"
markers in the gtk-doc comments. This patch tackles the cogl.h symbols.
2012-01-16 18:27:20 +00:00
Robert Bragg
75b687a9eb onscreen: Remove _EXP symbol mangling and add gtk-doc
We are in the process of removing all _EXP suffix mangling for
experimental APIs (Ref: c6528c4b6c) and adding missing gtk-doc
comments so that we can instead rely on the "Stability: unstable"
markers in the gtk-doc comments. This patch tackles the onscreen
framebuffer api symbols.
2012-01-16 18:27:20 +00:00
Robert Bragg
54b1fb0b5e renderer: Remove _EXP symbol mangling and add gtk-doc
We are in the process of removing all _EXP suffix mangling for
experimental APIs (Ref: c6528c4b6c) and adding missing gtk-doc
comments so that we can instead rely on the "Stability: unstable"
markers in the gtk-doc comments. This patch tackles the cogl-pipeline
symbols.
2012-01-16 18:27:20 +00:00
Robert Bragg
e163f1ca1a Remove CoglVector3 type and use float * instead
It proved to be inconvenient that we had a special CoglVector3 typedef
for vectors instead of just accepting pointers to float arrays because
you'd so often end up having to make awkward casts from another vector
type into a CoglVector3 and then cast back again. We're hoping that
taking float pointers instead will lead to less unnecessary casting.
2012-01-16 18:27:19 +00:00
Robert Bragg
2b351af46a renderer: Remove _EXP symbol mangling and add gtk-doc
We are in the process of removing all _EXP suffix mangling for
experimental APIs (Ref: c6528c4b6c) and adding missing gtk-doc
comments so that we can instead rely on the "Stability: unstable"
markers in the gtk-doc comments. This patch tackles the symbols in
cogl-renderer.h.
2012-01-16 18:27:19 +00:00
Robert Bragg
a8513c1d77 renderer: Adds api to add/remove selection constraints
This allows applications to specify certain constraints that feed into
the process of selecting a CoglRenderer backend. For example
applications might depend on x11 for handling input and so they require
a backend that's also based on x11.
2012-01-16 18:27:19 +00:00
Robert Bragg
50d1285ba1 Updates in line with latest wayland protocol
The shm buffer format enum values were renamed and the explicitly
premultiplied format was dropped since it's now assumed if the buffer
has an alpha component then it's premultiplied.
2012-01-16 18:27:19 +00:00
Rob Bradford
8632c65e79 wayland: Add a cogl_wayland_onscreen_resize function
This function will call into the Wayland EGL platform API and resize the
surface that the window is using and update the internal dimensions for
framebuffer and viewport to reflect the change.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-13 13:56:12 +00:00
Neil Roberts
cbbac5a2f5 Add a feature ID for the swap event notification
Previously the swap event notification feature was only accessible as
a winsys feature using the semi-internal
cogl_clutter_winsys_has_feature. This just adds a feature ID for it so
it can also be accessed via cogl_has_feature.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-09 18:59:59 +00:00
Robert Bragg
c6528c4b6c Start removing _EXP defines and improves some docs
Originally we decided to use #define tricks to rename all experimental
symbols so that they had an _EXP suffix so it would be a bit clearer for
those wanting to check for ABI changes that they shouldn't worry about
these experimental symbols.

We feel now though that the defines are a bit more hassle than they are
really worth, since they are one extra thing to remember when coding,
they make using gdb slightly more awkward since you have to use the real
symbol name to set breakpoints and we already have a mechanism for
declaring symbols as experimental via gtk-doc that can be used by anyone
wanting to check for ABI changes.

Instead of just using a script to remove all the #defines we are going
to go through them manually because we need to make sure the symbols
are marked as unstable via gtk-doc. This patch does a first batch of
define removals and in fact some of the symbols didn't have any
documentation at all so that needed to be added too.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-01-05 21:00:17 +00:00
Robert Bragg
fc88e166f0 sub-texture: Exposes a getter for parent texture
This adds a cogl_sub_texture_get_parent getter for the parent of a
CoglSubTexture.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-01-05 20:57:52 +00:00
Robert Bragg
3bc70687ac Remove old fallback for vblank wait via manual drm ioctl
This workaround code has just been incrementally carried forward since
Cogl was integrated with Clutter but really we have no idea when this
code path was ever tested. Since the work around is from before the time
of the current Cogl developers we don't know anything about the
circumstances which led to this extreme workaround instead of pushing to
fix a driver.

It seems pretty likely we can push to fix any drm based drivers so
we're removing the workaround.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-01-05 20:31:09 +00:00
Joshua Lock
20f2d51392 build: Fix building clutter on armv4t devices
GCC will define __ARM_ARCH_4T__ when building with "-march=armv4t" so we
can check this to turn off the use of 'clz' instructions, which
otherwise would cause compile errors like "selected processor does not
support ARM mode `clz r3,r0'".

Signed-off-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-01-05 20:13:41 +00:00
Neil Roberts
85d79ab4fa Add a utility to make a GSource out of a CoglContext
The GSource is created using cogl_glib_source_new which takes a
pointer to a CoglContext. The source calls cogl_poll_get_info() in its
prepare function and cogl_poll_dispatch() in its dispatch
function. The poll FDs on the source are updated according to what
Cogl reports.

The header is only included and the source only compiled if Cogl is
configured with GLib support.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-05 13:40:59 +00:00
Neil Roberts
181b875a3d xlib: Internally retrieve XEvents
Previously we relied on the application to send all X events through
Cogl using cogl_xlib_renderer_handle_event. This breaks the
abstraction that an application shouldn't need to know what winsys
Cogl is using. Now that we have main loop integreation in Cogl, the
Xlib-based winsys's can report that Cogl needs to block on the file
descriptor of the X connection and it can manually handle the
events.

The event retrieval can be disabled by an application if it calls the
new cogl_xlib_renderer_set_event_retrieval_enabled() function. The
event retrieval will also automatically be disabled if the application
sets a foreign display.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-05 13:40:24 +00:00
Neil Roberts
7497475295 Add support for main loop integration
This adds two new functions:

void
cogl_poll_get_info (CoglContext *context,
                    CoglPollFD **poll_fds,
                    int *n_poll_fds,
                    gint64 *timeout);

void
cogl_poll_dispatch (CoglContext *context,
                    const CoglPollFD *poll_fds,
                    int n_poll_fds);

The application is expected to call the first function whenever it is
about to block to go idle, and the second function whenever it comes
out of idle. This gives Cogl winsys's the ability poll file
descriptors for events. For example when handing swap complete
notifications, it can report that it needs to block on a file
descriptor.

The two functions are backed by winsys virtual functions. There are
currently no implementations. The default handler for get_info just
reports no file descriptors and an infinite timeout.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-05 13:40:10 +00:00
Neil Roberts
55344ff2c4 Add the missing cogl_is_context() function
This was missing from the CoglContext header.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-05 12:58:41 +00:00
Robert Bragg
9a82b9d21b build: removes unused variable
Simply removes an unused variable to avoid a compile time warning
2012-01-04 19:32:41 +00:00
Robert Bragg
def67a39fe gl-prototypes: split up cogl-ext-functions.h
This splits up cogl-ext-functions.h in to sets of prototypes that
can be included separately so that we can include just core
gles1 or gles2 functions without any extensions.

Since eglGetProcAddress can not be used to query core client APIs
and some implementations (notably on Android) can return a garbage
pointer instead of NULL this will allow us to explicitly check
when to use eglGetProcAddress and when to use dlsym().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-01-04 19:27:20 +00:00
Robert Bragg
04a71afab5 pipeline: fix realloc of uniform overrides array
If we need to realloc the uniforms overrides array for a pipeline to
insert a new override then we copy the old state into the new allocation
for the entries surrounding the inserted entry.

This patch fixes a mistake in how we copied the old entries that follow
the inserted entry since we were actually copying to begining of the new
allocation and potentially reading from beyond the extents of the old
allocation.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-01-04 19:27:20 +00:00
Chun-wei Fan
e215902110 Bug 666349: Dist files needed by MSVC for SDL winsys
Distribute the new VS2008/2010 project/solution files and the
pre-configured cogl-defines.h(.win32_SDL) needed for the build with MSVC.
2011-12-20 22:41:55 +08:00
Chun-wei Fan
5b53a1e4e8 Bug 666349: SDL/MSVC-Add a pre-configured cogl-defines.h
Create a pre-configured cogl-defines.h for use during Visual C++
compilation of the SDL winsys (this is in addition to the Win32/WGL
winsys).
2011-12-20 22:30:42 +08:00
Neil Roberts
24fe7c300c cogl-texture-pixmap-x11: Fix the foreach_sub_texture_in_region impl
The foreach_sub_texture_in_region implementation tries to forward the
function on to its child texture but it was mistakenly forwarding back
on to itself so it would just recurse endlessly and crash.
2011-12-20 12:46:50 +00:00
Chun-wei Fan
330146557d Bug 664827: Autotools changes for Windows .rc files
This will make autotools fill in the versioning info for the COGL/
COGL-Pango .rc files and distribute the resulting .rc files
2011-12-15 20:31:31 +08:00
Chun-wei Fan
090527f32d Add Windows Resource Files templates
This tells people on the versioning info and copyright info of the
COGL/COGL-Pango DLLs.  The versioning values are inserted during the
autogen stage.
2011-12-15 20:31:30 +08:00
Neil Roberts
bdcbb8af4d Update the SDL winsys
The SDL winsys was missing a few minor features, such as the
implementation. This patch adds that in.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-14 16:45:17 +00:00