Commit graph

19 commits

Author SHA1 Message Date
Hugues Fruchet
5c307e8d17 gtkwaylandsink: do not use drm dumb pool when importing DMAbuf buffers
There is no need to use DRM dumb pool if buffer to
render is already a DMABuf, just import it and render it.

This fixes a DMAbuf memory leakage when waylandsink downstream
element exports DMABuf while waylandsink is configured to be
DMABuf exporter (drm-device=/drv/dri/card0):

gst-launch-1.0 v4l2src io-mode=4 ! gtkwaylandsink drm-device=/dev/dri/card0

leakage identfied with command:
watch "cat /sys/kernel/debug/dma_buf/bufinfo | grep attached "

Fixes #2729

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5350>
2023-09-19 16:21:58 +00:00
Robert Mader
fd82342bbd waylandsink: Move format caps list to shared library
So it can be shared and more easily updated. While on it, order the
formats according to the documentation for GstVideo.VIDEO_FORMATS_ALL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5275>
2023-09-07 13:50:48 +00:00
Nicolas Dufresne
0149d77eff waylandsink: Improve DMA DRM integration
Pass GstVideoInfoDmaDrm or GstVideoInfo whenever possible, avoiding passing
strange combination of GstVieoFormat + modifier. Even though we don't have any
at the moment, this also allow supporting GstVideoFormat that are not supported
in our DRM integration.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5120>
2023-08-01 14:55:23 -04:00
Cheah, Vincent Beng Keat
6e22846301 waylandsink: Add DRM modifiers support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5103>
2023-07-27 17:08:26 +00:00
Colin Kinloch
82c449ce00 waylandsink: Emit "map" signal boarder surface is ready
This allows gtkwaylandsink to queue a draw of its gtk widget at the
correct time, avoiding a race.

Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4722>
2023-05-31 18:57:56 +00:00
Colin Kinloch
1b926e0dcc gtkwaylandsink: Fix crash when rendering after the window is closed
Continuation of https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4197

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4232>
2023-03-21 08:57:34 +00:00
Colin Kinloch
6ebd7867e0 gtkwaylandsink: Destroy GstWlWindow when parent GtkWindow is destroyed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4197>
2023-03-17 04:27:22 +00:00
Nicolas Dufresne
413ceb060f waylandsink: Add a comment about dmabuf without feature
The code does not make it obvious that dmabuf is still supported
without the feature. This documents that it is supported, but
only for formats that are also support by SHM interface.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3476>
2023-03-15 18:42:54 +00:00
Nicolas Dufresne
5441b77683 waylandsink: Remove unused instance member
use_dmabuf is set but never used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3476>
2023-03-15 18:42:54 +00:00
Colin Kinloch
ed60843c1e wayladnsink: Add DRM Dumb allocator support
If the input is not a DMABuf, attempt to copy into a DRM Dumb
buffer and import it has a DMABuf. This will offload the
compositor from actually doing this copy (needed to handle SHM)
and may allow the software decoded stream to be rendered to
an HW layer, or even reach through some better accelerated
GL import path.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
2023-03-14 21:50:57 +00:00
Nicolas Dufresne
6ce1b484fd wllinuxdmabuf: Handle video meta inside the importer
This allow simplifying the GstVideoInfo handling in the sinks. Instead
of having to update a video info for the import, the sink can simply pass the
video info associated with the caps and rely on the VideoMeta in the GstBuffer
to obtain the appropriate offset and stride.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
2023-03-14 21:50:57 +00:00
Nicolas Dufresne
0961606942 gtkwaylandsink: Fix display/wl_window/pool leaks
These were leaked in the GTK implementation of the sink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
2023-03-14 21:50:57 +00:00
Nicolas Dufresne
965117b400 waylandsink: Refactor internal pool handling
This is to make it easier to support more then one allocators
including falling back from one to another.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
2023-03-14 21:50:57 +00:00
Nicolas Dufresne
9084a960a5 waylandsink: Let the baseclass know when frames are dropped
This is using the new GST_BASE_SINK_FLOW_DROPPED return value.
With this change, fpsdisplaysink will properly report the
render and dropped rate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
2023-03-14 21:50:57 +00:00
Nicolas Dufresne
018fdf36b1 gtkwaylandsink: Force a redraw on resolution change
As we don't render into the widget directly, there is no "initial" draw
happening. As a side effect, the internal aspect ratio adapted display
width/height is never initialize leading to assertions when handling navigation
events.

  gst_video_center_rect: assertion 'src->h != 0' failed

Simply queue a redraw after setting the widget format in order to fix the issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
2023-03-14 21:50:57 +00:00
Nicolas Dufresne
3ed0d34065 waylandsink: Stop modifying the display GstVideoInfo
The video_info is supposed to match the display dimentions, but as soon as we
get a padded video buffer, we modify it. This has side effect later on and
maybe cause bad frames.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
2023-03-14 21:50:57 +00:00
Nicolas Dufresne
beaff76dd0 gtkwaylandsink: Remove redefine of GST_CAPS_FEATURE_MEMORY_DMABUF
Instead just include the appropriate header file. There is no meson deps
modification as gstallocators_dep is already part of gstwayland_dep.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
2023-03-14 21:50:57 +00:00
Thibault Saunier
6a4425e46a meson: Call pkgconfig.generate in the loop where we declare plugins dependencies
Removing some copy pasted code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2970>
2022-09-01 21:17:35 +00:00
George Kiagiadakis
7e18fc1b1f Add new gtkwaylandsink element
This is based on gtksink, but similar to waylandsink uses Wayland APIs
directly instead of rendering with Gtk/Cairo primitives.

Note that the long term plan is to move this into the existing extension
in `-good`, which requires the Wayland library to move the as well.

For this reason several files like `gstgtkutils.*` and `gtkgstbasewidget.*`
are straight copies and should be kept in sync.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1515>
2022-08-02 16:34:13 +00:00