Commit graph

867 commits

Author SHA1 Message Date
Matthew Waters 6c1a4e30c4 gl/upload: implement lazy init
Rename init_format to set_format
2017-12-09 19:31:39 +00:00
Matthew Waters cda89d7ce0 gl/upload: add get_format method
Simply retreives the format set by init_format
2017-12-09 19:31:39 +00:00
Matthew Waters 6e5494d729 gl/filter: attempt to passthrough the pool if the caps are the same
Reduces the number of glbufferpool instances required for >=2
consecutive GL elements in a pipeline.
2017-12-09 19:31:39 +00:00
Matthew Waters 6872ad5ff5 gl/filter: always initialize the upload object 2017-12-09 19:31:39 +00:00
Matthew Waters 8fd450b941 gl: advertise GstGLMemory usage in the caps as capsfeatures
https://bugzilla.gnome.org/show_bug.cgi?id=729658
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
Julien Isorce d7c5444447 gl: do not allocate the target texture of an EGLImage
The target texture of an EGLImage is the texture bind just
before calling glEGLImageTargetTexture2D.

As we currently only support a gl texture as the source of an EGLImage
the gl texture is actually already allocated when creating the eglimage.

I also see some cases where it fails to upload an eglimage when
glTexImage2D is called on the target.
2017-12-09 19:31:39 +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
Julien Isorce 88864ea2cc gl: no need to initialize a frame buffer object to upload an eglimage
Fix https://bugzilla.gnome.org/show_bug.cgi?id=729588
2017-12-09 19:31:39 +00:00
Julien Isorce bcc633ed2c gl: use GST_CAT_ERROR instead of GST_ERROR_OBJECT
It fixes segault when GST_DEBUG is at least level 1 and eglCreateImage fails
2017-12-09 19:31:39 +00:00
Julien Isorce dd1c2b4c4c gl: delete texture used with GstVideoGLTextureUploadMeta 2017-12-09 19:31:39 +00:00
Julien Isorce 4b0e037fa4 gl: use gst_gl_context_gen_shader helper instead of duplicating code 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 6a2f2088e9 gl/window: fix string length check for eagl 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
Edward Hervey 47a4be4721 gl/cocoa: Use OBJCFLAGS where needed
Should fix usage of c-compiler-only flags with an objective-c compiler
2017-12-09 19:31:39 +00:00
Matthew Waters bf9c8544e3 gl: use the bufferpool's upload when available
Avoids duplicating GL resources

https://bugzilla.gnome.org/show_bug.cgi?id=728872
2017-12-09 19:31:39 +00:00
Julien Isorce 2fed41dc30 gl: show internal cocoa window on top of others
Useful when your OSX terminal is fullscreen

https://bugzilla.gnome.org/show_bug.cgi?id=728127
2017-12-09 19:31:39 +00:00
Matthew Waters db544c3c1f gl/pool: init the upload object on start
Theoretically, set_config could be called multiple times
2017-12-09 19:31:38 +00:00
Sebastian Dröge 8c56e1bba7 gl: Try harder to load symbols from the correct place
This commit makes the loading of the GModules threadsafe, and
always first tries to load the symbol for the GL library that
is selected for the current context. Only then it falls back
to looking into the current module (NULL), and only as a last
resort the context specific function (e.g. eglGetProcAddress())
is called.

Also add configure parameters to select the names of the library
modules instead of using the defaults, and let the defaults be
independent of the G_MODULE_SUFFIX.

https://bugzilla.gnome.org/show_bug.cgi?id=728753
2017-12-09 19:31:38 +00:00
Matthew Waters 33091ff6a5 gl/mem: implement texture copying between formats with strides properly
Previously, we used the width to determine the amount of data to be
copied using pbos.  This, makes it allocate enough data for the
the strides as well.
2017-12-09 19:31:38 +00:00
Matthew Waters 8638a5638c gl/mem: pad the public struct 2017-12-09 19:31:38 +00:00
Nicolas Dufresne 1e8fc49203 gl: no need to provide full lib path to load symbols
- Make gstgl work on Mali
- Keep it work on RPI
- fallback to NULL name module if fails with usual lib name

https://bugzilla.gnome.org/show_bug.cgi?id=728753
2017-12-09 19:31:38 +00:00
Julien Isorce cebcc837de gl: add convenient functions to setup default vertex and fragment shaders
Most of our 2D filters use the same simple vertex shader.
Also define the default fragment shader as the identity.

