Commit Graph

1925 Commits

Author SHA1 Message Date
Chun-wei Fan
a4d2c78e2b Update cogl.symbols
Remove the symbols that are now in cogl-path (where cogl-path.symbols
already include), and add the symbols that were added to the Cogl API.

Also add internal symbols as required by cogl-path and cogl-pango.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-03-20 18:00:00 +00:00
Chun-wei Fan
001cffd783 cogl/cogl-renderer.c: Avoid Clash with Newer Windows SDKs
The DriverCallback is a function that is defined by the Windows SDK 8.0+
headers, which was initially used for device driver development.  The use
of DriverCallback would cause a clash, causing things to break when built
with newer Windows SDKs, so rename DriverCallback to CoglDriverCallback to
avoid this problem.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-03-20 17:56:52 +00:00
Robert Bragg
804082abd3 Expose EGL context/display and GLX context
To help facilitate integration with third party frameworks this exposes
the EGL context and display to applications as well as the GLX context.
(Note that the GLX display is already available via
cogl_xlib_renderer_get_display())

This adds a new top-level <cogl/cogl-glx.h> header that needs to be
included explicitly to access the glx specific api.

Anyone using these apis will be responsible for checking that Cogl
is indeed using EGL or GLX by calling cogl_renderer_get_winsys_id()

This will enable GStreamer, for example, to be able to create a GL
context that shares resources with Cogl's context.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-03-20 17:34:04 +00:00
Robert Bragg
081acdc146 move GLeglImageOES define into cogl-egl-private.h
This splits out the GLeglImageOES define in cogl-egl.h into a private
cogl-egl-private.h header and updates the guards in cogl-egl.h to be
consistent with other top-level headers where we need to be careful
about how __COGL_H_INSIDE__ is defined and undefined, esp when the
gobject introspection scanner is running.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-03-20 17:34:04 +00:00
Robert Bragg
dca992a160 egl: remove NativeWindowType/NativeDisplayType defines
This ensures we use EGLNativeWindowType and EGLNativeDisplayType
everywhere instead. The previous names come from EGL 1.2 but it seems
reasonable to require more recent EGL versions. If someone wanted to add
compatibility for EGL 1.2 later it would be straightforward to define
the new names to the old.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-03-20 17:34:04 +00:00
Robert Bragg
2beb7c40e0 sdl2: fix GL driver selection
SDL2 supports selecting between full OpenGL or OpenGL ES 1/2 but our
selection code was written before SDL 2.0 was officially released and
since then a new SDL_GL_CONTEXT_PROFILE_MASK attribute was added and
we have to explicitly set the SDL_GL_CONTEXT_MINOR_VERSION attribute.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-03-20 17:34:04 +00:00
Robert Bragg
ad9db72f74 Expose COGL_FEATURE_ID_BUFFER_AGE feature id
This adds a new COGL_FEATURE_ID_BUFFER_AGE feature id that can be used
to determine if cogl_onscreen_get_buffer_age() will ever return an age
other than 0. This should be used instead of querying the winsys feature
via cogl_clutter_winsys_has_feature().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-03-20 17:34:04 +00:00
Robert Bragg
beebbfc625 glx-feature-functions: update misleading comment
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-03-20 17:34:04 +00:00
Robert Bragg
3917690f5a egl: fix incorrect #ifdef guarding of features
We have an #ifdef EGL_WL_bind_wayland_display guard in
cogl-winsys-egl-feature-functions.h to avoid referencing wayland types
when the EGL header doesn't know about them, but somehow this guard also
ended up around the KHR_create_context and EXT_buffer age features too
even though they aren't wayland specific.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-03-20 17:34:01 +00:00
Neil Roberts
18b8035dcf Set COGL_WINSYS_FEATURE_BUFFER_AGE on EGL
This winsys feature flag is exposed via the deprecated
cogl_clutter_winsys_has_feature function and Clutter is curently
relying on it. Previously the EGL winsys was only setting the internal
COGL_EGL_WINSYS_FEATURE_BUFFER_AGE flag and there was no mapping to
the public flag. Therefore the feature would only be used on GLX. This
patch just adds the mapping.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 8418e98b2b1b25515a961ad1bb9f0c4770d6eb1d)
2014-03-14 13:51:39 +00:00
Jasper St. Pierre
e7011f1910 cogl-winsys-egl-kms: Make sure to close our connection to DRM at shutdown
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit dcdba60e95ae7be1b0253d28686d1562c35374ba)
2014-03-12 17:29:27 +00:00
Jasper St. Pierre
0d91085193 cogl-winsys-egl-kms: Add cogl_kms_renderer_set_kms_fd
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 7bc7ea4cb5e8134a3aeed9615477f4152b558509)

