summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Tightly integrate ulib (was eglib)wip/ulibRobert Bragg2014-03-10316-7331/+7305
| | | | | | | | | | | | | | Instead of maintaining optional support for using deps/eglib instead of glib we now always use this code. This way the code is always being tested so we are less likely to break support for building Cogl without glib, and because the api no longer needs to be swappable we are free to make Cogl specific changes to the api. So that we can still support glib integration the eglib library has been renamed to ulib and symbols are prefixed with 'u_' or 'U_' so that they don't clash with glib. GLib integration for GError and GType continues to be supported.
* eglib: simplify compiler checksRobert Bragg2014-03-054-184/+75
| | | | | | | | | | | This removes a number of ./configure time compiler checks in favour of compile time checks and also assumes you are building with a modern compiler. For example we assume <stdint.h> and <inttypes.h> headers are available. These changes will make it easier to maintain the ability to build Cogl on Android via an Android.mk file where it's not usual to use the build system to check compiler features.
* eglib: remove unused gpattern and gmarkup apisRobert Bragg2014-03-057-1009/+3
| | | | | This simply removes a couple of eglib apis that aren't needed by Cogl and the corresponding tests.
* eglib: remove some redundant filesRobert Bragg2014-03-0517-2653/+5
| | | | | | The eglib as found in the mono git repository can be built separately from the rest of mono, but to avoid maintaining parallel build scripts for eglib this strips away the autotool related files from deps/eglib.
* Add deps/eglib library from the mono projectRobert Bragg2014-03-05193-38604/+23443
| | | | | | | | | | | | | This adds a deps/eglib api which is a small MIT licensed library that is api compatible with enough of the glib api to run Cogl. This replaces deps/glib and deps/gmodule for use when Cogl is built with --enable-standalone. This code is based on eglib from the mono project, with a few updates and additions to handle apis that Cogl uses that mono doesn't. As a reference point for monitoring eglib changes in the mono project, this code is based on commit d50c836721f22df74a45185d51d0b9d37c370e33
* standalone: Fix building standaloneRobert Bragg2014-02-203-12/+8
| | | | | This fixes a few build issues with compiling Cogl against our internal deps/glib and deps/gmodule libraries.
* gmacros: Use _Static_assert for G_STATIC_ASSERTRobert Bragg2014-02-201-3/+6
| | | | | | This now simply defines G_STATIC_ASSERT in terms of _Static_assert if __GNUC__ is defined, and disables the assertion if not. This stops lots of verbose compiler warnings caused by the previous typedef based approach.
* stb_image: upgrade to version 1.33Robert Bragg2014-02-201-1291/+2076
| | | | | This upgrades stb_image to 1.33 which notably fixes some problems with inconsistently using #if and #ifdef to check the STBI_SIMD define.
* Fix _COGL_RETURN_VAL_IF_FAIL return type warningRobert Bragg2014-02-201-1/+1
| | | | | | This fixes a warning by making the _COGL_RETURN_VAL_IF_FAIL check in _cogl_offscreen_gl_allocate return FALSE not NULL, since the api returns a CoglBool not a pointer.
* cogl-gst: allocate textures synchronouslyRobert Bragg2014-02-201-1/+3
| | | | | | | | | This makes sure video textures being uploaded via video_texture_new_from_data are allocated before the function returns. This function create a CoglBitmap to wrap the data from gstreamer and by allowing cogl to allocate the texture lazily it's possible that the data being pointed to by the bitmap won't remain valid until we actually come to allocate the texture.
* kms: include stddef.h before drm.hAndreas Oberritter2014-02-201-0/+1
| | | | | | | | | | | | 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>
* Allocate immediately in _cogl_egl_texture_2d_new_from_imageNeil Roberts2014-02-201-1/+10
| | | | | | | | | | | | | | | | | | | 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>
* Don't dereference an unitialised pointer in _cogl_container_ofNeil Roberts2014-02-196-32/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Updated Ukrainian translationDaniel Korostil2014-02-141-99/+121
|
* Updated FSF's addressDaniel Mustieles2014-01-3167-193/+67
|
* cogl-basic-video-player: Allow passing a GStreamer pipelineNeil Roberts2014-01-311-12/+122
| | | | | | | | | | | | | | If the URI argument given on the command line doesn't look like a URI then the basic video player will now try to parse it as a GStreamer pipeline description. The pipeline must contain a coglsink element which the player will look for. This can be used to test Cogl GST. For example, to test NV12 this can be used: ./cogl-basic-video-player 'videotestsrc ! video/x-raw,format=(string)NV12 ! coglsink' Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogl-gst: Fix get_caps implementation when no context is setNeil Roberts2014-01-311-1/+5
| | | | | | | | | | | | | | If no context is set on the CoglGstVideoSink then it would previously call gst_caps_ref with a NULL pointer. This patch makes it just return NULL instead. I think that is a valid thing to do because that is what gst_base_sink_default_get_caps does. If we don't do this then it's not possible to use CoglGstVideoSink with GstParse because that tries to link the pipeline after parsing the string. That was previously causing a critical error because the freshly parsed sink doesn't have a CoglContext. Reviewed-by: Robert Bragg <robert@linux.intel.com> Reviewed-by: Lionel Landwerlin <llandwerlin@gmail.com>
* cogl-gst: video-sink: add NV12 supportNeil Roberts2014-01-311-6/+111
| | | | | | | | | | | | | | | | | | This adds a cogl-gst renderer to decode NV12 data. NV12 is split into two buffers, one for the luma component and another for the two chrominance components at a quarter of the resolution. The second buffer is uploaded to a two-component RG texture. RG-component textures are only supported if COGL_FEATURE_ID_TEXTURE_RG is advertised by Cogl so the NV12 cap is also only advertised when that is available. Based on a patch by Lionel Landwerlin which was in turn based on a patch from Edward Hervey and Matthieu Bouron for Clutter-Gst: https://bugzilla.gnome.org/show_bug.cgi?id=712832 Reviewed-by: Robert Bragg <robert@linux.intel.com> Reviewed-by: Lionel Landwerlin <llandwerlin@gmail.com>
* cogl-gst-video-sink: Premultiply the colors coming from the videoNeil Roberts2014-01-312-38/+125
| | | | | | | | | | | | | | | | | | | | | | | | Commit 99a53c82e9ab0a1e5 removed the internal format argument when uploading a video frame to a texture so that the format will just be determined automatically from the image format. However this also leaves the premultiplied state at the default and the default is TRUE. That means that when we upload RGBA data Cogl will do a premultiplied conversion on the CPU. We probably don't want to be putting a CPU conversion in the way of video frames so this patch changes it to set the premultiplied state to FALSE on the textures and then do the premultiplied conversion in the shader. This is particularly important for AYUV which uses the alpha channel for the V component so doing a premultiplied conversion on the CPU just creates garbage and messes up the image. The RGB and RGBA renderers have each been split into two; one that uses GLSL and one that uses a regular pipeline. The RGBA pipeline without GLSL is then changed to use 2 layers so we that we can do the premultiplied conversion in the second layer with a special layer combine string. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Update Chinese simplified translationWylmer Wang2014-01-241-105/+100
|
* cogl-gst: video-sink: fix not installed rgb shaderLionel Landwerlin2014-01-221-1/+3
| | | | Reviewed-by: Neil Roberts <neil@linux.intel.com>
* mingw-fetch-dependencies: Add the -L option when using curlNeil Roberts2014-01-201-1/+1
| | | | | | | The -L option makes curl follow redirections. This is needed for downloading glext.h because khronos.org is using a redirect. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* winsys-wgl: Don't include cogl.hNeil Roberts2014-01-201-2/+0
| | | | | | | | 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>
* Set the COGL_BITWISE_BIT flag for the formats with 10-bit componentsNeil Roberts2014-01-201-9/+9
| | | | | | | | | The texture formats which have 10-bit components are necessarily not byte-aligned so they ought to have the COGL_BITWISE_BIT flag. This flag is enough to make them unique so they no longer need a new enum value. The last enum value is therefore reset back to 1. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add support for RG texturesNeil Roberts2014-01-2015-16/+283
| | | | | | | | | | | | | | | | | | 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>
* Tweak documentation for the CoglTexture interfaceNeil Roberts2014-01-202-11/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* This re-licenses Cogl under the MIT licenseRobert Bragg2014-01-14327-4474/+6574
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows up on the proposal that was sent to the Cogl mailing list to re-license from the LGPL to the MIT license: 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.
* pipeline-cache: Prune old unused pipelines when the cache gets too bigNeil Roberts2014-01-148-87/+334
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* winsys-glx: Fix swap region to remain disabled for old mesaAdel Gadllah2014-01-061-1/+1
| | | | | Commit a750f80c6aaa was supposed to enable it for newer mesa but was wrong, fix that.
* winsys-glx: Reenable swap_region for llvmpipe and swrastAdel Gadllah2014-01-061-10/+14
| | | | | | | | | | | | | 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>
* texture: fix cogl_texture_get_components prototypeRobert Bragg2014-01-022-2/+2
| | | | | | 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.
* remove internal_format and redundant error argumentsRobert Bragg2014-01-0160-549/+308
| | | | | | | | | | | | | | | | 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>
* introduce texture loaders to make allocations lazyRobert Bragg2014-01-0128-838/+1599
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* get_texture_bits_via_offscreen(): use meta texture formatRobert Bragg2014-01-013-25/+69
| | | | | | | | | | | | 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>
* texture: return ints from _get_width/heightRobert Bragg2014-01-012-4/+4
| | | | | | | | This changes cogl_texture_get_width/height to return signed integers just because unsigned integers in C often cause un-obvious arithmetic issues due to implicit casting. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* texture: make cogl_texture_get_format api privateRobert Bragg2014-01-0118-33/+23
| | | | | | | | | | | 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>
* atlas: defer checks until allocationRobert Bragg2014-01-011-24/+24
| | | | | | | This defers checking the internal format and whether accelerated migration is supported until allocating the texture. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* atlas: make zero size a programmer errorRobert Bragg2014-01-011-9/+2
| | | | | | | | 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>
* texture: allocate on slicing/hw repeat queriesRobert Bragg2014-01-011-0/+6
| | | | | | | | | | 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>
* ensure texture allocated in _get_gl_texture() in preparationRobert Bragg2014-01-011-0/+3
| | | | | | | | | | | | | | 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>
* framebuffer: defer calculating level size until allocationRobert Bragg2014-01-014-34/+53
| | | | | | | | | | | | | 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>
* framebuffer: if size unknown; allocate for size/vp queriesRobert Bragg2014-01-011-0/+32
| | | | | | | | | | | | | | | | | | 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>
* offscreen: allocate texture before querying slicingRobert Bragg2014-01-011-3/+5
| | | | | | | | 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>
* framebuffer: make format internalRobert Bragg2014-01-015-17/+11
| | | | | | | | | | | | | | | | | This removes cogl_framebuffer_get_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>
* cogl-gst: video-sink: fix YV12/I420 supportRobert Bragg2014-01-011-3/+3
| | | | | | | This fixes a mistake in commit 637728dd89d51bc28 that was meant to fix yv12/i420 support but when the patch was updated based on review to use COGL_PIXEL_FORMAT_A instead of COGL_PIXEL_FORMAT_G the corresponding glsl code wasn't also updated to sample the .a component.
* cogl-gst: video-sink: fix ayuv pipeline setupLionel Landwerlin2013-12-111-2/+2
|
* cogl-gst: video-sink: fix YV12/I420 supportLionel Landwerlin2013-12-111-4/+49
|
* cogl-framebuffer: Don't mark the clear clip dirty from the journalJasper St. Pierre2013-12-043-1/+11
| | | | | | | | | 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>
* Fix calculating the bounds when clipping from a primitiveNeil Roberts2013-12-032-2/+2
| | | | | | | | 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>
* Add a test for cogl_framebuffer_push_path_clipNeil Roberts2013-12-033-1/+71
| | | | | | | | | | | The test makes an L-shaped path that fills the whole framebuffer except for the top right quadrant. It then clips to that and tries to fill the framebuffer with a rectangle. Then it verifies that all of the quadrants have the expected colour. This is currently failing due to a bug in the primitive clipping. Reviewed-by: Robert Bragg <robert@linux.intel.com>