Commit graph

119 commits

Author SHA1 Message Date
Randy Li (ayaka)
0d746d1022 waylandsink: prevent frame callback being released twice
For those using context from the application which
would be the embedded video case, if the frame callback
is entering at the same time as window is finalizing,
a wayland proxy object would be destroyed twice, leading
the refcout less than zero in the second time, it can
throw an abort() in wayland.

For those top window case, which as a directly connection
to the compositor, they can stop the message queue then
the frame callback won't happen at the same time as the
window is finalizing. It doesn't think it would bother
them about this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1883>
2021-06-15 16:25:17 -04:00
Stéphane Cerveau
178dda8623 wayland: allow per feature registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2038>
2021-03-23 14:19:17 +00:00
Randy Li
6d8133e41e waylandsink: release frame callback when destroyed
We would use a frame callback from the surface to indicate
that last buffer is rendered, but when we destroy the surface
and that callback is not back yet, it may cause the wayland event
queue crash.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1729>
2020-10-29 12:09:01 +00:00
Damian Hobson-Garcia
ff5f264045 waylandsink: Keep per display wayland buffer caches
Instead of attaching a single wayland wl_buffer to each GStBuffer as qdata,
keep a separate cache for each display.
A unique wl_buffer and associated metadata is created for each display.
This allows for sharing of GstBuffer objects between multiple
displays, such as when using tee elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1401>
2020-07-15 14:35:06 +00:00
Mathieu Duponchelle
6baffc2931 docs: mark more types as plugin API 2020-06-23 12:10:17 -04:00
Wonchul Lee
8e79e53c6e wlvideoformat: clean up video formats
It cleans up videoFormat by combining the wl_shm_formats and
drm_formats into a single table that represents the same format.
In addition, it adds NV61 format to the waylandsink.
2019-12-17 17:12:03 +00:00
Aaron Boxer
6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Mark Nauwelaerts
2f920a90bb wayland: gracefully handle unknown formats 2019-09-09 17:07:30 +00:00
Shinya Saito
e4c4f193f2 waylandsink: Fix return type of prototype of show_frame() 2019-08-26 11:54:45 +09:00
Mathieu Duponchelle
42adb02a10 docstrings: port ulinks to markdown links 2019-08-23 20:14:12 +02:00
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