Conflicts:
	cogl/winsys/cogl-winsys-egl-kms.c
2014-03-12 17:29:21 +00:00
Jasper St. Pierre
76cdaabc15 cogl-winsys-egl-wayland: Report an error if we can't find the globals we need
Instead of spinning forever, do a roundtrip, which guarantees that the
global messages have been sent by the time we read the sync message.

If the proper globals aren't initialized yet, error out immediately. This
does mean that users can't use CoglOnscreen with foreign custom surface
types without xdg_shell, but when a use case comes for this, we'll
investigate then...

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit af9057d35f331e2c9509958fb40627917c477b80)
2014-03-12 14:41:01 +00:00
Robert Bragg
a0441778ad This re-licenses Cogl 1.18 under the MIT license
Since the Cogl 1.18 branch is actively maintained in parallel with the
master branch; this is a counter part to commit 1b83ef938fc16b which
re-licensed the master branch to use the MIT license.

This re-licensing is a follow up to the proposal that was sent to the
Cogl mailing list:
http://lists.freedesktop.org/archives/cogl/2013-December/001465.html

Note: there was a copyright assignment policy in place for Clutter (and
therefore Cogl which was part of Clutter at the time) until the 11th of
June 2010 and so we only checked the details after that point (commit
0bbf50f905)

For each file, authors were identified via this Git command:
$ git blame -p -C -C -C20 -M -M10  0bbf50f905..HEAD

We received blanket approvals for re-licensing all Red Hat and Collabora
contributions which reduced how many people needed to be contacted
individually:
- http://lists.freedesktop.org/archives/cogl/2013-December/001470.html
- http://lists.freedesktop.org/archives/cogl/2014-January/001536.html

Individual approval requests were sent to all the other identified authors
who all confirmed the re-license on the Cogl mailinglist:
http://lists.freedesktop.org/archives/cogl/2014-January

As well as updating the copyright header in all sources files, the
COPYING file has been updated to reflect the license change and also
document the other licenses used in Cogl such as the SGI Free Software
License B, version 2.0 and the 3-clause BSD license.

This patch was not simply cherry-picked from master; but the same
methodology was used to check the source files.
2014-02-22 02:02:53 +00:00
Andreas Oberritter
3669a89215 kms: include stddef.h before drm.h
Not doing so leads to the following error, if stddef.h is not included
indirectly through EGL headers:

| libdrm/drm.h:132:2: error: unknown type name 'size_t'
|   size_t name_len;   /**< Length of name buffer */

Signed-off-by: Andreas Oberritter <obi@saftware.de>

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 55c82476a93366a3e7d1a2537fccc3a7aab87c66)
2014-02-20 18:17:42 +00:00
Neil Roberts
dd7b1d53db Allocate immediately in _cogl_egl_texture_2d_new_from_image
The _cogl_egl_texture_2d_new_from_image function has a CoglError
argument which implies that it is unlike the other texture
constructors and returns errors immediately rather than having a
delayed-allocation mechanism. cogl_wayland_texture_2d_new_from_buffer
which calls it is also like this. We can't rely on delayed-allocation
semantics for this without changing the applications because the
texture needs to be allocated before the corresponding EGLImage is
destroyed. This patch just makes it immediately allocate.

A better patch might be to remove the error argument to make it
obvious that there are delayed-allocation semantics and then fix all
of the applications.

