Commit graph

1390 commits

Author SHA1 Message Date
Matthew Waters 79f4a5fcf3 gl/utils: implement wayland display GstContext
requried for sharing GL contexts or subsurface support
2017-12-09 19:32:03 +00:00
Matthew Waters 00cff1f9e4 gl/wayland: run each window on a separate queue
Based on patch by Julien Isorce <julien.isorce@collabora.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=709747
2017-12-09 19:32:03 +00:00
Jan Schmidt 0f6b04c91d gl: Don't leak temp strings in _RGB_pixel_order()
Fix a memory leak of temporary strings when computing
swizzling of RGB formats.
2017-12-09 19:32:03 +00:00
Jan Schmidt 5007311198 glfilter: Add transform_internal_caps() vfunc
Add a vfunc that is called by glfilter before it sets
caps features and intersects with the peer caps, and
move removing the size from caps into its default
implementation. Allows sub-classes to do more
sophisticated management of the size fields in case they
don't support arbitrary resizing or have distinct
preferences.
2017-12-09 19:32:03 +00:00
Jan Schmidt 697107fe7d glfilter: Don't remove size fields from caps
Instead of removing size fields, set them to the full range
like videoscale does, so the caps are clearly unfixed in
all cases.
2017-12-09 19:32:03 +00:00
Julien Isorce 238edceda4 gl: add GstGLContextGPUProcess backend
It builds its GL vtable from a proc address provided
by the application.
2017-12-09 19:32:02 +00:00
Julien Isorce fce0e0ba3c gl: add and use gst_gl_internal_format_rgba
Previously when compiling GstGL with both GL and GLES2,
GL_RGBA8 was picked from GL/gl.h. But a clash may happen at
runtime when one is selecting GLES2.

gst_gl_internal_format_rgba allows to check at runtime
if it should use GL_RGBA or GL_RGBA8.
2017-12-09 19:32:02 +00:00
Julien Isorce 2efeb71c83 glwindow_x11: use parent default implementation 2017-12-09 19:32:02 +00:00
Julien Isorce fa7aafb4ff glcontext_glx: rename variable from window to context 2017-12-09 19:32:02 +00:00
Julien Isorce 01961ec44d glwindow: initialize debug in class_init
Useful if one uses gst_gl_window_x11_new directly
instead of gst_gl_window_new.
2017-12-09 19:32:02 +00:00
Julien Isorce a81de2f282 glcontext: initialize debug in class_init
Useful if one uses gst_gl_context_egl_new directly
instead of gst_gl_context_new.
2017-12-09 19:32:02 +00:00
Julien Isorce 5849a9f657 glcontext: add gst_gl_context_set_display helper 2017-12-09 19:32:02 +00:00
Julien Isorce bad3e16601 glcontext: add missing _CAST after G_TYPE_CHECK_CLASS 2017-12-09 19:32:02 +00:00
Julien Isorce 78ca5ce1c4 glwindow: add missing _CAST after G_TYPE_CHECK_CLASS 2017-12-09 19:32:02 +00:00
Julien Isorce 2472bcaaa6 glwindow: provides some default implementations to factorize with all backends 2017-12-09 19:32:02 +00:00
Luis de Bethencourt 7361160673 gleffects: 'for' loop initial declaration
'for' loop initial declarations are not allowed in C89, moving the declarations
to before the 'for' loops.
2017-12-09 19:32:02 +00:00
Xavier Claessens 0280be02ca gloverlay: fix a leak
https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Xavier Claessens 01177670ea gloverlay: properly handle errors while loading file
Post an error on the bus if anything bad happens while reading
and parsing the image file.

https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Xavier Claessens 80914d1731 gloverlay: remove unused type_file field
https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Xavier Claessens 840157230d gl: propagate return value from filter and filter_texture
https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Matthew Waters c55790143f gleffects: properly initialize the shaders across contexts implementing multiple API's 2017-12-09 19:32:02 +00:00
Matthew Waters b53178f724 gleffects_laplacian: fix shader compilation in gl3/gles2
https://bugzilla.gnome.org/show_bug.cgi?id=748393
2017-12-09 19:32:02 +00:00
Matthew Waters 4e58ec83e0 gl/wayland: remove dead event source code 2017-12-09 19:32:02 +00:00
Matthew Waters 9f704d7c2d gl/wayland: add GstGLDisplayWayland
Simple implementation split from GstGLWindowWayland

Can now have multiple glimagesink elements all displaying output
linked via GL or otherwise (barring GL platform limitations).

The intel driver is racy and can crash setting up the two glimagesink contexts.