Avoid duplicating the same vertex and fragment shader text.
2017-12-09 19:31:38 +00:00
Philippe Normand 95290346c6 gl: add missing G_BEGIN/END_DECLS in utils header 2017-12-09 19:31:38 +00:00
Jan Schmidt cf018389e1 gl: Reduce noisy Info level output to LOG 2017-12-09 19:31:38 +00:00
Julien Isorce 391661b626 gl: use gst_gl_platform_from_string because we support gl shareList on all platforms 2017-12-09 19:31:38 +00:00
Julien Isorce c441afdc6b glfilter: only warn when other_context attribute is set
Fix false positive
2017-12-09 19:31:38 +00:00
Julien Isorce 959aae65c0 gl: fix string literal warning
warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
2017-12-09 19:31:38 +00:00
Nicolas Dufresne 801f11e36b gl/x11: Removed unused variable 2017-12-09 19:31:37 +00:00
Sebastian Dröge 8f156591e5 gl/x11: Get rid of unneeded second display connection and do everything from the main loop 2017-12-09 19:31:37 +00:00
Sebastian Dröge a0a133288e gl/x11: Block rendering until swapbuffers is called and don't go via X11 events as unneeded indirection
This should fix QoS problems, where basesink believed it was rendering with
20FPS but actually we were just queueing up X11 Expose events and only once
in a while something was rendered.
2017-12-09 19:31:37 +00:00
Julien Isorce c9d2f8ee94 gl/rpi: do not scale to full screen
Having a 640x360 movie being scaled to 1900x1200 does not look nice
2017-12-09 19:31:37 +00:00
Julien Isorce 7a77d435c1 gl/rpi: change dispmanx attributes of existing element instead of creating a new one
I was lucky that:
e1 = vc_dispmanx_element_add ()
eglCreateWindowSurface (e1)
vc_dispmanx_element_remove (e1)
e2 = vc_dispmanx_element_add ()

resulted in having e2 equal to e1. And also having the egl surface
that does not allocate its buffers before the first draw.
2017-12-09 19:31:37 +00:00
Julien Isorce 33a60e238c gl/rpi: ensure the dispmanx element to be opaque
So that we ensure it does not get alpha composited with other
dispmanx elements like the desktop.
2017-12-09 19:31:37 +00:00
Julien Isorce 2cd72a49ec gl/cocoa: pass a NSView to set_window_handle instead of a NSWindow
Fix backwards compatibility

https://bugzilla.gnome.org/show_bug.cgi?id=728451
2017-12-09 19:31:37 +00:00
Julien Isorce 9db9834128 gl/cocoa: only draw once the window has been resized
It avoids to draw the first frame with an incorrect view port.
2017-12-09 19:31:37 +00:00
Julien Isorce 545bed3c7a gl/cocoa: set the view to use for drawing by the context
It avoids to draw to an invalid buffer.
Withtout this the default frame buffer is undefined:
glBindFramebuffer (GL_FRAMEBUFFER, 0)

Visually you could see some white frames at the beginning
when lunching videotestsrc ! glimagesink

With OpenGL Profiler from XCode you could see some
GL_INVALID_FRAMEBUFFER_OPERATION for the first frames
2017-12-09 19:31:37 +00:00
Julien Isorce e4b832db90 gl: fix declaration-definition mismatch for _init_upload 2017-12-09 19:31:37 +00:00
Julien Isorce 213590c79c gl/bufferpool: do not reset upload when set_config does not change the caps
With videotestsrc ! glimagesink it was reset 3 times
2017-12-09 19:31:37 +00:00
Julien Isorce bc52c7bb00 gl: use #ifdef instead of #if for __APPLE__
warning: "__APPLE__" is not defined [-Wundef]

with gcc version 4.7.2 20120731 (prerelease)
    (crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08)
2017-12-09 19:31:37 +00:00
Nicolas Dufresne 4372ba8999 glmemory: User g_slice_new0 to ensure fully initilized structure
The pbo pointer not being initialized would trigger a use of unitilialized variable
in valgrind.
2017-12-09 19:31:37 +00:00
Vincent Penquerc'h c728fd3b8d gl: prevent division by 0 on unsupported texture type
Coverity 1199697
2017-12-09 19:31:37 +00:00
Jan Schmidt c891eedb79 glcolorconvert: Fix bt709 conversion matrices.
Fix the sign on one entry in the bt.709 YUV->RGB conversion
matrix, and the corresponding inverse matrix. Fixes really
wrong colouring of some videos.
2017-12-09 19:31:37 +00:00
Julien Isorce d539fd4a54 gl: allow to include GLES/gl.h
https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:37 +00:00
Sebastian Dröge 2843ca2066 gl/eagl: Fix compilation 2017-12-09 19:31:37 +00:00
Sebastian Dröge a6f5b079d8 gl/eagl: Notify the window's resize callback about surface dimension changes
https://bugzilla.gnome.org/show_bug.cgi?id=728107
2017-12-09 19:31:37 +00:00
Sebastian Dröge d462e7f6df gl/eagl: Remove spurious private struct pointer 2017-12-09 19:31:37 +00:00
Sebastian Dröge 6fb0f1d1c7 gl/android: Notify the window's resize callback about surface dimension changes
https://bugzilla.gnome.org/show_bug.cgi?id=728107
2017-12-09 19:31:37 +00:00
Matthew Waters 175ca3f7b0 gl/context: output available extensions 2017-12-09 19:31:36 +00:00
Matthew Waters 1460d22e92 gl/context: provide get_gl_version 2017-12-09 19:31:36 +00:00
Julien Isorce 9062658bc7 gl/color: restore viewport dimensions when fbo done
Regression introduced by 95abfda139.
It caused to display the wrong frame size when resizing the window.
2017-12-09 19:31:36 +00:00
Sebastian Dröge b83d2df47d gl: Import QuartzCore/QuartzCore.h for CAEAGLLayer on older iOS versions 2017-12-09 19:31:36 +00:00
Sebastian Dröge 3770d2a406 gl: Add support for iOS EAGL platform
https://bugzilla.gnome.org/show_bug.cgi?id=703341
2017-12-09 19:31:36 +00:00
Julien Isorce 9d396a2495 gl/cocoa: make gst_gl_window_cocoa_send_message_async re-entrant
Backends that use g_main_context_invoke are re-entrant.

