Commit graph

95 commits

Author SHA1 Message Date
Julien Isorce 4952fdd956 gl: do not include GL headers in public gstgl headers
Except for gst/gl/gstglfuncs.h

It is up to the client app to include these headers.
It is coherent with the fact that gstreamer-gl.pc does not
require any egl.pc/gles.pc. I.e. it is the responsability
of the app to search these headers within its build setup.

For example gstreamer-vaapi includes explicitly EGL/egl.h
and search for it in its configure.ac.

For example with this patch, if an app includes the headers
  gst/gl/egl/gstglcontext_egl.h
  gst/gl/egl/gstgldisplay_egl.h
  gst/gl/egl/gstglmemoryegl.h
it will *no longer* automatically include EGL/egl.h and GLES2/gl2.h.
Which is good because the app might want to use the gstgl api only
without the need to bother about gl headers.

Also added a test: cd tests/check && make libs/gstglheaders.check

https://bugzilla.gnome.org/show_bug.cgi?id=784779
2017-12-09 19:32:29 +00:00
Tim-Philipp Müller 1ddde50048 gl: make some debug categories private
They weren't supposed to be public.

https://bugzilla.gnome.org/show_bug.cgi?id=786170
2017-12-09 19:32:29 +00:00
Tim-Philipp Müller 4be04f8315 gl: don't export symbols that are not supposed to be public
Make a bunch of symbols private that are currently leaked
accidentally because they have a gst_* prefix and are used
internally. We mark those we can't make static with
G_GNUC_INTERNAL so that they get hidden with the autotools
build as well (although we could just pass -fvisibility=hidden
there too).
2017-12-09 19:32:29 +00:00
Tim-Philipp Müller fbb62097e7 gl, wayland: mark more declared functions with GST_EXPORT 2017-12-09 19:32:29 +00:00
Julien Isorce a50c09ac26 gl: return NULL mem if eglCreateImage failed
Found on rpi when gpu_mem is too low so there is not enough memory to
create the eglimage. But still gst_buffer_pool_acquire_buffer succeeded.
And it leads to a CRITICAL assert:
  gst_egl_image_get_image: assertion 'GST_IS_EGL_IMAGE (image)' failed

https://bugzilla.gnome.org/show_bug.cgi?id=785518
2017-12-09 19:32:29 +00:00
Matthew Waters 82cf1b9c71 gl/docs: some documentation updates
Add some missing/incomplete docs
2017-12-09 19:32:29 +00:00
Sebastian Dröge a9a05c01a9 gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent
https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-12-09 19:32:28 +00:00
Vincent Penquerc'h 326b8763de glcontext: fix display leak
https://bugzilla.gnome.org/show_bug.cgi?id=781019
2017-12-09 19:32:27 +00:00
Matthew Waters 66468b4245 gl/format: use our own GL format enum's instead of gstvideo's
They can describe in more detail (such as component sizes) the requested format.
2017-12-09 19:32:27 +00:00
Sebastian Dröge de16dc2555 gl: Fix backwards compat GST_GL_TYPE_* functions/macros
These have to be macros instead of inline function as they must behave
more or less like an integer literal, i.e. include the function call.
2017-12-09 19:32:26 +00:00
Matthew Waters 0348225001 gl/docs: add symbols from -unused.txt 2017-12-09 19:32:26 +00:00
Matthew Waters e80337e374 gl/egl: remove use of texture orientation 2017-12-09 19:32:25 +00:00
Matthew Waters cec46fc75e glcontext/egl: don't overwrite set GError
Doing so is an error and will cause a glib warning to be printed.

https://bugzilla.gnome.org/show_bug.cgi?id=776722
2017-12-09 19:32:25 +00:00
Sebastian Dröge aeb5d4edaf gst: Don't declare variables inside the for loop header
This is a C99 feature.
2017-12-09 19:32:25 +00:00
Matthew Waters bf7b608728 glmemoryegl: remove spurious #if GST_GL_HAVE_DMABUF conditions
8c2118823b had some incorrect preprocessor
conditions that aren't actually needed.  Remove them.