e.g.
videotestsrc ! tee name=t ! queue ! glupload ! glimagesinkelement
  t. ! queue ! gleffects_blur ! glimagesinkelement

videotestsrc ! glupload ! glfiltercube ! tee name=t ! queue ! glimagesinkelement
  t. ! queue ! gleffects_blur ! glimagesinkelement
2017-12-09 19:32:02 +00:00
Matthew Waters 1d796508e8 gltransformation: fix DrawElements call for element array buffers
https://bugzilla.gnome.org/show_bug.cgi?id=749734
2017-12-09 19:32:02 +00:00
Matthew Waters eba6f6b80f gl/calayer: provide the exact GL api version for the wrapped context
Otherwise we could end up being mistaken for the diference between a
gl3 and a gl2 context resulting in a failure getting the list of
extensions from the wrapped context due to the difference between
glGetString and glGetStringi for the GL_EXTENSIONS token.

https://bugzilla.gnome.org/show_bug.cgi?id=749728
2017-12-09 19:32:02 +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
Jan Schmidt 95b08b75ba glupload: Don't leak all memory uploaded via raw uploads.
Remove an extra ref missed when switching over to not
reusing output textures
2017-12-09 19:32:02 +00:00
Sebastian Dröge 5503937337 compositor/glvideomixer: Don't calculate PAR/DAR with unset GstVideoInfos
Otherwise we divide by zero.
2017-12-09 19:32:02 +00:00
Matthew Waters d4894caacf glcontext: require a shader version to initialize.
It's very near pointless to try our GL implementation without shaders.

https://bugzilla.gnome.org/show_bug.cgi?id=749284
2017-12-09 19:32:02 +00:00
Jan Schmidt 506129ed42 Fix flags order in GL examples for uninstalled build 2017-12-09 19:32:01 +00:00
Matthew Waters 44153e637b compositor/glvideomixer: fix up par handling
We were using the wrong formula

https://bugzilla.gnome.org/show_bug.cgi?id=749634
2017-12-09 19:32:01 +00:00
Xavier Claessens 80fab54c0a gl: fix crash on windows with intel driver
https://bugzilla.gnome.org/show_bug.cgi?id=749430
2017-12-09 19:32:01 +00:00
Matthew Waters f0ed0b728d caopengllayersink: static const the indices array
the contents will never change anyway.
2017-12-09 19:32:01 +00:00
Matthew Waters 56bd10a392 caopengllayersink: correctly use the sync meta across multiple contexts
1. Set the sync point after the (possible) upload has occured
2. Wait in the correct GL context (the draw context)

Note: We don't add the GL sync meta to the input buffer as it's not
writable and a copy would be expensive.

Similar to the change with the same name for glimagesink
2017-12-09 19:32:01 +00:00
Matthew Waters d6c4f850ea caopengllayersink: update for GL3 element array buffer usage
fixes blank output
2017-12-09 19:32:01 +00:00
Matthew Waters f272500ccb glimagesink: correctly use the sync meta across multiple contexts
1. Set the sync point after the (possible) upload has occured
2. Wait in the correct GL context (the draw context)

Note: We don't add the GL sync meta to the input buffer as it's not
writable and a copy would be expensive.
2017-12-09 19:32:01 +00:00
Matthew Waters e8e84cf6b3 gl/calayer: provide a current wrapped GstGLContext for callbacks
So that the draw and resize callbacks can get the current GstGLContext.
2017-12-09 19:32:01 +00:00
Matthew Waters 18b9519a66 glsyncmeta: ensure that the Fence is going to be executed
Otherwise it could stay client side without being submitted to the GL
server resulting in another context waiting on a Fence that will never
become signalled causing a deadlock.
2017-12-09 19:32:01 +00:00
Matthew Waters 62c2d98c52 glupload: don't reuse output textures for raw data upload
Causes stale textures to be used further down the chain.
2017-12-09 19:32:01 +00:00
Matthew Waters d5e0d435e4 glframebuffer: don't clear the framebuffer
Breaks attempting to blend with the destination buffer and should be done
explicitly by the callback anyway.
2017-12-09 19:32:01 +00:00
Matthew Waters 5a275c77eb glbasefilter: track gl_start/stop correctly
Don't start multiple times without calling gl_stop.
2017-12-09 19:32:01 +00:00
Matthew Waters 0e2fe3c2e9 glimagesink: free the vertex buffer when done
fixes a memory leak
2017-12-09 19:32:01 +00:00
Matthew Waters 5d8841c8e7 glcontext/cocoa: implement GL3 core context selection 2017-12-09 19:32:01 +00:00
Matthew Waters 2cbf2abea0 tests/gl: fix typo 2017-12-09 19:32:01 +00:00