Commit graph

260 commits

Author SHA1 Message Date
Julien Isorce
63366be8ad gl: add GstGLDisplayCocoa
https://bugzilla.gnome.org/show_bug.cgi?id=746012
2017-12-09 19:31:58 +00:00
Matthew Waters
813fb633b4 gl: store the list of contexts within gldisplay
Removes the reliance on the allocation query to propogate GL contexts.

Allows thread safely getting a context for the a specific thread.
2017-12-09 19:31:57 +00:00
Edward Hervey
285afe0861 gldisplay: Only use debugging if we have valid values
The debug category won't have been created/activated if it's not a
valid display
2017-12-09 19:31:56 +00:00
Edward Hervey
f56c4c541a gl: Add/Update more debug statements
Where possible, use the _OBJECT variants in order to track better from
which object the debug statement is coming from

Define (and use) GST_CAT_DEFAULT where applicable

Use GST_PTR_FORMAT where applicable
2017-12-09 19:31:54 +00:00
Matthew Waters
a2a8059daf gldisplay: fix build error
gstgldisplay.c:234:541: error: 'return' with no value, in function returning non-void [-Werror]
   g_return_if_fail (GST_IS_GL_DISPLAY (display));
2017-12-09 19:31:51 +00:00
Matthew Waters
4bd62ebb03 gldisplay: implement runtime GL api filtering
Needed so that the pipeline/application can limit the choice of GL api
to what it supports
2017-12-09 19:31:51 +00:00
Matthew Waters
35e9b5ab8b gl: sprinkle some Since markers 2017-12-09 19:31:49 +00:00
Matthew Waters
fab6790c7f gl/docs: remove superflous 'the' 2017-12-09 19:31:45 +00:00
Matthew Waters
d3804ee7aa gl: document GST_GL_* environment variables
https://bugzilla.gnome.org/show_bug.cgi?id=733245
2017-12-09 19:31:45 +00:00
Matthew Waters
bcce615263 gl: add a scary note about initializing thread support for the winsys
We cannot do it as the winsys may crash if we initialize too late.

Example, GLX contexts with Intel drivers:
Intel requires the X Display to be the same in order to share GL
resources across GL contexts.  These GL contexts are generally
accessed from different threads.  Without winsys support it is
nearly impossible to guarentee that concurrent access will not
occur.  This concurrent access could result in crashes or abortion
by the winsys (xcb).

https://bugzilla.gnome.org/show_bug.cgi?id=731525
2017-12-09 19:31:43 +00:00
Matthew Waters
5433010ab5 gl/wayland: create a dummy display instead of an EGLDisplay
Currently, GstGLWindowWaylandEGL holds the wayland display connection
If we create the EGLDisplay at the GstDisplay creation time, then
libEGL will internally open another connection to the wayland server.
These two display connections are unable to communicate resulting in
no window output/display and hangs inside libEGL.

Eventually we will move the wl_display from GstGLWindow to GstGLDisplay.
2017-12-09 19:31:42 +00:00
Sebastian Dröge
228eccdbdf gldisplay: Use GST_STR_NULL() for printing possibly NULL strings and print all variables we use
Fixes compiler warning about set but not used platform_choice variable
among other things.
2017-12-09 19:31:40 +00:00
Matthew Waters
857200ff40 gl: make all GObjects inherit from GstObject
Aids memory leak debugging with GST_TRACE=mem-live
2017-12-09 19:31:39 +00:00
Matthew Waters
90bf46484d gl/display: avoid endless recursion for cocoa 2017-12-09 19:31:39 +00:00
Matthew Waters
59592f9bfc gl/display: clean up pre gstglcontext api and struct fields
https://bugzilla.gnome.org/show_bug.cgi?id=729551
2017-12-09 19:31:39 +00:00
Matthew Waters
f6ed9a685b gl/display: add get_handle_type
https://bugzilla.gnome.org/show_bug.cgi?id=729551
2017-12-09 19:31:39 +00:00
Matthew Waters
c5a11aa448 gl/display: avoid opening the X11 display on systems with Cocoa (OS X)
https://bugzilla.gnome.org/show_bug.cgi?id=729551
2017-12-09 19:31:39 +00:00
Matthew Waters
320ceef471 gl/display: check the correct env variable for choosing an egl display
GST_GL_WINDOW is used for window system specific choices.
An EGLDisplay can be created from window systems with egl support by using
eglGetDisplay().

