Commit graph

53 commits

Author SHA1 Message Date
Jakub Adam
c56a87b73d gldownload: use gst_gl_sync_meta_wait_cpu()
Simple gst_gl_sync_meta_wait() is not sufficient to ensure GL commands
are executed before dma-buf devices get to see the buffer.

This is the first step that should make the code behave correctly for
everybody, although there may be performance penalty. In the future we
should introduce a more general sync meta that would allow to move the
waiting from gldownload (the producer) to the sink elements (the
consumers).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6968>
2024-06-01 08:09:34 +00:00
Nirbheek Chauhan
fe1a7edda2 gl: Fix libdrm dependency detection and usage
drm_fourcc.h should be picked up via the pkgconfig dep, not the system
includedir directly. All this allows it to be picked up consistently
(via the subproject, for example).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6932>
2024-05-29 15:49:45 +00:00
Thibault Saunier
41f8276c2b glvideomixer: Handle pads which have no caps set on mouse events
And directly use the pad vinfo instead of getting current caps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6265>
2024-05-05 12:37:05 +00:00
Shengqi Yu
a92167ea6e glmixer: Add GL_SYNC_META option to bufferpool
when pipline is
glvideomixerelement->glcolorconvertelement->gldownloadelement and
glcolorconvertelement is not passthrough, the gl bufferpool between
glvideomixerelement and glcolorconvertelement will not add gl sync meta
during allocating buffer. This will cause that glcolorconvert's inbuf
has no sync meta to wait for.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6756>
2024-04-29 19:15:39 +00:00
Matthew Waters
3f29c897f8 glimagesink: avoid a possible critical on shutdown
It is possible that the close callback can be called after glimagesink
is changing state to NULL.  Protect against that by taking the glimagesink
lock and some NULL checking.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6504>
2024-04-02 23:50:41 +00:00
Matthew Waters
d9b563e9b2 glimagesink: unref the potential last ref outside of the glimagesink lock
Avoids a deadlock between the state change removing the last ref and
the destructer calling the window's on_close handler and trying to
take the glimagesink lock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6504>
2024-04-02 23:50:41 +00:00
Jan Schmidt
aadefa8aca glvideoflip: fix setting of method property at construction time
A port of the same fix that
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4536
did for the non-GL videoflip element

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3245

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5966>
2024-01-29 18:00:21 +00:00
Robert Mader
7495db8855 gl: colorbalance: Add DMA_DRM passthrough support
By adding them to additional caps that are only supported in passthrough
mode. They get filtered out otherwise.

This can easily extended to support other caps later.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5948>
2024-01-25 20:39:37 +00:00
Tim-Philipp Müller
ceed3f9914 glimagesink: fix typo in docs
Fixes #3233

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5942>
2024-01-19 07:41:48 +00:00
Damian Hobson-Garcia
fe64e68cc4 gloverlay: Apply updated overlay coordinates correctly
When overlay coordinates are updated, after the initial coordinates
are set, the shader indices are applied to the wrong buffer, resulting
in the background image appearing where the overlay should.

Bind the array buffer before applying subsequent coordinate
updates.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5901>
2024-01-11 01:53:16 +00:00
Hosang Lee
2afe7cb97e glstereomix: Fix typo
Fix typo in example. vid -> video

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5685>
2023-11-17 04:42:32 +00:00
He Junyan
ea35adc55f gl: upload: Implement the fixate_caps virtual function
We now prefer the 2D target than other targets when fixating src caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5468>
2023-10-18 19:56:30 +00:00
Philippe Normand
ce7b2af414 glsinkbin: Check sink property exists before attempting to read it
The same is done in the set_property function. This was noticed when attempting
to dump a pipeline containing glsinkbin sink=gtk4paintablesink to dot format.
Critical warnings were raised due to the missing force-aspect-ratio property on
that sink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5311>
2023-09-11 07:36:21 +00:00
Matthew Waters
9d867356df gl/bufferpool: add configuration to extend buffer lifetime before reuse
Fixes a potential GPU stall if an immediately freed texture/buffer is
attempted to be reused immediately by the CPU, e.g. when uploading.

Problematic scenario is this:
1. element does GPU processing reading from texture
2. frees the buffer back to the pool
3. pool acquire returns the just released buffer
4. GPU processing then has to wait for the previous GPU operation to
   complete causing a stall

If there was a reliable way to know whether a buffer had been finished
with across all GPU drivers, we would use it.  However as that does not
exist, this workaround is to keep the released buffer unusable until the
next released buffer.

