Commit graph

57 commits

Author SHA1 Message Date
Ramprakash Jelari c5804b9af5 glcontext: Fix unused variable warning by moving declaration where it is actually used 2017-12-09 19:31:50 +00:00
Vineeth T M d747c65d4c glcontext: build errors when GST_GL_HAVE_OPENGL is 0
Moving variables within #if GST_GL_HAVE_OPENGL, which are not going to be used otherwise.
and which are needed only when OpenGl is present

https://bugzilla.gnome.org/show_bug.cgi?id=740235
2017-12-09 19:31:50 +00:00
Matthew Waters e2f61d20a2 glcontext: fail context creation if glGetString returns NULL 2017-12-09 19:31:49 +00:00
Matthew Waters 35e9b5ab8b gl: sprinkle some Since markers 2017-12-09 19:31:49 +00:00
Matthew Waters 7d97a35139 glcontext: add more functionality to wrapped contexts
Implements get_current_context() and get_proc_address() for wrapped
contexts.
2017-12-09 19:31:49 +00:00
Matthew Waters be5d0d81e4 glcontext: add api for retreiving the current context and api
that is current in the calling thread.
2017-12-09 19:31:48 +00:00
Edward Hervey ef00d85f16 glcontext: Initialize variable
Avoids the following warning:

gstglcontext.c:647:58: error: 'prev' may be used uninitialized in
 this function [-Werror=maybe-uninitialized]
2017-12-09 19:31:47 +00:00
Matthew Waters ca476f03a8 glcontext: fixup error in sharegroup comment 2017-12-09 19:31:47 +00:00
Matthew Waters 817417c005 glcontext: detect the sharegroup case where the context are in different chains
In the end they will lead to the same root context in the tree so check that
for equality.
2017-12-09 19:31:47 +00:00
Matthew Waters 14630fac38 glcontext: add gst_gl_context_can_share
Which determines whether two GstGLContext's can share sharable
OpenGL resources.
2017-12-09 19:31:46 +00:00
Sebastian Dröge 9dd4f40ad6 gl: Let gst_gl_context_get_thread() return a new reference to the GThread
Otherwise it might go away in the meantime and the caller has some random pointer.
2017-12-09 19:31:46 +00:00
Tim-Philipp Müller 9cccbb315c gl: add since markers for new API 2017-12-09 19:31:46 +00:00
Matthew Waters 4e75ceba46 glcontext: add API to retreive the thread that context is active in 2017-12-09 19:31:46 +00:00
Wang Xin-yu (王昕宇) 62bebdb4e6 gl: Add GSTGLAPI macro to the debug callback function
Fixes the Windows build.

https://bugzilla.gnome.org/show_bug.cgi?id=735565
2017-12-09 19:31:46 +00:00
Matthew Waters 61b95b0300 glcontext: implement the debug callback
For both GL_KHR_debug and ARB_debug_output.  This allows us to
receive errors and other hints from the GL instead of querying after
every GL operation.
2017-12-09 19:31:45 +00:00
Matthew Waters 4277d2742a glcontext: add a destroy function
that just calls the subclass
2017-12-09 19:31:45 +00:00
Sebastian Dröge 188ae1c3b0 glcontext: Handle (unlikely) NULL return of gl->GetString (GL_VERSION) more gracefully
CID 1219858
2017-12-09 19:31:42 +00:00
Matthew Waters b534e7e7af glcontext: fix up assertion
error: 'return' with no value, in function returning non-void
2017-12-09 19:31:42 +00:00
Matthew Waters bfd8550bff glcontext: check for GLES versions 2017-12-09 19:31:42 +00:00
Matthew Waters babef3069b gl/context: add check_gl_version 2017-12-09 19:31:42 +00:00
Edward Hervey 2ee94d606c glcontext: Try GLX support before EGL support
If available, glx has got a better chance of being the Gl platform
we want to use compared to EGL
2017-12-09 19:31:42 +00:00
Edward Hervey 14f844e1e9 glcontext: Try to open lib{EGL|GL|GLESv2}.so.1 before lib{EGL|GL|GLESv2}
Fixes issues with .so (without numbering) being installed for development
(such as from mesa-dev) but actual driver (with numbering) coming from
some other place (like nvidia drivers)
2017-12-09 19:31:42 +00:00
Julien Isorce b84a2eaf9f gl: rename platform cocoa to cgl
Before:
GST_GL_PLATFORM=cocoa GST_GL_WINDOW=cocoa
gst-launch-1.0 videotestsrc ! glimagesink

After:
GST_GL_PLATFORM=cgl GST_GL_WINDOW=cocoa
gst-launch-1.0 videotestsrc ! glimagesink

but still pass --enable-cocoa to configure script
because currently it can only be used with cocoa API.

We could later have cgl/gstglcontext_cgl.h that manages
a CGLContextObj directly and cocoa/gstglcontext_cocoa.h
would just wrap it.
So that it could be used with other Apple's window APIs.

https://bugzilla.gnome.org/show_bug.cgi?id=729245
2017-12-09 19:31:41 +00:00
Matthew Waters 4435c1c289 gl/context: add gl extension checking to check_feature()
Useful for extensions that do not define any new GL API entrypoints
but can still modify behaviour when used.
2017-12-09 19:31:41 +00:00
Matthew Waters 166d7b505c gl/context: add generic feature checking
At the moment it simply delegates to the subclass.
2017-12-09 19:31:40 +00:00
Sebastian Dröge 9fd7e34fee glcontext: Add more assertions to make sure that everything sets the GError during context creation if something fails 2017-12-09 19:31:40 +00:00
Matthew Waters 857200ff40 gl: make all GObjects inherit from GstObject
Aids memory leak debugging with GST_TRACE=mem-live
2017-12-09 19:31:39 +00:00
Matthew Waters 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
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
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
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
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
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
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
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 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 d6e6ac471d [902/906] context: implement glGetStringi handling for GL core contexts/GLES3 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
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 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 d6bdcbe751 [856/906] context: document it 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 42f1d66bc6 [833/906] gstglcontext: initialize window to NULL 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 266ffc48be [824/906] android: Build fixes
https://bugzilla.gnome.org/show_bug.cgi?id=709786
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 4bec88ea28 [815/906] fix some refcount errors 2017-12-09 19:31:31 +00:00