Commit graph

858 commits

Author SHA1 Message Date
Enrique Ocaña González
34ef2b2759 glcolorbalance: Error out on unsupported texture target types
The issue can be reproduced on a computer with a Radeon graphics card
when trying to force GStreamer Editing Services to use GL for video
mixing in GESSmartMixer, instead of the GstCompositor that smart mixer
would normally use. This change causes the resulting video stream to
have "video/x-raw(memory:GLMemory) ... texture-target: 2D" caps (instead
of "video/x-raw ..." caps). At the PlaySink stage of the pipeline, a
GstGLImageSinkBin is plugged, with a GstGLColorBalance on it. For some
reason that is still to be debugged (and out of the scope of this
patch), gst_gl_filter_set_caps() is never called on that color balance
element, leaving filter->in_texture_target set to its default
GST_GL_TEXTURE_TARGET_NONE value. The incomplete _create_shader() logic
does the rest and silently generates a shader code that doesn't build.

This is the command I use to reproduce the issue (I'm not sure if I
would be able to isolate the issue in a simple pipeline, though):

 GST_PLUGIN_FEATURE_RANK=vaapih265enc:NONE,vaapih264enc:NONE,vaapisink:NONE,vaapidecodebin:NONE,vaapipostproc:NONE,vaapih265dec:NONE,vaapivc1dec:NONE,vaapih264dec:NONE,vaapimpeg2dec:NONE,vaapijpegdec:NONE,glvideomixer:260
 ges-launch-1.0 +clip /tmp/video.mp4

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1159>
2021-05-20 13:22:24 +00:00
Jordan Petridis
23da209431 ext/gl: change graphene default options
The type was changed upstream from a boolean to an autofeature

41ebe5fa61

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1087>
2021-05-16 13:18:33 +00:00
Matthew Waters
c16412dd63 gl/download: add support for output memory:NVMM buffers
Currently RGBA-only.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1071>
2021-04-28 12:44:38 +10:00
Matthew Waters
98249a57db gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1073>
2021-03-19 04:20:19 +00:00
Stéphane Cerveau
cd5d4b025d gl: 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-base/-/merge_requests/1029>
2021-03-16 17:58:59 +00:00
He Junyan
3d96786857 gl: download: Fix a caps memory leak in _try_export_dmabuf().
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1058>
2021-03-03 02:43:01 +00:00
He Junyan
f506a3e0ff gl: download: Fix a caps memory leak in prepare_output_buffer().
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1058>
2021-03-03 02:43:01 +00:00
He Junyan
2f3033cebe gl: download: Fix the wrong transformed result from src direction in transform_caps().
The current manner in transform_caps() for src direction is not very correct. For example,
when the src caps is:
  video/x-raw(memory:DMABuf); video/x-raw; video/x-raw(memory:GLMemory)
this function returns:
  video/x-raw(memory:DMABuf); video/x-raw; video/x-raw(memory:GLMemory)
as the sink caps. This is not correct, because DMABuf feature is not even in the sink pad's
caps template. The correct answer should be:
  video/x-raw(memory:GLMemory); video/x-raw
only.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1058>
2021-03-03 02:43:01 +00:00
Marijn Suijten
abb026ec6a gl,video: Make ptrs to VideoInfo and (GL)AllocationParams immutable
These parameters are incorrectly regarded as mutable in G-IR making them
"incompatible" with languages that are explicit about mutability like
Rust. In order to clean up the code and expected API there, update the
signatures here, right at the source (instead of overriding them in
Gir.toml and hoping for the best).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1005>
2021-01-14 11:53:10 +00:00
He Junyan
6ffddd27e5 glimagesink: Avoid assert in query.
The sink_query just uses context, other_context and display to query info.
But all these objects can be changed or distroyed in state_change() func
and other places.
This patch is not very perfect. The condition race still exists in other
places in this element. All the functions directly access these objects
without protection. Most of them are executed when the data is pushing and
draw context/window have already been established, so they should not have
problems. But the sink_query and propose_allocation functions are the query
-like functions and executed in query context, which can be called in any
state of the element. So it can cause some crash issues because of destroyed
context object.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/922>
2020-12-04 00:40:12 +08:00
He Junyan
f7ea6d9b64 glcolorconver: Return empty caps in transform_caps if fails.
We should not return a NULL in transform_caps() function. The NULL
will generate a assert of:
  "transform_caps returned caps which are not a real subset of the
   filter caps"