https://bugzilla.gnome.org/show_bug.cgi?id=775248
2017-12-09 19:32:25 +00:00
Matthew Waters afbca8576e gl: add necessary context_egl.h #includes to the source files 2017-12-09 19:32:25 +00:00
Matthew Waters 6992e16d4d gl/memoryegl: remove access to private header gstglcontext_egl.h
It's been removed and thus compiling anything against GstGLMemoryEGL
would error with:

In file included from gstomxvideodec.c:41:0:
usr/include/gstreamer-1.0/gst/gl/egl/gstglmemoryegl.h:32:41: fatal error: gst/gl/egl/gstglcontext_egl.h: No such file or directory
 #include <gst/gl/egl/gstglcontext_egl.h>
                                         ^

https://bugzilla.gnome.org/show_bug.cgi?id=774886
2017-12-09 19:32:25 +00:00
Matthew Waters 59b65373b0 gl/egl: remove EGLImage functions from egl context
By adding the necessary GstEGLImage entry points to create a GstEGLImage
from a GstGLMemory.

https://bugzilla.gnome.org/show_bug.cgi?id=774518
2017-12-09 19:32:25 +00:00
Matthew Waters 39e75767fb glcontext: add vfunc to retrieve the OpenGL platform version
i.e. the version of EGL, GLX, etc implemented.

https://bugzilla.gnome.org/show_bug.cgi?id=774518
2017-12-09 19:32:25 +00:00
Matthew Waters 6703641734 gl/egl: move get_error_string() into gstegl
So others can use it without #include-ing a private header

https://bugzilla.gnome.org/show_bug.cgi?id=774518
2017-12-09 19:32:24 +00:00
Matthew Waters 415ce6c96a display/egl: implement getting the EGLDisplay of a specific platform
https://bugzilla.gnome.org/show_bug.cgi?id=774518
2017-12-09 19:32:24 +00:00
Víctor Manuel Jáquez Leal ddf7fe0e80 gl/egl: check the feature in the extensions list
https://bugzilla.gnome.org/show_bug.cgi?id=774518
2017-12-09 19:32:24 +00:00
Matthew Waters d0b8f7c002 gl: add padding to all exposed winsys/platform-specific structs 2017-12-09 19:32:24 +00:00
Matthew Waters 9d295ed19b gl/egl: don't install the gstglcontext_egl.h header
It's not needed to be exposed and there are no users of the API.
2017-12-09 19:32:24 +00:00
Matthew Waters 18ac98c58b gl: GST_GL_TYPE -> GST_TYPE_GL
Some deprecated symbols are kept for backwards compatibility
2017-12-09 19:32:23 +00:00
Matthew Waters 9bafa08a5d 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
2017-12-09 19:32:23 +00:00
Matthew Waters 51a6f47bf8 gl/docs: document new API added in 1.10
GstGLRenderbuffer
GstGLFramebuffer
GstGLQuery
GstEGLImage
GstGLMemoryEGL
2017-12-09 19:32:23 +00:00
Matthew Waters 99f5ac40db meson: gl: add support for building with dispmanx on the rpi 2017-12-09 19:32:23 +00:00
Matthew Waters 36b8ed8712 gl/eglimage: Fix passing the destroy function to gst_egl_image_new_wrapped
The function pointer and the user data arguments were swapped in both
uses.

https://bugzilla.gnome.org/show_bug.cgi?id=769382
2017-12-09 19:32:23 +00:00
Matthew Waters 19f32c0f49 gl/egl: fix inverted typedef
2b6841d had an inverted typedef defining ginptr and EGLAttrib.  Fix that.
2017-12-09 19:32:22 +00:00
Matthew Waters 1a7333173a gl/build: add configure check for possibly missing EGLAttrib
Fixes the build on older android targets.
2017-12-09 19:32:22 +00:00
Song Bing 15c34b0ab1 gl/egl/dmabuf: Wrong attribute list type for EGL 1.5
For EGL 1.5 spec, the attribute list type should be EGLAttrib.

