Commit graph

1648 commits

Author SHA1 Message Date
Matthew Waters
66d616f5ed gl/egl: remove use of texture orientation 2017-01-10 13:57:37 +11:00
Matthew Waters
d9f553bff5 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-01-10 01:00:12 +11:00
Matthew Waters
d8d28e4426 gl/format: use the unsized format for RGB on GLES2
In GLES2 GL_RGB8 doesn't exist so we cannot use it, use GL_RGB
instead.

https://bugzilla.gnome.org/show_bug.cgi?id=776141
2016-12-17 01:13:44 +11:00
Matthew Waters
e6e403a6c9 gl/window: remove unused priv variable
https://ci.gstreamer.net/job/GStreamer-master/7989/console
2016-12-16 00:22:41 +11:00
Matthew Waters
f58eb98440 gl/window: remove use of main_context_push/pop_thread_default()
No-one's using/depending on it (it would have criticalled and not worked)
and it's causing more problems than it's solving.  Store the GMainContext
in the public struct instead for subclasses to optionally use instead of
relying on the push/pop state to be correct.

https://bugzilla.gnome.org/show_bug.cgi?id=775970
2016-12-16 00:02:47 +11:00
Sebastian Dröge
5c99f9cf37 gst: Don't declare variables inside the for loop header
This is a C99 feature.
2016-12-13 22:39:01 +02:00
Julien Isorce
f7b039e7df gstglupload: relax EGL context check
Check for GST_GL_PLATFORM_EGL enum instead of type GstGLContextEGL.

https://bugzilla.gnome.org/show_bug.cgi?id=774518
2016-12-01 10:50:10 +00:00
Julien Isorce
119955bea4 gstglcontext: is_shared should return FALSE if no group
If a sub class of GstGLContext does not create a group
then it currently crashes:

0 g_atomic_int_get (&share->refcount)
1 _context_share_group_is_shared (context->priv->sharegroup)
2 gst_gl_context_is_shared
3 _default_set_sync_gl

https://bugzilla.gnome.org/show_bug.cgi?id=774518
2016-12-01 10:50:05 +00:00
Matthew Waters
1db88cbee7 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
2016-11-30 19:29:27 +11:00
Matthew Waters
024e92afe7 glwindow: move g_main_context_push/pop_thread_default() to run()
Calling g_main_context_push_thread and then g_main_context_invoke()
(used by gst_gl_window_send_message_async()) in the same thread will
cause the invoked function to run immediately instead of being delayed.

This had implications for the creation of the OpenGL context not waiting
until the main loop had completely started up and as a result would
sometimes deadlock in short create/destroy scenarios.

https://bugzilla.gnome.org/show_bug.cgi?id=775171
2016-11-28 14:27:03 +11:00
Matthew Waters
25fbc6d877 glcontext: fix race between creation/shutdown
626bcccff9 removed some locks that
allowed the main loop quit to occur before the context was fully
created.

2776cef25d attempted to readd them but
missed the scop of the quit() call.

Also remove the use of g_thread_join() as that's not safe to use when
it's possible to lose the last reference from the GL thread.