Il allows to call two nested gst_gl_context_thread_add.
ex: init_upload / init_colorconvert
2017-12-09 19:31:36 +00:00
Julien Isorce 3819fbef46 gl/cocoa: fix NSAutoreleasePool initialization 2017-12-09 19:31:36 +00:00
Julien Isorce 08cce2cd5b gl/cocoa: ensure to call NSApplication:sharedApplication in the main thread
"(NSApplication *)sharedApplication This method also makes a connection
to the window server and completes other initialization"
The implicit thing which is not mentioned is that it required
to be called in the main thread.

Fix a regression introduces by 82b7c915bb
When using with gst-launch, it was not possible to click on the close
cross of the window anymore which is a bit anoying and also because
it's was possible before.

Prior to this commit the GstGLContextCocoaClass was initialized
in the main thread because gst_gl_context_new was called in the
state change function from going from ready to paused.

From this commit this call is done from the streaming thread.
So that the call to [NSApplication sharedApplication];
was not done in the main thread anymore.

We now ensure that by assuming there is a GMainLoop running.
It's for debugging purpose so that's ok to do that. Also
note we already do this assumtion to run app itereations.

The regression had no consequence on the cocoa/videooverlay example
(that should be moved from gst-plugins-gl to -bad) because the
application is responsible for that necessary call.
2017-12-09 19:31:36 +00:00
Julien Isorce e7dc1d787e gl/color: fix warning type qualifiers ignored
i686-apple-darwin11-llvm-gcc-4.2
"warning: type qualifiers ignored on function return type"
2017-12-09 19:31:36 +00:00
Matthew Waters a321fa998a gl/color: remove if statement with no effect
Coverity 1199698
2017-12-09 19:31:36 +00:00
Matthew Waters 92c243be62 gl/color: pass large value by reference
Coverity 1199700
2017-12-09 19:31:36 +00:00
Matthew Waters 6c73fa0b5f gl/mem: cache the stride/unpack length for upload 2017-12-09 19:31:36 +00:00
Matthew Waters 1ce0c5356f gl/color: explicitly map the buffers we are copying into
Otherwise it may not be downloaded at all.
2017-12-09 19:31:36 +00:00
Matthew Waters 50ff50c10e gl/color: cache the temporary textures 2017-12-09 19:31:36 +00:00
Matthew Waters 94371dc204 gl/mem: provide defines for tokens not defined in GLES2/ancient platforms 2017-12-09 19:31:36 +00:00
Matthew Waters 7c77c31afd gl: fixup incorrect number of arguments 2017-12-09 19:31:36 +00:00
Matthew Waters 12ecf507b8 gl: fix incorrect usage of g_return_if_fail 2017-12-09 19:31:36 +00:00
Matthew Waters 30c6efc432 gl/mem: allocate the memory per plane
This patch provides the basic infrastructure required for this.
Upload and Download has been ported to this.

Has the nice effect of allowing GstGLMemory to be our
refcounted texture object for any texture type (not just RGBA).

Should not lose any features/video formats.
2017-12-09 19:31:36 +00:00
Matthew Waters ea2d4cb446 gl/eglimage: #if 0 unused code 2017-12-09 19:31:36 +00:00
Matthew Waters fba49c3463 gl: add colorconvert object that converts between color spaces/formats
Currently used by both upload and download objects separately.
2017-12-09 19:31:36 +00:00
Vincent Penquerc'h 7de81a33ca gl: fix leaks
As the relevant variables are initialized to 0/NULL, we can loop
over the full range and make sure we free partial allocations
when an error happens partway through initialization.
2017-12-09 19:31:36 +00:00
Matthew Waters a20a5d36e2 gl: pass video info's by reference 2017-12-09 19:31:35 +00:00
Matthew Waters ff52514714 gl/glx: use the context's display rather than asking for the window's 2017-12-09 19:31:35 +00:00
Matthew Waters 71548893bf gl: avoid adding a NULL pool to propose allocation 2017-12-09 19:31:35 +00:00
Matthew Waters 790f34c7a6 gl: fix detection of extensions with GL versions < 3
Mesa, for example returns valid pointers for glGetIntegerv and
glGetStringi even if the gl version is less than that required for
both those functions to supposedly exist.

https://bugzilla.gnome.org/show_bug.cgi?id=727324
2017-12-09 19:31:35 +00:00
Tim-Philipp Müller 82555e80ba gl: egl: fix distcheck and out of source build 2017-12-09 19:31:35 +00:00
Rico Tzschichholz 34a4eef1ec build: Fix make dist 2017-12-09 19:31:35 +00:00
Matthew Waters 6491e4d275 gl: fix out-of-source builds pt2
21b897de2f did this for x11 and wayland.
Do it for the other backends as well.
2017-12-09 19:31:35 +00:00
Julien Isorce 0233939eaa gl: only set CAPS_FEATURE_MEMORY_EGL_IMAGE on egl platform 2017-12-09 19:31:35 +00:00
Julien Isorce 6614df6478 gl: let the user includes itself our egl headers if needed
Forgot to address this change.

