Commit graph

61 commits

Author SHA1 Message Date
Sebastian Dröge
939528e542 gl/x11: Remove unused static function 2016-11-25 23:44:25 +02:00
Matthew Waters
01fa90c1e7 glwindow: remove is_running() function
It isn't necessary in correctly written programs.
2016-11-10 20:05:45 +11:00
Matthew Waters
4f6c226bd2 gl/x11: use xcb instead of libX11
- xcb is supposedly thread-safe!

videotestsrc ! glimagesink now doesn't spuriously result in a
'call XInitThreads()' error however if anybody else is using X11,
then XInitThreads() still needs to be called and multiple glimagesink's
still need XInitThreads().

Everything still takes libX11 handles as they are compatible with the xcb
variants.  Unfortunately we cannot move fully over to xcb due to GLX being
entirely based on Xlib.  It's also impossible to transform a xcb_connection
to a Display which means we require X11 handles.
2016-11-08 15:14:26 +11:00
Matthew Waters
41a6448918 gl: GST_GL_TYPE -> GST_TYPE_GL
Some deprecated symbols are kept for backwards compatibility
2016-11-03 16:16:12 +11:00
Haihua Hu
fa37e3588e glwindow: Fix glimagesink cannot show frame when connect to qmlglsrc
When connect to qmlglsrc, x11 event loop will be replace by qt event loop
which will cause the window cannot receive event from xserver, such as resize

https://bugzilla.gnome.org/show_bug.cgi?id=768160
2016-08-03 22:10:56 +10:00
Matthew Waters
82bb5d4e22 gl/x11/navigation: add button press to the selected event mask
Otherwise we won't get the button press events and GstNavigation fails.
2016-01-14 17:52:23 +11:00
Sebastian Dröge
d81eea5de1 glwindow: Hide navigation specific internal API and add API to asynchronously send navigation events
Exposing the navigation thread's main context, GSourceFuncs and structs called
key_event and mouse_event is exposing a bit too much of the internals. Let's
just go with two functions to asynchronously send navigation events on the
window with the same API as the synchronous ones.
2015-12-21 11:27:09 +01:00
Matthew Waters
27422da056 glwindow: remove unused draw_unlocked function
The functionality is provided by draw anyway and is leftover from
X11's specific threading requirements that no longer apply.
2015-09-28 16:44:05 +10:00
Matthew Waters
3addb6bbf4 glwindow: add API to request a resize event on the next draw
- glimagesink needs to be able to resize the viewport on aspect ratio
  changes resulting from either caps changes or 3d output mode changes.
- Performing a glViewport outside the GstGLWindow::resize callback
  will not have the winsys' stack of viewports required to correctly
  place the output frame.

Provide a function to request a resize on the next draw event from the
winsys.

Also track size changes inside the base GstGLWindow class rather
than in each subclass.

https://bugzilla.gnome.org/show_bug.cgi?id=755111
2015-09-17 20:26:23 +10:00
Matthew Waters
1625f74632 gl/x11: store the correct dimension from the resize events
small typo s/width/height/
2015-09-17 20:21:43 +10:00
Matthew Waters
3b89d8a23c glwindow: pass display to implementation's _new()
So they have to opportunity to fail if they cannot handle the
display connection.

https://bugzilla.gnome.org/show_bug.cgi?id=752743
2015-07-27 18:23:29 +10:00
Sebastian Dröge
cb01fbfc27 Revert "gl/window/x11: don't create our own X11 display"
This reverts commit 5697b6b89b.

https://bugzilla.gnome.org/show_bug.cgi?id=751003
2015-06-23 16:46:39 +02:00
Matthew Waters
ea4867dfa7 gl/window/x11: only listen on the X Display when needed
5697b6b89b causes us to possibly listen
on a toolkit provided Display connection.  We thus could eat their
precious winsys events.  Only listen if we need to
(!foreign_display or videooverlay).
2015-06-12 13:14:57 +10:00
Matthew Waters
5697b6b89b gl/window/x11: don't create our own X11 display
It's not needed anymore with most window operations occuring in the
GL thread.
2015-06-12 00:34:58 +10:00
Matthew Waters
e2adfb8bf2 gl/window/x11: handle_events() may be called before the window has been created
Fixes an XIO fatal error
2015-06-12 00:34:58 +10:00
Julien Isorce
c5f8c789a3 glwindow_x11: use parent default implementation 2015-05-27 17:10:32 +01:00
Matthew Waters
49b00e44ed gl/x11: don't XGetWindowAttributes every XEvent
fixes a deadlock in xcb where the X window may not exist.

