Commit graph

237 commits

Author SHA1 Message Date
Matthew Waters
a20d064304 gldisplay: some annotation updates/typo fixes 2017-01-10 15:35:52 +11:00
Matthew Waters
e4916fb1ef gldisplay: add a list of glwindow's
With the event thread on the display, for a particular winsys event
we need to be able to retreive the window that the event matches.
2016-11-08 15:14:26 +11:00
Matthew Waters
1a6c4be242 gldisplay: add a dedicated event thread
Will take the place of the navigation event thread for dealing with
winsys events.
2016-11-08 12:50:45 +11:00
Matthew Waters
fe64686c8c gldisplay: Fix inverted precondition
A GError argument must either be null or point to a NULL GError.

https://developer.gnome.org/glib/stable/glib-Error-Reporting.html
2016-11-03 18:21:55 +11:00
Matthew Waters
23e147f619 gl/gi: some annotation updates for called functions
With scope, closure, destroy annotations
2016-11-03 16:16:12 +11:00
Matthew Waters
41a6448918 gl: GST_GL_TYPE -> GST_TYPE_GL
Some deprecated symbols are kept for backwards compatibility
2016-11-03 16:16:12 +11:00
Matthew Waters
0dc003bf30 gl/docs: massive update
- add Since: markers where necessary.
- document structs
- add documentation headers for each module (short_description,
  see_also, etc)
- reduce the number of warnings gtk-doc outputs
- fix spelling mistakes
2016-11-03 16:16:11 +11:00
Matthew Waters
bad58e2b13 gldisplay: also free the GWeakRef when removing dead contexts
Otherwise we leak GWeakRef's.

Found with make -C tests/check libs/gstglcontext.valgrind
2016-09-22 18:25:37 +10:00
Matthew Waters
9e06a75018 gl: add memory type for renderbuffer's
Soon to be used for framebuffers for e.g. depth buffers or throwaway color
buffers.
2016-07-26 14:07:24 +10:00
Matthew Waters
e597e45008 gldisplay: always unref the context on a collision
Otherwise we will leak GstGLContext's when adding the same context more than
once.

Fixes a regression caused by 5f9d10f603 in the
gstglcontext unit test that failed with:

Assertion 'tmp == NULL' failed
2016-05-26 20:19:13 +10:00
Matthew Waters
5f9d10f603 gldisplay: add some debugging about retrieving GL contexts 2016-05-25 18:28:20 +10:00
Matthew Waters
b42ccb0556 gldisplay: demote no platform display debug to info
Avoids confusing everyone with a warning that's not always fatal.

https://bugzilla.gnome.org/show_bug.cgi?id=746933
2016-05-15 13:14:41 +03:00
Matthew Waters
5498e97a11 gl/egl: replace gsteglimagememory with an EGLImage wrapper
That can be passed to GstGLMemoryEGL.

This also ports the dmabuf uploader to GstEGLImage and GstGLMemoryEGL.
2016-05-04 13:31:48 +10:00
Gwang Yoon Hwang
c83fd26c80 gl: implement GstGLMemoryEGL
Because current GstEGLImageMemory does not inherit GstGLMemory, GLUpload
allocates additional GLMemory and upload the decoded contents from the decoder
which uses EGLImage (e.g. gst-omx in RPi).

This work adds GstGLMemoryEGL to avoid this overhead. Decoders allocate
GstGLMemoryEGL and decode its contents to the EGLImage of GstGLMemoryEGL.  And
GLUpload uses this memory without allocation of additional textures and blit
operations.

[Matthew Waters]: gst-indent the sources and fix a critical retreiving the egl
display from the memory.

https://bugzilla.gnome.org/show_bug.cgi?id=760916
2016-05-04 12:57:27 +10:00
Matthew Waters
aa6062945c gldisplay: make readding the same context a no-op
With e38af23044 returning the correct contexts,
gst_gl_display_add_context() was susceptible to causing infinte loops when
adding the same GstGLContext more than once.  Fix and add a test for
gst_gl_display_add_context().

Fixes glvideomixer gst-validate tests.
2016-03-08 02:06:13 +11:00
Mark Nauwelaerts
e38af23044 gldisplay: really retrieve glcontext for a specific thread
When requesting a glcontext (regardless of thread), the result was correct.
However, when requesting current glcontext on a specific thread, it could
come up with a glcontext active on another thread.

https://bugzilla.gnome.org/show_bug.cgi?id=763168
2016-03-06 12:10:51 +01:00
Matthew Waters
4c8f264686 glbasebuffer: remove unsed memory subclass
The functionality has been split into GstGLBaseMemory and GstGLBuffer.
2015-12-14 16:35:34 +11:00
Matthew Waters
2b7495bbc1 glmemory: base classify and add the pbo memory on top
The base class is useful for having multiple backing memory types other
than the default.  e.g. IOSurface, EGLImage, dmabuf?

