Commit graph

217 commits

Author SHA1 Message Date
Julien Isorce 76983d4454 gldisplay: add gst_gl_display_create_context
It also emits a create-context signal so that an application
can provide an external GstGLContext backend.

https://bugzilla.gnome.org/show_bug.cgi?id=750310
2017-12-09 19:32:04 +00:00
Matthew Waters 900bcea9de glmemory: implement on top of glbasebuffer
Provides convenient access to PBO usage.

Currently texture updates are coupled tightly to data transfers.
2017-12-09 19:32:04 +00:00
Matthew Waters 9f704d7c2d gl/wayland: add GstGLDisplayWayland
Simple implementation split from GstGLWindowWayland

Can now have multiple glimagesink elements all displaying output
linked via GL or otherwise (barring GL platform limitations).

The intel driver is racy and can crash setting up the two glimagesink contexts.

e.g.
videotestsrc ! tee name=t ! queue ! glupload ! glimagesinkelement
  t. ! queue ! gleffects_blur ! glimagesinkelement

videotestsrc ! glupload ! glfiltercube ! tee name=t ! queue ! glimagesinkelement
  t. ! queue ! gleffects_blur ! glimagesinkelement
2017-12-09 19:32:02 +00:00
Matthew Waters 03908c679e gldisplay: synchronize the searching and creation of GstGLContext's
Ootherwise we could end up with multiple elements in different chains
each creating a context.  Fixes context creation with glvideomixer.
2017-12-09 19:31:59 +00:00
Julien Isorce a71d479cc3 gldisplay: fix GThread leak
https://bugzilla.gnome.org/show_bug.cgi?id=746541
2017-12-09 19:31:58 +00:00
Matthew Waters 0b5c7e8b49 gl/docs: update some doc comments 2017-12-09 19:31:58 +00:00
Matthew Waters 1c51ba395a gldisplay: tentative proper context collision detection
Fixes
tee name=t ! queue ! gliamgesink t. ! queue ! glimagesink
2017-12-09 19:31:58 +00:00
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