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>
This adds api for querying a "natural" width and height for a video
which has the correct aspect ratio for displaying on square, 1:1 pixels.
The natural size is the minimum size where downscaling is not required.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Since we don't generate a mipmap chain for uploaded video frames this
avoids setting the min filter to COGL_PIPELINE_FILTER_LINEAR_MIPMAP_LINEAR.
Since COGL_PIPELINE_FILTER_LINEAR is the default and since it is also
dubious that cogl-basic-video-player is directly manipulating layers
that are conceptually internal to cogl-gst this removes the loop that
updates the filtering for cogl-gst layers.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
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.
Note: we don't simply use cogl_texture_2d_[sliced_]new_from_data() here
because we need to be able to call cogl_texture_set_premultiplied()
before allocating the texture.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
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>
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>
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)
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 7bc7ea4cb5e8134a3aeed9615477f4152b558509)
Conflicts:
cogl/winsys/cogl-winsys-egl-kms.c
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)
This adds a PlatformToolset tag in order to make upgrading the projects to
Visual Studio 2012/2013 formats easier, especially when done with a script.
The script, for example, can change the value inside these tags
apporpriately to do the upgrade job quite easily.
This updates the Visual Studio 2010 Projects in the following ways,
similar to the recent changes to the Visual Studio 2008 projects:
-Make all the copying of the pre-configured header files custom build
rules, so that it is cleaner when people clean their builds, and the files
can be re-copied when updated.
-Split up the property sheets, so to ease future maintenance
-Make the cogl-path library built as a DLL
-Build and link against SDL-2.x for SDL builds
-Make everything except the .sln file and the README.txt file use UNIX line
endings, for easier maintenance.
-Merge cogl_sdl.sln and install-sdl.vcxproj into cogl.sln and
install.vcxproj respectively.
-Update build of the conformance test to not use COGL_COMPILATION, and make
it link to cogl-path.
Split up the property sheets, so that it is easier to maintain, and update
the project files accordingly. Also clean up the project files by
finishing up the merge of the *_sdl.vcproj items into their regular
counterparts, and dropping all the *_sdl.* files.
Make use of UNIX line endings for all the MSVC 2008 build files, except the
.sln file and the README.txt files, for easier maintenance.
We need to link the conformance test executable to cogl-path, so make that
project depend on the cogl-path project, so that it will link to it as
well.
...for all of the copying of the pre-configured headers for Cogl. This
makes it much easier for people using the projects for building Cogl to
clean up files that are "generated", and this commit is the last bit for
it. Also clean up the property sheets as a result.
Also fix the Cogl project that it does indeed look for headers in
cogl/deprecated, so that the build is fixed.
Similar updates to the Visual Studio 2010 Projects will follow.
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.
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)
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)
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)
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>
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>
(cherry picked from commit 49e47c8329d50774e365fc7c3a7504b5fc005dc7)
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>
(cherry picked from commit cf26da2964e372c9fe5bd6da060a57006a83af38)
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>
(cherry picked from commit 2c619216964b46aab313be3ef1c405dfc720d258)
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>
(cherry picked from commit 07a57f26596c72507035369c90ed6d62568330b5)
The Cogl 1.x API exports cogl_set_path() and cogl_get_path(), which
means that the regular expression needs to catch those two symbols
as well.
https://bugzilla.gnome.org/show_bug.cgi?id=722765
Reviewed-by: Neil Roberts <neil@linux.intel.com>
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>
(cherry picked from commit 85baaef4a4f4fd3a03c7c9f05002eae483ddd6b3)
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)
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