This was breaking Cogland and Mutter.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 0206c03d54823b2f6cbb2aa420d07a4db9bcd8a3)
2014-02-20 16:05:08 +00:00
Neil Roberts
7bf0fe9df8 Don't dereference an unitialised pointer in _cogl_container_of
The previous implementation was dereferencing the sample pointer in
order to get the offset to subtract from the member pointer. The
resulting value is then only used to get a pointer to the member in
order to calculate the offset so it doesn't actually read from the
memory location and shouldn't cause any problems. However this is
probably technically invalid and could have undefined behaviour. It
looks like clang takes advantage of this undefined behaviour and
doesn't actually offset the pointer. It also generates a warning when
it does this.

This patch splits the _cogl_container_of macro into two
implementations. Previously the macro was always used in the list
iterator macros like this:

SomeType *sample = _cogl_container_of(list_node, sample, link)

Instead of doing that there is now a new macro called
_cogl_list_set_iterator which explicitly assigns to the sample pointer
with an initial value before assigning to it again with the real
offset. This redundant initialisation gets optimised out by compiler.

The second macro is still called _cogl_container_of but instead of
taking a sample pointer it just directly takes the type name. That way
it can use the standard offsetof macro.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 1efed1e0a2bce706eb4901979ed4e717bb13e4e2)
2014-02-20 13:38:43 +00:00
Owen W. Taylor
ee5dc42612 GLX winsys: fix feature handling for INTEL_swap_event
The declaration of INTEL_swap_event was treating winsys features as
if they were a bitfield, but they aren't. The end result was that
instead of reporting two features when INTEL_swap_event is present,
we report none.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2014-02-05 13:44:38 +00:00
Neil Roberts
d3ecaf7a9a winsys-wgl: Don't include cogl.h
Since 248a76f5eac7e5ae4fb45208577f9a55360812a7 cogl.h can no longer be
included in internal source files so the WGL winsys was no longer
compiling.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 91af97a2a27ab5ad3e7eaabebd03503b685d4d42)
2014-01-20 16:41:13 +00:00
Neil Roberts
eb7ef457cb Add support for RG textures
This adds COGL_PIXEL_FORMAT_RG_88 and COGL_TEXTURE_COMPONENTS_RG in
order to support two-component textures. The RG components for a
texture is only supported if COGL_FEATURE_ID_TEXTURE_RG is advertised.
This is only available on GL 3, GL 2 with the GL_ARB_texture_rg
extension or GLES with the GL_EXT_texture_rg extension. The RG pixel
format is always supported for images because Cogl can easily do the
conversion if an application uses this format to upload to a texture
with a different format.

If an application tries to create an RG texture when the feature isn't
supported then it will raise an error when the texture is allocated.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 568677ab3bcb62ababad1623be0d6b9b117d0a26)

Conflicts:
	cogl/cogl-bitmap-packing.h
	cogl/cogl-types.h
	cogl/driver/gl/gl/cogl-driver-gl.c
	tests/conform/test-read-texture-formats.c
	tests/conform/test-write-texture-formats.c
2014-01-20 14:40:45 +00:00
Neil Roberts
06c75ea2e7 Tweak documentation for the CoglTexture interface
The following changes are made to the documentation for CoglTexture:

• The description of the default value for the components property is
  changed to say that it is always RGBA for textures created by the
  ‘_with_size’ textures. Previously it said that the default is based
  on the pixel format used the first time data is set on the texture,
  but this is only true if the data is set using a constructor.

• Added documentation for the CoglTextureComponents enum.

• Changed it to say that it _specifies_ what components are required
  for sampling rather than determinging [sic] them.

• Added ‘Since: 1.18’ to
  cogl_texture_{set,get}_{components,premultiplied}

• Changed the since tag for CoglTextureError from 2.0 to 1.8.

• Added documentation for COGL_TEXTURE_ERROR_{FORMAT,TYPE}.