The PBO transfer logic is now inside GstGLMemoryPBO which uses GstGLBuffer
to manage the PBO memory.

This also moves the format utility functions into their own file.
2015-12-14 16:35:32 +11:00
Matthew Waters
6cf8da132b gl: add a GL buffer based GstMemory
Heavily based on GstGLBaseBuffer that is a subclass of GstGLBaseMemory.
Provides GPU and CPU accessible GL buffer objects by GL handle or by
sysmem data pointer.
2015-12-14 16:34:54 +11:00
Matthew Waters
3dfc6899ad gl: be consistent in gobject boilerpate
GST_GL_IS_* vs GST_IS_GL_*

git grep -l 'GST_GL_IS_' | xargs sed -i 's/GST_GL_IS_/GST_IS_GL_/g'
2015-10-19 15:15:30 +11:00
Julien Isorce
66d833fcf2 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
2015-06-19 13:10:30 +01:00
Matthew Waters
7d8d1f8206 glmemory: implement on top of glbasebuffer
Provides convenient access to PBO usage.

Currently texture updates are coupled tightly to data transfers.
2015-06-12 16:59:20 +10:00
Matthew Waters
2704fdaa59 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
2015-05-25 17:39:14 +10:00
Matthew Waters
6cb6d8f9e8 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.
2015-04-21 12:55:24 +10:00
Julien Isorce
d35e3b8481 gldisplay: fix GThread leak
https://bugzilla.gnome.org/show_bug.cgi?id=746541
2015-03-22 19:03:19 +01:00
Matthew Waters
0ee027b6ee gl/docs: update some doc comments 2015-03-18 10:13:25 -07:00
Matthew Waters
78c82328ee gldisplay: tentative proper context collision detection
Fixes
tee name=t ! queue ! gliamgesink t. ! queue ! glimagesink
2015-03-15 14:43:10 +00:00
Julien Isorce
802bf79998 gl: add GstGLDisplayCocoa
https://bugzilla.gnome.org/show_bug.cgi?id=746012
2015-03-14 08:38:03 +00:00
Matthew Waters
ef0bd30c87 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.
2015-03-12 16:45:51 +00:00
Edward Hervey
1172e2875d 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
2015-03-05 19:09:49 +01:00
Edward Hervey
f09272f434 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
2015-02-12 15:57:55 +01:00
Matthew Waters
f67190d3ca 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));
2014-11-28 10:03:18 +11:00
Matthew Waters
3c1e77eb31 gldisplay: implement runtime GL api filtering
Needed so that the pipeline/application can limit the choice of GL api
to what it supports
2014-11-28 09:14:26 +11:00
Matthew Waters
f36d6daf51 gl: sprinkle some Since markers 2014-10-31 21:29:25 +11:00
Matthew Waters
8f045ab18c gl/docs: remove superflous 'the' 2014-08-01 17:51:08 +10:00
Matthew Waters
707cb58004 gl: document GST_GL_* environment variables
https://bugzilla.gnome.org/show_bug.cgi?id=733245
2014-08-01 16:43:47 +10:00
Matthew Waters
1d16cd50a3 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
2014-06-24 23:41:00 +10:00
Matthew Waters
574b29f2c4 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.
2014-06-05 18:52:11 +10:00
Sebastian Dröge
5c960069e4 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.
2014-05-08 22:50:27 +02:00
Matthew Waters
c247be334a gl: make all GObjects inherit from GstObject
Aids memory leak debugging with GST_TRACE=mem-live
2014-05-08 15:33:43 +10:00
Matthew Waters
ee95595af0 gl/display: avoid endless recursion for cocoa 2014-05-07 19:07:23 +10:00
Matthew Waters
f19e5abcb8 gl/display: clean up pre gstglcontext api and struct fields
https://bugzilla.gnome.org/show_bug.cgi?id=729551
2014-05-06 21:08:30 +10:00
Matthew Waters
c28dd9b0d3 gl/display: add get_handle_type
https://bugzilla.gnome.org/show_bug.cgi?id=729551
2014-05-06 21:08:30 +10:00
Matthew Waters
1eeecae29e gl/display: avoid opening the X11 display on systems with Cocoa (OS X)
https://bugzilla.gnome.org/show_bug.cgi?id=729551
2014-05-06 21:08:30 +10:00
Matthew Waters
b694b292b9 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
2014-05-06 21:07:38 +10:00
Julien Isorce
0ae3c984aa 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
2014-03-26 19:09:13 +00:00
Matthew Waters
49b37650f6 gl: Add EGLDisplay display subclass 2014-03-17 10:56:39 +01:00
Matthew Waters
0d1d42b205 [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.
2014-03-15 18:37:06 +01:00
Matthew Waters
f4036318da [889/906] display: add display type enum 2014-03-15 18:37:06 +01:00
Matthew Waters
4d30769b86 [857/906] display: document the new GstContext api 2014-03-15 18:37:05 +01:00