https://bugzilla.gnome.org/show_bug.cgi?id=729551
2017-12-09 19:31:39 +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
894035f0d7 gl: Add EGLDisplay display subclass 2017-12-09 19:31:34 +00:00
Matthew Waters
303b77eeff [890/906] x11: add display subclass
GstGLDisplayX11 holds the display connection and name.  Each thread requires
it's own X11 Display connection (initialised from name) due to the fact that
we do not want to call XInitThreads().  Doing so would result in segfaults
when integrating with GUI toolkits Gtk, Qt, etc.

The Display connection is for OpenGL platforms where a constant display is
required in order to share contexts (egl).  In the case of a wrapped context
(added later), we do not have GstGLWindow to retreive the display from so a
'master' connection is used instead.
2017-12-09 19:31:33 +00:00
Matthew Waters
adfbafe36c [889/906] display: add display type enum 2017-12-09 19:31:33 +00:00
Matthew Waters
54923d1909 [857/906] display: document the new GstContext api 2017-12-09 19:31:32 +00:00
Matthew Waters
84425ad43d [853/906] display: remove _{set,get}_context
A GstGLDisplay doesn't need a GstGLContext and its use
was cause a reference cycle
2017-12-09 19:31:32 +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
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
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
Sebastian Dröge
b3eef9dd15 [753/906] gldisplay: Sending a message is synchronous, we can allocate the memory on the stack 2017-12-09 19:31:29 +00:00
Sebastian Dröge
ef68e5ade2 [751/906] gldisplay: Don't hold lock while sending a message to the GL thread
https://bugzilla.gnome.org/show_bug.cgi?id=704247
2017-12-09 19:31:29 +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
Matthew Waters
2ae5b50fa4 [709/906] display: some more cleanups 2017-12-09 19:31:28 +00:00
Matthew Waters
6e86d0e920 [708/906] display: a cleanup and removal of old code 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
Matthew Waters
c6988cb064 [701/906] display: move context creation into window 2017-12-09 19:31:28 +00:00
Matthew Waters
9c633e658a [700/906] display: move most of the code into utils for sorting later
This contains a hack that essentially requires one GstGLDisplay
per process.
2017-12-09 19:31:28 +00:00
Matthew Waters
38e0434d95 [699/906] display: remove list of upload and download objects
and only create an up/download object when needed.
2017-12-09 19:31:28 +00:00
Matthew Waters
81334a1af0 [698/906] move sink-specific stuff from GstGLDisplay into glimagesink 2017-12-09 19:31:28 +00:00
Matthew Waters
ad31c9f8e2 [697/906] display: allow the user to try and choose the GL api we use via env variable
GST_GL_API=opengl,opengl3,gles2,gles3
2017-12-09 19:31:28 +00:00
Matthew Waters
d71ab51c9f [688/906] display: properly shutdown if we error after context creation
The _finalize() code checks to see if the context was created before
attempting to destroy it.  We never did say that we had created the context.
2017-12-09 19:31:27 +00:00
Matthew Waters
a9b5bfe9d7 [684/906] display: lack of format-string causing a compiler warning 2017-12-09 19:31:27 +00:00
Matthew Waters
792f055db4 [672/906] display: constify GstGLFuncs *gl 2017-12-09 19:31:27 +00:00
Matthew Waters
dba83ebbd3 [670/906] display: replace glib deprecated api 2017-12-09 19:31:27 +00:00
Matthew Waters
7d4d1f50d4 [669/906] window: seperate object creation and context creation 2017-12-09 19:31:27 +00:00
Matthew Waters
6bee9b9c93 [647/906] remove dependecy on glew 2017-12-09 19:31:27 +00:00
Matthew Waters
2f2916dd50 [645/906] fix gles2 compilation 2017-12-09 19:31:27 +00:00
Matthew Waters
c692a610de [643/906] display: privatise most of the struct 2017-12-09 19:31:26 +00:00
Matthew Waters
e983f02e87 [642/906] add gstglconfig.h for apps to find out what our capabilites are
ie libgstgl can be compiled with any combination of opengl/gles2
2017-12-09 19:31:26 +00:00
Matthew Waters
8375116c4b [641/906] display: feature check for GL extension functions 2017-12-09 19:31:26 +00:00
Matthew Waters
db236c510f [633/906] display: fail properly in context creation in order to minimize a race condition
previously, on context creation, when we failed to get a valid context
we would still atempt to run the window mainloop as well as setting an error
on the display. This would cause the calling element to finalize the display
and therefore attempt to quit the window mainloop.  However the mainloop
may not have started running.  Thus when the window mainloop ran it would
never a get a quit message and never end.
2017-12-09 19:31:26 +00:00
Matthew Waters
1ec4ffc824 [630/906] display: add gl api checking
i.e. check for cases where the window wants a different API than
what the library was compiled with
2017-12-09 19:31:26 +00:00
Matthew Waters
344253e860 [624/906] OPENGL_ES2 => HAVE_GLES2 and add HAVE_OPENGL
use GstGLAPI to determine which code paths to execute.
perform some cleanups
2017-12-09 19:31:26 +00:00
Matthew Waters
4d88e9977e [608/906] add GST_GL_PLATFORM_ANY for choosing any platform 2017-12-09 19:31:25 +00:00
Matthew Waters
538643e3c0 [606/906] determine the GL platform to use at runtime
- Make GstGLWindow subclassablerather than specified at compile time.
- Add GstGLWindowX11 for x11 windows and two subclasses, GstGLWindowX11GLX
  and GstGLWindwX11EGL for GLX and EGL repectively. (win32 and cocoa
  ports to come)