• Added the following to the cogl2-sections.txt file:
  COGL_TEXTURE_ERROR
  CoglTextureError
  cogl_texture_allocate
  cogl_texture_set_components
  cogl_texture_get_components
  cogl_texture_set_premultiplied
  cogl_texture_get_premultiplied

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 2f12c4329c519fa14b927b2dcd708dddcc903c32)
2014-01-20 14:32:39 +00:00
Neil Roberts
5085919acc pipeline-cache: Prune old unused pipelines when the cache gets too big
Previously when a pipeline is added to the cache it would never be
removed. If the application is generating a lot of unique pipelines
this can end up effectively leaking a large number of resources
including the GL program objects. Arguably this isn't really a problem
because if the application is generating that many unique pipelines
then it is doing something wrong anyway. It also implies that it will
be recompiling shaders very often so the cache leaking will likely be
the least of the problems.

This patch makes it keep track of which pipelines in the cache are in
use. The cache now returns a struct representing the entry instead of
directly returning the pipeline. This entry contains a usage counter
which the pipeline backends can use to mark when there is a pipeline
alive that is using the cache entry. When the hash table decides that
it's a good time to prune some entries, it will make a list of all of
the pipelines that are not in use and then remove the least recently
used half of the pipelines. That way it is less likely to remove
pipelines that the application is actually regenerating often even if
they aren't in use all of the time.

When the cache is pruned the hash table makes a note of how small the
cache could be if it removed all of the unused pipelines. The hash
table starts pruning when there are more entries than twice this
minimum expected size. The idea is that if that case it hit then the
hash table is more than half full of useless pipelines so the
application is generating lots of redundant pipelines and it is a good
time to remove them.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit c21aac22992bb7fef5a8d0913130b8245e67f2eb)

Conflicts:
	cogl/driver/gl/cogl-pipeline-fragend-glsl.c
	cogl/driver/gl/cogl-pipeline-progend-glsl.c
	cogl/driver/gl/cogl-pipeline-vertend-glsl.c
	cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c
2014-01-14 12:05:17 +00:00
Robert Bragg
85a26ea785 texture: fix cogl_texture_get_components prototype
This fixes the cogl_texture_get_components() prototype to have a return
type of CoglTextureComponents instead of CoglBool which was probably a
copy and paste error.

(cherry picked from commit 55b09f8a939db71ee5ff41afa0ed08cbe937a4ec)
2014-01-13 19:10:27 +00:00
Robert Bragg
a77dc1319c texture-rectangle: update _new_with_size in line with master
This updates the cogl_texture_rectangle_new_with_size() api in line with
master to be consistent with other texture constructors. This removes
the internal_format and error arguments and allows the texture to be
allocated lazily which means the texture can be configured with apis
like cogl_texture_set_components() and cogl_texture_set_premultiplied()
before it is allocated.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-01-13 17:35:05 +00:00
Robert Bragg
8cedb43249 expose deprecated fb api regardless of COGL_ENABLE_EXPERIMENTAL_2_0_API
test-path for example uses COGL_ENABLE_EXPERIMENTAL_2_0_API to access
the 2.0 CoglPath api but also uses deprecated framebuffer api such as
cogl_push/pop_framebuffer. Similarly clutter-backend.c builds with
COGL_ENABLE_EXPERIMENTAL_2_0_API and uses cogl_set_framebuffer().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-01-09 17:10:21 +00:00
Robert Bragg
1932892b98 framebuffer: move fb stack under cogl/deprecated/
This moves the framebuffer stack apis out of cogl-framebuffer.c into
cogl/deprecated/cogl-framebuffer-deprecated.c so cogl-framebuffer.c is
more in-line with the master branch to ease cherry picking patches.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-01-09 16:29:14 +00:00
Robert Bragg
1472c5beb2 auto-texture: Adds cogl-auto-texture.h header
This moves all of the automagic texture constructor prototypes from
cogl-texture.h into a new deprecated/cogl-auto-texture.h file. This also
moves cogl_texture_new_from_sub_texture() into
deprecated/cogl-auto-texture.c

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-01-09 16:29:11 +00:00
Robert Bragg
af7398788a remove internal_format and redundant error arguments
Texture allocation is now consistently handled lazily such that the
internal format can now be controlled using
cogl_texture_set_components() and cogl_texture_set_premultiplied()
before allocating the texture with cogl_texture_allocate(). This means
that the internal_format arguments to texture constructors are now
redundant and since most of the texture constructors now can't ever fail
the error arguments are also redundant. This now means we no longer
use CoglPixelFormat in the public api for describing the internal format
of textures which had been bad solution originally due to how specific
CoglPixelFormat is which is missleading when we don't support such
explicit control over the internal format.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 99a53c82e9ab0a1e5ee35941bf83dc334b1fbe87)

