Commit graph

1910 commits

Author SHA1 Message Date
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 976e7e4e3d eglimage: Fail exportation if a modififer is used
We don't support modififers and that would result in bad image being
displayed. Note that this was fixes recently in Mesa MR 1138, prior to
that, the reported modifier is always 0, which makes this change a
no-op.

Fixes #441
Related to https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1338
2019-11-11 17:01:23 -05:00
Matthew Waters 3b552cc05a display: add a specific lock for the list of windows
It's either this or replacing all the object lock usage in gldisplay
with a recursive mutex which is not backwards compatible

The failure case is effectively:
1. The user has locked the display object lock
2. a glcontext loses it's last ref and attempts to quit the window
3. gst_gl_window_quit() attempts to remove the window from the display
4. gst_gl_display_remove_window attempts to take the display object lock

The only concern with changing the locking for the window list in the
display is that gst_gl_display_create_window() has documentation requiring
the object lock to be held which must continue to work correctly.
2019-11-06 01:07:27 +00:00
Matthew Waters b887db1efe glwindow: fix racy resize updates
Take locks around resize handling and marshall all resizes to the
windowing thread by default.
2019-11-06 01:07:27 +00:00
Matthew Waters b29d61b88e glwindow: remove window from display list on quit/finalize
Fixes a possible use-after-free in the X11 backend.
2019-11-06 01:07:26 +00:00
Matthew Waters d79d742492 gl/display: Add thread-safe retrieve_window
Returning a transfer none value for a value checked by a lock is not
thread safe as the reference could disappear before the caller can take
its reference.
2019-11-06 01:07:26 +00: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
Haihao Xiang b3e9e3f747 glimagesink: add support for Y210 format
Y210 is a 10-bit YUY2, so we may re-use the YUY2 shaders but gl format
is set to RG16

Sample pipeline:
gst-launch-1.0 videotestsrc ! video/x-raw,format=Y210 ! glimagesink
2019-10-16 08:30:31 +08:00
David Trussel 0b362e5a4b glcolorconvert: add support for the NV16 and NV61 formats
NV16/NV61 is basically the same as NV12/NV21 with a higher chroma resolution.
Since only the size of the UV plane/texture is different, the same shaders are used as for NV12/NV21.
2019-10-15 22:53:56 +11:00
Haihao Xiang 7ef84fb757 glimagesink: add support for Y410 format
Sample pipeline:
gst-launch-1.0 videotestsrc ! video/x-raw,format=Y410 ! glimagesink
2019-10-15 04:44:02 +00:00
Haihao Xiang 56de495f0e glcolorconvert: merge shaders for AYUV and VUYA formats
The shaders can be used for AYUV and varieties.
2019-10-15 04:44:01 +00:00
Tim-Philipp Müller 289d8e53e2 Remove autotools build system 2019-10-13 14:15:43 +01:00
Thibault Saunier 8d32de0905 glupload: Add VideoMetas and GLSyncMeta to the raw uploaded buffers
This is done by reusing `gst_gl_memory_setup_buffer` avoiding to
duplicate code.

Without a VideoMeta, mapping those buffers lead to GstBuffer mapping the
buffer in system memory even when specifying the GL flags (through the
buffer merging mechanism) making the result totally broken.
2019-10-02 19:27:39 +00:00
Matthew Waters 8ce2460ad5 build: fix debug output werror build with newer gcc
In file included from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gst.h:55,
                 from ../gst-libs/gst/tag/tag.h:25,
                 from ../gst-libs/gst/tag/gsttageditingprivate.h:24,
                 from ../gst-libs/gst/tag/gsttageditingprivate.c:23:
../gst-libs/gst/tag/gsttageditingprivate.c: In function ‘__exif_tag_capturing_white_balance_to_exif_value’:
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstinfo.h:645:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  645 |     gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  646 |         (GObject *) (object), __VA_ARGS__);    \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstinfo.h:1068:27: note: in expansion of macro ‘GST_CAT_LEVEL_LOG’
 1068 | #define GST_WARNING(...)  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
      |                           ^~~~~~~~~~~~~~~~~