https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +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
Julien Isorce cb9521ab05 gl: deploy egl headers in gst/gl/egl instead of gst/gl
https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +00:00
Julien Isorce f55e8b3ea8 gl: remove commented and unsued code in x11 Makefile.am
https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +00:00
Julien Isorce 3e3b573503 gl: fix crash if _build_extension_string is not called
On GLES2 then (gl->GetIntegerv && gl->GetStringi) is false
regression introduced by cc6df204e2

https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +00:00
Gwenole Beauchesne 14521a89cb gl: fix out-of-source builds.
Always use the locally generated <gst/gl/gstglconfig.h> file.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2017-12-09 19:31:35 +00:00
Matthew Waters adebb3b7f8 gl/download: add support for the bt709 color matrix 2017-12-09 19:31:35 +00:00
Matthew Waters ee0c102ac5 gl/upload: add support for the bt709 color matrix 2017-12-09 19:31:35 +00:00
Matthew Waters 0fa966bb3d gl: remove explicit reference to X_CFLAGS
They are in GL_CFLAGS if required
2017-12-09 19:31:35 +00:00
Matthew Waters 16a30a12aa gl/upload: remove the legacy GL 1.x upload path
uploading requires shaders and fbos available in GL2.
2017-12-09 19:31:35 +00:00
Julien Isorce da24ea1956 gl: fallback to glGetString if GL_NUM_EXTENSIONS fails
Need it on MacOSX 10.7.5
2017-12-09 19:31:35 +00:00
Matthew Waters 3c27e588c3 gl: and update the Makefile 2017-12-09 19:31:35 +00:00
Matthew Waters 45c71eb3e1 gl: reorganize the extension headers by function rather than api 2017-12-09 19:31:35 +00:00
Matthew Waters 350981b14c gl/win32: use the correct include and gst-indent 2017-12-09 19:31:35 +00:00
Wang Xin-yu (王昕宇) 369bee2031 gl: use wglCreateContextAttribsARB to create share context
https://bugzilla.gnome.org/show_bug.cgi?id=726494
2017-12-09 19:31:35 +00:00
Matthew Waters d3a823c459 gl/mixer: fix download check for failure 2017-12-09 19:31:35 +00:00
Matthew Waters a9070713a2 gl: silence a critical if upstream does not provide us with meta params 2017-12-09 19:31:35 +00:00
Julien Isorce 19d138601b gl: silence warnings building for RPI related to 'vcos_*'
Similar than 1190a79b19
2017-12-09 19:31:34 +00:00
Julien Isorce b30d15d4b8 gl: keep only one occurence of '#include <EGL/egl.h>'
To simply maintainance if we need to put specific includes around it.
2017-12-09 19:31:34 +00:00
Руслан Ижбулатов 8c2c3d8dbf gl: fix the use of always-defined macros
After 2a0f0399ae GST_GL_* macros are always
defined to 0 or 1. Don't use #ifdef ... or #if defined() on them.

https://bugzilla.gnome.org/show_bug.cgi?id=726591
2017-12-09 19:31:34 +00:00
Matthew Waters 4a28b62d5a gl: add GModule libs for win32 2017-12-09 19:31:34 +00:00
Matthew Waters 9b5a5a3c37 gl: only link against gstegl if we are using egl
Assuming if we are building egl that the egl library is built
2017-12-09 19:31:34 +00:00
Matthew Waters f98fee49c2 gl: add path of the gstegl library
Temporary until we merge the two libraries
2017-12-09 19:31:34 +00:00
Matthew Waters 891f7e2ce8 Revert "gl: add dep on gstegl"
It was already in _LIBADD

This reverts commit b10a353080.
2017-12-09 19:31:34 +00:00
Matthew Waters 95e7f50355 gl: add dep on gstegl
Temporary until we merge the two libraries
2017-12-09 19:31:34 +00:00
Edward Hervey 3ab0b67318 gl/cocoa: Fix debug statements and platform 2017-12-09 19:31:34 +00:00
Edward Hervey 46034834e0 gl: Fix static build with objective-C
--tag=CC is needed for static build
2017-12-09 19:31:34 +00:00
Matthew Waters 894035f0d7 gl: Add EGLDisplay display subclass 2017-12-09 19:31:34 +00:00
Matthew Waters 1af7847fdc gl/window: add a dummy window class
Effective for the case where we have a platform that does not
require a native window.  We require a mainloop to run the GL
commands which is currently operated by GstGLWindow.
2017-12-09 19:31:34 +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 1732e378f1 gl: define GL_NUM_EXTENSIONS if not defined 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 4a18aa4b70 [906/906] filter: warn about trying to share with multiple contexts at once 2017-12-09 19:31:34 +00:00
Matthew Waters 3f5b68b072 [905/906] Add GL context sharing support for non-gstgl elements 2017-12-09 19:31:34 +00:00
Matthew Waters 344ad5fe6f [904/906] mixer: ask for display handles on pad activation 2017-12-09 19:31:34 +00:00
Matthew Waters f772bc1afc [903/906] api: add GstGLPlatform to/from string 2017-12-09 19:31:34 +00:00
Matthew Waters d6e6ac471d [902/906] context: implement glGetStringi handling for GL core contexts/GLES3 2017-12-09 19:31:34 +00:00
Matthew Waters 6300c2ef1b [901/906] glx: use the display handle from the global display
Intel drivers require the display handles be the same for context
sharing to occur.  Also solves some cases of use after free of the
display when integrating with gstreamer-vaapi.

