Commit graph

53 commits

Author SHA1 Message Date
Matthew Waters
31b1094744 gl: misc docs fixes/additions 2017-12-09 19:32:17 +00:00
Matthew Waters
86110c4765 glupload: always add texture-target field to GL caps
1. Various elements/base classes only perform a subset check on accept-caps
2. Some GL elements have texture-target in their pad template
3. When checking subsets, only the caps to check are allowed to contain extra
   fields.  If the 'template' caps have extra fields, the subset fails.
Thus without texture-target on the caps, various accept-caps implementations
were failing.

Also, add some convenience functions for setting and retrieving
texture targets to/from GValue.

https://bugzilla.gnome.org/show_bug.cgi?id=759860
2017-12-09 19:32:14 +00:00
Matthew Waters
caee3e41f9 gl: add convenience function for the start of a video frame
Get's the start of the video frame based on a GstVideoInfo and
GstVideoAlignment.
2017-12-09 19:32:12 +00:00
Reynaldo H. Verdejo Pinochet
68e668168d Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe
2017-12-09 19:32:11 +00:00
Matthew Waters
117fc0409a glshader: properly unref the stages on failure
When failing in the varargs functions, all the stage objects not handled need to
be unreffed to prevent a leak.
2017-12-09 19:32:11 +00:00
Alessandro Decina
7fedb34bea gstglutils: fix shader compilation on Mountain Lion
Make gst_gl_context_gen_shader/_compile_shader assume GST_GLSL_PROFILE_ES |
GST_GLSL_PROFILE_COMPATIBILITY as the profile. Without this, the shader compiler
doesn't inject the #version tag resulting in a compilation error on Mountain
Lion.

This is a workaround for old code using gst_gl_context_gen_shader. New code
should use the gst_glsl_stage_* API directly which allows the caller to
explicitly specify version/profile.
2017-12-09 19:32:10 +00:00
Matthew Waters
f688a8f0b2 glshader: port to using GstGLSLStage objects for string management
A GstGLShader is now simply a collection of stages that are
compiled and linked together into a program.  The uniform/attribute
interface has remained the same.
2017-12-09 19:32:09 +00:00
Matthew Waters
16ee1636dc gl: move debugging related functions to their own file 2017-12-09 19:32:09 +00:00
Matthew Waters
0580536fa1 glutils: use gst_element_set_context for setting display/other_context
1. So we get tracking inside GstElement properly when e.g. adding to a bin
2. Removes redundant code.  Now only one place where
   GstContext->GstGLDisplay/GstGLContext transformation occurs
3. Fixes a memory leak in the process
4. Make the retrieval of debug categories thread safe
2017-12-09 19:32:09 +00:00
Matthew Waters
dc469454d7 gl: set the context on the element on a context query
Otherwise it's possible to lose the context information if the
context is only propagated through queries.
2017-12-09 19:32:09 +00:00
Matthew Waters
c486b1b3b0 gl/utils: add a function to insert a debug marker
These markers are visible in tools that record the GL function calls
such as apitrace, et al.

Makes it easier to match up GL draw commands with specific elements.
2017-12-09 19:32:08 +00:00
Matthew Waters
1e9f7b6303 gl: consolidate internal_rgba_format into glmemory
Expose some useful value format conversion functions available in
GstGLMemory.
2017-12-09 19:32:03 +00:00
Matthew Waters
79f4a5fcf3 gl/utils: implement wayland display GstContext
requried for sharing GL contexts or subsurface support
2017-12-09 19:32:03 +00:00
Julien Isorce
fce0e0ba3c gl: add and use gst_gl_internal_format_rgba
Previously when compiling GstGL with both GL and GLES2,
GL_RGBA8 was picked from GL/gl.h. But a clash may happen at
runtime when one is selecting GLES2.

gst_gl_internal_format_rgba allows to check at runtime
if it should use GL_RGBA or GL_RGBA8.
2017-12-09 19:32:02 +00:00
Sebastian Dröge
51d3a0a059 Revert "gl: readd glupload/download onto element pads"
This reverts commit 87d8270f30.
2017-12-09 19:32:00 +00:00
Matthew Waters
343947f383 gl: readd glupload/download onto element pads
Allows insertion of gl elements into non-gl pipelines without converter
(upload/download) elements.

https://bugzilla.gnome.org/show_bug.cgi?id=743974
2017-12-09 19:32:00 +00:00
Julien Isorce
a51680b1b3 gl: avoid overwriting display and context to NULL
It happens when the application provides display
and/or context.
2017-12-09 19:31:57 +00:00
Matthew Waters
6d4cca89ef glutils: expose running a query on a set of src/sink pads 2017-12-09 19:31:56 +00:00
Jan Schmidt
6350c35352 Remove a bunch of silly ';;' typos at the end of lines 2017-12-09 19:31:56 +00:00
Matthew Waters
530ae2cbb0 glupload/download/convert: provide transform_caps functions
Allows finer grain decisions about formats and features at each
stage of the pipeline.
Also provide propose_allocation for glupload besed on the supported
methods.
2017-12-09 19:31:54 +00:00
Nicolas Dufresne
a1e02726ee gl: Add support for GstVideoAlignment
This allow saving a copy with libav video decoders or decoders with
similar padding requirement.