../gst-libs/gst/tag/gsttageditingprivate.c:265:3: note: in expansion of macro ‘GST_WARNING’
  265 |   GST_WARNING ("Invalid white balance: %s", str);
      |   ^~~~~~~~~~~
../gst-libs/gst/tag/gsttageditingprivate.c:265:40: note: format string is defined here
  265 |   GST_WARNING ("Invalid white balance: %s", str);
      |                                        ^~

In file included from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gst.h:55,
                 from ../gst-libs/gst/tag/tag.h:25,
                 from ../gst-libs/gst/tag/gstxmptag.c:39:
../gst-libs/gst/tag/gstxmptag.c: In function ‘deserialize_exif_gps_direction’:
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstinfo.h:645:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  645 |     gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  646 |         (GObject *) (object), __VA_ARGS__);    \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstinfo.h:1068:27: note: in expansion of macro ‘GST_CAT_LEVEL_LOG’
 1068 | #define GST_WARNING(...)  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
      |                           ^~~~~~~~~~~~~~~~~
../gst-libs/gst/tag/gstxmptag.c:818:5: note: in expansion of macro ‘GST_WARNING’
  818 |     GST_WARNING ("Missing %s tag", dirref_str);
      |     ^~~~~~~~~~~
../gst-libs/gst/tag/gstxmptag.c:818:27: note: format string is defined here
  818 |     GST_WARNING ("Missing %s tag", dirref_str);
      |                           ^~
In file included from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gst.h:55,
                 from ../gst-libs/gst/tag/tag.h:25,
                 from ../gst-libs/gst/tag/gstxmptag.c:39:
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstinfo.h:645:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  645 |     gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  646 |         (GObject *) (object), __VA_ARGS__);    \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstinfo.h:1068:27: note: in expansion of macro ‘GST_CAT_LEVEL_LOG’
 1068 | #define GST_WARNING(...)  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
      |                           ^~~~~~~~~~~~~~~~~
../gst-libs/gst/tag/gstxmptag.c:814:5: note: in expansion of macro ‘GST_WARNING’
  814 |     GST_WARNING ("Missing %s tag", dir_str);
      |     ^~~~~~~~~~~
../gst-libs/gst/tag/gstxmptag.c:814:27: note: format string is defined here
  814 |     GST_WARNING ("Missing %s tag", dir_str);
      |                           ^~

In file included from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gst.h:55,
                 from ../gst-libs/gst/gl/gstgl_fwd.h:24,
                 from ../gst-libs/gst/gl/gl.h:24,
                 from ../gst-libs/gst/gl/gstglsl.c:25:
../gst-libs/gst/gl/gstglsl.c: In function ‘gst_glsl_version_profile_from_string’:
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstinfo.h:645:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  645 |     gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  646 |         (GObject *) (object), __VA_ARGS__);    \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstinfo.h:1068:27: note: in expansion of macro ‘GST_CAT_LEVEL_LOG’
 1068 | #define GST_WARNING(...)  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
      |                           ^~~~~~~~~~~~~~~~~
../gst-libs/gst/gl/gstglsl.c:333:7: note: in expansion of macro ‘GST_WARNING’
  333 |       GST_WARNING ("Invalid preprocesser directive detected: %s", version_s);
      |       ^~~~~~~~~~~
../gst-libs/gst/gl/gstglsl.c:333:62: note: format string is defined here
  333 |       GST_WARNING ("Invalid preprocesser directive detected: %s", version_s);
      |                                                              ^~

In function ‘print_stream_info’,
    inlined from ‘print_topology’ at ../tools/gst-discoverer.c:352:3:
../tools/gst-discoverer.c:316:3: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  316 |   g_print ("%*s%s: %s\n", 2 * GPOINTER_TO_INT (depth), " ",
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  317 |       gst_discoverer_stream_info_get_stream_type_nick (info), desc);
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-09-23 17:59:12 +10:00
Haihao Xiang 14ce1ccdd2 glimagesink: Fix VUYA in memory:DMABuf
Sample pipeline:
gst-launch-1.0 videotestsrc ! msdkvpp ! \
video/x-raw\(memory:DMABuf\),format=VUYA ! glimagesink
2019-09-16 15:46:47 +08:00
Seungha Yang e5d06b24b7 egldevice: Fix undeclared type build error
Not all eglext.h defines EGLDeviceEXT type. That's implementation and
egl extension version dependent.
2019-09-12 13:32:07 +00:00
Thibault Saunier 909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
Matthew Waters fc539f6162 glwindow/cocoa: silence unused-variable warning
We are using ARC to cleanup after ourselves.

../gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:159:20: error: unused variable 'queue' [-Werror,-Wunused-variable]
  dispatch_queue_t queue = (__bridge_transfer dispatch_queue_t) window->priv->gl_queue;
                   ^
2019-08-30 13:00:14 +10:00
Matthew Waters bff6e9a749 glcontext/egl: fallback to WINDOW_BIT if PBUFFER_BIT fails
There are some drivers that do not advertise any PBUFFER EGLConfig's.
2019-08-29 00:31:26 +00:00
Jonas Larsson 94984e13a9 eglimage: Fix memory leak
Also free the GstEGLImage struct allocated by g_new0.

Fixes #661
2019-08-28 11:24:01 -07:00
Nirbheek Chauhan 564ab3031b gstgl: Add a new window type for WinRT
This is needed for using GstGL with ANGLE as the GLES implementation
in Universal Windows Platform apps that use the Windows Runtime
(WinRT) instead of Win32, which is deprecated and not allowed in
Windows Store apps.

This has been tested with Servo on the Microsoft HoloLens 2, and seems
to work quite well.
2019-08-28 02:25:11 +05:30
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
Seungha Yang 5f70adf667 gl/egl/display: Add support EGLDevice display type
Simple addition for supporting EXT_platform_device typed display.
It's a kind of special display type (part of EGL specification)
which has no window at all.
To use EGLDevice explicitly, set environment "GST_GL_WINDOW=egl-device"

See also https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_platform_device.txt
2019-08-21 05:19:46 +00:00
Seungha Yang 7a378ba3ab glwindow: Introduce new vfunc for querying output surface availability
Only dummy window will return FALSE for now.
2019-08-21 05:19:46 +00: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
Xavier Claessens 1b089ab065 glcolorconvert: Fix external-oes shader
The #extention must come before 'precision highp float;'.

Closes: #650
2019-08-12 15:52:17 +00:00
Seungha Yang fe9c38244f gl: Add support for P016 format
All implementation for P010_10LE/BE can be reused.
2019-08-08 11:46:16 +09:00
Lucas Stach 7b8fc744f1 gl/wayland: fix wayland event source burning CPU
Commit c71dd72b "gl/wayland: fix glib mainloop integration" was overeager
in removing the poll result test from the check function. This caused
dispatch to be called even if no new events are available on the
Wayland connection, which in turn would wake up the glib mainloop,
causing effectively a tight loop without ever blocking on the poll.

Fixes #603
2019-07-26 08:48:05 +01:00
Wonchul Lee ba9ef3c50e gldisplay: fix g-i warning 2019-07-23 09:10:17 +09:00
Dylan McCall 2e686b0dad gstgldisplay: Add public foreign_display property
We use this property in gst_gl_display_egl_from_gl_display, to set
foreign_display for the new GstGLDisplayEGL instance. This fixes a
problem where gst_gl_display_egl_finalize calls EglTerminate on a
pre-existing EGL connection.
2019-07-08 20:46:58 +00:00
Marc Leeman 92137572c3 egl: wl_egl_window is not wl_proxy
It seems that eglCreatePlatformWindowSurfaceEXT is failing (with
EGL_BAD_ALLOC) because it thinks an EGL surface has already been created
for the wl_egl_window. The reason is that the "driver_private" field of
the wl_egl_window is getting clobbered by the function
wl_proxy_set_queue().

Since a wl_egl_window is not a wl_proxy, it shouldn't be passed to
wl_proxy_set_queue(). It just wraps a wl_surface (which is a wl_proxy).
And it looks like the queue for that surface is getting set earlier on
in the function anyway.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/621#note_184582
2019-07-03 09:07:06 +00:00
Philippe Normand b233911684 glupload: Keep track of cached EGLImage texture format
This patch fixes the following critical warning:

CRITICAL **: 11:33:32.843: Unknown GL format 0x0 provided