See https://bugs.freedesktop.org/show_bug.cgi?id=41736 for the intel bug.
2017-12-09 19:31:34 +00:00
Matthew Waters 07ed5dd637 [899/906] egl: warn if we resort to display handles from the window 2017-12-09 19:31:34 +00:00
Matthew Waters e64051fd1f [897/906] api: plugin a small memory leak
Found by adrien.schwartzentruber@gmail.com
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 4b42da6141 [895/906] context: call window_class->close last
We should destroy resources before closing the display connection

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=725048
2017-12-09 19:31:33 +00:00
Wang Xin-yu (王昕宇) af033ae60a [894/906] gl: add missing G_BEGIN_DECLS/G_END_DECLS
https://bugzilla.gnome.org/show_bug.cgi?id=725111
2017-12-09 19:31:33 +00:00
Matthew Waters 8f29fffc2f [893/906] x11: close both of the display's we use
(the comment doesn't seem to apply anymore)

https://bugzilla.gnome.org/show_bug.cgi?id=725048
2017-12-09 19:31:33 +00:00
Matthew Waters d169aa05dc [892/906] silence a compiler warning on older gcc versions (4.6) 2017-12-09 19:31:33 +00:00
Matthew Waters 97f6bc0bfc [891/906] context: add support for wrapping external contexts 2017-12-09 19:31:33 +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
Adrien SCH d382eab15e [888/906] correct error handling in gstgldownload.c 2017-12-09 19:31:33 +00:00
Matthew Waters 1e5851fa00 [887/906] mixer: fixup a memory leak of the context in the GLTextureUploadMeta path
gst_structure_get returns a reference to the object and we asked
for another with gst_object_replace.

https://bugzilla.gnome.org/show_bug.cgi?id=724816
2017-12-09 19:31:33 +00:00
Matthew Waters 3c9f5e6e5e [886/906] fixup a memory leak of the context in the GLTextureUploadMeta path
gst_structure_get returns a reference to the object and we asked
for another with gst_object_replace.

https://bugzilla.gnome.org/show_bug.cgi?id=724816
2017-12-09 19:31:33 +00:00
Matthew Waters c2e1e6a2d1 [885/906] filter: free our data
plugs some memory leaks

https://bugzilla.gnome.org/show_bug.cgi?id=724816
2017-12-09 19:31:33 +00:00
Matthew Waters f292e785ce [884/906] filter: return the pad template caps in transform_caps
We can transform from any input in our caps to any output.
With the following pipeline snippet:

  ... ! vaapidecode ! glcolorscale ! xvimagesink

GstVideoGLTextureUploadMeta was being used on both src and sink
pads causing linking to fail.  This allows the usage of the meta
on either pad without affecting whether the meta is chosen on the
other pad.
2017-12-09 19:31:33 +00:00
Matthew Waters cd53fbba24 [883/906] api: provide from_string()
Also s/gst_gl_api_string/gst_gl_api_to_string/g
2017-12-09 19:31:33 +00:00
Matthew Waters 6c594a0b15 [881/906] upload: restore default values for unpack_length
fixes elements that upload a supplementary texture (glbumber,
gldifferencematte, etc)
2017-12-09 19:31:33 +00:00
Matthew Waters 10f18a151e [879/906] build: don't add X_CFLAGS to CFLAGS
It should already be included if needed inside GL_CFLAGS
2017-12-09 19:31:33 +00:00
Chris Paulson-Ellis b6f6d585c3 [877/906] x11: Use correct format string for guintptr
https://bugzilla.gnome.org/show_bug.cgi?id=723537
2017-12-09 19:31:33 +00:00
Matthew Waters d233bb66a9 [876/906] glmem: use GstVideoInfo for format configuration
Allows use of strides
2017-12-09 19:31:33 +00:00
Matthew Waters d84bb0b3b2 [875/906] upload: support for arbitrary strides
Using GL_UNPACK_ALIGNMENT for GLES2 and GL_UNPACK_ROW_LENGTH for everything else
2017-12-09 19:31:33 +00:00
Matthew Waters 8daa7693cf [874/906] filter: implement draw_texture for GLES2
(taken from gleffects)
2017-12-09 19:31:33 +00:00
Matthew Waters 2eb7938db9 [873/906] upload: use GstVideoInfo for choosing the format 2017-12-09 19:31:33 +00:00
Matthew Waters a9f6679e90 [872/906] upload: consolidate data _fill 2017-12-09 19:31:33 +00:00
Matthew Waters bc8b4085b5 [871/906] upload: fix texture scaling for YUY2/UYVY with GLES2
Another artifact from the transition to GL_TEXTURE_2D
2017-12-09 19:31:33 +00:00
Matthew Waters 1f4d041d5b [870/906] upload: remove superflous g_mutex_init 2017-12-09 19:31:33 +00:00
Matthew Waters 970fbacf96 [869/906] tests: add some upload tests 2017-12-09 19:31:33 +00:00
Matthew Waters 8d67249633 [868/906] upload: fix compilation for GLES2 2017-12-09 19:31:33 +00:00
Wang Xin-yu (王昕宇) 5168d86d9e [867/906] glupload: Add GRAY8/GRAY16LE/BE upload support to glimagesink
the 16bit data is uploaded as LUMINANCE_ALPHA, then expanded, composed
in shader. value weight is a little complicate, high byte weight is
255*256/65535 (denormalize to [0~255] ,shift to high byte,then normalize
to [0~1]), low byte weight is 255/65535(similar)

https://bugzilla.gnome.org/show_bug.cgi?id=722670
2017-12-09 19:31:33 +00:00
Matthew Waters 95833db905 [866/906] upload: update some docs 2017-12-09 19:31:33 +00:00
Matthew Waters 89a203abe3 [865/906] glmem: report successful copy to the caller 2017-12-09 19:31:33 +00:00
Matthew Waters 253fe220df [863/906] window: hold a ref to our GstGLDisplay 2017-12-09 19:31:33 +00:00
Matthew Waters 2026f60879 [862/906] window: remove set_need_lock
No-one is using it.  The only code that did was the x11 one which
doesn't need it anymore.
2017-12-09 19:31:33 +00:00
Wang Xin-yu (王昕宇) 0f4c10aed9 [861/906] glprototypes: Add missing glScalef declare
https://bugzilla.gnome.org/show_bug.cgi?id=721903
2017-12-09 19:31:33 +00:00
Matthew Waters 8cc37b903c [860/906] docs: misc updates 2017-12-09 19:31:32 +00:00
Matthew Waters dadce598ba [859/906] window: provide some documetation 2017-12-09 19:31:32 +00:00
Matthew Waters 148607f6da [858/906] glmem: update the docs 2017-12-09 19:31:32 +00:00
Matthew Waters 54923d1909 [857/906] display: document the new GstContext api 2017-12-09 19:31:32 +00:00
Matthew Waters d6bdcbe751 [856/906] context: document it 2017-12-09 19:31:32 +00:00
Matthew Waters 1e02438715 [855/906] upload: add support for GstVideoGLTextureUploadMeta 2017-12-09 19:31:32 +00:00
Matthew Waters 2623734d19 [854/906] use the allocation query to propogate GstGLContext
uses the GstVideoGLTextureUploadMeta api type for the query
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 f15206082a [850/906] glupload: Remove texture scaling artifacts from the TEXTURE_RECTANGLE -> TEXTURE_2D transition
fixes the funky colours in some of the yuv formats

https://bugzilla.gnome.org/show_bug.cgi?id=721155
2017-12-09 19:31:32 +00:00
Matthew Waters 689e722dfa [848/906] filter: a little code cleanup 2017-12-09 19:31:32 +00:00
Matthew Waters ad315254e9 [847/906] mixer: unmap the video frames we map
plugs a memory leak
2017-12-09 19:31:32 +00:00
Matthew Waters 5ee09b36fa [846/906] mixer: handle 0/1 framerate better in caps 2017-12-09 19:31:32 +00:00
Matthew Waters 4b8019b12c [845/906] filter: handle capsfeatures properly 2017-12-09 19:31:32 +00:00
Matthew Waters 2cb2a3951b [844/906] mixer: give access to the pads at render time
allows us to move the video frame mapping somewhere else
2017-12-09 19:31:32 +00:00
Matthew Waters 36c62b32e5 [843/906] memory: provide copy_into_texture 2017-12-09 19:31:32 +00:00
Tim-Philipp Müller b0999fbc03 [842/906] Fix gstglconfig.h-related 'make distcheck' issues
Fix srcdir vs. builddir issue in docs and 'files left after
disclean' issue for gstglconfig.h
2017-12-09 19:31:32 +00:00
Julien Isorce e42b5bc985 [841/906] osx: allow x11/glx backend and set default runtime to cocoa/nsgl
https://bugzilla.gnome.org/show_bug.cgi?id=719757
2017-12-09 19:31:32 +00:00
Julien Isorce be87f6096b [839/906] cocoa: allow to call set_window_handle before to create glcontext
So that it actually make cocoa videooverlay example work again.

Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=719758
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
Matthieu Bouron 32265d7e4e [837/906] cocoa: resize OpenGL view size each time the window is resized
Fixes glitches that can appear when the OpenGL view has not been resized
after a window resize.

https://bugzilla.gnome.org/show_bug.cgi?id=711672
2017-12-09 19:31:32 +00:00
Matthieu Bouron cc0b1f3e05 [836/906] cocoa: only use GSRegisterCurrentThread with GNUStep environment 2017-12-09 19:31:32 +00:00
Julien Isorce 6a5bd364a4 [835/906] gstglwindow: remove unused fields 2017-12-09 19:31:32 +00:00
Julien Isorce 4d6de2ce1b [834/906] gstglwindow: clear mutex 2017-12-09 19:31:32 +00:00
Julien Isorce 42f1d66bc6 [833/906] gstglcontext: initialize window to NULL 2017-12-09 19:31:32 +00:00
Julien Isorce 0a2787863b [832/906] x11: ignore Expose events not initiated by gst_gl_window_draw 2017-12-09 19:31:32 +00:00
Julien Isorce 66d7d4712e [831/906] glimagesink: avoid to overload the drawer if already drawing
Especially if the application calls gst_video_overlay_expose a lot
2017-12-09 19:31:32 +00:00
Matthew Waters 7b7e7bb8d0 [829/906] mixer: error out properly on flushing 2017-12-09 19:31:32 +00:00
Matthew Waters ac0db99c94 [828/906] context: refcount the display 2017-12-09 19:31:32 +00:00
Matthew Waters b91eb6b557 [827/906] mixer: don't unref the query in the default case
The element/application performing the query is responsible for the
de/allocation
2017-12-09 19:31:32 +00:00
Matthew Waters bf610e210a [826/906] upload: free our mutex 2017-12-09 19:31:32 +00:00
Julien Isorce 0da88c6516 [825/906] glwindow_x11: check if the loop exists
It happens when calling set_window_handle before to reach GST_STATE_READY.
In this case the parent is set when creating the internal window.
2017-12-09 19:31:32 +00:00
Matthew Waters 266ffc48be [824/906] android: Build fixes
https://bugzilla.gnome.org/show_bug.cgi?id=709786
2017-12-09 19:31:31 +00:00
Julien Isorce ab5a3e310d [823/906] wayland_egl: make the wayland backend actually work on Raspberry Pi
Fix resizing and can now move the window
2017-12-09 19:31:31 +00:00
Julien Isorce 64a05da4fe [822/906] gstglcontext_egl: avoid non working EGL confs on rpi/wayland 2017-12-09 19:31:31 +00:00
Julien Isorce 6e732b0408 [821/906] tests: fix test_share on GLESv2 2017-12-09 19:31:31 +00:00
Julien Isorce e1eb30005c [820/906] gstglwindow: if available use wayland instead dispmanx on rpi 2017-12-09 19:31:31 +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 3b1ec77cf8 [818/906] window: add send_message_async vmethod
- provide a default synchronous send_message
- make context creation threadsafe again
2017-12-09 19:31:31 +00:00
Matthew Waters 2a937dd96a [817/906] make the state change test pass 2017-12-09 19:31:31 +00:00
Matthew Waters f7c8658464 [816/906] x11: fix make check segfault 2017-12-09 19:31:31 +00:00
Matthew Waters 4bec88ea28 [815/906] fix some refcount errors 2017-12-09 19:31:31 +00:00
Matthew Waters a44517a1e8 [814/906] mixer: timestamp buffers 2017-12-09 19:31:31 +00:00
Matthew Waters fa02b04292 [813/906] unref the pool on shutdown 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 704f231343 [808/906] x11: remove dead code 2017-12-09 19:31:31 +00:00
Matthew Waters d9cc31aca0 [807/906] context: Move some window error enums to context 2017-12-09 19:31:31 +00:00
Matthew Waters 57c32baab7 [806/906] egl: doesn't require the EGLConfig from the other context
libEGL should give us the same or similar EGLConfig from the
EGLDisplay we have.
2017-12-09 19:31:31 +00:00
Matthew Waters 0f8fc0881a [805/906] glfilter: rename external-opengl-context prop to other-context
It now requires a GstGLContext instead of a handle
2017-12-09 19:31:31 +00:00
Julien Isorce cc38e16ef2 [804/906] rpi: call bcm_host_init in plugin_init 2017-12-09 19:31:31 +00:00
Julien Isorce dd679dee25 [803/906] raspberrypi: add support for dispmanx
See https://bugzilla.gnome.org/show_bug.cgi?id=703342
2017-12-09 19:31:31 +00:00
Matthew Waters 48cd6ac353 [801/906] context: Reimplement GL context sharing
https://bugzilla.gnome.org/show_bug.cgi?id=704806
2017-12-09 19:31:31 +00:00
Matthew Waters 40a2c12495 [798/906] build: install needed header 2017-12-09 19:31:31 +00:00
Matthew Waters 72cc3c4815 [797/906] x11: fix build for clang 2017-12-09 19:31:31 +00:00
Matthew Waters b8b9fced19 [796/906] move egl into its own directory 2017-12-09 19:31:31 +00:00
Matthew Waters 83ac943fc4 [795/906] android: port to GstGLContext
not tested
2017-12-09 19:31:31 +00:00
Matthew Waters 9cbb652b66 [794/906] context: add subclasses for the different platforms (egl, glx, wgl, etc)
- most code taken from the Window subclasses
- tested combinations: xEGL, GLX, Wayland+EGL, Cocoa (under GNUStep), WGL (Wine)
2017-12-09 19:31:30 +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 175f28848c [792/906] build: use our own in tree headers before system ones
allows us to develop against the tree rather than what may be installed
2017-12-09 19:31:30 +00:00
Julien Isorce b56bf26dce [791/906] glwindow/x11: remove X11EventSource as soon as the window is deleted
gst_gl_window_x11_send_message do not use XSendEvent anymore
2017-12-09 19:31:30 +00:00
Sebastian Dröge 4e8c78a4da [789/906] egl: Create a window surface if necessary 2017-12-09 19:31:30 +00:00
Tonu Jaansoo 431ce49db3 [788/906] osx: Fix compilation 2017-12-09 19:31:30 +00:00
Tonu Jaansoo c304635ecf [787/906] gl: The GLSL rectangle resampler does not always work with int tex coords
Use floats instead.
2017-12-09 19:31:30 +00:00
Sebastian Dröge 396717587e [786/906] glprototypes: Add support for NV extensions for DrawBuffers and ReadBuffer 2017-12-09 19:31:30 +00:00
Sebastian Dröge b6207a10a2 [785/906] egl: Use EGL_KHR_surfaceless_context instead of creating a useless surface if available 2017-12-09 19:31:30 +00:00
Sebastian Dröge 82eb297aba [782/906] gldownload: Use strlen() instead of sizeof(char*)
gstgldownload.c:846:22: error: argument to 'sizeof' in 'memcpy' call is the same expression as the source; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]
2017-12-09 19:31:30 +00:00
Matthew Waters e32e8f45e0 [781/906] download: propogate errors from the GL thread 2017-12-09 19:31:30 +00:00
Matthew Waters 7c4d51edf4 [780/906] up/download: check return values
So we fail properly
2017-12-09 19:31:30 +00:00
Matthew Waters 13d487741a [779/906] download: remove _thread variants of the API 2017-12-09 19:31:30 +00:00
Matthew Waters 1f19143837 [778/906] upload: remove _thread variants of the API 2017-12-09 19:31:30 +00:00
Matthew Waters d009a216e6 [777/906] upload: overhaul and addition of new video formats
use the shaders from eglglessink (adapted for Desktop GL)
error out properly
2017-12-09 19:31:30 +00:00
Matthew Waters 0df6a5e963 [776/906] download: fix compiler warning about missing string format 2017-12-09 19:31:30 +00:00
Sebastian Dröge e4f45140d6 [775/906] configure: Check for GLeglImageOES and others again
https://bugzilla.gnome.org/show_bug.cgi?id=704498
2017-12-09 19:31:30 +00:00
Sebastian Dröge fe0ad33572 [774/906] win32: Fix some compiler errors/warnings 2017-12-09 19:31:30 +00:00
Mathieu Duponchelle 47b9fb1d49 [773/906] glfilters: Mark writable-only properties as readable as well
https://bugzilla.gnome.org/show_bug.cgi?id=704429
2017-12-09 19:31:30 +00:00
Sebastian Dröge 8efcecb98c [771/906] gl: Some less long/ulong/gulong usage 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
Matthew Waters d492036322 [765/906] wayland: remove fullscreen 2017-12-09 19:31:30 +00:00
Matthew Waters 2c6f8de516 [764/906] filter: fix pad template caps
upload is for the sink template
download is form the src template
2017-12-09 19:31:30 +00:00
Matthew Waters 8577de136e [763/906] memory: copy properly depending on where the most recent data is 2017-12-09 19:31:30 +00:00
Sebastian Dröge 5b1dd556de [762/906] glimagesink: Fix some memory leaks and properly set up the buffer pool 2017-12-09 19:31:30 +00:00
Sebastian Dröge 4f23429abb [761/906] x11: Protect event display connection with a mutex
We use it from different threads and need to serialize the
accesses to it.
2017-12-09 19:31:30 +00:00
Sebastian Dröge 9810469db0 [760/906] x11: Always use the same display connection from the GL thread
The other display connection might be used by async calls from elsewhere
at the same time.