https://bugzilla.gnome.org/show_bug.cgi?id=740900
2017-12-09 19:31:52 +00:00
Matthew Waters
892d056a44 gl: remove the use of glu 2017-12-09 19:31:51 +00:00
Matthew Waters
d738b78229 glutils: only attempt getting the app context when we don't already have a display
avoids querying/messaging the world on each frame
2017-12-09 19:31:49 +00:00
Matthew Waters
6811c39ff9 gl/examples: update for other-context property removal 2017-12-09 19:31:49 +00:00
Matthew Waters
62e3c40d97 gl: propogate other-context using GstContext 2017-12-09 19:31:48 +00:00
Wang Xin-yu (王昕宇)
c8d1e4ad5f gl: check null before unref GstGLDisplay 2017-12-09 19:31:45 +00:00
Matthew Waters
a76fe07919 gl: don't take an extra ref on the display on set_context
gst_context_get_gl_display() returns a ref.  Don't take another in
gst_object_replace().
2017-12-09 19:31:45 +00:00
Matthew Waters
4a8b31afd6 glfeature: remove GST_GL_API_GLES3
instead check the gl version using gst_gl_context_check_gl_version()
2017-12-09 19:31:42 +00:00
Julien Isorce
4bc96ae4cd gl: allow to avoid calling glTexImage2D(w, h, NULL) when generating a texture
Just pass 0 as width or height to gst_gl_context_gen_texture.
2017-12-09 19:31:39 +00:00
Jan Schmidt
cf018389e1 gl: Reduce noisy Info level output to LOG 2017-12-09 19:31:38 +00:00
Julien Isorce
c2471aec81 gl: add EGLImage support
* picked from old libgstegl:
  - GstEGLImageMemory
  - GstEGLImageAllocator
  - last_buffer management from removed GstEGLImageBufferPool

* add-ons:
  - GstEGLImageMemory now old a reference on GstGLContext
    so that it can delete the EGLImage and its gltexture source
    while having the associated gl context being current.
  - add EGLImage support for GstVideoGLTextureUploadMeta which
    mainly call EGLImageTargetTexture2D
  - GstGLBufferPool now supports GstEGLImageAllocator
  - glimagesink / glfilters / etc.. now propose GstEGLImageAllocator
    to upstream

https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +00:00
Matthew Waters
d55eb1e859 gl: fix undeclared symbol when building without GST_DEBUG 2017-12-09 19:31:34 +00:00
Matthew Waters
e51e0a8869 gl: fix a double unref of the query when building without X 2017-12-09 19:31:34 +00:00
Matthew Waters
312741634d gl: silence a compiler warning about missing prototypes 2017-12-09 19:31:34 +00:00
Matthew Waters
f64292325d gl/utils: add x11 GstContext handling
https://bugzilla.gnome.org/show_bug.cgi?id=726360
2017-12-09 19:31:34 +00:00
Matthew Waters
e225af3e0d gl: silence all the compiler warnings 2017-12-09 19:31:34 +00:00
Matthew Waters
0fb0776432 [896/906] utils: use the vtable for deleting the texture 2017-12-09 19:31:34 +00:00
Matthew Waters
64fad7a6d2 [852/906] use GstContext for GstGLDisplay propogation
implements the hooks required in GstElement::set_context and the context query
2017-12-09 19:31:32 +00:00
Matthew Waters
efa22442a9 [838/906] gl: Use GL_TEXTURE_2D instead of GL_TEXTURE_RECTANGLE
We create our textures (in Desktop GL) with GL_TEXTURE_RECTANGLE,
vaapi attempts to bind our texture to GL_TEXTURE_2D which throws a
GL_INVALID_OPERATION error and as thus, no video.

Also, by moving exclusively to GL_TEXTURE_2D and the npot extension
we also remove a difference between the Desktop GL and GLES2 code.

https://bugzilla.gnome.org/show_bug.cgi?id=712287
2017-12-09 19:31:32 +00:00
Matthew Waters
56384a0db3 [819/906] make gen_texture/del_texture threadsafe
Use stack allocated instead of static variables

Conflicts:
	gst-libs/gst/gl/gstglutils.c
2017-12-09 19:31:31 +00:00
Matthew Waters
711ad485b2 [812/906] move the GL vtable from GstGLDisplay to GstGLContext
Conflicts:
	tests/check/libs/gstglcontext.c
2017-12-09 19:31:31 +00:00
Julien Isorce
b54293266d [810/906] gstglutils: use gl_vtable for glDeleteTextures 2017-12-09 19:31:31 +00:00
Matthew Waters
e80533dcee [793/906] add a GstGLContext object that will be the basis of OpenGL contexts
At the moment it just sits in between GstGLDisplay and GstGLWindow
performing some of the stuff that GstGLWindow used to do.
2017-12-09 19:31:30 +00:00
Matthew Waters
49951beac8 [766/906] utils: generate a RGBA texture in all cases 2017-12-09 19:31:30 +00:00
Julien Isorce
d17a4381b1 [732/906] build: fix repeated typedefs
Write forward declarations in another way to avoid
repeated typedefs "error: redefinition of typedef".
Raised when using i686-apple-darwin11-llvm-gcc-4.2
It seems that C apple compiler does not support
C11 feature.

https://bugzilla.gnome.org/show_bug.cgi?id=703885
2017-12-09 19:31:29 +00:00
Sebastian Dröge
341210eaa6 [729/906] gl: Include config.h everywhere 2017-12-09 19:31:29 +00:00
Matthew Waters
5b13d0ebf4 [718/906] shader: make it possible to unref in the non-GL thread 2017-12-09 19:31:28 +00:00
Matthew Waters
1c84c0fb96 [714/906] Add GstGLFramebuffer to replace _display_gen_fbo and friends
This version is simply API compatible with _display_gen_fbo.
The next version will likely revamp the API
2017-12-09 19:31:28 +00:00
Matthew Waters
bdf5b5be0f [707/906] display: move error_message to utils 2017-12-09 19:31:28 +00:00
Matthew Waters
5bc069a5d5 [706/906] display: move activate_context into utils 2017-12-09 19:31:28 +00:00