https://bugzilla.gnome.org/show_bug.cgi?id=745633
2015-03-11 18:56:06 +00:00
Matthew Waters
bc7a7259f3 gl/window: create the main loop/context on init/finalize
Avoids races setting the window handle from the main thread.

https://bugzilla.gnome.org/show_bug.cgi?id=745633
2015-03-11 13:52:15 +00:00
Matthew Waters
6cf97eb221 glwindow: make showing a window explicit
Also fixes the cgl context always displaying a window to render to for
every GstGLContextCocoa created
2015-01-29 22:26:37 +11:00
Matthew Waters
ab48bb6f0f glwindow: remove width/height from _draw()
Depending on the platform, it was only ever implemented to 1) set a
default surface size, 2) resize based on the video frame or 3) nothing.
Instead, provide a set_preferred_size () that elements/applications
can use to request a certain size which may be ignored for
videooverlay/other cases.
2015-01-23 16:11:31 +11:00
Lubosz Sarnecki
6702811e14 glimagesink: implement gst_video_overlay_handle_events
https://bugzilla.gnome.org/show_bug.cgi?id=736035
2014-11-06 16:04:11 +11:00
Vasilis Liaskovitis
3c3b78508f GstGLWindow: Introduce navigation thread
This thread dispatches navigation events. It is needed to avoid deadlocks
between window backend threads that emit navigation events (e.g. X11/GMainLoop
thread) and consumers of navigation events such as glimagesink, see
https://bugzilla.gnome.org/show_bug.cgi?id=733661

GstGlWindow_x11 thread is changed to invoke the navigation thread for navigation
dispatching, instead of emiting the event itself. Othe backends beside X11 do
not dispatch navigation events yet, but should use this thread when dispatching
these events in the future.

The navigation thread is currently part of GstGLWindow and not implemented in
separate subclasses / backends. This will be needed in the future.

gst_gl_window_x11_get_surface_dimensions is also changed to use a cached value
of the window's width, height. These values are now retrieved in the X11
thread, function gst_gl_window_x11_handle_event. This change is needed because
otherwise the XGetWindowAttributes gets called from the navigation thread,
leading to xlib aborting due to multithreaded access (if XInitThreads is not
called before, as is the case for gst-launch)
2014-09-09 21:47:02 +10:00
Vasilis Liaskovitis
4dacc4ba55 GstGLWindow, GstGLImagesink, x11: Scale navigation events on resized windows
If window is resized, GstStructure pointer values have to be rescaled to
original geometry. A get_surface_dimensions GLWindow class method is added for
this purpose and used in the navigation send_event function.

https://bugzilla.gnome.org/show_bug.cgi?id=703486
2014-08-07 13:55:02 +10:00
Matthew Waters
46db28ac2c gl/x11: silence runtime warning
g_main_loop_quit: assertion 'loop != NULL' failed
2014-07-31 18:36:58 +10:00
Vasilis Liaskovitis
05f908bf45 glwindow/11: Emit signals for mouse and key navigation events
https://bugzilla.gnome.org/show_bug.cgi?id=703486
2014-07-24 12:24:34 +02:00
Matthew Waters
1f90323a4d glwindow_x11: allow expose events to redraw our window
otherwise we will not update the window contents on low framerate
streams until the next buffer