It would happen during the setup of a second pipeline involving the DMABuf
uploader, typically with a v4l2src element. The warning was raised because the
uploader had a cached EGLImage already filled but the formats were not
synchronized accordingly.
2019-06-23 11:34:49 +01:00
Haihao Xiang 6d0f796591 glimagesink: add support for P010 variants
This makes a pipeline below works:

little endian:
gst-launch-1.0 videotestsrc ! video/x-raw,format=P010_10LE ! glimagesink

big endian:
gst-launch-1.0 videotestsrc ! video/x-raw,format=P010_10BE ! glimagesink
2019-06-18 16:32:00 +08:00
Haihao Xiang 49f16489ab glcolorconvert: rename the NV12/NV12 shader to semi planar
This shader can be used for other semi planar formats, e.g. P010_10LE
2019-06-18 16:18:02 +08:00
Haihao Xiang 3f63295280 glimagesink: add support for BGR10A2_LE / RGB10A2_LE
This makes a pipeline below work:

gst-launch-1.0 videotestsrc ! video/x-raw,format={BGR10A2_LE, \
RGB10A2_LE} ! glimagesink
2019-06-18 02:58:16 +00:00
Haihao Xiang d15a516037 glformat: removde dead break after return 2019-06-18 02:58:16 +00:00
Adrian Negreanu 96363a3425 glcontext_egl: check if eglChooseConfig has a matching config
The specs recommends to also check the num_config parameter.
2019-06-14 12:59:03 +03:00
Matthew Waters 6a399b95a8 glcontext: add a couple of preconditions of invalid usage 2019-06-13 07:08:06 +00:00
Víctor Manuel Jáquez Leal 634ff541d0 gl: detect possible GL version prefix
Instead of checking if the requested GL API is GLES2 (because ANY can
be set) the string is matched with the GLES2 prefix, and if so, then
the string is offset.
2019-06-12 20:42:34 +02:00
Haihua Hu 2ea98270b4 viv-fb: fix build break for GST_GL_API
Need include config.h in gstglwindow_viv_fb_egl.c
2019-06-11 18:55:00 +08:00
Fernando Herrrera 80547d9437 wayland: set the event queue also for the xdg_wm_base object 2019-06-05 13:27:56 +01:00
Niels De Graef 93daa1435a Use G_DEFINE_AUTOPTR_CLEANUP_FUNC unconditionally
Since we started depending on GLib 2.44, we can be sure this macro is
defined (it will be a no-op on compilers that don't support it). For
plugins we should just start using `G_DECLARE_FINAL_TYPE` which means we
no longer need the macro there, but for most types in base/gst-libs we
don't want to break ABI, which means it's better to just keep it like it
is (and use the `#ifdef` instead).
2019-06-04 20:31:09 -04:00
Matthew Waters 51f2d05ff6 gl/docs: add to new docs system 2019-05-21 01:49:48 +00:00
Guillaume Desmottes d90ac65af1 gloverlaycompositor: fix crash if buffer doesn't have video meta
Fix #501
2019-05-14 17:12:06 +00:00
Thibault Saunier 287897e465 doc: Fix some gtk-doc comments 2019-05-13 11:34:08 -04:00
Matthew Waters 15cb86435d glshader: fix default external-oes shaders
In glsl, #extension directives need to before other non-preprocesser
directives.  We were placing the precision qualifier before that.  Fix
by moving the #extension to the first line in the shader.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/601
2019-05-07 18:43:49 +10:00
Niels De Graef e8450397c0 gl/wayland: Don't prefix wl_shell struct field
As part of commit 808e7127, we prefixed the `GstWlWindow`'s `shell`
field with wl_, to differentiate it from the other types of shells a
Wayland compositor might support. However, this is apparently a struct
that we expose to our users, so changing it means we have an API break.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/592
2019-04-24 09:03:44 +00:00
Sebastian Dröge 5f19e83f14 eglimage: Add compatibility define for DRM_FORMAT_NV24 2019-04-23 14:12:17 +00:00
Sebastian Dröge 1837fc46af gl: Add various missing Since: 1.16 markers
And add some missing function documentation.
2019-04-23 12:28:26 +00:00