- Also cleanup GL library detection in configure.ac
2017-12-09 19:31:25 +00:00
Matthew Waters
4c35d682c9 [603/906] update FSF address 2017-12-09 19:31:25 +00:00
Matthew Waters
39866ea830 [590/906] up/download: fix scaling on transfer
i.e. uploading from a 10x10 video frame to a 20x20 texture into another 30x30 videoframe
2017-12-09 19:31:25 +00:00
Matthew Waters
3ee54d3135 [573/906] add upload and download library objects
allows multiple upload pipelines that previously wasn't possible
 (i.e. upload RGB and I420 and ... on the same GstGLDisplay)
2017-12-09 19:31:25 +00:00
Matthew
4a424d6d2c [567/906] fix OpenGL|ES2 ifdef'ed code 2017-12-09 19:31:25 +00:00
Matthew Waters
a1a653c8ed [562/906] gldisplay: fix download of YUV formats 2017-12-09 19:31:24 +00:00
Matthew Waters
c0235ddafa [561/906] gldisplay: fix endianess issues on RGB download 2017-12-09 19:31:24 +00:00
Matthew Waters
7a79d684e2 [543/906] GstGLDisplay: fix segfault from GST_PTR_FORMAT trying to expand the object 2017-12-09 19:31:24 +00:00
Matthew Waters
38b6bdfa8b [527/906] GstGLDisplay: add some trace debugging 2017-12-09 19:31:24 +00:00
Matthew Waters
0d5b8bbc38 [524/906] GstGLDisplay: rework the download code
data paramaters now take GstVideoFrame
remove redundant parameters
2017-12-09 19:31:24 +00:00
Matthew Waters
be177b01b7 [522/906] GstGLDisplay: add forgotten function definition 2017-12-09 19:31:24 +00:00
Matthew Waters
6528aba8c9 [515/906] GstGLDisplay: rework gen_texture and upload
rename functions so that other code can create textures in the GL thread
change upload functions to take a GstVideoFrame
default to GLSL for upload conversion
2017-12-09 19:31:24 +00:00
Matthew Waters
3e18471e8e [509/906] GstGLDisplay: update for 1.0 2017-12-09 19:31:24 +00:00
Matthew Waters
f7bc5dcf83 [503/906] Rename GST_BOILERPLATE_* to G_DEFINE_TYPE_* and move _base_init into _class_init 2017-12-09 19:31:24 +00:00
Julien Isorce
20c429684e [500/906] gldisplay: do not call glCheckFramebufferStatus if 0 is bound
Indeed it may return GL_FRAMEBUFFER_UNDEFINED if there is no
default framebuffer.
It seems to be the case on MacOSX
2017-12-09 19:31:24 +00:00
Julien Isorce
83b2f12c12 [495/906] glES2.0: properly use glDeleteShader 2017-12-09 19:31:23 +00:00
Julien Isorce
badaaaec34 [491/906] glES2.0: properly fails if driver/kernel inconsistency 2017-12-09 19:31:23 +00:00
Julien Isorce
07df6a220d [490/906] gldisplay: error out instead of g_assert 2017-12-09 19:31:23 +00:00
Julien Isorce
ef87b0e70d [488/906] libvisual-gl: full compatibility with projectM-libvisual if libprojectM >= 2.0.1
Fix bug #310775
2017-12-09 19:31:23 +00:00
Julien Isorce
74526865c6 [486/906] libvisual-gl: add minimal support to libvisual plugins that uses Framebuffer objects
Fix bug #310775