Note: there are numerous API changes for functions currently marked
as 'unstable' which we don't think are in use by anyone depending on
a stable 1.x api. Compared to the original patch though this avoids
changing the cogl_texture_rectangle_new_with_size() api which we know
is used by Mutter.
2014-01-09 15:49:47 +00:00
Robert Bragg
cbd6951134 introduce texture loaders to make allocations lazy
This introduces the internal idea of texture loaders that track the
state for loading and allocating a texture. This defers a lot more work
until the texture is allocated.

There are several intentions to this change:

- provides a means for extending how textures are allocated without
  requiring all the parameters to be supplied in a single _texture_new()
  function call.

- allow us to remove the internal_format argument from all
  _texture_new() apis since using CoglPixelFormat is bad way of
  expressing the internal format constraints because it is too specific.

  For now the internal_format arguments haven't actually been removed
  but this patch does introduce replacement apis for controlling the
  internal format:

    cogl_texture_set_components() lets you specify what components your
    texture needs when it is allocated.
    cogl_texture_set_premultiplied() lets you specify whether a texture
    data should be interpreted as premultiplied or not.

- Enable us to support asynchronous texture loading + allocation in the
  future.

Of note, the _new_from_data() texture constructors all continue to
allocate textures immediately so that existing code doesn't need to be
adapted to manage the lifetime of the data being uploaded.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 6a83de9ef4210f380a31f410797447b365a8d02c)

Note: Compared to the original patch, the ->premultipled state for
textures isn't forced to be %TRUE in _cogl_texture_init since that
effectively ignores the users explicitly given internal_format which was
a mistake and on master that change should have been made in the patch
that followed. The gtk-doc comments for cogl_texture_set_premultiplied()
and cogl_texture_set_components() have also been updated in-line with
this fix.
2014-01-09 15:49:46 +00:00
Robert Bragg
3f780e2f3f get_texture_bits_via_offscreen(): use meta texture format
When reading a texture back by first wrapping it as an offscreen
framebuffer and using _read_pixels_into_bitmap() we now make sure the
offscreen framebuffer has an internal format that matches the
meta-texture being read not that of the current sub-texture being
iterated. In the case of atlas textures the subtexture is a shared
texture whose format doesn't reflect the premultipled alpha status of
individual atlas-textures, nor whether the alpha component is valid.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 6ee425d4f10acd8b008a2c17e5c701fc1d850f59)
2014-01-09 15:49:46 +00:00
Robert Bragg
99cdcc9e3c texture: make cogl_texture_get_format api private
CoglPixelFormat is not a good way of describing the internal
format of a texture because it's too specific given that we don't
actually have exact knowledge of the internal format used by the driver.

This makes cogl_texture_get_format private and in the future we'll
provide a better way of querying the channels and their precision.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit ffde82981f22bd0185a7f33e1e6e1479f4c295b8)