https://bugzilla.gnome.org/show_bug.cgi?id=775171
2016-11-28 14:27:03 +11:00
Sebastian Dröge
939528e542 gl/x11: Remove unused static function 2016-11-25 23:44:25 +02:00
Matthew Waters
4a0214335f gl/contextglx: error out on more invalid display/window combinations
https://bugzilla.gnome.org/show_bug.cgi?id=774851
2016-11-23 17:04:34 +11:00
Matthew Waters
7ab4abb3ab gl: add necessary context_egl.h #includes to the source files 2016-11-23 15:57:05 +11:00
Matthew Waters
75d36b990d 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
2016-11-23 13:36:45 +11:00
David Evans
5591f55db5 gl: add gstreamer-video to pkg-config path
https://bugzilla.gnome.org/show_bug.cgi?id=774624
2016-11-21 09:34:44 +02:00
Matthew Waters
39b59beace meson: gl/egl: add missing source file
d42145e8c1 didn't add the necessary
meson build changes.
2016-11-17 14:32:10 +11:00
Matthew Waters
8c2118823b 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
2016-11-17 14:06:21 +11:00
Matthew Waters
f2e9190229 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
2016-11-17 14:06:21 +11:00
Matthew Waters
d42145e8c1 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
2016-11-17 14:06:21 +11:00
Matthew Waters
cdaada4300 display/egl: implement getting the EGLDisplay of a specific platform
https://bugzilla.gnome.org/show_bug.cgi?id=774518
2016-11-17 14:06:21 +11:00
Víctor Manuel Jáquez Leal
9ca4c8ec35 gl/egl: check the feature in the extensions list
https://bugzilla.gnome.org/show_bug.cgi?id=774518
2016-11-16 19:52:54 +01:00
Matthew Waters
bb84f7357b glcontext/cocoa: implement empty swap_buffers
Fixes some GL tests on OS X.
2016-11-16 17:34:29 +11:00
Matthew Waters
9f690fa241 glwindow/cocoa: remove unneeded window code in NSWindow
This is all taken care of by GstGLWindowCocoa/GstGLNSView now.
2016-11-16 00:01:00 +11:00
Matthew Waters
23ec5aeb83 glwindow/cocoa: remove our view from the parent when closing
Otherwise, when the application reuses the same UIView, we were getting
draw notifications on the previous view/layer's which weren't valid anymore
and were referencing pointers that had been freed.

https://bugzilla.gnome.org/show_bug.cgi?id=753003
2016-11-16 00:00:17 +11:00
Matthew Waters
5602cab04d gl/caopengllayer: add a debug category 2016-11-15 23:55:00 +11:00
Matthew Waters
f2d09b8cd4 glbufferpool: introduce check for GLMemory allocators
The last missing piece of EGLImage support has been pushed.
2016-11-15 23:55:00 +11:00
Tim-Philipp Müller
ba6b8c33e0 gl: x11-xcb is not a required dependency
Don't fail if it's not found..
2016-11-11 01:06:23 +00:00
Matthew Waters
3f7b549881 gl/utils: move gen_shader() to the plugin and remove del_shader()
gst_gl_context_del_shader() can be replaced by a g_object_unref().
gst_gl_context_gen_shader() should be replaced by using GstGLSLStage.
2016-11-10 20:11:03 +11:00
Matthew Waters
59350d078b glwindow: remove unused field in public struct 2016-11-10 20:05:45 +11:00
Matthew Waters
01fa90c1e7 glwindow: remove is_running() function
It isn't necessary in correctly written programs.
2016-11-10 20:05:45 +11:00
Nirbheek Chauhan
de4552d279 meson/gl: XCB changes also need x11-xcb as a dependency
https://ci.gstreamer.net/job/GStreamer-master-meson/380/console