gst-launch audiotestsrc ! libvisual_gl_projectM ! glimagesink is working
but for now you cannot append any other opengl filters between
libvisual_gl_projectM and glimagesink because our FBO is turned OFF.

It would require that libvisual allows to split rendering between
pass1,2,3... and final rendering. In order to unbind our FBO before
the passN, and then rebind it just before the final libvisual rendering.
2017-12-09 19:31:23 +00:00
Julien Isorce
0f54271129 [485/906] gstgldisplay: turn off texture binding and read buffer when downloading rgb is done
It fixes: (black image before)
gst-launch-0.10 audiotestsrc ! libvisual_gl_lv_gltest ! gldownload ! ximagesink
and
gst-launch-0.10  audiotestsrc ! libvisual_gl_lv_gltest ! gldownload ! glimagesink
2017-12-09 19:31:23 +00:00
Julien Isorce
7c79cc5c41 [481/906] feature checking: error out instead of doing nothing if an OpenGL feature is not present
Fix bug #572767
2017-12-09 19:31:23 +00:00
Julien Isorce
ade2526b8f [455/906] glimagesink: handle pixel-aspect-ratio 2017-12-09 19:31:23 +00:00
Julien Isorce
c390c30aac [432/906] GstGLDisplay: this is GL_DEPTH24_STENCIL8_EXT, not GL_DEPTH24_STENCIL8_EXT 2017-12-09 19:31:23 +00:00
Pierre Pouzol
c9dfa9c111 [431/906] GstGLDisplay: enable stencil buffer when using framebuffer objects.
Fixes Bug #612159
2017-12-09 19:31:23 +00:00
Julien Isorce
b36b45e437 [412/906] Cocoa backend: improve support on GNUStep 2017-12-09 19:31:23 +00:00
Julien Isorce
36a51c6e02 [406/906] glimagesink: add a client-data property
Also add it to glfilterapp.

Fixes #559131
2017-12-09 19:31:22 +00:00
Julien Isorce
e70ed87aa8 [400/906] gstgldisplay: no need the I420 work around if ATI Mobility
fix #588653
2017-12-09 19:31:22 +00:00
Pratheesh Gangadhar
f93bb87e77 [394/906] gstgldisplay: use of GL_DEPTH_COMPONENT16 if OpenGL ES 2.0
glRenderbufferStorage does not accept GL_DEPTH_COMPONENT in
OpenGL ES 2.0.

