Commit graph

51 commits

Author SHA1 Message Date
Matthew Waters e9864e2e3e glwindow: remove unused draw_unlocked function
The functionality is provided by draw anyway and is leftover from
X11's specific threading requirements that no longer apply.
2017-12-09 19:32:08 +00:00
Matthew Waters 63bbe9406a glwindow: add API to request a resize event on the next draw
- glimagesink needs to be able to resize the viewport on aspect ratio
  changes resulting from either caps changes or 3d output mode changes.
- Performing a glViewport outside the GstGLWindow::resize callback
  will not have the winsys' stack of viewports required to correctly
  place the output frame.

Provide a function to request a resize on the next draw event from the
winsys.

Also track size changes inside the base GstGLWindow class rather
than in each subclass.

https://bugzilla.gnome.org/show_bug.cgi?id=755111
2017-12-09 19:32:08 +00:00
Matthew Waters 6589c38d1a glcontext/wgl: implement gl3 core profile context selection 2017-12-09 19:32:07 +00:00
Matthew Waters ab142b2671 glcontext/wgl: fix defenition of gst_gl_context_wgl_new
gstglcontext_wgl.c: In function 'gst_gl_context_wgl_new':
gstglcontext_wgl.c:83:40: error: 'display' undeclared (first use in this function)
2017-12-09 19:32:07 +00:00
Matthew Waters 7acca333fe gl/win32: fix definition of gst_gl_window_win32_new 2017-12-09 19:32:07 +00:00
Matthew Waters 6ccaafc0f3 glwindow: pass display to implementation's _new()
So they have to opportunity to fail if they cannot handle the
display connection.

https://bugzilla.gnome.org/show_bug.cgi?id=752743
2017-12-09 19:32:07 +00:00
Matthew Waters 9587eb477d glcontext: pass display to implentation's _new()
This allows the context to fail creation based on incompatible
display type's. e.g. glx context with an wayland display handle.

https://bugzilla.gnome.org/show_bug.cgi?id=752743
2017-12-09 19:32:06 +00:00
Matthew Waters cfa9b94045 glcontext: consolidate get_proc_address function definition
Pass the GstGLAPI directly.
2017-12-09 19:32:05 +00:00
Matthew Waters bb1de83ff2 gl/window: use the default main loop implementation for all backends
fixes glimagsink being unable to display.

https://bugzilla.gnome.org/show_bug.cgi?id=750337
2017-12-09 19:32:03 +00:00
Xavier Claessens 6db457a7d9 gl: win32: do not call SetParent in release_parent_win_id()
When called from gst_gl_window_win32_close(), internal window
could not exist, and if it does it's going to be destroyed just
after that anyway. Also it causes window_proc() to be called
and crash because it gets a NULL context.

When called from gst_gl_window_win32_set_window_handle() we are
going to set another parent anyway, and it's probably better to
reparent directly instead of passing by a NULL parent which could
cause the internal window to popup briefly.

https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Xavier Claessens 1d9ccc2189 gl: win32: remove unused code
https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Xavier Claessens 77e1e70fdc gl: win32: fix crash when finalizing GstGLContext
gst_gl_context_finalize() is calling gst_gl_window_win32_quit()
which was posting a message. But then window_proc takes window's
context and get a NULL.

Now that we've got a GMainLoop we can do like other backends and
simply call g_main_loop_quit().

This also remove duplicated code to release the parent window and
potential crash there because parent_proc could be NULL if we never
created the internal window. That could happen for example if setting
state to READY then setting a window_handle, and go back to NULL state.

https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Xavier Claessens db0380a9ee gl: win32: Fix leaked GstGLContext
https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Xavier Claessens 8f268785d6 gl: win32: set the parent window when creating internal window
When _set_window_handle() was called in READY state, it wasn't
set to the internal window created later.

https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Xavier Claessens 886ea15c52 gl: win32: use a GMainContext to dispatch win32 messages
gst_gl_window_win32_send_message_async() could be called before the
internal window is created so we cannot use PostMessage there.

x11 and wayland backends both create a custom GSource for this,
so there is no reason to not do that for win32.

https://bugzilla.gnome.org/show_bug.cgi?id=749601
2017-12-09 19:32:02 +00:00
Matthew Waters 66cec1c47a gl/win32: fixup compilation 2017-12-09 19:31:53 +00:00
Matthew Waters 598715fc4b glwindow: make showing a window explicit
Also fixes the cgl context always displaying a window to render to for
every GstGLContextCocoa created
2017-12-09 19:31:53 +00:00
Matthew Waters 019367c128 glwindow: remove width/height from _draw()
Depending on the platform, it was only ever implemented to 1) set a
default surface size, 2) resize based on the video frame or 3) nothing.
Instead, provide a set_preferred_size () that elements/applications
can use to request a certain size which may be ignored for
videooverlay/other cases.
2017-12-09 19:31:53 +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
Matthew Waters 1f6fceafa4 gl/win32: make send_message reentrant
I could not find a comparable win32API function so keep the running
thread pointer to compare against.

https://bugzilla.gnome.org/show_bug.cgi?id=730782
2017-12-09 19:31:41 +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 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
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 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
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
Matthew Waters 97f6bc0bfc [891/906] context: add support for wrapping external contexts 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
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 d9cc31aca0 [807/906] context: Move some window error enums to context 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 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
Sebastian Dröge fe0ad33572 [774/906] win32: Fix some compiler errors/warnings 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
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 29874d3be6 [743/906] win32: Allow setting window handle before creating the context 2017-12-09 19:31:29 +00:00
Sebastian Dröge 6a5bebebb9 [734/906] win32: Make automake happy by using noinst_HEADERS 2017-12-09 19:31:29 +00:00
Sebastian Dröge f7998a2e98 [733/906] gl: Major header and include cleanup 2017-12-09 19:31:29 +00:00
Matthew Waters ac1a2297f5 [726/906] window: don't call a NULL destroy function 2017-12-09 19:31:29 +00:00
Matthew Waters 06eb6f4965 [695/906] build: remove libtool warning about -version-info not used in convenience libraries 2017-12-09 19:31:28 +00:00
Matthew Waters b9a10f8e15 [678/906] window_win32_wgl: implement wglGetProcAddress for extension functions 2017-12-09 19:31:27 +00:00
Matthew Waters 8d07dcbd5e [676/906] windwo_win32: port to new API 2017-12-09 19:31:27 +00:00
Matthew Waters e983f02e87 [642/906] add gstglconfig.h for apps to find out what our capabilites are
ie libgstgl can be compiled with any combination of opengl/gles2
2017-12-09 19:31:26 +00:00
Matthew Waters c3526080aa [629/906] window: add GError for error handling of context creation 2017-12-09 19:31:26 +00:00
Matthew Waters ee992ec531 [623/906] move GL includes into a single file 2017-12-09 19:31:26 +00:00
Matthew Waters 0be301af24 [621/906] GstGLRendererAPI => GstGLAPI and get GstGLAPI from a window 2017-12-09 19:31:26 +00:00
Matthew Waters 62e6b36cd0 [619/906] fix typo for win32 debug variables 2017-12-09 19:31:26 +00:00