https://bugzilla.gnome.org/show_bug.cgi?id=704247
2017-12-09 19:31:30 +00:00
Sebastian Dröge bb4414ac7f [759/906] gldownload: #ifdef some GLES2 specific code to fix compilation 2017-12-09 19:31:30 +00:00
Sebastian Dröge a41b21f4a5 [758/906] android: Don't require a window to be set
This allows the filters to be usable without a GL sink downstream.
2017-12-09 19:31:30 +00:00
Sebastian Dröge 0a6359fc59 [757/906] egl: Create an offscreen surface if no window was provided 2017-12-09 19:31:30 +00:00
Sebastian Dröge 1de089fe81 [756/906] gldownload: Reset the viewport after download RGB via GLES2 2017-12-09 19:31:29 +00:00
Sebastian Dröge 85a4f1042b [755/906] gldownload: Unbind framebuffer after downloading RGB with GLES2 2017-12-09 19:31:29 +00:00
Sebastian Dröge f804d53a9c [754/906] gldownload: Add support for RGB reordering when using GLES2 2017-12-09 19:31:29 +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 b2934152ce [752/906] glwindow: Add destroy notifies for the data of the callbacks
And actually call the close callback when the window is closed.
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
Sebastian Dröge 15438d5b7f [750/906] glupload: Add support for RGB reordering when using GLES2 2017-12-09 19:31:29 +00:00
Sebastian Dröge 9d4f99b8bb [749/906] glshader: Add some more debug output 2017-12-09 19:31:29 +00:00