Note: Since we can't break API compatibility on the 1.x branch this adds
a cogl/deprecated/cogl-texture-deprecated.c file with a
cogl_texture_get_format() wrapper around the private api. This also
moves the cogl_texture_get_rowstride() and cogl_texture_ref/unref()
functions that were previously deprecated into cogl-texture-deprecated.c
2014-01-09 15:49:35 +00:00
Robert Bragg
bab33bf0f3 atlas: defer checks until allocation
This defers checking the internal format and whether accelerated
migration is supported until allocating the texture.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 83b05cbe3969789bc3ec78480c0937a6722efbf1)
2014-01-09 15:29:30 +00:00
Robert Bragg
46f5239664 atlas: make zero size a programmer error
Instead of throwing a CoglError exception if an application tries to
allocate a zero size atlas texture this make that a programmer error
instead.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit d3eaeedc86d408669b81d6c43ef2b0ab9d859c85)
2014-01-09 15:29:30 +00:00
Robert Bragg
40c6b1cc29 texture: allocate on slicing/hw repeat queries
The plan is to defer a lot more work in creating a texture until
allocation time. This means that for some texture backends we might not
know until after allocation whether the texture is sliced or can support
hardware repeating. This makes sure we trigger an allocation if either
of these are queried.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 4868582812dbcd5125495b312d858f751fc31e9d)
2014-01-09 15:29:30 +00:00
Robert Bragg
b9093839b4 ensure texture allocated in _get_gl_texture() in preparation
The plan is to defer a lot more work in creating a texture until
allocation time. This means we wont be able to assume that all textures
being used to render must have already been allocated when data was
specified.

The latest point at which we will generally require a texture to be
allocated will be when we need to know the underlying GL handle for a
texture and so this updates cogl_texture_get_gl_texture() to ensure the
texture is allocated.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 59f6fefc37524f492512a71b831760a218d9bb95)
2014-01-09 15:29:30 +00:00
Robert Bragg
96ed01cc18 framebuffer: defer calculating level size until allocation
The plan is to defer more of the work for creating a texture until
allocation time, but that means we won't be able to always assume
we can query the size of a texture when creating an offscreen
framebuffer from a texture (consider for example using
_texture_new_from_file() where the size isn't known until the file has
been loaded). This defers needing to know the size of the texture
underlying an offscreen framebuffer until calling
cogl_framebuffer_allocate().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 9688e7dc1eeae3144729dfd4a4bf409620346bf4)
2014-01-09 15:29:30 +00:00
Robert Bragg
08ba5c64b9 framebuffer: if size unknown; allocate for size/vp queries
This ensures framebuffers are implicitly allocated when querying the
width, height or viewport width/height if the framebuffer's size is
currently unknown. The plan is to allow texture backends to defer
calculating the size of textures until they are allocated which in turn
means we won't know the size of offscreen framebuffers until the texture
has been allocated. Potentially we could be more specific about this in
the future and only ensure the texture is allocated, but for now it will
be simplest to just ensure the framebuffer is allocated.

Note: in the case of onscreen buffers which are always initialized with
a requested size we are careful to avoid triggering an allocation when
this is queried otherwise we will see recursion when the winsys code
queries the requested size during allocation.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit f4b612f1b75e043f1852b9a32368cc37ab89308b)
2014-01-09 15:29:30 +00:00
Robert Bragg
a07d26e9ae offscreen: allocate texture before querying slicing
Since we are planning on deferring more texture allocation work this
makes sure we don't query whether a texture is sliced until we know it
has been allocated.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit b742638a1ce581f5a2c9f15907361c3b0c1b178c)
2014-01-09 15:29:30 +00:00
Robert Bragg
2e61318914 framebuffer: make format internal
This removes cogl_framebuffer_get_color_format() since the actual
internal format isn't strictly controlled by us. CoglFramebuffer::format
has been renamed to ::internal_format to make it clearer that it only
really represents the premultiplication status.

The plan is to make most of the work involved in creating a texture
happen lazily when allocating so this patch also changes
_cogl_framebuffer_init() to not take a format argument anymore since we
won't know the format of offscreen framebuffers until the framebuffer is
allocated, after the corresponding texture has been allocated. In the
case of offscreen framebuffers we now update the framebuffer
internal_format during allocation.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 8cc9e1c8bd2fac8b2a95087249c23c952d5e379f)