https://bugzilla.gnome.org/show_bug.cgi?id=723529
2014-05-30 11:51:01 +10:00
Matthew Waters
1512666ac7 gl/window_x11: avoid BadDrawable error on shutdown 2014-05-27 13:57:09 +10:00
Nicolas Dufresne
70350bd89e gl/x11: Removed unused variable 2014-04-24 13:59:51 -04:00
Sebastian Dröge
eb88f19c10 gl/x11: Get rid of unneeded second display connection and do everything from the main loop 2014-04-24 19:11:31 +02:00
Sebastian Dröge
42a3bb7d6e gl/x11: Block rendering until swapbuffers is called and don't go via X11 events as unneeded indirection
This should fix QoS problems, where basesink believed it was rendering with
20FPS but actually we were just queueing up X11 Expose events and only once
in a while something was rendered.
2014-04-24 19:11:31 +02:00
Matthew Waters
870503dc6b gl: silence all the compiler warnings 2014-03-16 15:17:44 +01:00
Matthew Waters
b6b8f9cd88 [893/906] x11: close both of the display's we use
(the comment doesn't seem to apply anymore)

https://bugzilla.gnome.org/show_bug.cgi?id=725048
2014-03-15 18:37:07 +01:00
Matthew Waters
0d1d42b205 [890/906] x11: add display subclass
GstGLDisplayX11 holds the display connection and name.  Each thread requires
it's own X11 Display connection (initialised from name) due to the fact that
we do not want to call XInitThreads().  Doing so would result in segfaults
when integrating with GUI toolkits Gtk, Qt, etc.

The Display connection is for OpenGL platforms where a constant display is
required in order to share contexts (egl).  In the case of a wrapped context
(added later), we do not have GstGLWindow to retreive the display from so a
'master' connection is used instead.
2014-03-15 18:37:06 +01:00
Chris Paulson-Ellis
1a53bc22c7 [877/906] x11: Use correct format string for guintptr
https://bugzilla.gnome.org/show_bug.cgi?id=723537
2014-03-15 18:37:06 +01:00
Matthew Waters
cf7838a0b6 [862/906] window: remove set_need_lock
No-one is using it.  The only code that did was the x11 one which
doesn't need it anymore.
2014-03-15 18:37:05 +01:00
Julien Isorce
d1376390ba [832/906] x11: ignore Expose events not initiated by gst_gl_window_draw 2014-03-15 18:37:03 +01:00
Julien Isorce
160fad22c0 [825/906] glwindow_x11: check if the loop exists
It happens when calling set_window_handle before to reach GST_STATE_READY.
In this case the parent is set when creating the internal window.
2014-03-15 18:37:03 +01:00
Matthew Waters
db1c7a242b [818/906] window: add send_message_async vmethod
- provide a default synchronous send_message
- make context creation threadsafe again
2014-03-15 18:37:02 +01:00
Matthew Waters
e29d826b0a [816/906] x11: fix make check segfault 2014-03-15 18:37:02 +01:00
Matthew Waters
135ea8e562 [808/906] x11: remove dead code 2014-03-15 18:37:02 +01:00
Matthew Waters
c639a2d126 [797/906] x11: fix build for clang 2014-03-15 18:37:01 +01:00
Matthew Waters
95c08c2ee2 [794/906] context: add subclasses for the different platforms (egl, glx, wgl, etc)
- most code taken from the Window subclasses
- tested combinations: xEGL, GLX, Wayland+EGL, Cocoa (under GNUStep), WGL (Wine)
2014-03-15 18:37:01 +01:00
Julien Isorce
bfac5a8d76 [791/906] glwindow/x11: remove X11EventSource as soon as the window is deleted
gst_gl_window_x11_send_message do not use XSendEvent anymore
2014-03-15 18:37:01 +01:00
Sebastian Dröge
f6f0c4ddad [762/906] glimagesink: Fix some memory leaks and properly set up the buffer pool 2014-03-15 18:36:59 +01:00
Sebastian Dröge
380ab312ca [761/906] x11: Protect event display connection with a mutex
We use it from different threads and need to serialize the
accesses to it.
2014-03-15 18:36:59 +01:00
Sebastian Dröge
ddfc527857 [760/906] x11: Always use the same display connection from the GL thread
The other display connection might be used by async calls from elsewhere
at the same time.

https://bugzilla.gnome.org/show_bug.cgi?id=704247
2014-03-15 18:36:59 +01:00
Sebastian Dröge
2b6e54d416 [752/906] glwindow: Add destroy notifies for the data of the callbacks
And actually call the close callback when the window is closed.
2014-03-15 18:36:58 +01:00
Sebastian Dröge
7fffd9097e [740/906] x11: Allow setting window handle before creating the context 2014-03-15 18:36:58 +01:00
Sebastian Dröge
c479544540 [739/906] x11: Don't leak main context and main loop 2014-03-15 18:36:58 +01:00
Matthew Waters
f9d46c29ca [725/906] x11: use GMainContext/GMainLoop
allows us to be reentrant

https://bugzilla.gnome.org/show_bug.cgi?id=703445
2014-03-15 18:36:57 +01:00