Fix bug #593786
2017-12-09 19:31:22 +00:00
Julien Isorce
b85ffef956 [387/906] glmixer: add a glmixer base element
glmixer can be seen as a glfilter except it handles N requested
sink pads.
Each sink pad and the src pad are video/x-raw-gl.
glmixer is responsible for managing different framerates from inputs.
It uses OpenGL context sharing. It means that each input is in its
own OpenGL context shared together and shared with the OpenGL context
of the ouput gl chain.
Also add a glmosaic which is an example of implementation of glmixer.
For now glmosaic is a cube but it will be fixed in the next commits.
For now the glmixer has some weird behaviours in some configurations
but it will be improved in the next commits.
The autotools builds is temporarly broken since those changes
have been made on win32.
2017-12-09 19:31:22 +00:00
Stefan Kost
2b9ff50feb [384/906] build: use <stdio.h> / "stdio.h" 2017-12-09 19:31:22 +00:00
Stefan Kost
c218748bc2 [383/906] build: include <stdio.h> when using printf & co. 2017-12-09 19:31:22 +00:00
Julien Isorce
8f6927c70a [382/906] ES2.0: remove warnings
Partially fix #593786
2017-12-09 19:31:22 +00:00
Julien Isorce
95dbe51fef [378/906] gldisplay: avoid to request gl thread when deleting a texture
A texture is not destroyed when when we are done with it.
This texture is just added to the texture pool in order to be
re-used. In this case no OpenGL code is executed so we do not need to
request gl thread.
2017-12-09 19:31:22 +00:00
Julien Isorce
fa41020ee4 [377/906] gldisplay: avoid to request gl thread when generating a texture
Thanks to the texture pool the gl textures are re-used.
When re-using one, no opengl code is executed so do not need
to request gl thread.
2017-12-09 19:31:22 +00:00
Julien Isorce
8bed6a5e85 [369/906] define missing glew macro on older versions 2017-12-09 19:31:22 +00:00
Jan Schmidt
8884cfefa8 [358/906] gstgldisplay: Close a small race starting the display thread
Take the display lock before signalling the create-context cond
to ensure the caller has dropped the lock and is therefore listening
for the signal.
2017-12-09 19:31:22 +00:00
Jan Schmidt
3fbe0f0a98 [352/906] fix typo
Change GST_GL_DISPLAY_PROJECTION_PERSPECIVE to
GST_GL_DISPLAY_PROJECTION_PERSPECTIVE.

Re-indent a couple of files that needed it.
2017-12-09 19:31:22 +00:00
Julien Isorce
de9f763bff [337/906] Improve cluttershare example
Use clutter_threads_API.
When just using glupload from rgb, we have to be sure that
the upload texture is not in use in our gst gl context.
2017-12-09 19:31:21 +00:00
Julien Isorce
f631cf4976 [334/906] [win32/winCE] fix some pointer cast warnings with mingw
And turn off deprecated Wp64 msvc compiler option.
2017-12-09 19:31:21 +00:00
Julien Isorce
d43fdd3daf [333/906] add force-aspect-ratio support 2017-12-09 19:31:21 +00:00
Julien Isorce
2eb9cb551c [330/906] Can now share textures with an external gl context
The external opengl context must be specify when creating
our OpenGL context (glx) or just after (wgl).
When calling glXCreateContext or wglShareLists, the
external opengl context must not be current.
Then our gl context can be current in the gl thread while
the external gl context is current in an other thread.
See tests/examples/clutter/cluttershare.c
2017-12-09 19:31:21 +00:00
Julien
095be23366 [327/906] fix init FBO's texture attachment on ES 2.0 2017-12-09 19:31:21 +00:00
Julien Isorce
ad8b227ff7 [322/906] [download YUY2/UYVY] fix a regression
The call to glLoadIdentity was removed by mistake during
OpenGL ES 2.0 integration.
2017-12-09 19:31:21 +00:00
Julien Isorce
61a8f34442 [321/906] add OpenGL ES 2.x support.
In OpenGL 2.x for Embedded System, a lot of basic scene/draw functions
have been removed. It means that everything is made using vertex and
fragment shaders.
I have also added a gstglwindow backend for winCE that uses EGL
(Native Platform Graphics Intercace) (which is a full part of
OpenGL ES specification). It remove the use of wgl/glx functions.
2017-12-09 19:31:21 +00:00
David Schleef
2e2213fbd7 [310/906] Global reindent
Indent parameters:
INDENT_PARAMETERS="--braces-on-if-line \
        --case-brace-indentation0 \
        --case-indentation2 \
        --braces-after-struct-decl-line \
        --line-length80 \
        --no-tabs \
        --cuddle-else \
        --dont-line-up-parentheses \
        --honour-newlines \
        --continuation-indentation4 \
        --tab-size8 \
        --indent-level2"
2017-12-09 19:31:21 +00:00
Julien Isorce
c060a8896d [301/906] depends on libpng instead of gdk_pixbuf 2017-12-09 19:31:21 +00:00