[...]
gst-libs/gst/gl/x11/xcb_event_source.c:98: undefined reference to `xcb_get_file_descriptor'
2016-11-08 17:52:02 +05:30
Philippe Normand
a424f04a22 gl/x11: fix meson build
The x11_event_source.[ch] files were renamed in
4f6c226bd2.
2016-11-08 09:54:15 +01:00
Matthew Waters
f9d463d80e glwindow: remove the navigation thread
This functionality can now effectively be implemented with the display event
thread.
2016-11-08 15:14:27 +11:00
Matthew Waters
4f6c226bd2 gl/x11: use xcb instead of libX11
- xcb is supposedly thread-safe!

videotestsrc ! glimagesink now doesn't spuriously result in a
'call XInitThreads()' error however if anybody else is using X11,
then XInitThreads() still needs to be called and multiple glimagesink's
still need XInitThreads().

Everything still takes libX11 handles as they are compatible with the xcb
variants.  Unfortunately we cannot move fully over to xcb due to GLX being
entirely based on Xlib.  It's also impossible to transform a xcb_connection
to a Display which means we require X11 handles.
2016-11-08 15:14:26 +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
92ba1d0df6 gl: don't expose OpenGL prototypes
We roll our own to avoid depending a certain OpenGL header version
2016-11-08 12:46:09 +11:00
Matthew Waters
2a440f60e4 gl/cocoa: don't install the gstglcontext_cocoa.h header
It's not needed to be exposed
2016-11-08 12:46:09 +11:00
Matthew Waters
7dc7ec94e7 gl/android: don't install the android window header
It's not needed
2016-11-08 12:46:09 +11:00
Matthew Waters
86930b6d11 gl: add padding to all exposed winsys/platform-specific structs 2016-11-08 12:46:09 +11:00
Matthew Waters
2209c5d97f gl/wayland: install the gstgldisplay_wayland.h header
As it is used by other OpenGL sinks (gtkglsink, qmlglsink)
2016-11-08 12:45:55 +11:00
Matthew Waters
c6326530cc 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.
2016-11-08 02:44:30 +11:00
Matthew Waters
cafcde5586 glfilter: remove display_init/reset
They are mirrors of GstGLBaseFilter's gl_start() and gl_stop() virtual methods
so use them instead.
2016-11-08 02:21:20 +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
61a3c55d55 gl/gi: also include GstVideo
Removes all the unknown type GstVideo* warnings while building the GIR
file.
2016-11-03 16:16:12 +11:00
Matthew Waters
19752be030 glfeature: move internal functions into a private header
Don't expose them to the outside world
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
1296741d3d gl/docs: document new API added in 1.10
GstGLRenderbuffer
GstGLFramebuffer
GstGLQuery
GstEGLImage
GstGLMemoryEGL
2016-11-03 12:08:44 +11:00
Matthew Waters
4b43862cdb glsl: fix #version 150 not working with profiles
The spec allows the core/compatibility profiles to be used
with #version 150.

Also tighten up the tests to check for default profiles being chosen
correctly.
2016-11-03 12:08:44 +11:00
Nirbheek Chauhan
f1c9fa28d2 build: Also need to define GST_EXPORTS for Autotools
The change to use GST_EXPORT for symbols under Windows requires
GST_EXPORTS for internal use, and that is also needed under Autotools.
The same thing is done for gstreamer-1.0.dll in -core.
2016-10-28 10:01:36 +05:30
Nirbheek Chauhan
7e6764e304 gstgl: Re-enable WINAPI on _MSC_VER
The calling convention may be deprecated, but we still need it for
OpenGL. The build issue was caused by an incorrect syntax being used for
the WINAPI (__stdcall) prototype in function pointers which was accepted
by GCC but is rejected by MSVC.
2016-10-28 10:00:59 +05:30
Nirbheek Chauhan
f790863755 Explicitly define float constants as float
With MSVC, this gives the following warning:

warning C4305: 'function': truncation from 'double' to 'gfloat'

Apparently, MSVC does not figure out what type to use for constants
based on the assignment. This warning is very spammy, so let's try to
fix it.
2016-10-27 23:06:26 +05:30
Nirbheek Chauhan
e3c1a545ba gstgl: Add GST_EXPORT to all symbols used on Windows
This is a requirement for those symbols to be exported in gstgl-1.0.dll
when building with the MSVC compiler
2016-10-27 23:06:25 +05:30
Nirbheek Chauhan
6f707381c3 meson: Add support for building WGL on Windows
Currently only tested with MSVC.
2016-10-27 23:06:25 +05:30
Nirbheek Chauhan
d5dba89fc0 gstgl: Porting fixes for MSVC with Meson
GL/gl.h needs windows.h on MSVC

WINAPI should not be used with MSVC. It also causes a build error.
2016-10-27 23:06:25 +05:30
Matthew Waters
cbaee81f9c glsyncmeta: don't glFinish() everytime a sync point is set
At minimum, we only need to glFlush() if we are in a shared GL context
environment.  Move the glFinish() to when the actual wait is requested
which may be never.  Improves the throughput on older GL systems without
GL3/GLES3 and/or fence sync objects.
2016-10-21 15:54:37 +11:00
Matthew Waters
c36ea6f56f meson: gl: add support for building with dispmanx on the rpi 2016-10-19 17:10:48 +11:00
Matthew Waters
0abeebc4e8 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
2016-10-18 22:43:03 +11:00
Munez
cb8204f6c0 Implemented gst_video_overlay_set_window_handle()
https://bugzilla.gnome.org/show_bug.cgi?id=772608
2016-10-18 15:53:10 +11:00
Matthew Waters
5e2f9a9690 meson: gl: fix detection of glx without gl
We need to check for libGL if we may use desktop OpenGL *or* GLX.
2016-10-18 14:15:40 +11:00
Matthew Waters
b85fa6f2dd meson: gl: fix incorrect error string
Use the winsys variable for an incorrect winsys provided
2016-10-18 14:10:32 +11:00
Munez
429135face gl/dispmanx: egl_show should resize the window only if there is no render rectangle set
https://bugzilla.gnome.org/show_bug.cgi?id=772699
2016-10-18 11:23:42 +11:00
Munez
1cf3d0a590 gl/dispmanx: Fix set_render_rectangle typo
https://bugzilla.gnome.org/show_bug.cgi?id=772698
2016-10-18 11:23:42 +11:00
Matthew Waters
9ad4c67578 glwindow: don't use g_thread_join() to join the navigation thread
Using g_thread_join() in _finalize() handlers may result in a deadlock
joining the current thread when the last reference is held by a signal
handler.

e.g.:

error 'Resource deadlock avoided' during 'pthread_join (pt->system_thread, NULL)'

The backtrace looks like this:
[...]
g_thread_join ()
gst_gl_window_finalize ()
gst_gl_window_x11_finalize ()
g_object_unref ()
g_value_unset ()
g_signal_emit_valist ()
g_signal_emit ()
gst_gl_window_send_mouse_event ()
gst_gl_window_mouse_event_cb ()
g_main_dispatch ()
[..]
g_main_loop_run ()
gst_gl_window_navigation_thread ()
g_thread_proxy ()
start_thread ()
clone ()
2016-10-05 18:32:09 +11:00
Matthew Waters
e20dab09ea gl/win32: remove egl implementation
It hasn't been used in ages and is dead code.
2016-10-05 12:20:52 +11:00
Gwang Yoon Hwang
b75ec0c433 gl/dispmanx: Implements set_render_rectangle to adjust the position of window
We cannot set the x, y coordinate of the video frame at the dispmanx at
this point. We need to teach dispmanx backend to understand about
set_render_rectangle API to draw a video with other UI.

This patch keeps the current behavior which places video frame at the
center of the display if there is no set_render_rectangle call to the
dispmanx window.

https://bugzilla.gnome.org/show_bug.cgi?id=766018
2016-09-28 17:08:52 +10:00
Matthew Waters
c200e47ef8 gl: add necessary padding bytes to all public structs 2016-09-28 17:08:52 +10: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
32273c2c9c meson/gl: use separate deps for gl and glx
e.g. passing with_gl_api=gles2 would still build the glx code but not be
linking against the libGL library which is where the glX* functions are
located and would result in a linker error.

Solved by checking for the libGL library if either opengl or glx may be
needed and then disabling the corresponding deps as requested.
2016-09-09 23:26:24 +10:00
Matthew Waters
b5b7a3aec3 meson: add some starting build files for GL
Currently only works on linux with egl/glx + wayland/x11 but the general
principals have been layed out for adding the other GL platforms/winsys'.
2016-09-09 11:22:47 +10:00
Alistair Buxton
c3d5057185 gl: Remove duplicate GL_CFLAGS in Makefile.am.
https://bugzilla.gnome.org/show_bug.cgi?id=771021
2016-09-08 09:45:18 +10:00
Jan Schmidt
840c2729cc gl: Remove extra duplicate typedef of GstGLFramebuffer
It's triggering a warning building git master on OSX
2016-08-31 04:27:09 +10:00
Alessandro Decina
a7dccec0ff glupload: fix tests and check for the new RECONFIGURE behaviour
The tests were broken since 91fea30, which changed glupload to return
GST_GL_UPLOAD_RECONFIGURE if the texture target in the input buffers doesn't
match the texture-target configured in the output caps.

This commit fixes that and adds more checks for the new behaviour.
2016-08-29 16:06:06 +10:00
Alessandro Decina
91fea30ff4 gstglupload: make the GLMemoryUpload method output the correct texture-target
Now when used with video/x-raw as input, the GLMemoryUpload method checks for
->tex_target in input GLMemory(es) and sets the output texture-target
accordingly.

Fixes video corruption with a pipeline like avfvideosrc ! video/x-raw !
glimagesink where on macos avfvideosrc pushes RECTANGLE textures but glupload
was configuring texture-target=2D as output.
2016-08-26 17:44:33 +10:00
Jan Schmidt
45df74868c glviewconvert: Fix texture target fixation
Don't set the chosen texture-target into the wrong structure.
The input caps may not be writable, and in any case - the
intention was to configure the othercaps. Also, remove an
extra unref - the othercaps ref is consumed by
gst_caps_make_writable already.
2016-08-26 03:25:49 +10:00
Nirbheek Chauhan
42af2d66d8 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Matej Knopp <matej.knopp@gmail.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:35:54 +01:00
Matthew Waters
306e610547 glwindow: marshal gst_gl_window_resize through the window loop
saves having every caller do it themselves.
2016-08-19 16:07:07 +10:00
Matthew Waters
05a0f0002c gl/wayland: use multi-threaded safe event wayland API
Multiple threads may be accessing the wayland fd at the same time which
requires the use of special wayland API to deal with to ensure nobody
will steal reads and cause a stall for anyone else.
2016-08-19 16:06:26 +10:00
Matthew Waters
0fc3c0f9dc gl/egl: fix inverted typedef
2b6841d had an inverted typedef defining ginptr and EGLAttrib.  Fix that.
2016-08-16 20:34:37 +10:00
Matthew Waters
2b6841da32 gl/build: add configure check for possibly missing EGLAttrib
Fixes the build on older android targets.
2016-08-16 16:51:02 +10:00
Song Bing
4e04f28478 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
2016-08-16 15:34:08 +10:00
Vincent Penquerc'h
2776cef25d glcontext: fix race joining thread on finalize
https://bugzilla.gnome.org/show_bug.cgi?id=769939
2016-08-16 13:10:30 +10:00
Matthew Waters
402ab38f07 glcolorconvert: add missing rgb16 and bgr16 video formats in switch
Fixes an assertion that code should not be reached

https://bugzilla.gnome.org/show_bug.cgi?id=769462
2016-08-04 23:16:14 +10:00
Haihua Hu
fa37e3588e glwindow: Fix glimagesink cannot show frame when connect to qmlglsrc
When connect to qmlglsrc, x11 event loop will be replace by qt event loop
which will cause the window cannot receive event from xserver, such as resize

https://bugzilla.gnome.org/show_bug.cgi?id=768160
2016-08-03 22:10:56 +10:00
Hyunjun Ko
2bb3baa8c9 glupload: Use bufferpool to allocate new buffer in GLTextureUploadMeta
To improve performace of upload with GLTextureUploadMeta,
use bufferpool instead of allocating new buffer every time.

https://bugzilla.gnome.org/show_bug.cgi?id=769293
2016-08-03 21:16:47 +10:00
Matthew Waters
a46d4f3b57 glwindow: move unsetting queue_resize to _resize() instead of _draw()
Makes infinitely more sense and implementation were expecting that behaviour
anyway and would enter a resize, draw, resize, draw, ... cycle instead of only
resizing once.
2016-08-03 21:15:01 +10:00
Matthew Waters
01157c4433 glframebuffer: add compatibility definition for GL_DEPTH_STENCIL_ATTACHMENT
GLES2 doesn't have it defined...
2016-07-26 15:57:54 +10:00
Matthew Waters
5da138d1ae glfilter: rewrite subclasses for filter_texture() occuring on GL thread
There's no need for the jump to an extra thread in most cases, especially
when relying solely on a shader to render.  We can use the provided
render_to_target() functions to simplify filter writing.
2016-07-26 14:07:24 +10:00
Matthew Waters
6edd89c883 glutils: remove unused GstGLDisplayProjection 2016-07-26 14:07:24 +10:00
Matthew Waters
06b4b52a20 glcontext: remove not thread-safe get/set_error()
Use GError's instead if necessary.
2016-07-26 14:07:24 +10:00
Matthew Waters
518e8a3fd2 glframebuffer: rewrite for a more consistent API
Facilities are given to create fbo's and attach GL memory (renderbuffers
or textures).  It also keeps track of the renderable size for use with
effective use with glViewport().
2016-07-26 14:07:24 +10:00
Matthew Waters
aa109016a3 gl: use GLMemory for accessing textures everywhere
This simplifies and consolidates a lot of duplicated code creating
and modifying textures.
2016-07-26 14:07:24 +10:00
Matthew Waters
f10a67ec44 glfilter: rename draw_texture to draw_fullscreen_quad
And remove unused arguments.
2016-07-26 14:07:24 +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
0daa380245 glformat: define our own set of formats from the GL defines
also add some depth/stencil formats
2016-07-26 14:07:24 +10:00
Matthew Waters
6f4091bbd3 glbasememory: assert for a valid allocator instead of segfaulting 2016-07-26 14:07:24 +10:00
Tim-Philipp Müller
c593e0a17f gl: wayland: improve debug message when connecting to display
And another copy'n'paste-o.

https://bugzilla.gnome.org/show_bug.cgi?id=768929
2016-07-18 17:47:50 +01:00
Matthew Waters
087bb0ed6a glviewconvert: fix transformation matrix usage
Calling glUniformMatrix before the shader is bound is invalid and
would result in errors like:

GL_INVALID_OPERATION in glUniformMatrix(program not linked)

Move glUniformMatrix() to after the gst_gl_shader_use() call.
2016-06-30 21:54:03 +10:00
Matthew Waters
e0ecd774dd glupload: fix raw data uploader with addition of GstVideoGLTextureType
Fixes regression from 989200820d

https://bugzilla.gnome.org/show_bug.cgi?id=768217
2016-06-30 14:07:32 +10:00
Olivier Crête
461201c396 glvideoconvert: RG/LA is available in OpenGL ES 3, so let that through 2016-06-29 23:55:18 -04:00
Matthew Waters
5592a966c6 Revert "Revert "gl/eagl: try getting a gles3 context""
This reverts commit eb14273631.

vtdec now successfully outputs textures that can be converted by
glcolorconvert in GLES3 contexts.
2016-06-29 18:04:28 +10:00
Matthew Waters
989200820d 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.
2016-06-29 18:04:28 +10:00
Matthew Waters
6958b7a014 glcolorconvert: don't assume Red/RG textures will be used
Take the used texture type from the memory instead.

Fixes conversion from multi-planar YUV formats with two components per plane
(NV12, NV21, YUY2, UYVY, GRAY16_*, etc) with Luminance Alpha input textures.

This is also needed for zerocopy decoding on iOS with GLES 3.x.
2016-06-29 18:04:28 +10:00
Matthew Waters
b9cdc9d4b0 glcontext: correct precondition for get_gl_version
The intention was to assert if both maj and min were NULL (as there would be no
point calling the function).  Instead if either maj or min were NULL, the assert
would occur.

Fix that.
2016-06-29 18:04:28 +10:00
Sebastian Dröge
0e58e86c4c eglimage: Only register debug category if dmabuf support is enabled
It's not used otherwise currently and causes compiler warnings.
2016-06-23 16:00:00 +03:00
Wang Xin-yu (王昕宇)
6ed2ca373a glcontext/wgl: try wglCreateContextAttribsARB even not gl3 core profile
https://bugzilla.gnome.org/show_bug.cgi?id=764018
2016-06-21 22:57:13 +10:00
Matthew Waters
8a67cd90b3 glcontext: fix get_current_gl_api() on win32
Another case of incorrect calling conventions.

Using this function on win32 would corrupt the stack pointer and end in
massive hilarity.
2016-06-21 22:57:00 +10:00
Matthew Waters
d3f3787d64 glsl: fixup external-oes shaders by mangling the required extension
Newer devices require using a different GLSL extension for accessing
external-oes textures in a shader using the texture() functions.

While the GL_OES_EGL_image_external_essl3 should supposedly be supported
on a any GLES3 android device, the extension was defined after a lot of the
older drivers were built so they will not know about it.  Thus there are two
possible interpretations of which of texture[2D]() should be supported for
external-oes textures.  Strict adherence to the GL_OES_EGL_image_external
extension spec which uses texture2D() or following GLES3's pattern, also
allowing texture() as a function for accessing external-oes textures

This adds another mangling pass to convert
 #extension GL_OES_EGL_image_external : ...
into
 #extension GL_OES_EGL_image_external_essl3 : ...
on GLES3 and when the GL_OES_EGL_image_external_essl3 extension is supported.

Only uses texture() when the GLES3 and the GL_OES_EGL_image_external_essl3
extension is supported for external-oes textures.
Uses GLES2 + texture2D() + GL_OES_EGL_image_external in all other external-oes
cases.

https://bugzilla.gnome.org/show_bug.cgi?id=766993
2016-06-21 21:27:47 +10:00
Sergey Borovkov
180405714c qml: Enable qmlglsink for eglfs
https://bugzilla.gnome.org/show_bug.cgi?id=763044
2016-06-16 01:49:16 +10:00
Matthew Waters
861ce43cd8 glsl: add some debugging 2016-06-15 18:10:59 +10:00
Matthew Waters
27e4288de4 glutils: remove unused functions for texture creation/deletion
Everyone uses GstGLMemory now and any future code should as well.
2016-06-15 16:08:57 +10:00
Matthew Waters
216b8eea6c glfilter: remove unused class fields in/out_tex_id
The functionality is not used by any subclass nor are the values set anywhere.
2016-06-15 15:47:47 +10:00
Matthew Waters
6b7f94abb2 gl/upload/meta: remove unneeded texture deletion
The textures are managed by the GstGLMemory inside the output buffer.  Freeing
them prematurely may result in a use-after-free.
2016-06-15 14:40:40 +10:00
Guillaume Desmottes
991d9a6f5f gst-libs: gl, video: use MAY_BE_LEAKED flag
https://bugzilla.gnome.org/show_bug.cgi?id=767162
2016-06-03 00:59:12 +01:00
Havard Graff
63a05aff6a gl: glquery: cast to silence compiler warning
https://bugzilla.gnome.org/show_bug.cgi?id=766973
2016-05-28 22:28:06 +01: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
Xavier Claessens
b2cfc56e83 gl: win32: Add debug category in gstglcontext_wgl.c
https://bugzilla.gnome.org/show_bug.cgi?id=766867
2016-05-25 23:10:44 +10:00
Haihua Hu
a5cb746983 glimagesink: support video rotation using transform matrix
Add "rotate-method" to glimagesink and apply transform matrix
to vertex coordinate to control rotation.

https://bugzilla.gnome.org/show_bug.cgi?id=765795
2016-05-25 18:28:20 +10:00
Matthew Waters
5f9d10f603 gldisplay: add some debugging about retrieving GL contexts 2016-05-25 18:28:20 +10:00
Sebastian Dröge
6f9b9e153a eglimage: Re-add accidentially removed GST_DEFINE_MINI_OBJECT_TYPE() 2016-05-25 10:01:38 +03:00
Sebastian Dröge
b730f7e89d 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
2016-05-25 09:46:37 +03:00
Tim-Philipp Müller
db90f4686f g-i: pass compiler env to g-ir-scanner
It's what introspection.mak does as well. Should
fix spurious build failures on gnome-continuous.
2016-05-24 00:55:11 +01:00
Xavier Claessens
098c5c16ad gl: win32: Unparent internal window before destroying it
For some reason DestroyWindow() deadlock if it's called from
parent window's KeyPress event.

https://bugzilla.gnome.org/show_bug.cgi?id=766533
2016-05-20 17:04:01 +02:00
Xavier Claessens
83bb89f4ec gl: win32: Don't steal parent focus when creating internal window
This fix regression introduced by 0acc18c60f.

https://bugzilla.gnome.org/show_bug.cgi?id=766520
2016-05-20 17:04:01 +02: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
799efcb133 gl: take the affine transformation in NDC
Provide a function to get the affine matrix in the meta in terms of NDC
coordinates and use as a standard opengl matrix.

Also advertise support for the affine transformation meta in the allocation
query.
2016-05-14 16:35:29 +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
8ccf3dc589 glmemory: add wrapped data pointers to setup_buffer
Allows creating wrapped memories with GstGLAllocationParams.

The wrapped pointers will be set in the parameters before being passed
to the memory allocation function.
2016-05-04 12:51:59 +10:00
Matthew Waters
c9d9077a5f glbasememory: take a pointer as the wrapped gpu handle
Allows passing arbitrary data to wrap the the specific memory implementation
which is required for some memory implementations.
2016-05-04 12:51:59 +10:00
Matthew Waters
344e7db975 gl: fix gles3 header usage for older platforms
Some platforms provide an old version of GLES2/gl2.h and GLES2/gl2ext.h that
will fail when including GLES3/gl3.h due to missing typedef's.

Seen on the RPi.
2016-05-03 20:02:34 +10:00
Sebastian Dröge
b9cfa34118 glviewconvert: Port more things to GLES/GL 3 compatibility
And move the shader mangling code into a single place instead of having a copy
in glcolorconvert and glviewconvert.

https://bugzilla.gnome.org/show_bug.cgi?id=765266
2016-04-27 11:47:20 +03:00
Sebastian Dröge
57a4494528 glcolorconvert: GLES3 deprecates texture2D() and it does not work at all in newer versions than 3.3
Use the newer texture() function instead. This fixes glimagesink and other
things on various Android devices.

https://bugzilla.gnome.org/show_bug.cgi?id=765266
2016-04-27 11:47:20 +03:00
Hyunjun Ko
6a0b35bf37 gl/cocoa: Fix incompatible type warning
https://bugzilla.gnome.org/show_bug.cgi?id=765292
2016-04-20 10:11:03 +03:00
Heinrich Fink
ef12e05a59 gl/caopengllayer: Apply layer.contentsScale to viewport dims
Fixes blurry content on HiDPI screens

https://bugzilla.gnome.org/show_bug.cgi?id=765194
2016-04-18 10:32:07 +03:00
Matthew Waters
b3b73d39a0 gl/cocoa/eagl: don't leak GThread's when dispatching messages
gst_gl_context_get_thread() returns a refed pointer, we need to unref it.
2016-04-13 01:03:20 +10:00
Matthew Waters
5115eadc46 glupload: keep the parent buffer around when converting EGLImage to 2D textures
e.g. receiving and releasing a buffer from OMX too early will potentially
cause textures to be overwritten while/before they are displayed.
2016-04-12 09:41:23 +10:00
Alessandro Decina
b73d2586ce libgstgl: cocoa, eagl: use libdispatch to schedule GL calls
Use libdispatch instead of GMainLoop to dispatch GL calls. libdispatch is more
optimized and cuts a lot of poll()/pthread_* overhead.
2016-04-11 08:40:03 +10:00
Alessandro Decina
38cb69279b glwindow: reduce the number of GMutexes and GConds in send_message()
Don't create many short lived locks/conds in gst_gl_window_send_message. This is
a micro optimization to save a bunch of pthread_* calls which are expensive on
OSX/iOS and possibly other platforms.
2016-04-11 08:40:03 +10:00
Matthew Waters
5e80a99faf 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.
2016-04-01 16:08:18 +11:00
Matthew Waters
beeb3ff883 glviewconvert: support outputting to multiple draw buffers on GLES3
A similar change that was done to glcolorconvert adding the necessary shader
mangling.
2016-04-01 15:37:04 +11:00
Matthew Waters
822f09f6ae glcolorconvert: implement multiple render targets for GLES3
There are numerous slight differences required between Desktop GL and GLES3 for
multiple render targets.

1. gl_FragData doesn't exist at all and one is required to use
   'layout (location = ?) out ...' instead.
2. gl_FragColor doesn't exist, same as 1
3. texture2D() has been deprecated

Fortunately most of these have been taken care of with GL3 and the shader
mangling already exists so just expand the conditions they are used in.  The
gl_FragData issue requires a new mangle pass though.  We also use this new
pass on desktop GL for consistency.
2016-04-01 15:37:04 +11:00
Matthew Waters
1fe958d6d3 glcolorconvert: don't use the predefined variable name sample
Using 'sample' as a variable name is an error in GLES3
2016-03-31 20:53:18 +11:00
Matthew Waters
9e40dd7d40 gl: add support for building against GLES3 headers
with a fallback to GLES2 headers if available.
2016-03-31 20:53:18 +11:00
Matthew Waters
9ea15579ec glmemory: add checking the read implementation format/type on gles2 platforms
By default, reading GL_RED or GL_RG us unsupported by glReadPixels unless
exposed through GL_COLOR_READ_IMPLEMENTATION_FORMAT/TYPE.  This allows
downloading multiple-planar video frames where possible.
2016-03-31 20:52:42 +11:00
Matthew Waters
afd0ce7160 glbasememory: rollback map state when subclass map fails
Otherwise our state doesn't reflect reality.
2016-03-31 20:52:42 +11:00
Matthew Waters
7685b052b8 glmemorypbo: unmap pbo memory on pbo read error
Otherwise we are returning failure with a dangling map!

Also only unset the NEED_DOWNLOAD flag in download_transfer() if the read actually
succeeds.
2016-03-31 20:52:42 +11:00