This is the same approach as is used in the qml (Qt5) elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5144>
2023-08-31 01:24:38 +00:00
Matthew Waters
b291efe44b gldownload: handle passthrough without a critical
With passthrough mode, gldownload/glbasefilter may not ever retrieve a
relevant GstGLContext as it doesn't actually query the surrounding
elements.  Guard against that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4791>
2023-06-07 22:15:39 +00:00
Ruben Gonzalez
059965fe53 doc: Fix newline char between authors
Found running `gst-inspect-1.0 -a |& grep -v ":" | grep @`

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4682>
2023-05-20 05:48:23 +00:00
Matthew Waters
e9bf1c79cc glmixer: don't add rgba templates by default
Subclasses may want to override the pad template with different formats
or with a different pad subclass.

The original beahviour is still available by calling
gst_gl_mixer_class_add_rgba_pad_templates() in _class_init() of the
subclass.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4608>
2023-05-18 19:34:15 +00:00
Matthew Waters
fc85b63c2b glmixer: remove set_caps() vfunc
All of its implementors can be moved to gl_start/stop() from
GstGLBaseMixer instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4608>
2023-05-18 19:34:14 +00:00
Matthew Waters
331b1af468 glmixer: remove reset vfunc
This functionality is covered by GstGLBaseMixer's gl_stop() vfunc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4608>
2023-05-18 19:34:14 +00:00
Matthew Waters
14e7e991d3 gl/mixer: make fbo instance field private and provide accessor function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4608>
2023-05-18 19:34:14 +00:00
Matthew Waters
007a602726 gl: move gl(base)mixer to library
For use by applications/libraries outside of the opengl plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4608>
2023-05-18 19:34:14 +00:00
Jan Schmidt
e1faaefea0 glvideomixer: Implement force-live and min-upstream-latency properties
Proxy the force-live and min-upstream-latency propertyies to the internal
glvideomixerelement at construction time. force-live has to be set
during construction of the glvideomixerelement, so that has to be
deferred until the _constructed() call. Make sure that all other
existing proxied properties will still get set once the element
is created.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4494>
2023-05-02 22:47:38 +00:00
Mathieu Duponchelle
15102e2eef docs: mark GstGLSinkBin as plugin API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4408>
2023-04-13 21:46:59 +00:00
Matthias Fuchs
15b7c7ea25 glvideoflip: fix leaked caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4394>
2023-04-11 21:31:45 +00:00
Sebastian Dröge
ccad9a7338 plugins: Fix various trivial clang compiler warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4210>
2023-03-18 16:16:55 +02:00
Carlos Falgueras García
76abb90477 gluploadelement: Delete unused types
`*GstGLUploadElementPrivate` is not defined or used anywhere.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4145>
2023-03-13 06:15:03 +00:00
Thibault Saunier
dc1c9c8985 glvideomixer: Keep a reference to the underlying pad
There was cases where we were accessing the pad while it was already
destroyed. Ensure it can't happen by owning a ref on it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3916>
2023-02-13 22:23:13 +00:00
Anders Hellerup Madsen
acb8f2ee5d glstereosplit: use gst_display_ensure_context
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3843>
2023-02-06 16:16:14 +01:00
Anders Hellerup Madsen
ecd9a4e37c glbasemixer: use gst_display_ensure_context
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3843>
2023-02-06 16:15:06 +01:00
Georges Basile Stavracas Neto
a8a7ee6d83 glvideomixer: Add xalign and yalign properties
With the addition of the 'keep-aspect-ratio' sizing policy, content
that doesn't fit the target size is downscaled according to its own
aspect ratio to fit that target size, and centered.

Centering might not always be the desired behaviour, however;
consumers of this API might want to align the resulting picture to
the left or to the right.

To account for any of these cases, add two new properties to the
glvideomixer pad: xalign, and yalign. They operate on normalized
coordinates (0.0 for start, 1.0 for end), and default to 0.5 which
centers content.

<https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3762>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3762>
2023-01-27 16:21:28 +00:00
Georges Basile Stavracas Neto
56513a18cb glvideomixer: Add 'sizing-policy' pad property
The sizing policy allows selecting between the current behavior,
which deforms the texture to fill the width and height of the
pad; and a new 'keep-aspect-ratio' sizing policy, which fits the
texture within the rectangle respecting its original aspect ratio.

The reason for this is that this allows avoiding extra elements
in the pipeline, and reduces the number of buffer passing through
the pipeline.

Most of this code is a direct port of the sizing policy handling
of the compositor element, except it is adapted to operate on GL
texture coordinates through the projection matrix.

<https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3760>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3760>
2023-01-25 15:16:31 +00:00
Ruben Gonzalez
2cdfccc3b5 glvideomixer: Fixing error with mouse navigation events when no pixel-aspect-ratio
Handling mouse navigation events in glvideomixer element, if no
pixel-aspect-ratio info in the caps, an assertion error is produced
inside gst_util_fraction_multiply because default denominator is zero.

Error fixed:
```
(gst-launch-1.0:102654): GStreamer-CRITICAL **: 00:47:51.598: gst_util_fraction_multiply: assertion 'b_d != 0' failed
```