Note: Since we can't break API compatibility on the 1.x branch this
actually keeps the cogl_framebuffer_get_color_format() api but moves it
into a new deprecated/cogl-framebuffer-deprecated.c file and it now
returns the newly name ::internal_format.
2014-01-09 15:29:30 +00:00
Robert Bragg
8f19d01815 macros: Add 1.18 deprecation macros 2014-01-09 15:29:30 +00:00
Robert Bragg
3083ff6877 version: Add COGL_VERSION_1_18 define 2014-01-09 15:29:30 +00:00
Adel Gadllah
0af4105458 winsys-glx: Fix swap region to remain disabled for old mesa
Commit a750f80c6a was supposed to enable it for newer mesa but was wrong,
fix that.
2014-01-06 22:02:16 +01:00
Adel Gadllah
a750f80c6a winsys-glx: Reenable swap_region for llvmpipe and swrast
The bug that prevented MESA_copy_sub_buffer to work for swrast /
llvmpipe got fixed in mesa 10.1 git so enable it for mesa 10.1+.

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

When landing the patch, it was tweaked to #include "cogl-version.h" to
avoid a compiler warning about COGL_VERSION_ENCODE being implicitly
defined. -- Robert Bragg

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit e7e216b1d3d151acf3fed619bd759692a989b4b4)
2014-01-06 17:17:17 +00:00
Robert Bragg
52a69bb9ab Build and install cogl-path as a shared library
Since we now have more time to ensure that Clutter is updated to check
for the now separate cogl-path package as part of its build
configuration we are now making the package split, in line with Cogl
master.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2013-12-11 18:49:19 +00:00
Robert Bragg
a0bc2d96be Make cogl-sdl.h a top-level header
This makes it so that cogl-sdl.h is a top-level header no longer
automatically included by cogl.h. This avoids lots of warnings building
the conformance tests and examples due to SDL.h warning when
__STRICT_ANSI__ isn't defined.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit f7536985437dc85c26b33d1bbe1b7f3d4b32476a)
2013-12-11 18:49:19 +00:00
Jasper St. Pierre
1b0d0f3892 cogl-framebuffer: Don't mark the clear clip dirty from the journal
This means that we can't cache the journal read_pixels optimization.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 550bae22d20c8d6d7cf1d090faa9c91619594077)
2013-12-04 18:38:44 +00:00
Neil Roberts
24412798dc Revert "Revert "Remove the framebuffer's stack of clip stacks""
This reverts commit bc41489336.

The reason this was causing problems for Clutter is that it defines
COGL_ENABLE_EXPERIMENTAL_2_0_API which is meant to cause the Cogl
headers not to declare the deprecated API. The reverted patch moved
some additional clipping API to a deprecated header which was
previously being used by Clutter. Clutter was still successfully
compiling but with some warnings for the missing function
declarations. However when the binary is run the clipping would get
completely messed up because it would assume all of the arguments to
the functions are integers instead of floats and the wrong values
would be passed.

Clutter now has commit to make it use the 2.0 API instead of the
deprecated functions so the revert is no longer necessary.

https://git.gnome.org/browse/clutter/commit?id=705640367a5c2ae21405806bfa

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2013-12-04 17:22:01 +00:00
Neil Roberts
0596fe8020 Fix calculating the bounds when clipping from a primitive
When projecting the bounding rectangle of a primitive it was using the
modelview matrix twice instead of the modelview and projection
matrices so it was coming out with garbage.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 7e1f05c84013bb91248d691091df00f4f634c6cf)
2013-12-03 15:28:35 +00:00
Jasper St. Pierre
bc41489336 Revert "Remove the framebuffer's stack of clip stacks"
This reverts commit ae9cd7ca01.

Pushing this for now so we can get gnome-shell working again without
memory corruption. Let's push a proper fix later for everybody.
2013-12-02 23:32:48 -05:00
Neil Roberts
833ed7ebc1 Remove cogl2-compatibility.c
This was added in 361bd516f3 late during the 1.10 cycle to
contain experimental functions that we should never have made public.
The plan was to remove them once we started working on 1.12 but it
looks like we never got around to doing that. Better late than never!

The header for the file was already removed in 7365c3aa77.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2013-12-02 17:05:30 +00:00