[PATCH spice-gtk] spice-widget: Make sure we can use X11 from different thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In order to support GStreamer overlay this is necessary as some
plugins can use X11 from a different thread.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 src/spice-widget.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

CI result:
https://gitlab.freedesktop.org/fziglio/spice-gtk/pipelines/9559

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 312c640a..cca0867e 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -2547,6 +2547,19 @@ static void queue_draw_area(SpiceDisplay *display, gint x, gint y,
                                x, y, width, height);
 }
 
+#ifdef GDK_WINDOWING_X11
+/* See https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/GstGLDisplay.html
+ * (look for XInitThreads). We call it into a constructor to make sure
+ * we call before any X11 function.
+ * In case of GStreamer some plugins will use X11 from different
+ * threads.
+ */
+SPICE_CONSTRUCTOR_FUNC(x11_threads_init)
+{
+    XInitThreads();
+}
+#endif
+
 static void* prepare_streaming_mode(SpiceChannel *channel, bool streaming_mode, gpointer data)
 {
 #ifdef GDK_WINDOWING_X11
-- 
2.17.2

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]