https://bugzilla.gnome.org/show_bug.cgi?id=768602
2017-12-09 19:32:22 +00:00
Matthew Waters 1153684a94 glmemory: add the texture type to allocate to parameters
Rather than assuming something.  e.g. zerocopy on iOS with GLES3 requires
the use of Luminance/Luminance Alpha formats and does not work with
Red/RG textures.
2017-12-09 19:32:21 +00:00
Sebastian Dröge f457e29192 eglimage: Only register debug category if dmabuf support is enabled
It's not used otherwise currently and causes compiler warnings.
2017-12-09 19:32:20 +00:00
Sergey Borovkov 0731b0937d qml: Enable qmlglsink for eglfs
https://bugzilla.gnome.org/show_bug.cgi?id=763044
2017-12-09 19:32:20 +00:00
Guillaume Desmottes b23a008ab6 gst-libs: gl, video: use MAY_BE_LEAKED flag
https://bugzilla.gnome.org/show_bug.cgi?id=767162
2017-12-09 19:32:20 +00:00
Sebastian Dröge 0ea3706901 eglimage: Re-add accidentially removed GST_DEFINE_MINI_OBJECT_TYPE() 2017-12-09 19:32:20 +00:00
Sebastian Dröge b054da4c96 eglimage: Ensure that the debug category is always initalized
Before the initializer was only run if dmabuf support was used.

https://bugzilla.gnome.org/show_bug.cgi?id=766794
2017-12-09 19:32:20 +00:00
Matthew Waters 5efc2e8705 gl/egl: replace gsteglimagememory with an EGLImage wrapper
That can be passed to GstGLMemoryEGL.

This also ports the dmabuf uploader to GstEGLImage and GstGLMemoryEGL.
2017-12-09 19:32:19 +00:00
Gwang Yoon Hwang ecfe5b0801 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
2017-12-09 19:32:19 +00:00
Matthew Waters b1a60af720 eglimage: perform eglCreateImage in the gl thread
while calling eglCreateImage without a GL context current in the executing
thread works on the RPi, some other implementations will return errors.

Marshall the eglCreateImage to the GL thread to appease these implementations.
2017-12-09 19:32:18 +00:00
Matthew Waters 9d66a5ff06 eglimagememory: add compatibility definitions for EGL dmabuf
e.g. the RPi doesn't have them defined
2017-12-09 19:32:17 +00:00
Sebastian Dröge adfd016d01 gl: Fix compiler warning about unused const variable with gcc 6
CC       libgstgl_x11_la-gstglcontext_glx.lo
In file included from gstglcontext_glx.c:39:0:
../utils/opengl_versions.h:52:43: error: ‘gles2_versions’ defined but not used [-Werror=unused-const-variable]
 static const struct { int major, minor; } gles2_versions[] = {
                                           ^~~~~~~~~~~~~~
2017-12-09 19:32:17 +00:00
Matthew Waters d41c132dfa glcontext: back out unintended lost_context changes 2017-12-09 19:32:15 +00:00
Matthew Waters 5d2ddf7664 egl: implement selecting opengl3 contexts 2017-12-09 19:32:15 +00:00
Matthew Waters 786b2fb9f1 gl/egl: pass the error value to get_error_string() 2017-12-09 19:32:15 +00:00
Nicolas Dufresne f91b4eb4ff eglimagememory: Also import BGR16, ABGR, xBGR, AYUV, GRAY16_LE/BE and Y444
https://bugzilla.gnome.org/show_bug.cgi?id=743345
2017-12-09 19:32:13 +00:00
Nicolas Dufresne 9567542ca2 eglimagememory: Add RGB/BGR DMABuf importation support
https://bugzilla.gnome.org/show_bug.cgi?id=743345
2017-12-09 19:32:13 +00:00
Lubosz Sarnecki 0468dc6663 eglimagememory: Methods to create GstGLMemory from dmabufs
Maps GstVideoFormats to suitable DRM fourccs which work with
glcolorconvert, using gst_gl_memory_alloc(). We require mostly
only 4 formats to be supported by the driver. We require DRM
equivalent to RGB16, RGBA, R8 and RG88. This way it's compatible with
DesktopGL, since GL_TEXTURE_2D is used and limit driver requirements.
With this we can virtually support all formats the glcolorconvert
supports.

https://bugzilla.gnome.org/show_bug.cgi?id=743345
2017-12-09 19:32:13 +00:00
Lubosz Sarnecki 376b1eb262 gstglcontext_egl: Expose gst_gl_context_egl_get_error_string.
https://bugzilla.gnome.org/show_bug.cgi?id=743345
2017-12-09 19:32:13 +00:00