Commit graph

1837 commits

Author SHA1 Message Date
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