Simple pipeline to reproduce the issue:
```
gst-launch-1.0 -v glvideomixer name=mix ! glimagesinkelement  gltestsrc  ! mix.sink_0
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3766>
2023-01-22 00:52:56 +01:00
Michiel Konstapel
81b726344e glvideomixer: don't clear pad->geometry_change when setting an identical value
Closes #1715

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3733>
2023-01-18 14:05:37 +00:00
Guillaume Desmottes
e87a2c38c0 glvideomixer: override sink pad template
Allow us to pass the GType of its pad and so
improve the documentation when inspecting glvideomixer.

Fix #1253

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2527>
2022-12-14 12:50:36 +00:00
Nicolas Dufresne
b985c8eadd glimagesink: Fix render rect assertion
Whenever the surface is resized before the stream is negotiated, we endup
with an assertion in libgstvideo.

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

This fixes it, by following the style aready in place, which is to ensure
surfaces have a minimum size of 1x1.

Fixes #1139

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3467>
2022-11-28 07:52:25 +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
Matthew Waters
390518a296 glimagesink: only allow setting the GL display/context if it is a valid value
Otherwise, when setting the external application context, then the
display may be cleared and then not used and the asharing mechanism does
not work anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2750>
2022-07-13 01:20:00 +00:00
Sebastian Dröge
d090e2c343 glvideomixer: Only consider property changes a geometry change if there as an actual change
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2669>
2022-07-01 05:41:57 +03:00
Sebastian Dröge
3a252f3d87 glvideomixer: Add crop-{left,right,top,bottom} pad properties for cropping inputs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2669>
2022-07-01 05:41:57 +03:00
Camilo Celis Guzman
4c0d64dd10 gstglmixerbin: minor refactor of _find_element_pad_template
As suggested by @slomo, make the loop more readable and prevent returning
a garbage value to the caller from the previous implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2232>
2022-04-20 07:04:44 +00:00
Xavier Claessens
b99ecc78ca Replace gst-i18n-*.h with gi18n-lib.h
GLib guarantees libintl is always present, using proxy-libintl as
last resort. There is no need to mock gettex API any more.

This fix static build on Windows because G_INTL_STATIC_COMPILATION must
be defined before including libintl.h, and glib does it for us as part
as including glib.h.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2028>
2022-04-19 18:01:06 +00:00
Bastian Krause
c39181903e gltransformation: let graphene alloc its structures memory aligned
With NEON instructions enabled, graphene expects the memory passed to it
16-byte-aligned. Otherwise unaligned memory access faults occur causing
SIGBUS signals.

graphene has alloc functions for its structures that take care of this,
so use them.

See also: https://github.com/ebassi/graphene/issues/215#issuecomment-794744829

Suggested-by: Sebastian Dröge <sebastian@centricular.com>
Signed-off-by: Bastian Krause <bst@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1321>
2022-04-06 18:14:53 +02:00
Haihua Hu
df0958e855 ximagesink/xvimagesink: use GST_XINITTHREADS to ensure call to XInitThreads
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2098>
2022-04-04 15:49:02 +08:00
Matthew Waters
b2232c5c9a glmixerbin: slightly better pad/element creation
Use the return value from gst_element_link_pads() and gst_bin_add()

Fixes:

../ext/gl/gstglmixerbin.c:305:12: error: variable 'res' set but not used [-Werror,-Wunused-but-set-variable]
  gboolean res = TRUE;
           ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2038>
2022-03-27 05:38:37 +00:00
Thibault Saunier
25819c41fb navigation: Add support for key Modifiers in all relevant events
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2010>
2022-03-25 15:16:03 +00:00
Vivienne Watermeier
6c2f6c3bd4 all: Use new navigation interface and API
Use and implement the new navigation interface in all relevant sink elements,
and use API functions everywhere instead of directy accessing the event structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1633>
2022-03-23 13:14:52 +00:00
Vivienne Watermeier
2b85e5f99c glvideomixerelement: send translated navigation events to the relevant sink pads
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1495>
2022-03-18 06:22:02 +00:00
Olivier Crête
fdd7f9be23 glutils: Export affine transformation functions for gtkglsink
Also remove duplicated copy of those functions from the gl plugin

With contributions from Bastien Nocera

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1088>
2021-10-12 20:27:34 +00:00
Olivier Crête
9b75628101 glvideoflip: Replace GstVideoFlipMethod -> GstVideoOrientationMethod
It's the same enum, just drop the renamed copy. But keep the registered
GEnum as it is part of the API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1088>
2021-10-12 20:27:34 +00:00
Olivier Crête
b4ca5f386a glvideoflip: Use the API to parse the image orientation
This will reduce the code duplication a little.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1088>
2021-10-12 20:27:34 +00:00