Commit graph

1953 commits

Author SHA1 Message Date
Nirbheek Chauhan 21bc1040d4 glframebuffer: Don't do expensive checks with low gst debug levels
Framebuffer checks can be very expensive, taking up to 3-5% of the
total CPU consumed by the application.
2019-03-12 03:21:57 +00:00
Lucas Stach c71dd72b21 gl/wayland: fix glib mainloop integration
Implement the prepare and check functions according to the
documentation by returning TRUE when events should be dispatched
via the dispatch function.

As wl_display_read_events never blocks we can call it unconditionally
without looking at the poll status.

This simplifies the implementation and gets rid of a race where the
mainloop could get blocked due to nobody actually reading the events
from the wayland connection.
2019-03-11 13:54:16 +01:00
Matthew Waters 6a37bf9bb9 gl: Don't restore the viewport on function exit
Doing so involves retrieving the current viewport from OpenGL which as
with any glGet operation, is expensive.

This means that the various sinks need to reset the viewport on draw.

In the process, fix resizing on cocoa.
2019-03-08 17:49:05 +11:00
Matthew Waters 4e13980e10 gl: fix a few other leaks when not getting to PAUSED 2019-03-07 02:01:09 +11:00
Matthew Waters 86aa568383 glcolorconvert: Ensure we free the internal convert object
If we only ever make it to READY, transform_caps can create an
internal convert object that will never be freed by basetransform's
stop vmethod (PAUSED->READY).
2019-03-06 23:32:18 +11:00
Tim-Philipp Müller d58b7cf75c gl: .gitignore generated wayland xdg shell files 2019-03-06 10:49:48 +00:00
Matthew Waters 13fc711eca gloverlaycompositor: Also free the texcoord GL buffer
Fix a typo that was attempting to free the position GL buffer twice
(without any consequences as there was a if (buffer) check)

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/561
2019-03-06 01:08:04 +00:00
Matthew Waters 55bcdcf01a gl: actually use the highp specifier
675415bf2e contained a typo that incorrectly
used the mediump specifier instead of highp.
2019-02-28 23:39:21 +11:00
Matthew Waters 675415bf2e gl: try to use highp precision where supported
The use of mediump as a specifier in GLSL shaders will have limited
resolution and when used as texture coordinates may become inaccurate
over texture sizes of 1024.
2019-02-28 17:26:32 +11:00
Tim-Philipp Müller 0cdb3aa9b3 gl: eglimage: fix build on RPi by adding more fallback defines for EGL_*_EXT 2019-02-18 13:52:43 +00:00
Edward Hervey dc2bc38b1e wayland: Also dist the private header 2019-02-13 11:59:10 +01:00
Nicolas Dufresne 77d7cfea10 eglimage: Add some more defines
This allow building on advertised version of libdrm drm_fourcc.h files.

