Commit graph

1934 commits

Author SHA1 Message Date
Philipp Zabel dedd20f430 glupload: fix transform_caps NULL pointer dereference
gst_gl_upload_transform_caps() is missing a NULL pointer check in case
the current upload method's transform_caps returns a NULL pointer. In
the following loop over all upload methods, NULL pointer return values
are already handled correctly.
2020-03-02 11:07:26 +00:00
Philipp Zabel 7849f22cb3 glupload: dmabuf: support direct upload into external-oes textures
Some drivers support directly importing DMA buffers in some formats into
external-oes textures only, for example because the hardware contains
native YUV samplers.
Note that in these cases colorimetry can only be passed as hints and
there is no feedback whether the driver supports the required YUV
encoding matrix and quantization range.
2020-03-02 11:07:26 +00:00
Philipp Zabel 359e361881 gl/egl: support direct dmabuf import with external-oes only formats
Allow creating EGL images from DMA buffers in formats that the driver
only supports for the external-oes texture target.

Pass the intended texture target to gst_egl_image_from_dmabuf_direct so
that _gst_egl_image_check_dmabuf_direct can decide whether to create an
EGL image for a format that can only be targeted at external-oes
textures by the driver. Allow creating GstGLMemoryEGL objects from these
DMA buffers.
2020-03-02 11:07:26 +00:00
Matthew Waters 7da70e2b9f glquery: fix a possible unintialized value
A GL driver may not fill the resulting value so initialize it to 0
ourselves.
2020-03-02 19:36:50 +11:00
Matthew Waters c7c2d09acf gl/context/glx: dump GLXFBConfig information to debug logs 2020-03-02 19:36:50 +11:00
Seungha Yang 6dd643532f meson: gl: Update to support when egl and win32 window system are explicitly requested 2020-02-18 21:04:42 +09:00
Seungha Yang 6531037533 glwindow/win32: Accept both win32 and egl display
EGL would be the case where we use ANGLE.
2020-02-18 20:11:40 +09:00
Seungha Yang 929c17e6cc glcontext: egl: Fix build with win32 window system 2020-02-18 20:10:22 +09:00
Seungha Yang e78c5ffb1b gl: Decouple win32 window and wgl context
With ANGLE, win32 window can be used with gles and egl
2020-02-18 20:10:03 +09:00
Seungha Yang 4a006d6951 glcontext/egl: Fix build with upstream ANGLE
ANGLE_surface_d3d_render_to_back_buffer extension is only available
with Microsoft fork of ANGLE. Note that Microsoft's ANGLE repository
has been deprecated.
2020-02-18 04:48:06 +00:00
Seungha Yang d176f67d33 gl/window/win32: Handle mouse and key events
This is at least useful for the gst-play-1.0 use case.
2020-02-17 02:42:41 +00:00
Matthew Waters 0e1f7f6e8d gl/window/win32: implement get_window_handle()
Some other frameworks need the HWND to retrieve information from.
2020-02-13 12:31:43 +11:00
Matthew Waters a171eb80d6 glcolorconvert: error out if memory context is different than ours 2020-02-05 15:32:14 +11:00
Matthew Waters 1abd05dbff glviewconvert: fix reset context for GL context change
We need to remove GL resources from the old context instead of the new
GL context.  The two GL context may not even be shared.
2020-02-05 15:32:14 +11:00
Matthew Waters af1986352b glviewconvert: fix a use-after-free with allocation params
_free(params) followed by a params->align is a bad idea :)
2020-02-05 15:32:14 +11:00
Matthew Waters cbffe13d60 glviewconvert: also remove GL buffers on a reset
Fixes a possible memory leak on renegotiation
2020-02-05 15:32:14 +11:00
Matthew Waters 9461d178ea gl/basesrc: call gl_stop when shutting down
Fixes multiple leaks
2020-02-05 15:31:38 +11:00
Seungha Yang 940c9998e5 glwindow/win32: Don't post any WinProc message to parent window
Posting any message to parent seems to be pointless. That might break
parent window.
Regardless of the posting, parent window can catch mouse event
and also any keyboard events will be handled by parent window by default.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/634
2019-12-22 09:16:35 +00:00
Stéphane Cerveau f8dc428a2a remove various useless linefeed in logs 2019-12-11 10:07:12 +01:00
Matthew Waters eb0107986a gl/macos+ios: privatise _invoke_on_main()
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1132
2019-12-03 14:15:58 +11:00
Wonchul Lee 32ae3e336d glupload: Fix allocator leak
It fixes allocator leak in failure case
2019-11-15 10:26:48 +00:00
Matthew Waters a41bad561a gl/window: marshall quit to the window thread
Fixes a possible deadlock where we're waiting for the window thread to
quit but it never does.
2019-11-15 01:04:45 +00:00
Wonchul Lee 7d8e7cd3eb glcontext/egl: Fix window leak
Fixed to do unref after use of window get by gst_gl_context_get_window()
2019-11-13 17:35:40 +09:00
Nicolas Dufresne 9870783f01 eglimage: Fix extension names in dmabuf import check
There was a typo in the extension name which resulted in the modifiers
to never be set when doing DMABuf import. That triggered the modifiers
lookup in Intel driver, which was in fact hiding bugs in the gldownload
to glupload path when doing DMABuf.

Note, this changes breaks pipeline the following pipeline on Intel and
some other drivers:

  gltestsrc ! gldownload ! video/x-raw\(memory:DMABuf\) ! glimagsink

A fix for this was added to Mesa recently:

Related to https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1338
Fixes 5d0e191710
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 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