Commit graph

1973 commits

Author SHA1 Message Date
Seungha Yang
220f2dd3c7 glwindow/win32: Chain up mouse event to parent window
Fix a regression of the commit 940c9998e5

Unlike key event, mouse event will not be chained up to parent window
by DefWindowProc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/718>
2020-06-22 18:34:49 +00:00
David Bender
b4bdb75a80 gstglwindow_x11: fix resize
This patch was taken from #629#note_178766, the comment made
at the time was:

The root issue is a mismatch between the initialization of render_rect
in GstGLWindowX11Private and what's expected in the draw_cb function.
Because render_rect is not explicitly initialized to a width and height
of -1 (unlike gstglwindow_wayland_egl.c which does initialize to -1),
the less-than check for explicitly-set render_rect at gstglwindow_x11.c:453-454
always fails, even when the parent_win has been set and the render rectangle
has never been set.

Maybe this came from copying the similar check in the wayland code? Regardless,
I think the correct inequality should be '<= 0' (on both lines).

Alternatively initialization could be changed, but other sinks, e.g.
xvimagesink don't appear to use -1 to mean "unset" render_rect this way.

The issue can be reproduced by running the example in
tests/examples/gl/qt/videooverlay/ on X11, and resizing the output
window

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/701>
2020-06-12 01:36:22 +00:00
Matthew Waters
51b057ea26 glcontext/eagl: handle sending one message during shutdown
gst_gl_window_quit() will attempt to send a message but will be called
from GstGLContext's finalize handler and so the weak ref that backs
gst_gl_window_get_context will return NULL as it has already been
cleared.  We need that context in send_message_async to decide whether
to run the provided callback immediately or queue in GCD

This is the equivalent commit for iOS as:
7f59cefafb
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/618

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/681>
2020-06-02 14:32:03 +10:00
Matthew Waters
c506adc950 gl/eagl: don't access UIkit objects on the main thread
This means we cannot access [view layer] or view.bounds from the OpenGL
thread.  This also means that we need to call the main thread when
setting the window handle.  However, we cannot perform that
synchronously as that may deadlock with the application performing the
set_window_handle() call.

We need to defer the actual update and run it asynchronously and wait
for the window handle update internally at each point it is needed.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/372
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/681>
2020-06-02 14:32:03 +10:00
Matthew Waters
a57380d718 gl/ios: fix typo GS_GL -> GST_GL
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/681>
2020-06-02 14:32:03 +10:00
Víctor Manuel Jáquez Leal
165f801bb0 libs: gl: silence gir compiler
There were a couple complains of the gir compiler on these gstgl
files.

* Added namespace to public macros, even if they are helpers.
* Removed a misused private tag

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/678>
2020-05-29 13:35:56 +02:00
Guillaume Desmottes
eed54928c8 gl: egl: fix gtk-doc doc start code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/664>
2020-05-19 10:37:59 +02:00
Guillaume Desmottes
6a42e2e176 gl: workaround gir warning
The gir generator wrongly assume that the vfunc
GstGLFilterClass.filter() and the method gst_gl_filter_filter_texture()
are related. As a result it complains about not matching argument names.

Workaround this by naming both of their arguments input and output.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/664>
2020-05-19 10:37:59 +02:00
Guillaume Desmottes
c3e98ad2d0 gl: egl: add missing gir annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/664>
2020-05-19 10:37:59 +02:00
Guillaume Desmottes
41f9d9103c gl: x11: skip gst_gl_display_x11_new_with_display() from gir
The X11 Display type is not usable in gir.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/664>
2020-05-19 10:17:21 +02:00
Matthew Waters
d0de7cba48 gl/display/egl: ensure debug category is initialized
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/662>
2020-05-14 16:41:00 +10:00
Sebastian Dröge
a0258e3e6b gldisplay: Fix context leak when removing a context from the display
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/654>
2020-05-06 14:46:17 +00:00
Edward Hervey
0fe052db61 gldisplay: Fix list iteration
We were never moving past the first entry it seems...

CID #1461275

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/654>
2020-05-06 14:46:17 +00:00
Philippe Normand
03c4a819d3 gl: Add since tags for new glbasesrc base class
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/647>
2020-04-30 18:00:19 +01:00
Philippe Normand
101868c5d0 gst/gl: Add documentation for new scroll API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/647>
2020-04-30 18:00:19 +01:00
Matthew Waters
6a1e575345 glbasesrc: avoid deadlock when querying for OpenGL context
Continuation of:
a4e49ba8c9
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/642

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/643>
2020-04-27 11:36:02 +10:00
Matthew Waters
5d47b8e232 gl: fix application context querying between elements
Fixes error introduced by:
a4e49ba8c9
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/642

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

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

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/642>
2020-04-24 18:03:16 +10:00
He Junyan
4216bd6eb2 libs: gl: Fix a context leak when display_create_context failed 2020-04-08 15:26:23 +08:00
Haihao Xiang
77db5a0e21 gl: add support for Y412_LE / Y412_BE format
Reuse Y410 code for Y412_LE / Y412_BE except gl format. The gl format is
RGBA16 for Y412_LE / Y412_BE.

