Commit graph

109 commits

Author SHA1 Message Date
Niels De Graef
67bb17e4fa waylandsink: Implement XDG-shell stable support
[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.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/897

[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-03-04 10:58:54 +00:00
Fabien Dessenne
f777c66dcc waylandsink: support fullscreen
Add the fullscreen property that makes the sink displayed all across
the output.

https://bugzilla.gnome.org/show_bug.cgi?id=688190
2018-05-06 15:13:59 +02:00
Nicolas Dufresne
c04aba241e waylandsink: Fix memory leak of shm allocator
This fixes conflict resolution error introduced in commit:

  816d115317

http://bugzilla.gnome.org/show_bug.cgi?id=790042
2017-12-06 20:50:31 -05:00
Shinya Saito
816d115317 waylandsink: Fix memory leak of shm allocator.
gst_allocator_find() needs gst_object_unref() after usage.

https://bugzilla.gnome.org/show_bug.cgi?id=790042
2017-12-06 15:46:40 -05:00
Nicolas Dufresne
9c866da336 waylandsink: Add prototype for gst_wayand_pool_get_type() 2017-11-25 20:06:57 -05:00
Nicolas Dufresne
2db81d6597 waylandsink: Rollback video info changes when copying
We change the video info base on the received buffer. We need to
rollback these changes whenever we want to copy into our internal
pool of buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=790057
2017-11-25 14:59:03 -05:00
Nicolas Dufresne
1a7363e023 waylandsink: Validate strides and offset when using FD as SHM
As SHM interface only support 1 stride, and 1 offset, we need to
make sure that there is no padding between planes for planar formats.

https://bugzilla.gnome.org/show_bug.cgi?id=790057
2017-11-25 14:59:03 -05:00
Nicolas Dufresne
cc033355ab waylandsink: Update video info size to buffer size
We where setting the size to the first memory size, this may be
too small in case we received a buffer with multiple memory.

https://bugzilla.gnome.org/show_bug.cgi?id=790057
2017-11-25 14:59:03 -05:00
Nicolas Dufresne
02df3a47b3 waylandsink: Allocate only what's needed when copying
There was this regression that we'd be using the updated video
info size instead of default size when initializing the pool.

https://bugzilla.gnome.org/show_bug.cgi?id=790057
2017-11-25 14:59:03 -05:00
Nicolas Dufresne
9bbd5ef722 waylandsink: Only try SHM for single memory buffer
https://bugzilla.gnome.org/show_bug.cgi?id=790057
2017-11-25 14:59:03 -05:00
Nicolas Dufresne
51bb235cc6 wlwindow: Only update video info on new render
The sink->video_info might not reflect the current buffer
when expose is being called.

https://bugzilla.gnome.org/show_bug.cgi?id=790057
2017-11-25 14:59:03 -05:00
Nicolas Dufresne
b06a8bffde waylandsink: Disable video-alignment from the pool
The SHM interface does not allow passing arbitrary strides and offsets,
for this reason, we simply disable this feature from the proposed pool.

This fixes video artifact seen when using the FFMPEG based video
decoder.

https://bugzilla.gnome.org/show_bug.cgi?id=790057
2017-11-25 14:59:03 -05:00
Nicolas Dufresne
9b2e28d91d Request minimum buffer even if need_pool is FALSE
When tee is used, it will not request a pool, but still it wants to
know how many buffers are required.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
2017-09-06 14:19:37 -04:00
Thibault Saunier
78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Fabien Dessenne
e2dffab9be waylandsink: consider buffer size when copying to wl shm pool
When the sink receives a buffer that is neither a wl_shm one nor a
dmabuf one, this buffer is copied to an internal wl_shm buffer before
being sent to the display.
In that case, the actual size of the received buffer (which may differ
from the one negotiated in the caps) must be used.

https://bugzilla.gnome.org/show_bug.cgi?id=777841
2017-02-22 04:23:44 -05:00
Fabien Dessenne
e2fba40038 waylandsink: fix display re-connection (redraw pending)
Reset redraw_pending at display disconnection, so we can re-connect
later from a clean state (avoid endless buffer drops).
Add a log to inform of dropped buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=775791
2017-01-02 19:53:27 -05:00
Nicolas Dufresne
5d01d3bbb8 waylandsink: Rework dmabuf support
Simplify and fix some of the show_frame logic.

https://bugzilla.gnome.org/show_bug.cgi?id=711155
2016-11-03 15:37:46 -04:00
Fabien Dessenne
2ad337e440 waylandsink: support linux dmabuf protocol
Support the wayland zwp_linux_dmabuf_unstable_v1 protocol.
SHM formats and DMABuf formats are exposed differently in caps: the
DMABuf formats are flagged with GST_CAPS_FEATURE_MEMORY_DMABUF.
No buffer pool is proposed for DMABuf buffers, it is the upstream
element responsibility to provide with such buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=711155
2016-11-03 15:37:46 -04:00
Nicolas Dufresne
3272f2002f waylandsink: Allow any kind of FD for shm memory
https://bugzilla.gnome.org/show_bug.cgi?id=711155
2016-11-03 15:37:46 -04:00
Arun Raghavan
312c8c9f7c waylandsink: Properly configure internal pool
There was a small omission in the code. It still worked, but the pool
configuration may not have been optimimal.
2016-10-13 12:10:51 -04:00
Arun Raghavan
cd8f463345 waylandsink: Actually use buffer pool config after setting it up
CID: 1373420
2016-09-30 12:59:20 +05:30
Nicolas Dufresne
31d0a2c1ea waylandsink: Don't leak GValues in getcaps 2016-09-23 16:48:34 -04:00
Nicolas Dufresne
f6b270d8eb waylandsink: Update our window size on configure event
This is specific to when the waylandsink is not being embedded. In
this patch we pass the render lock to the window so it can safely
call gst_wl_window_set_render_rectangle() with the new size.

https://bugzilla.gnome.org/show_bug.cgi?id=722343
2016-09-22 19:12:22 -04:00
Nicolas Dufresne
fdea1e1144 waylandsink: Remove atomic operation
We already take the render lock from the wlqueue thread in some other
place which indicates that there is no use of this atomic instead of
a proper locking mechanism.
2016-09-22 19:12:22 -04:00
Nicolas Dufresne
0859e201f6 waylandsink: Do not pre-configure proposed pool
Upstream must configure the pool before using it. Pre-configuring
the proposed pool could hide bugs in upstream elements.
2016-09-22 19:12:22 -04:00
Nicolas Dufresne
3378b1a259 waylandsink: Port to vmeta and GstVideoFrame
This add support for non-standard strides to be used. Note that
some extra work is needed for multi-plane format which may have
a different GstMemory object per plane. This is not currently a
problem since SHM interface is limited to 1 memory.
2016-09-21 11:02:40 -04:00
Nicolas Dufresne
74a7baa533 waylandsink: Don't propose multiple time the same buffer pool
The buffer pool API does not allow multiple of owner. This otherwise
lead to error when renegotiation take place. Aso consider the
allocation query "need_pool" boolean.
2016-09-21 11:02:40 -04:00
Nicolas Dufresne
9357047eaf waylandsink: Promote debug trace into error trace
Otherwise those error may go unseen making debugging much
harder.
2016-09-21 11:02:40 -04:00
Nicolas Dufresne
94a5652694 waylandsink: Factor-out the pool creation 2016-09-21 11:02:40 -04:00
Nicolas Dufresne
1c81b0bb6e waylansink: Implement _show_frame()
This fixes the property show-preroll-frame expose by the VideoSink base
class and removes redundant code.
2016-09-21 11:02:40 -04:00
Vineeth TM
8cdfb13658 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2016-03-24 14:56:51 +02:00
Vineeth TM
7c42ba97d7 plugins-bad: Fix example pipelines
rename gst-launch --> gst-launch-1.0
replace old elements with new elements(ffmpegcolorspace -> videoconvert, ffenc_** -> avenc_**)
fix caps in examples

https://bugzilla.gnome.org/show_bug.cgi?id=759432
2015-12-15 10:30:49 +00:00
Reynaldo H. Verdejo Pinochet
86ec812429 Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe
2015-11-18 16:05:42 -08:00
Hyunil Park
c9aaa4189b waylandsink: Add exception code for setting wl_surface
Waylandsink needs exception code in gst_wayland_sink_set_window_handle().
After making sink->window, User can call
gst_wayland_sink_set_window_handle(). It is the user's fault, but
Waylandsink needs to handle the exception, if not then sink->window is
changed and rendering fails.

https://bugzilla.gnome.org/show_bug.cgi?id=747482
2015-11-03 10:45:05 +00:00
Hyunil Park
d3db3df320 waylandsink: Add exception code for setting wl_display
Waylandsink needs exception code in gst_wayland_sink_set_context(). After
calling gst_wayland_sink_set_context(), below code is set.
GST_ELEMENT_CLASS (parent_class)->set_context (element, context); but, If
user can call onemore. It is user's fault. but waylandsink need to
exception.

https://bugzilla.gnome.org/show_bug.cgi?id=747482
2015-11-03 10:42:14 +00:00
George Kiagiadakis
c2f34b9814 waylandsink: don't advertise the local wl_display context
This wl_display proxy is temporary only until waylandsink goes NULL,
at which point the connection to the display is disposed. Unfortunately,
if this is advertised as a GstContext, playbin will cache it and re-feed
it to the sink when it goes PLAYING again, but the wl_display pointer
will at that point be invalid and cause a crash.

Another solution to the problem would be to also cache the GstWlDisplay
object inside the GstContext, which would automatically ref-count
the display connection, but I see no reason in doing that at the moment,
as there are no known users of this GstContext outside waylandsink.
It's probably better to avoid chasing hidden refcounts.

https://bugzilla.gnome.org/show_bug.cgi?id=756567
2015-10-26 16:11:56 +01:00
George Kiagiadakis
f78b37e6b2 waylandsink: fix fallback buffer allocation
Copy-paste mistake; the wl_buffer was attached on the wrong buffer...
2015-10-14 22:05:52 +02:00
George Kiagiadakis
abcc8eafed waylandsink: rename GstWlDisplay::formats array to shm_formats
These formats are specific to the wl_shm interface. We are going
to add dmabuf formats later as well.
2015-10-14 22:05:52 +02:00
Edward Hervey
2b59d8ab7c waylandsink: Free leaked GstStructure
Coverity CID : 1256565
2015-01-23 12:44:22 +01:00
Benjamin Gaignard
23bb5f5319 waylandsink: do not render twice the same buffer
Do not try to render a buffer that is already being rendered.
This happens typically during the initial rendering stage as the first
buffer is rendered twice: first by preroll(), then by render().
This commit avoids this assertion failure:
  CRITICAL: gst_wayland_compositor_acquire_buffer: assertion
  'meta->used_by_compositor == FALSE' failed

https://bugzilla.gnome.org/show_bug.cgi?id=738069

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
2014-10-11 17:35:41 +02:00
George Kiagiadakis
5b1c5dbf99 waylandsink: stack the video subsurface into another subsurface that covers the whole render rectangle
The main reason behind this is that when the video caps change and the video
subsurface needs to resize and change position, the wl_subsurface.set_position
call needs a commit in its parent in order to take effect. Previously,
the parent was the application's surface, over which there is no control.
Now, the parent is inside the sink, so we can commit it and change size smoothly.

As a side effect, this also allows the sink to draw its black borders on
its own, without the need for the application to do that. And another side
effect is that this can now allow resizing the sink when it is in top-level
mode and have it respect the aspect ratio.
2014-10-11 14:57:14 +02:00
George Kiagiadakis
ee7968dd4a waylandsink: rename video format conversion functions to indicate they are about wl_shm
Needed to add linux_dmabuf format conversion functions later
2014-10-11 14:57:14 +02:00
George Kiagiadakis
4377a5d71c waylandsink: remove the ugly gst_wl_display_stop() now that this mechanism is not needed anymore
Because we no longer have a custom buffer pool that holds a reference
to the display, there is no way for a cyclic reference to happen like
before, so we no longer need to explicitly call a function from the
display to release the wl_buffers.

However, the general mechanism of registering buffers to the display
and forcibly releasing them when the display is destroyed is still
needed to avoid potential memory leaks. The comment in wlbuffer.c
is updated to reflect the current situation.
2014-10-11 14:57:13 +02:00
George Kiagiadakis
d7bddb0c51 waylandsink: replace the custom buffer pool with an allocator
This reduces the complexity of having a custom buffer pool, as
we don't really need it. We only need the custom allocation part.
And since the wl_buffer is no longer saved in a GstMeta, we can
create it and add it on the buffers in the sink's render()
function, which removes the reference cycle caused by the pool
holding a reference to the display and also allows more generic
scenarios (the allocator being used in another pool, or buffers
being allocated without a pool [if anything stupid does that]).

This commit also simplifies the propose_allocation() function,
which doesn't really need to do all these complicated checks,
since there is always a correct buffer pool available, created
in set_caps().

The other side effect of this commit is that a new wl_shm_pool
is now created for every GstMemory, which means that we use
as much shm memory as we actually need and no more. Previously,
the created wl_shm_pool would allocate space for 15 buffers, no
matter if they were being used or not.
2014-10-11 14:57:13 +02:00
George Kiagiadakis
9807d58b01 waylandsink: rework the mechanism for keeping buffers out of the pool until wl_buffer::release
This also removes the GstWlMeta and adds a wrapper class for wl_buffer
which is saved in the GstBuffer qdata instead of being a GstMeta.

The motivation behind this is mainly to allow attaching wl_buffers on
GstBuffers that have not been allocated inside the GstWaylandBufferPool,
so that if for example an upstream element is sending us a buffer
from a different pool, which however does not need to be copied
to a buffer from our pool because it may be a hardware buffer
(hello dmabuf!), we can create a wl_buffer directly from it and first,
attach it on it so that we don't have to re-create a wl_buffer every
time the same GstBuffer arrives and second, force the whole mechanism
for keeping the buffer out of the pool until there is a wl_buffer::release
on that foreign GstBuffer.
2014-10-11 14:57:13 +02:00
Ognyan Tonchev
8b0030d044 waylandsink: do not leak buffer pool in error case
https://bugzilla.gnome.org/show_bug.cgi?id=736735
2014-09-17 09:43:58 +03:00
Sebastian Dröge
902a9a56d0 waylandsink: Fix compiler warning
gstwaylandsink.c:480:14: error: comparison of constant -1 with expression of
      type 'enum wl_shm_format' is always false
      [-Werror,-Wtautological-constant-out-of-range-compare]
  if (format == -1)
      ~~~~~~ ^  ~~
2014-06-21 16:57:18 +02:00
George Kiagiadakis
c4616a550a waylandsink: remove the buffer from the surface when going PAUSED -> READY
This essentially hides the video and allows the application to
potentially draw a black background or whatever else it wants.
This allows to differentiate the "paused" and "stopped" modes
from the user's point of view.

Also reworded a comment there to make my thinking more clear,
since the "reason for keeping the display around" is not really
the exposed() calls, as there is no buffer shown in READY/NULL
anymore.
2014-06-17 13:51:30 +02:00
George Kiagiadakis
bda600ed92 waylandsink: improve the way the video size is passed to wlwindow and also improve the code for window creation 2014-06-17 13:51:29 +02:00
George Kiagiadakis
86930cab13 waylandsink: rename pause/resume_rendering to begin/end_geometry_change and update their documentation 2014-06-17 13:51:28 +02:00