in transform base class.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/922>
2020-12-04 00:24:32 +08:00
He Junyan
297a1555bf gluploadelement: Avoid race condition in propose_allocation().
The inside upload and context may have race condition in the function
of propose_allocation(). They may be destroyed while this function is
stilling using it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/916>
2020-11-05 04:08:13 +00:00
He Junyan
e8bb524278 gluploadelement: Avoid race condition of base class' context.
The base class' context may change, we should use the common API
with lock to access it, rather than the just directly access the
struct field.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/916>
2020-11-05 04:08:13 +00:00
He Junyan
9e37fa55bf gluploadelement: Avoid race condition of inside upload creation.
The operations for the inside GstGLUploadElement->upload have race
condition. The _transform_caps() will creates this object if it does
not exist, while the _stop() and change_state() can destroy this object.
The _transform_caps() is called by the gst_base_transform_query(),
so it does not hold the stream lock. It may use the upload while the
_stop() and change_state() has already destroy that object, and then
crash.

Fix: #645
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/913>
2020-11-04 13:55:07 +08:00
Dinesh Manajipet
ad697e8f97 gl: optimize glcolorbalance by precomputing shader math
Precompute the rgb -> yuv conversion and color balance adjustment math
so that the shader does minimal work per pixel.

Merging these 15+ steps into 3 steps let us jump from choppy
360p video to smooth 720p video on our underpowered embedded system.

If we can remove the clamp() step inside the shader, or apply it after
rgba
conversion, there are more performance benefits to reap. But I am not
sure
what the side effects will be in that case.

<https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/893>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/893>
2020-10-29 01:16:49 +00:00
Tim-Philipp Müller
5ecdb2f268 gldeinterlace: fix doc blurb
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/899>
2020-10-28 13:22:09 +00:00
Guillaume Desmottes
dd5f7f1bf9 gl: move each gl platform specific API to its own gir
With contributions from:
Thibault Saunier <tsaunier@igalia.com>
Matthew Waters <matthew@centricular.com>

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/651

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/661>
2020-08-06 04:09:09 +00:00
Mathieu Duponchelle
69d5428bfc docs: mark more types as plugin API 2020-06-23 14:52:20 -04:00
Sebastian Dröge
fddd7df2d3 Don't call gst_ghost_pad_construct() anymore
It's deprecated, unneeded and doesn't do anything anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/717>
2020-06-22 16:11:28 +00:00
Mathieu Duponchelle
cc516695b0 plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:41:17 +02:00
Mathieu Duponchelle
e666c9ec04 plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-03 22:44:23 -04:00
Niels De Graef
3843452366 glimagesink: Correct signals gtkdoc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/669>
2020-05-26 20:21:27 +00:00
Mathieu Duponchelle
1aef6b8fd5 glcolorscale: fix documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/653>
2020-05-15 14:34:16 +00:00
Edward Hervey
add3023f09 gloverlaycompositor: Don't leak caps feature
Only copy it if we really are going to modify and use it

CID #1439873

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/652>
2020-05-05 17:17:57 +02:00
Matthew Waters
5d47b8e232 gl: fix application context querying between elements
Fixes error introduced by:
a4e49ba8c9
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/642

Using the application GL context as the local GL context is not going to
work very well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/643>
2020-04-27 11:36:02 +10:00
Matthew Waters
a4e49ba8c9 gl: avoid deadlock querying for OpenGL context
If there are two elements and threads attempting to query each other for
an OpenGL context. The locking may result in a deadlock.

We need to unlock each element's context_lock when querying another
element for the OpenGL context in order to allow any other element to
take the lock when the other element is querying for an OpenGL context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/642>
2020-04-24 18:03:16 +10:00
Matthew Waters
cdd5470f06 glvideomixer: fix black output after display changes
Partial revert of 55e80b550e

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/743
2020-04-14 12:03:49 +10:00
Matthew Waters
ebf8198a97 glvideomixer: intersect with template caps when updating
Downstream may provide extra things when we ask it for caps that we may
need to remove.

Fixes the following pipeline warning:

gltestsrc ! glvideomixerelement ! glimagesinkelement

** (gst-launch-1.0:908581): WARNING **: 13:53:28.518: glvideomixer0: update_src_caps returned caps which are not a real subset of the filter caps
2020-04-14 12:03:49 +10:00
Philippe Normand
3f79805aa0 gl/wayland: Mouse events handling 2020-03-19 09:59:47 +00:00
Philippe Normand
5a4c5e9169 gl/navigation: Scroll events dispatch support 2020-03-19 09:59:47 +00:00
Edward Hervey
0200175d97 gloverlay: Fix various issues in allocation handling
* A copy-paste error was getting the information from the wrong
  query