Fixes #549
2019-02-11 10:01:55 -05:00
Nicolas Dufresne 837173c0f0 Revert "fix issue"
This reverts commit 5e0c458e0e.
2019-02-11 10:01:50 -05:00
yanle.zhang 5e0c458e0e fix issue
549."https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/549".
2019-02-11 16:13:15 +08:00
Seungha Yang 3152cbb46e glupload: Don't leak caps features
Create caps features when it is required.
2019-02-08 21:43:43 +09:00
Niels De Graef 17899dc9b6 gl/wayland: add support for XDG-shell
[wl_shell] is officially [deprecated], so provide support for the
XDG-shell protocol should be provided by all desktop-like compositors.
(In case they don't, we can of course fall back to wl_shell).

Note that the [XML spec] is provided by the `wayland-protocols`
git repository, which is provided by the Wayland project.

[wl_shell]: https://people.freedesktop.org/~whot/wayland-doxygen/wayland/Client/group__iface__wl__shell.html
[deprecated]: 698dde1958
[XML spec]: https://github.com/wayland-project/wayland-protocols/blob/master/stable/xdg-shell/xdg-shell.xml
2019-02-06 22:45:28 +00:00
Niels De Graef b52cf2f7d1 gl/wayland: extract code to create wl_shell_surface
This is just a cosmetic change that will make it easier to differentiate
between wl_shell and xdg_wm_base later.
2019-02-06 22:45:28 +00:00
Niels De Graef 808e712767 gl/wayland: prefix shell(_surface) with wl_
This will help us make the distinction later with xdg-shell and other
possible protocols that need to be supported.
2019-02-06 22:45:28 +00:00
Tim-Philipp Müller 6330eb0cb3 meson: opengl: fix enabled_gl_apis in pkg-config file
Make consistent with what autotools puts into enabled_gl_apis
variable. Autotools puts 'gl' in there instead of 'opengl'.

This would cause problems when building -bad glmixers plugin
in meson against a -base that was built with autotools.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/871
2019-01-22 13:35:38 +00:00
Haihao Xiang 7874c74cfb gstglwindow_x11: require a resize event at once after XResizeWindow
Otherwise surface_width/surface_height stored in GstGLWindowPrivate
isn't changed, sometimes an unnecessary reconfigure event is sent on
sinkpad, then result in upstream reconfiguring.

Example pipeline:

gst-launch-1.0 videotestsrc ! msdkvpp ! glimagesink
2019-01-21 01:27:15 +00:00
Sebastian Dröge acc098a736 gl: Only unbind buffers/vertex attrib arrays if we can't directly bind the vertex array to 0
Binding the vertex array to 0 will unbind everything else already.

In the previous order older versions of the Intel GL driver caused
errors to be printed for every single call when disabling the vertex
attrib arrays after binding the vertex array to 0.
2019-01-16 14:09:18 +02:00
Seungha Yang e48b8033e3 gl: Fix some type conversion warnings with MSVC
MSVC complained about implicit conversion between GstGLFormat* and guint*
2019-01-14 01:48:34 +00:00
Niels De Graef 3ce6bf65c7 gl/wayland: destroy wl_shell instance at finalize 2018-12-14 14:15:59 +01:00
Justin Kim c961dc9f8f gl/meson: Add OpenGL dependency by OSX way
Otherwise, it fails to link with the message below:

```
ld: can't map file, errno=22 file '...'
```
https://gitlab.freedesktop.org/gstreamer/gst-build/issues/13
2018-12-14 12:02:36 +09:00
Philipp Zabel 18c9babef9 glupload: dmabuf: use out_info to create allocation params for non-direct dmabuf uploads as well
Non-direct dmabuf uploads, just as direct dmabuf uploads, create EGL
images and thus GL textures of the same width as the imported image.
The input dmabuf line stride is not relevant to the resulting texture
in both cases.

This fixes the case where non-direct uploads of input dmabufs with line
stride larger than the width will for example cause glcolorconvert to
sample only the left part (width * bytes per pixel / stride) of the
image, causing a horizontally stretched and cropped output image.
2018-12-13 15:52:13 +01:00
Matthew Waters cfae8bd6c1 glmemory: normalize the internal format we pass into glTex* functions
Passing unsized formats sometimes breaks on embedded platforms

Take 2 at 694e30f858,
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/49
2018-12-13 00:10:10 +11:00
Matthew Waters 56ff61eac4 Revert "glformat: return sized formats in from_video_info"
This broke videotestsrc ! video/x-raw,format=NV12 ! glimagesink on
the desktop

Reverts: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/49
This reverts commit 694e30f858.
2018-12-13 00:09:59 +11:00
Nicolas Dufresne f7d5dff921 gl: window-gbm: Restore CRTC on close
This simply try and restore the state of the CRTC when the window
is closed. This is a bit cosmetic, but it allow resuming fbcon
when we exit.
2018-12-05 13:41:11 +00:00
Nicolas Dufresne 46b503d674 gl: window-gbm: Remove unused private class member
The display class member is not used, not set and rather
confusing.
2018-12-05 13:41:11 +00:00
Nicolas Dufresne 6f7fbbfa71 gl: window-gbm: Remove unneeded extra function
The cleanup function was only called in _close() which was only
calling that function. This indirection didn't make much sense.
2018-12-05 13:41:11 +00:00
Carlos Rafael Giani 08ea7d676e gl/gbm: Add GST_GL_GBM_DRM_CONNECTOR environment variable
If multiple DRM connectors are connected, currently the first one is
picked. Improve this by adding an environment variable that allows for
choosing a connector by name. The connector name has been made so they
are compatible with modetest/modeprint DRM utilities.

Related to #490
2018-12-01 13:44:26 -05:00
Carlos Rafael Giani 3663ad787d gl/gbm: Improve logging output
* List all connectors, modes, and encoders, even after picking one
* Add missing DRM_MODE_CONNECTOR_DPI string for logging and improve
  existing strings
* Make sure the names matches modetest/modeprint from DRM utilities

Related to #490
2018-12-01 13:36:17 -05:00
Matthew Waters 694e30f858 glformat: return sized formats in from_video_info
Fixes green output on e.g. Android when converting between YUV->RGBA
2018-11-30 18:05:58 +11:00
Matthew Waters 9bd8da6ed4 gl/meson: Allow for the use of libGL as well as OpenGL
OpenGL.framework and libGL are two different providers of a GL
implementation that can be linked into an application together.
2018-11-29 04:53:50 +00:00
Maciej Wolny f1556c1660 gst-gl: Remove duplicate declarations
This causes 'redefinition of typedef ...' errors on GCC 4.5.3
2018-11-28 11:59:25 +00:00
Jordan Petridis 2229d53f60
Run gst-indent through the files
This is required before we enabled an indent test in the CI.

https://gitlab.freedesktop.org/gstreamer/gstreamer-project/issues/33
2018-11-28 05:51:53 +02:00
Freyr666 5d7ceeae61 opengl: gbm: Adds missing unrefs for gl context and drm node release in finalizer
This adds a few missing gst_object_unref calls for the opengl context in
gstglwindow_gbm_egl.c, as well as the missing close call for the
drm node fd in gst_gl_display_gbm_finalize.
2018-11-23 15:41:01 +00:00
Víctor Manuel Jáquez Leal 9be278d4f5 gl: libs: glib might not define G_HAVE_ISO_VARARGS
This will fix the compiler warning
"G_HAVE_ISO_VARARGS" is not defined, evaluates to 0 [-Wundef]
2018-11-23 11:20:36 +00:00
Xavier Claessens 720e9ec2cc gl: Fix subclassing of GstGLContextEGL 2018-11-15 13:49:39 -05:00
Nirbheek Chauhan 998749d2a6 meson: Cleanup old FIXMEs that relied on meson bugfixes 2018-11-13 10:04:21 +05:30
Sebastian Dröge d05d52e0ad gl: Make sure that GST_GLSL_PROFILE_ANY gets the correct value in introspection
Currently in Python it would become a signed 64 bit value but should
actually be an unsigned 32 bit value with all bits set.

This is the same problem as with GST_MESSAGE_TYPE_ANY.

See https://bugzilla.gnome.org/show_bug.cgi?id=732633
2018-11-12 05:30:38 +00:00
Sjoerd Simons 989f53383b glupload: dmabuf: be explicit about gl formats used
Rather then letting gst_gl_memory_setup_buffer guess the GL format used
for an eglimage after importing a dmabuf be explicit about it. This
fixes issues where dmabuf import may have used another format then
gst_gl_format_from_video_info would guess on the basis of the available
GL extensions.

In particular on etnaviv the gst_gl_format_from_video_info would
assuming a luminance + alpha GL format is used for YUY2, but the dmabuf
import will always use RG88. Which causes images to end up somewhat pink when
displayed on the screen.
2018-11-11 16:15:59 -05:00
Sjoerd Simons 99ac4e6600 gl/egl: Determine correct format on dmabuf import
When importing an egl image from dmabuf gst_gl_format_from_video_info
was used to work what the result GL format will be. Unfortunately that
will only work if the conventional format and the choosen DRM fourcc for
the format match up.

On etnaviv platforms there is no support for GL_EXT_texture_rg, so the
GL format chosen for YUY2 ends up being GST_GL_LUMINANCE_ALPHA. However
DRM does not do luminance + alpha as it's a legacy GL thing, so the
dmabuf import ends up using DRM_FORMAT_GR88.

To fix this, tie the DRM_FORMAT and the GL format together so they
always match up.
2018-11-11 16:15:54 -05:00
Nicolas Dufresne e074eff5ef glupload: Only renegotiate if the caps are incompatible
There is new code that ensures that we renegotiate after an
uploader transition if the negotiated caps have changed.

The problem is that the raw uploader will not really try and
fixate the input caps, but instead of return a subset with the
only the supported target texture.

This had two effect, raw uploads was always done renegotiated
once and the raw upload unit test was now failing as it didn't
expect a renegotiation.

As it's a valid check, simply relax the gst_caps_is_equal() check
and use a gst_caps_is_subset() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-11-01 06:22:28 -04:00
Nicolas Dufresne c8c7672ffb glupload: Do prepend the preferred caps
The direct dmabuf upload does color conversion, so when it transforms
the caps, it replaces the format with all formats found through the
format query. When this uploader can't be used, it makes the upstream
source pick a unsupported format.

To fix this, we only append the caps with a list of format. So the
source will only pick one of these formats if the downstream preferred
format is not supported. A negotiation failure after this would be
normal.

This fixes pipelines without a glcolorconvert element.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-11-01 06:22:28 -04:00
Philipp Zabel 3c8ac7de80 glupload: dmabuf-direct: report driver limitations to debug log
Report in the DEBUG log if the driver does not support importing a given
format with linear modifiers non-externally.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-10-30 12:25:08 +01:00
Philipp Zabel eb20293a02 glupload: dmabuf-direct: query formats before modifiers
The EXT_image_dma_buf_import_modifiers extension [1] states regarding
eglQueryDmaBufModifiersEXT:

    The format must be one of those returned by the
    eglQueryDmaBufFormatsEXT command.

To comply with this requirement eglQueryDmaBufFormatsEXT must be called
before eglQueryDmaBufModifiersEXT.

[1] https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-10-30 12:25:08 +01:00
Philipp Zabel c4edd80c8c glupload: debug output from dmabuf and dmabuf_direct upload transform_caps
https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-10-30 12:25:08 +01:00
Philipp Zabel 58399b20bd glupload: calculate DRM fourcc once for direct dmabuf upload
Calculate DRM fourcc and report to the DEBUG log about it only once
instead of three times in gst_egl_image_from_dmabuf_direct().

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-10-30 12:25:08 +01:00
Michael Olbrich 507e31dfc0 glupload: Implement direct dmabuf uploader
The idea is that some GPUs (like the Vivante series) can actually
perform the YUV->RGB conversion internally, so no custom conversion
shaders are needed. To make use of this feature, we need an additional
uploader that can import DMABUF FDs and also directly pass the pixel
format, relying on the GPU to do the conversion.

Based on patches from Nicolas Dufresne <nicolas.dufresne@collabora.com> and
Carlos Rafael Giani <dv@pseudoterminal.org>.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-10-30 12:25:08 +01:00
Michael Olbrich f349cdccf5 glupload: handle upload methods with different caps
If a upload method is selected then use it exclusively in transform_caps().
Also, reconfigure if the current caps don't match the current upload
method.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-10-30 12:25:08 +01:00
Michael Olbrich f3292dc156 glupload: allow system memory for dmabuf in transform_caps
This should not be necessary, but currently not all plugins that provide
dmabuf memory announce this with caps features, e.g. v4l2.
The static caps already contain the system memory. It didn't break before
because other upload methods provide the necessary transformation.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-10-30 12:25:08 +01:00
Michael Olbrich 4d9abc6bed glupload: try to use the last method after reconfigure
Reconfigure will trigger a set_caps which clears the upload method.
Remember the method in this case and start with it.
Wrap around once to try all methods if necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-10-30 12:25:07 +01:00
Michael Olbrich 5d0e191710 gl/egl: Add gst_egl_image_from_dmabuf_direct() function
The colorspace conversion happens during the upload so the necessary hints
must be provided to ensure that the conversion works correctly.

At least the Mesa Intel driver will create a texture without error but
produces an incorrect result. Use eglQueryDmaBufModifiersEXT() to check if
non-external upload is supported for the given format.

Based on a patch from Carlos Rafael Giani <dv@pseudoterminal.org>.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-10-30 12:25:02 +01:00
Nicolas Dufresne 0ac646f7f4 glmemory: Fix n_wrapped_pointers usage
gst_gl_memory_setup_buffer() was not properly using the number
of pointers to wrapped. This also fixes the validation, as we
only support 1 wrapper per view, or num_planes * views wrapper.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-10-30 10:47:01 +01:00
Matthew Waters d63add22d2 gl/overlaycompositor: don't force unpremultiplied alpha
Remove testing code from 2315936561
2018-10-04 23:24:15 +10:00
Matthew Waters 2315936561 gl/overlaycompositor: support both (un)premultiplied alpha
Using the correct blend modes for each case or converting to
premultipled in the very unlikely case that separate blend modes are
unavailable on ancient opengl hardware.
2018-10-04 23:04:07 +10:00
Sebastian Dröge 5a3666395e gl: GstGLAPI should be gst_gl_api_ in lower-case 2018-10-04 14:50:43 +03:00
Sebastian Dröge ee98f056b1 glviewconvert: Add backwards compatibility gst_gl_stereo_downmix_mode_get_type()
It's proper new name is gst_gl_stereo_downmix_get_type().
2018-10-04 13:38:59 +03:00
Sebastian Dröge 62197270dd gl: Add gl-enumtypes.[ch] to CLEANFILES 2018-10-04 13:33:30 +03:00
Matthew Waters e9c519e5f3 gl/overlaycompositor: add support for flipping the output
This is required to use gloverlaycompositor outside of glimagesink where
the output is not automatically flipped
2018-10-04 14:28:35 +10:00
Matthew Waters 1359d0995e gl/overlaycompositor: handle ANY caps features gracefully 2018-10-04 14:28:35 +10:00
Matthew Waters 0086dfcf7f glfilter: don't complete overwrite caps features from the subclass
We can get away with ensuring that the memory:GLMemory caps feature is
present in the output caps
2018-10-04 14:28:35 +10:00
Sebastian Dröge 919083d082 gl: Add gl-enumtypes.h to nodist_HEADERS 2018-10-03 23:27:32 +03:00
Sebastian Dröge 2b0298d847 glviewconvert: Create an anonymous enum for GstGLStereoDownmix
Older glib-mkenums completely fails to parse it otherwise.
2018-10-03 23:17:56 +03:00
Sebastian Dröge 2b4dfb9941 gl: Generate enum GTypes via glib-mkenums
https://bugzilla.gnome.org/show_bug.cgi?id=797240
https://bugzilla.gnome.org/show_bug.cgi?id=797144
2018-10-03 13:13:24 +03:00
Sebastian Dröge 48e1c8e12d glsl: Fix error quark string to be more consistent 2018-10-02 21:01:31 +03:00
Sebastian Dröge fdacdf502b glbasememory: Fix error quark string and move documentation to the right place 2018-10-02 20:59:25 +03:00
Matthew Waters 2c44c5fb40 glviewconvert: wait and set the gl sync meta on buffers
This may be a cause of out-of-place frames when transforming multiview
buffers.
2018-09-26 13:44:48 +10:00
Sebastian Dröge 4d534ad8e8 glviewconvert: Copy composition meta from the primary buffer to both outputs
Without this, glviewconvert (and thus glimagesink) will drop all overlay
composition metas.
2018-09-25 17:01:15 +03:00
Sebastian Dröge 64774ece0c glcolorconvert: Don't copy overlay composition meta over to NULL outbufs 2018-09-25 17:01:15 +03:00
Tim-Philipp Müller dc29bc4e13 libs: fix API export/import and 'inconsistent linkage' on MSVC
For each lib we build export its own API in headers when we're
building it, otherwise import the API from the headers.

This fixes linker warnings on Windows when building with MSVC.

The problem was that we had defined all GST_*_API decorators
unconditionally to GST_EXPORT. This was intentional and only
supposed to be temporary, but caused linker warnings because
we tell the linker that we want to export all symbols even
those from externall DLLs, and when the linker notices that
they were in external DLLS and not present locally it warns.

What we need to do when building each library is: export
the library's own symbols and import all other symbols. To
this end we define e.g. BUILDING_GST_FOO and then we define
the GST_FOO_API decorator either to export or to import
symbols depending on whether BUILDING_GST_FOO is set or not.
That way external users of each library API automatically
get the import.

While we're at it, add new GST_API_EXPORT in config.h and use
that for GST_*_API decorators instead of GST_EXPORT.

The right export define depends on the toolchain and whether
we're using -fvisibility=hidden or not, so it's better to set it
to the right thing directly than hard-coding a compiler whitelist
in the public header.

We put the export define into config.h instead of passing it via the
command line to the compiler because it might contain spaces and brackets
and in the autotools scenario we'd have to pass that through multiple
layers of plumbing and Makefile/shell escaping and we're just not going
to be *that* lucky.

The export define is only used if we're compiling our lib, not by external
users of the lib headers, so it's not a problem to put it into config.h

Also, this means all .c files of libs need to include config.h
to get the export marker defined, so fix up a few that didn't
include config.h.

This commit depends on a common submodule commit that makes gst-glib-gen.mak
add an #include "config.h" to generated enum/marshal .c files for the
autotools build.

https://bugzilla.gnome.org/show_bug.cgi?id=797185
2018-09-24 08:45:34 +01:00
Sebastian Dröge cde4cfe384 gl/win32: Use g_io_channel_win32_new_messages() instead of our custom GSource
Removes some unneeded code duplication between here and GLib.

https://bugzilla.gnome.org/show_bug.cgi?id=797184
2018-09-21 11:57:01 +03:00
Víctor Manuel Jáquez Leal 982b212485 gl/egl: fix annotation for gst_egl_image_new_wrapped()
https://bugzilla.gnome.org/show_bug.cgi?id=797158
2018-09-18 11:37:39 +02:00
Víctor Manuel Jáquez Leal e12a55a4ea gl: meson: add missing headers for gir generations
There are a lot of symbols in GstGL-1.0.gir generated by automake that
are not when it is generated by meson, because a lot of headers were
not included in meson's gir generation.

https://bugzilla.gnome.org/show_bug.cgi?id=797158
2018-09-18 11:37:39 +02:00
Matthew Waters 5765641729 gl/build: don't pass OpenGL headers to GIR
g-ir-scanner does not have a good enough C parser to parse the GL system
headers
2018-09-18 11:13:27 +10:00
Matthew Waters 333566c53e glshader: macro out all the extremely similar uniform setting 2018-09-18 11:13:27 +10:00
Víctor Manuel Jáquez Leal fae3f7cb56 glviewconvert: fix GEnumValue declaration
The purpose of value_name in GEnumValue structure is to express in
text format the name of the enum, not a description of the value, so
it can be use later for the gir file generation.

https://bugzilla.gnome.org/show_bug.cgi?id=797144
2018-09-14 17:43:04 +02:00
Nicolas Dufresne bccc69fadb Revert "glmemory: Fix n_wrapped_pointers usage"
This reverts commit b1299c179b.
2018-09-13 20:02:43 -04:00
Nicolas Dufresne ffcab084d5 Revert "glupload: allow system memory for dmabuf in transform_caps"
This reverts commit d7eb48cce7.
2018-09-13 20:02:41 -04:00
Nicolas Dufresne da30327b94 Revert "glupload: handle upload methods with different caps"
This reverts commit 87336b1957.
2018-09-13 20:02:40 -04:00
Nicolas Dufresne 4a72dada3a Revert "gl/egl: Add gst_egl_image_from_dmabuf_direct() function"
This reverts commit 8f0d75d4d6.
2018-09-13 20:02:39 -04:00
Nicolas Dufresne 7b48561b8a Revert "glupload: Implement direct dmabuf uploader"
This reverts commit 3b1ae6262b.
2018-09-13 20:02:38 -04:00
Nicolas Dufresne 25df27698f Revert "glupload: try to use the last method after reconfigure"
This reverts commit c1053e17d5.
2018-09-13 20:02:37 -04:00
Michael Olbrich c1053e17d5 glupload: try to use the last method after reconfigure
Reconfigure will trigger a set_caps which clears the upload method.
Remember the method in this case and start with it.
Wrap around once to try all methods if necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-09-10 23:29:10 -04:00
Michael Olbrich 3b1ae6262b glupload: Implement direct dmabuf uploader
The idea is that some GPUs (like the Vivante series) can actually
perform the YUV->RGB conversion internally, so no custom conversion
shaders are needed. To make use of this feature, we need an additional
uploader that can import DMABUF FDs and also directly pass the pixel
format, relying on the GPU to do the conversion.

Based on patches from Nicolas Dufresne <nicolas.dufresne@collabora.com> and
Carlos Rafael Giani <dv@pseudoterminal.org>.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-09-10 23:29:10 -04:00
Nicolas Dufresne 8f0d75d4d6 gl/egl: Add gst_egl_image_from_dmabuf_direct() function
The colorspace conversion happens during the upload so the necessary hints
must be provided to ensure that the conversion works correctly.

At least the Mesa Intel driver will create a texture without error but
produces an incorrect result. Use eglQueryDmaBufModifiersEXT() to check if
non-external upload is supported for the given format.

Based on a patch from Carlos Rafael Giani <dv@pseudoterminal.org>.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-09-10 23:29:10 -04:00
Michael Olbrich 87336b1957 glupload: handle upload methods with different caps
If a upload method is selected then use it exclusively in transform_caps().
Also, reconfigure if the current caps don't match the current upload
method.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-09-10 23:03:03 -04:00
Michael Olbrich d7eb48cce7 glupload: allow system memory for dmabuf in transform_caps
This should not be necessary, but currently not all plugins that provide
dmabuf memory announce this with caps features, e.g. v4l2.
The static caps already contain the system memory. It didn't break before
because other upload methods provide the necessary transformation.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-09-10 23:03:03 -04:00
Nicolas Dufresne b1299c179b glmemory: Fix n_wrapped_pointers usage
gst_gl_memory_setup_buffer() was not properly using the number
of pointers to wrapped. This also fixes the validation, as we
only support 1 wrapper per view, or num_planes * views wrapper.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-09-10 23:02:46 -04:00
Matthew Waters 22f6ff094a gl/meson: check for EGL headers before allowing use of EGL
For distros that provide headers in seperate dev/devel packages this
won't build egl support without the necessary EGL headers.
2018-09-05 18:34:06 +10:00
Nirbheek Chauhan a9cab426d0 meson: Maintain macOS ABI through dylib versioning
Requires Meson 0.48, but the feature will be ignored on older versions
so it's safe to add it without bumping the requirement.

Documentation:
https://github.com/mesonbuild/meson/blob/master/docs/markdown/Reference-manual.md#shared_library
2018-08-31 14:40:43 +05:30
Matthew Waters 0c85af51d8 gl/meson: fix gbm option to enable rather than disable
This change matches what the other winsys/platforms are doing
2018-08-31 18:14:13 +10:00
Matthew Waters dddd2e4a07 gl/meson: add Android build definitions 2018-08-31 18:09:53 +10:00
Matthew Waters 43f0b75e55 gl/meson: add build for iOS 2018-08-31 12:23:40 +10:00
Nicolas Dufresne 63e602c63e doc: glbasefilter: Add missing Since for gst_gl_base_filter_find_gl_context() 2018-08-29 10:38:32 -04:00
Nirbheek Chauhan 12236671c7 meson: Always define gstgl_dep to a valid dependency object
Fixes configure error when gl support was auto-detected as not being
available:

ext/gl/meson.build:50:20: ERROR:  Unknown variable "gstgl_dep".
2018-08-28 13:43:36 +05:30
Yuji Kuwabara c537b2e2bb gl/dispmanx: fix removing foreign window handle
gst_gl_window_dispmanx_egl_set_window_handle() removes native window handle
(dispmanx element), regardless it was foreign window handle
(set via gst_video_overlay_set_window_handle()) or not.

This problem prevents glimagesink reusable.
(PAUSED -> READY -> PAUSED does not work)

This patch corrects it comparing the native window handle with foreign window
handle. This behavior is same as gst_gl_window_dispmanx_egl_close().

https://bugzilla.gnome.org/show_bug.cgi?id=785199
2018-08-28 14:54:40 +10:00
Matthew Waters 090bbd0721 gl/wayland: correctly use the set_render_rectangle size first
https://bugzilla.gnome.org/show_bug.cgi?id=789384
2018-08-28 14:31:43 +10:00
memeka 08ebb8264d gl/wayland: add preferred window size, and set it according to video size
The glimagesink wayland backend lacks the implementation of
gst_gl_window_wayland_egl_set_preferred_size. Because of this, glimagesink windows on
wayland are created with a fixed window size of 320x240.

[Matthew Waters]: gst-indent sources

https://bugzilla.gnome.org/show_bug.cgi?id=789384
2018-08-28 14:30:19 +10:00
Tim-Philipp Müller 4fe65c1633 gl: use right export decorator 2018-08-26 11:16:18 +02:00
Tim-Philipp Müller f1272e547d meson: gl: return not-found dependency instead of disabler if opengl is disabled
This allows consumers of the gstgl dependency where gstgl is optional
to do things like:

  config_data.set('HAVE_GST_GL', gstgl_dep.found())
  deps = [gstvideo_dep, gstgl_dep]

meaning they can still use the dep unconditionally. With the
disabler we would just disable the whole target even if the
gstgl part was an optional extra. We can add an option to
dependency() later to let users/consumers of the dep decide
if they want a not-found dependency or a disabler instead.
2018-08-18 12:37:48 +01:00
Nirbheek Chauhan b5aa5fa308 meson: host_system is 'ios' when building for iOS
The cross file sets this value, and we use 'ios' in Cerbero.
2018-08-17 04:14:15 +05:30
Tim-Philipp Müller 73828a1a5c meson: move gmodule check to top-level
It's also needed by the generic/states test and the variable
is currently checked as part of the opengl lib tests so wouldn't
be available if opengl was disabled.
2018-08-16 10:58:47 +01:00
Tim-Philipp Müller 4ec1ba433d meson: add option for opengl and the misc optional gl plugin deps
Finer control over the opengl integration library dependencies
is already implemented via the gl_api, gl_platform, and gl_winsys
options.

https://bugzilla.gnome.org/show_bug.cgi?id=796947
2018-08-16 10:56:58 +01:00
Tim-Philipp Müller ca15315565 gst-libs: include config.h in all source files
This will be needed later when we get our export define from config.h
2018-08-13 09:23:34 +01:00
Matthew Waters 91bc6f63f6 glviewconvert: fix output when a transformation matrix is used
If we have a transformation matrix, we have no idea where in the output
the video is going to endup.  It might also be different and not cover
the entire output.

We need to clear the output to remove any previous data in the backing
texture.

Found from
https://stackoverflow.com/questions/51707229/python-gstreamer-for-dynamic-control-of-element-properties
2018-08-10 22:46:34 +10:00
Matthew Waters 3d22e7d9da gl/meson: fix macos additions for non-macos platforms
"gst-libs/gst/gl/meson.build:655:20: ERROR:  Unknown variable "quartzcore_dep"."
2018-08-03 19:06:00 +10:00
Alessandro Decina 06b8792a5f gl/meson: OSX support (CGL and Cocoa)
[Matthew Waters]: minor additions such as -fobjc-arc and relying on
dependency rather than cc.find_library()
2018-08-03 12:53:10 +10:00
Norbert Wesp 574607702b Add GBM_CFLAGS and define EGL_PLATFORM_GBM_MESA
Building an image with yocto for an 'am335x' processor will fail,
because 'gbm.h' can not be found and 'EGL_PLATFORM_GBM_MESA' is not defined.

So simply adding define of 'EGL_PLATFORM_GBM_MESA' in 'gstgldisplay_egl.c'
and adding 'GBM_CFLAGS' in 'gst-gl.m4' to get rid of this errors and complete
a full build process.

ERRORs were:
-----------
gst-plugins-base-1.14.1/gst-libs/gst/gl/gbm/gstglwindow_gbm_egl.h:24:10:
fatal error: gbm.h: No such file or directory
  #include <gbm.h>
           ^~~~~~~

gst-plugins-base-1.14.1/gst-libs/gst/gl/egl/gstgldisplay_egl.c:157:39:
error: 'EGL_PLATFORM_GBM_MESA' undeclared (first use in this function);
did you mean 'EGL_PLATFORM_WAYLAND'?
  ret = _gst_eglGetPlatformDisplay (EGL_PLATFORM_GBM_MESA, (gpointer) display,
                                    ^~~~~~~~~~~~~~~~~~~~~

https://bugzilla.gnome.org/show_bug.cgi?id=796885
2018-08-02 12:17:56 +10:00
freyr 810d560a2f gl/gbm: allow headless mode
Don't require an output for the GBM backend.

https://bugzilla.gnome.org/show_bug.cgi?id=794716
2018-08-01 14:50:10 +10:00
Nicolas Dufresne 63cf6b4203 glupload: Only offer DMABuf caps feature if using EGL
This was miss-leading VAAPI which was not forcing linear back buffers,
would still export DMABuf. That caused bad rendering as the buffers are
tiled and most likely compressed.

https://bugzilla.gnome.org/show_bug.cgi?id=796822
2018-07-18 09:04:35 -04:00
Iñigo Huguet 48a0178857 gl/build: fixed failed compilation due to missing EGLuint64KHR typedef
[Matthew Waters]: add meson differences

https://bugzilla.gnome.org/show_bug.cgi?id=796820
2018-07-18 14:02:01 +10:00
Nicolas Dufresne ae5120a489 Revert "glupload: Only offer DMABuf caps feature if using EGL"
This reverts commit bc9afe7243.
2018-07-17 11:51:49 -04:00
Nicolas Dufresne bc9afe7243 glupload: Only offer DMABuf caps feature if using EGL
This was miss-leading VAAPI which was not forcing linear back buffers,
would still export DMABuf. That caused bad rendering as the buffers are
tiled and most likely compressed.
2018-07-17 11:43:40 -04:00
Matthew Waters 16cba63d43 gl/utils: fixup matrix math again for column major
e4bf9ed8f0 was not quite right and changed
the wrong thing. Intead we needed to change the multiplication order
and should have kept the previous to/from matrices as is done in this
patch.
2018-07-10 20:13:22 +10:00
memeka 1c8bf44dea gl: check for EGL_KHR_platform_gbm for non-MESA gbm implementations
https://bugzilla.gnome.org/show_bug.cgi?id=796694
2018-06-28 23:53:56 +10:00
Tim-Philipp Müller 71734b33aa gl: fix build on iOS 2018-06-24 13:35:20 +02:00
Tim-Philipp Müller 4093e4c237 gl: fix build on Windows 2018-06-24 13:19:21 +02:00
Tim-Philipp Müller d736bfc855 gl: Update for g_type_class_add_private() deprecation in recent GLib
https://gitlab.gnome.org/GNOME/glib/merge_requests/7
2018-06-23 22:58:44 +02:00
Matthew Waters 76f99f803b glcontextegl: only dump configs once 2018-06-22 22:43:08 +10:00
Matthew Waters d6ae44b1d0 glcontextegl: Fix android build without ES3 tokens 2018-06-22 22:42:45 +10:00
Matthew Waters c850faff95 glcontextegl: dump the list of EGLConfig's available 2018-06-21 17:46:57 +10:00
Matthew Waters cfa5d64ff1 gl: use dependency fallbacks to get at a possible gl-headers subproject
We would make the subproject conditional on the wrap-mode=nodownload
however get_option('wrap-mode') or similar is not available from
meson.build files as the wrap-mode is meant to be used automatically.

Instead use the dependency fallback mechanism to get at the subproject
where possible i.e. when downloading is allows and only add the compat
includes when we have a valid internal dependency from the gl-headers
subproject.

https://bugzilla.gnome.org/show_bug.cgi?id=796534
2018-06-19 12:21:48 +10:00
Tim-Philipp Müller 5ad841e5ff Revert "gl/meson: add support for using bundled headers in a subproject"
This reverts commit 82c43ff9a3.

Reverting for the time being, since it trips up build bots
that don't have network connectivity.

We ideally shouldn't have a subproject that's used unconditionally.
2018-06-07 17:42:35 +01:00
Matthew Waters 82c43ff9a3 gl/meson: add support for using bundled headers in a subproject
This is most useful when building on windows which does not ship the
necessary OpenGL headers.
2018-06-07 14:15:30 +10:00
Matthew Waters 1ceccb5b58 gl/meson: force the gl dependency to use pkg-config
Meson has an internal override for dependency('gl') which we do not want
to use as it assumes too many things.  Force meson to only search for
gl.pc.
2018-06-06 23:36:08 +10:00
Matthew Waters 8596f5a5b4 gl/meson: don't define GST_EXPORTS
The intended use (msvc) doesn't currently like it and will fail to
resolve symbols at runtime.
2018-06-06 23:36:08 +10:00
Matthew Waters e4bf9ed8f0 gl/utils: Fix NDC conversion matrices for column-majorness
The matrices were converting the wrong values with non-diagonal-only matrices.
e.g. a typical yflip matrix in [-1,1]^3 such as
 1  0  0  0
 0 -1  0  0
 0  0  1  0
 0  0  0  1

Would have actually required a matrix like this in [0,1]^3
 1  0  0  0
 0 -1  0  0
 0  0  1  0
 0 -2  0  1

Which is
1. not consistent with our multiplication convention and would require
   transposing matrices or changing our multiplication order (from what is
   generally used on opengl matrix guides/tutorials).
2. Produces incorrect values when input with actual vertices accounting for
   the difference in multiplication order.  e.g. some vertices multiplied by
   the yflip matrix using vertex * yflip(== transpose(yflip) * vertex):

     vertex:       -> result:           expected:
     vec4(1,0,1,1) -> vec4(1,-2,1,1)    vec4(1,1,1,1)
     vec4(1,1,1,1) -> vec4(1,-3,1,1)    vec4(1,0,1,1)

With the updated values, we now get the expected values.

Includes a test for this behaviour and the example above
2018-06-06 23:36:08 +10:00
Antoine Jacoutot 64585f88cd libs: g-ir-scanner: do not hardcode libtool path
https://bugzilla.gnome.org/show_bug.cgi?id=726571
2018-05-22 07:01:42 +02:00
Christoph Reiter 103f884d99 meson: gl: remove non-headers from gl_prototype_headers
This made the meson build install those files, while they aren't
installed with the autotools build.

https://bugzilla.gnome.org/show_bug.cgi?id=796274
2018-05-20 14:41:41 +01:00
Matthew Waters e367d3e812 glcolorconvert: fix negotiation for a non list video format in caps
For a single format in the caps, we were returning some weird answers,
like only RGB formats for a RGB input when we can also support YUV from
RGB.

Fixup of 3cfff727b1 where I thought my
previous (~6month) self had got this right.  Don't trust your previous
self people!
2018-05-06 18:54:20 +10:00
Nirbheek Chauhan 1e1a5d658e meson: Update option names to omit disable_ and with- prefixes
Also yield common options to the outer project (gst-build in our case)
so that they don't have to be set manually and use array types for some
options.
2018-05-05 20:30:52 +05:30
Matthew Waters ef71c5a29d gl: allow for high resolution EAGLLayer's 2018-05-05 21:36:25 +10:00
Matthew Waters 3cfff727b1 glcolorconvert: add support for ARGB64 conversion 2018-05-05 21:24:25 +10:00
Matthew Waters c4367b63d8 gl/format: add a function to retrieve if a format is supported 2018-05-05 21:24:25 +10:00
Matthew Waters c150928756 glbasefilter: expose finding the local GL context
And use it to attempt to find the GL context sooner for upload and color
conversion caps transformations.
2018-05-05 21:24:25 +10:00
Matthew Waters 396e04cf69 gl/memory: store the internal format as the texture format
Instead of having special cases at each GL texture creation, upload,
readback or copy for all non-8-bits-per-components.
Simply store the more specific format and retrieve the generic
component/type tuple from that.

Introduce a helper function for retrieving the generic GL format (RGBA,
RGB, RG, R, L, A) and type (BYTE, SHORT, SHORT_5_6_5) from a sized
GL format enum (RGBA8, RGB565, RG8, etc).
2018-05-05 21:24:25 +10:00
Haihua Hu e7700f20fd viv-fb: export viv-fb display api
qmlgl plugin will use this api

https://bugzilla.gnome.org/show_bug.cgi?id=795562
2018-04-26 09:29:41 +03:00
Haihua Hu 3c8368129a viv-fb: install gstgldisplay_viv_fb.h into build result
gstgldisplay_viv_fb.h is need by qmlgl plugin in gst-good package

https://bugzilla.gnome.org/show_bug.cgi?id=795499
2018-04-26 09:29:21 +03:00
Sebastian Dröge e99affac71 gl/cocoa: Let ARC clean up our dispatch queue if ARC is used, and otherwise do it manually
Also don't use __bridge casts if ARC is not used, as is the case on 32
bit systems.
2018-04-25 01:33:43 +03:00
Sebastian Dröge b747ae9657 gl/cocoa: Use NSRect instead of CGRect
On 64 bit systems they're typedefs of each other but on 32 bit systems
not, and we pass the rect to an API that expects a NSRect
2018-04-25 01:09:40 +03:00
Mark Nauwelaerts 710990d5cf gl: fix some GIR annotations
Mostly related to out and array parameters
2018-04-23 19:33:19 +02:00
Tim-Philipp Müller 762733c3d8 meson: gl: fix 'invalid keyword argument' meson warnings
Required is not a valid kwarg for cc.has_header()
2018-04-20 11:44:55 +01:00
Omar Akkila 2f3ff84f40 egl: fix build when using RPi EGL
https://bugzilla.gnome.org/show_bug.cgi?id=795336
2018-04-18 14:37:16 -04:00
Víctor Manuel Jáquez Leal 57ede858f0 gl: Define default value for GST_GL_HAVE_WINDOW_GBM
Thus, silent compiler's warning:
"GST_GL_HAVE_WINDOW_GBM" is not defined, evaluates to 0 [-Wundef]
2018-04-16 11:15:52 +02:00
Edward Hervey 22c9e5f7c1 libs: Documentation cleanup
* Fix wrong naming, wrong types and typos
* Add missing sections
* Add missing documentation for entries
* Explicitely mark private structure entries
* Remove items that never existed
2018-04-02 08:53:28 +02:00
Tim-Philipp Müller df66d00876 gl: pick up GstVideo-1.0.gir from local build dir
https://bugzilla.gnome.org/show_bug.cgi?id=794708
2018-03-27 11:18:35 +01:00
Carlos Rafael Giani 9324ada729 gl/gbm: Initialize window handle (= gbm surface) like other window systems
https://bugzilla.gnome.org/show_bug.cgi?id=793997
2018-03-22 10:15:10 +02:00
Carlos Rafael Giani 9ce1e4e712 viv-fb: Include gstglfuncs.h to fix cross compilation errors
https://bugzilla.gnome.org/show_bug.cgi?id=794589
2018-03-22 09:51:58 +02:00