Commit graph

77 commits

Author SHA1 Message Date
Fernando Herrrera
80547d9437 wayland: set the event queue also for the xdg_wm_base object 2019-06-05 13:27:56 +01:00
Matthew Waters
51f2d05ff6 gl/docs: add to new docs system 2019-05-21 01:49:48 +00:00
Niels De Graef
e8450397c0 gl/wayland: Don't prefix wl_shell struct field
As part of commit 808e7127, we prefixed the `GstWlWindow`'s `shell`
field with wl_, to differentiate it from the other types of shells a
Wayland compositor might support. However, this is apparently a struct
that we expose to our users, so changing it means we have an API break.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/592
2019-04-24 09:03:44 +00:00
Lucas Stach
c71dd72b21 gl/wayland: fix glib mainloop integration
Implement the prepare and check functions according to the
documentation by returning TRUE when events should be dispatched
via the dispatch function.

As wl_display_read_events never blocks we can call it unconditionally
without looking at the poll status.

This simplifies the implementation and gets rid of a race where the
mainloop could get blocked due to nobody actually reading the events
from the wayland connection.
2019-03-11 13:54:16 +01:00
Edward Hervey
dc2bc38b1e wayland: Also dist the private header 2019-02-13 11:59:10 +01:00
Niels De Graef
17899dc9b6 gl/wayland: add support for XDG-shell
[wl_shell] is officially [deprecated], so provide support for the
XDG-shell protocol should be provided by all desktop-like compositors.
(In case they don't, we can of course fall back to wl_shell).

Note that the [XML spec] is provided by the `wayland-protocols`
git repository, which is provided by the Wayland project.

[wl_shell]: https://people.freedesktop.org/~whot/wayland-doxygen/wayland/Client/group__iface__wl__shell.html
[deprecated]: 698dde1958
[XML spec]: https://github.com/wayland-project/wayland-protocols/blob/master/stable/xdg-shell/xdg-shell.xml
2019-02-06 22:45:28 +00:00
Niels De Graef
b52cf2f7d1 gl/wayland: extract code to create wl_shell_surface
This is just a cosmetic change that will make it easier to differentiate
between wl_shell and xdg_wm_base later.
2019-02-06 22:45:28 +00:00
Niels De Graef
808e712767 gl/wayland: prefix shell(_surface) with wl_
This will help us make the distinction later with xdg-shell and other
possible protocols that need to be supported.
2019-02-06 22:45:28 +00:00
Niels De Graef
3ce6bf65c7 gl/wayland: destroy wl_shell instance at finalize 2018-12-14 14:15:59 +01:00
Tim-Philipp Müller
dc29bc4e13 libs: fix API export/import and 'inconsistent linkage' on MSVC
For each lib we build export its own API in headers when we're
building it, otherwise import the API from the headers.

This fixes linker warnings on Windows when building with MSVC.

The problem was that we had defined all GST_*_API decorators
unconditionally to GST_EXPORT. This was intentional and only
supposed to be temporary, but caused linker warnings because
we tell the linker that we want to export all symbols even
those from externall DLLs, and when the linker notices that
they were in external DLLS and not present locally it warns.

What we need to do when building each library is: export
the library's own symbols and import all other symbols. To
this end we define e.g. BUILDING_GST_FOO and then we define
the GST_FOO_API decorator either to export or to import
symbols depending on whether BUILDING_GST_FOO is set or not.
That way external users of each library API automatically
get the import.

While we're at it, add new GST_API_EXPORT in config.h and use
that for GST_*_API decorators instead of GST_EXPORT.

The right export define depends on the toolchain and whether
we're using -fvisibility=hidden or not, so it's better to set it
to the right thing directly than hard-coding a compiler whitelist
in the public header.

We put the export define into config.h instead of passing it via the
command line to the compiler because it might contain spaces and brackets
and in the autotools scenario we'd have to pass that through multiple
layers of plumbing and Makefile/shell escaping and we're just not going
to be *that* lucky.

The export define is only used if we're compiling our lib, not by external
users of the lib headers, so it's not a problem to put it into config.h

Also, this means all .c files of libs need to include config.h
to get the export marker defined, so fix up a few that didn't
include config.h.

This commit depends on a common submodule commit that makes gst-glib-gen.mak
add an #include "config.h" to generated enum/marshal .c files for the
autotools build.

https://bugzilla.gnome.org/show_bug.cgi?id=797185
2018-09-24 08:45:34 +01:00
Matthew Waters
090bbd0721 gl/wayland: correctly use the set_render_rectangle size first
https://bugzilla.gnome.org/show_bug.cgi?id=789384
2018-08-28 14:31:43 +10:00
memeka
08ebb8264d gl/wayland: add preferred window size, and set it according to video size
The glimagesink wayland backend lacks the implementation of
gst_gl_window_wayland_egl_set_preferred_size. Because of this, glimagesink windows on
wayland are created with a fixed window size of 320x240.

[Matthew Waters]: gst-indent sources

https://bugzilla.gnome.org/show_bug.cgi?id=789384
2018-08-28 14:30:19 +10:00
Edward Hervey
22c9e5f7c1 libs: Documentation cleanup
* Fix wrong naming, wrong types and typos
* Add missing sections
* Add missing documentation for entries
* Explicitely mark private structure entries
* Remove items that never existed
2018-04-02 08:53:28 +02:00
Tim-Philipp Müller
c5b5ef16d3 gl: GST_EXPORT -> GST_GL_API
We need different export decorators for the different libs.
For now no actual change though, just rename before the release,
and add prelude headers to define the new decorator to GST_EXPORT.
2018-03-13 12:10:29 +00:00
Víctor Manuel Jáquez Leal
1784f62895 gl/wayland: Memory leak when display couldn't connect
When trying to create a wayland display, it may fail because there
is not actually display to connect. It this case NULL is returned
but the created instance is not freed.

This patch unrefs the failed display.

https://bugzilla.gnome.org/show_bug.cgi?id=793483
2018-02-16 13:56:50 +01:00
Matthew Waters
b25413fb1c gl/wayland: move roundtrip on show to window thread
This makes it thread safe and fixes a possible deadlock.

Keeping the roundtrip off the window thread will result in two different
threads call wl_display_dispatch_queue() for the same queue which
violates the assumption for _dispatch_queue()'s thread-safety
guarantees.

https://bugzilla.gnome.org/show_bug.cgi?id=788754
https://bugzilla.gnome.org/show_bug.cgi?id=792156
https://bugzilla.gnome.org/show_bug.cgi?id=758984
2018-01-04 15:39:36 +11:00
Víctor Manuel Jáquez Leal
7b8108a4ca gl: display: demote error level at display creation error
https://bugzilla.gnome.org/show_bug.cgi?id=791391
2017-12-19 12:41:00 +00:00
Matthew Waters
a5aff145a2 gl/wayland: call eglTerminate() before wl_display_disconnect()
Calling these two functions in the wrong order will result in
use-after-free inside wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=787293
2017-12-09 19:32:30 +00:00
Tim-Philipp Müller
1ddde50048 gl: make some debug categories private
They weren't supposed to be public.

https://bugzilla.gnome.org/show_bug.cgi?id=786170
2017-12-09 19:32:29 +00:00
Tim-Philipp Müller
4be04f8315 gl: don't export symbols that are not supposed to be public
Make a bunch of symbols private that are currently leaked
accidentally because they have a gst_* prefix and are used
internally. We mark those we can't make static with
G_GNUC_INTERNAL so that they get hidden with the autotools
build as well (although we could just pass -fvisibility=hidden
there too).
2017-12-09 19:32:29 +00:00
Tim-Philipp Müller
fbb62097e7 gl, wayland: mark more declared functions with GST_EXPORT 2017-12-09 19:32:29 +00:00
Matthew Waters
4c75bab70d glcontext: add public swap_buffers function
That simply calls the implementation
2017-12-09 19:32:28 +00:00
Sebastian Dröge
a9a05c01a9 gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent
https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-12-09 19:32:28 +00:00
Nicolas Dufresne
ae30818f7b gldisplay: Fix assert caused by missing debug category 2017-12-09 19:32:27 +00:00
Matthew Waters
f532e699df 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
2017-12-09 19:32:25 +00:00
Matthew Waters
d0b8f7c002 gl: add padding to all exposed winsys/platform-specific structs 2017-12-09 19:32:24 +00:00
Matthew Waters
d7d42971ab gl/wayland: install the gstgldisplay_wayland.h header
As it is used by other OpenGL sinks (gtkglsink, qmlglsink)
2017-12-09 19:32:24 +00:00
Matthew Waters
18ac98c58b gl: GST_GL_TYPE -> GST_TYPE_GL
Some deprecated symbols are kept for backwards compatibility
2017-12-09 19:32:23 +00:00
Matthew Waters
2763baf439 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.
2017-12-09 19:32:22 +00:00
Tim-Philipp Müller
2c3a31c483 gl: wayland: improve debug message when connecting to display
And another copy'n'paste-o.

https://bugzilla.gnome.org/show_bug.cgi?id=768929
2017-12-09 19:32:21 +00:00
Matthew Waters
f4bab389c5 gl: add .def file for msvc builds
Also internalize some API from being exported.
2017-12-09 19:32:16 +00:00
Matthew Waters
06de6998e5 gl: be consistent in gobject boilerpate
GST_GL_IS_* vs GST_IS_GL_*

git grep -l 'GST_GL_IS_' | xargs sed -i 's/GST_GL_IS_/GST_IS_GL_/g'
2017-12-09 19:32:09 +00:00
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
70184c52f0 wayland: fail window open if the display is the correct type
Errors out cleanly if a wayland compositor is not running
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
Thiago Santos
33b5cd5426 Fix a common typo: retreive -> retrieve
Seems to have been copy pasted around a few places
2017-12-09 19:32:03 +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
Sebastian Dröge
7ae1efa8b3 gl: Fix compiler warning
gstglwindow_wayland_egl.c:246:41: error: unused variable 'surface_listener' [-Werror,-Wunused-const-variable]
static const struct wl_surface_listener surface_listener = {
                                        ^
2017-12-09 19:32:03 +00:00
Matthew Waters
33d8bbaea4 gl/wayland: implement setting the render rectangle
Places our subsurface at the rectangle provided position
2017-12-09 19:32:03 +00:00
Matthew Waters
8332b1abe8 gl/wayland: don't block the event loop after poll
Use the dispatch_pending set of functions which just run the currently
queued up events instead of potentially waiting for an event to occur.
2017-12-09 19:32:03 +00:00
Matthew Waters
54199ea203 gl/wayland: implement basic video overlay support via subsurfaces
Currently does not position the subsurface relative to the parent surface at all
2017-12-09 19:32:03 +00:00
Matthew Waters
8404981dfb gl/wayland: allow a NULL wl_event_queue
perform operations on the default wl_display event queue in that case
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
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
5b8f3e7870 gl/window: create the main loop/context on init/finalize
Avoids races setting the window handle from the main thread.

https://bugzilla.gnome.org/show_bug.cgi?id=745633
2017-12-09 19:31:56 +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
e32c4a62c2 gl/wayland: implement resizing the window using the right mouse button 2017-12-09 19:31:50 +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