* The 'allocation_meta' GstStructure was being leaked
* No check was done on whether the query existed (to try to set the
  resulting allocation meta on)

CID: 1439872
CID: 1439873
CID: 1439874
CID: 1439875
CID: 1439876
CID: 1439877
2020-03-05 06:01:50 +00:00
Matthew Waters
6dbda0681b glstereomix: support gl display changes 2020-03-03 02:11:52 +00:00
Matthew Waters
7e2073000a glbasefilter: add support for changing the display
Each element will remove its usage of the old display and context and
try to retrieve a new GL context.
2020-03-03 02:11:52 +00:00
Matthew Waters
4e12363cb7 glstereosplit: support gl display changes 2020-03-03 02:11:52 +00:00
Matthew Waters
55e80b550e gl/mixer: support GstGLDisplay changes 2020-03-03 02:11:52 +00:00
Matthew Waters
2a4a3aa0d6 gltestsrc: NULL out the functions used
Fixes segfault when the display changes
2020-02-05 15:32:14 +11:00
Tim-Philipp Müller
cd4e64f885 meson: add graphene subproject
So we can build all the OpenGL elements.
2020-01-08 17:28:46 +00:00
Nicolas Dufresne
95abc6c263 gldownload: Fix renegotiation loop
When DMABuf was tried, we would renegotiate back and fourth between
DMABuf and system memory if the export failed. This would happen for
every single frame.

This patch introduces try_dmabuf_exports boolean, which is unset when
an export failed. This boolean is then put back to TRUE when upstream
pushes new caps, or downstream pushes a reconfigure event.
2019-11-11 17:11:45 -05:00
Nicolas Dufresne
a09674dd6d gldownload: Refactor download mode selection
This introduces an enum in order to cleanup how we select the
transfer mode. It also fixes the case where we callback to PBO but
we didn't execute the PBO. That was not causing any issue, just that
the processing latency would be delayed to the next element, which
can be confusing.
2019-11-11 17:01:23 -05:00
Nicolas Dufresne
ac0d19b72f eglimage: Fix exported DMABuf size
All we know is the height and the stride, so make sure not to expose
the DMABuf larger then the size we know about.
2019-11-11 17:01:23 -05:00
Nicolas Dufresne
747ae7d769 gldownload: Wait on sync meta if any
This is possibly not strictly needed when pixels are being downloaded to
CPU memory, but would cause issue when exporting DMABuf, as the data may
not be yet ready when the DMABuf reaches the consumer.
2019-11-11 17:01:18 -05:00
Matthew Waters
a32cd0e55e gl/gbm: ensure we call the resize callback before attempting to draw
Without this, sinks will not be notified about size changes or even the
initial size and would render at 0x0.
2019-11-05 07:27:29 +11:00
Guillaume Desmottes
b418b4b6ec gl: use gst_video_meta_set_alignment() 2019-11-02 13:05:43 +01:00
Nicola Murino
4ed345b7eb glimagesink: fix upper-left and upper-right rotate matrices 2019-10-30 14:59:40 +01:00
Tim-Philipp Müller
289d8e53e2 Remove autotools build system 2019-10-13 14:15:43 +01:00
Sebastian Dröge
73bd32e791 glfilters: Don't use static variables for storing per-element state 2019-10-03 00:49:09 +00:00
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
Matthew Waters
0973e1d07a gl: also build plugin with -fobjc-arc
Fixes macos werror build

../ext/gl/caopengllayersink.m:336:23: error: '__bridge_retained' casts have no effect when not using ARC [-Werror,-Warc-bridge-casts-disallowed-in-nonarc]
    ca_sink->layer = (__bridge_retained gpointer)layer;
                      ^~~~~~~~~~~~~~~~~~
2019-08-30 13:20:37 +10:00
Niels De Graef
0314b482f3 Don't pass default GLib marshallers for signals
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-08-27 07:31:57 +02:00
Philippe Normand
8d122f21ad gl: New pushsrc-based glbasesrc base class
The gltestsrc element was refactored to inherit from this base class which
handles the GL context. The sub-class only needs to implement the gl_start,
gl_stop and fill_gl_memory vfuncs, along with properly advertizing the GL APIs
it supports through the supported_gl_api GstGLBaseSrc class attribute.
2019-08-20 09:51:05 +01:00