Sample pipeline:
gst-launch-1.0 videotestsrc ! video/x-raw,format=Y412_LE ! glimagesink
2020-04-01 13:55:50 +08:00
Haihao Xiang
5f859203ad gl: add support for Y212_LE / Y212_BE format
Because the color value is stored in MSB, so we can reuse the
Y210 code for P012_LE / P012_BE

Sample pipeline:
gst-launch-1.0 videotestsrc ! video/x-raw,format=Y212_LE ! glimagesink
2020-04-01 13:55:11 +08:00
Matthew Waters
7f59cefafb glcontext/cocoa: handle sending one message during shutdown
gst_gl_window_quit() will attempt to send a message but will be called
from GstGLContext's finalize handler and so the weak ref that backs
gst_gl_window_get_context will return NULL as it has already been
cleared.  We need that context in send_message_async to decide whether
to run the provided callback immediately or queue in GCD
2020-03-26 11:25:44 +00:00
Matthew Waters
3a9fde7b24 glcontext: add context is valid precondition to get_thread() 2020-03-26 11:25:44 +00:00
Matthew Waters
785feed73f glwindow: remove unused private alive variable 2020-03-26 11:25:44 +00:00
Haihao Xiang
5b11ac0819 glupload: fix segfault
Without this fix, it is possible that outbuf is not initialized, which
will result in segfault when call gst_buffer_replace (&outbuf, NULL). In
addition, the patch fixes potential memory leak in restart path.

The segfault can be reproduced by the pipeline below:

GST_GL_PLATFORM=egl \
gst-launch-1.0 videotestsrc ! msdkh265enc ! msdkh265dec ! \
'video/x-raw(memory:DMABuf)' ! glimagesink
2020-03-26 14:06:13 +08:00
Haihao Xiang
1db94e5205 gl: add support for P012_LE / P012_BE format
Because the color value is stored in MSB, so we can reuse the
P016_LE / P016_BE code for P012_LE / P012_BE
2020-03-24 14:29:38 +08:00
Chris Lord
7cd2f5a29f glupload: Fix fallback from direct dmabuf to dmabuf upload method
In the situation that the direct dmabuf path is chosen, but with an
unsupported texture format, this causes accept to fail rather than
continue and fail at the upload stage. It is also possibly necessary to
reconfigure after falling back from direct to non-direct dmabuf upload
paths.
2020-03-23 11:09:49 +00:00
Philippe Normand
3f79805aa0 gl/wayland: Mouse events handling 2020-03-19 09:59:47 +00:00
Philippe Normand
5a4c5e9169 gl/navigation: Scroll events dispatch support 2020-03-19 09:59:47 +00:00
Peter Seiderer
7b00e5de99 meson: add window system egl 2020-03-12 10:00:59 +00:00
Matthew Waters
f58914b93b gl/wayland: use wayland's roundtrip_queue()
There's no need to roll our own anymore
2020-03-11 09:17:36 +00:00
Philipp Zabel
40773e9c91 glupload: dmabuf: only accept uploads to external-oes if supported by the context
This keeps the DirectDmabufExternal uploader from accepting buffers if
texture-target=external-oes is not supported by the GL context.
2020-03-06 12:02:58 +01:00
Matthew Waters
5ae7998a8f gl/wayland: use a proxy wrapper for the wl_display
This allows us to remove races when setting the wl_queue on wayland
objects with wl_proxy_set_queue() as each created object is created with
the queue already set.

We can also move all our initilization code into the window as we
can retrieve all wayland objects from each window instance.  This
removes a possible race when integrating with external API's as we would
always attempt to immediately retrieve a small set of wayland objects.
That is no longer the case with the objects from each window instance.
2020-03-04 00:04:18 +00:00
Matthew Waters
3df7edaa49 glfilter: use gst_object_unref/ref functions
Allows better visibility into ref/unref points with the leaks tracer
2020-03-04 00:04:18 +00:00
Matthew Waters
aa703285f9 gl/wayland: fix xdg shell close notification
Don't segfault by not calling the appropriate callback that destroys
resources in the correct order.
2020-03-04 00:04:18 +00:00
Matthew Waters
7e2073000a glbasefilter: add support for changing the display
Each element will remove its usage of the old display and context and
try to retrieve a new GL context.
2020-03-03 02:11:52 +00:00
Matthew Waters
de58d23b5c glbasesrc: add support for changing display's 2020-03-03 02:11:52 +00:00
Matthew Waters
4c008895ce gldisplay: add support removing a context from the internal list 2020-03-03 02:11:52 +00:00
Philipp Zabel
0e038a5612 glupload: dmabuf: add DirectDmabufExternal uploader
Automatic negotiation of texture-target=external-oes does not work
without separating the external-oes support out of the DirectDmabuf
uploader into a separate DirectDmabufExternal uploader.
2020-03-02 11:07:26 +00:00
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