[Spice-devel] xf86-video-qxl + libspice-server: no image on FreeBSD

Frediano Ziglio fziglio at redhat.com
Tue Jan 9 22:09:01 UTC 2018



> Hello!

> I would really like to see XSpice and xf86-video-qxl on FreeBSD.

> The correction for the FreeBSD build libspice-server.so is quite trivial and
> mechanical (first and dirty version in attach. I'd like to do the FreeBSD
> port later)

About the patch:


--- server/net-utils.c.orig	2017-09-12 15:00:11.000000000 +0300
+++ server/net-utils.c	2017-12-27 17:40:47.728516000 +0300
@@ -23,6 +23,9 @@
 #include <fcntl.h>
 #include <stdbool.h>
 #include <string.h>
+#include <sys/types.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
 #include <netinet/ip.h>
 #include <netinet/tcp.h>
 #include <sys/socket.h>
@@ -42,7 +45,7 @@
 {
     int keepalive = !!enable;
 
-    if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive, sizeof(keepalive)) == -1) {
+    if (setsockopt(fd, IPPROTO_TCP, SO_KEEPALIVE, &keepalive, sizeof(keepalive)) == -1) {
         if (errno != ENOTSUP) {
             spice_printerr("setsockopt for keepalive failed, %s", strerror(errno));
             return false;


no, this should be SOL_SOCKET as documented also in FreeBSD documentation.



@@ -54,7 +57,7 @@
     }
 
 #ifdef HAVE_TCP_KEEPIDLE
-    if (setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) {
+    if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) {
         if (errno != ENOTSUP) {
             spice_printerr("setsockopt for keepalive timeout failed, %s", strerror(errno));
             return false;


yes, better something like

#if !defined(SOL_TCP) && defined(IPPROTO_TCP)
#define SOL_TCP IPPROTO_TCP
#endif


--- server/red-worker.c.bak	2017-09-21 14:05:07.000000000 +0300
+++ server/red-worker.c	2017-12-27 17:53:23.512584000 +0300
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #include <poll.h>
 #include <pthread.h>
+#include <pthread_np.h>
 #include <openssl/ssl.h>
 #include <inttypes.h>
 #include <glib.h>
@@ -51,6 +52,16 @@
 #define CMD_RING_POLL_RETRIES 1
 
 #define INF_EVENT_WAIT ~0
+
+int pthread_setname_np(pthread_t, const char *);
+
+
+int pthread_setname_np(pthread_t id, const char *name)
+{
+	/* this BSD function returns no error */
+	pthread_set_name_np(id, name);
+	return 0;
+}
 

pthread_np.h should be detected by configure, I think an easier

#ifdef HAVE_PTHREAD_NP_H
#include <pthread_np.h>
#define pthread_setname_np pthread_set_name_np
#endif


would then work too


 struct RedWorker {
     pthread_t thread;
--- server/sound.c.orig	2017-09-21 14:05:07.000000000 +0300
+++ server/sound.c	2017-12-27 17:43:39.803158000 +0300
@@ -22,6 +22,8 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <limits.h>
+#include <sys/types.h>
+#include <netinet/in.h>
 #include <sys/socket.h>
 #include <netinet/ip.h>
 #include <netinet/tcp.h>


These should not harm



> After that, the compilation xf86-video-qxl (with --enable-xspice) is success:

> root at fbl1:/# ldd /usr/local/lib/xorg/modules/drivers/spiceqxl_drv.so
> /usr/local/lib/xorg/modules/drivers/spiceqxl_drv.so:
> libspice-server.so.1 => /usr/local/lib/libspice-server.so.1 (0x801656000)
> libXfont.so.1 => /usr/local/lib/libXfont.so.1 (0x8019cc000)
> libthr.so.3 => /lib/libthr.so.3 (0x801c09000)
> libc.so.7 => /lib/libc.so.7 (0x800826000)
> libgthread-2.0.so.0 => /usr/local/lib/libgthread-2.0.so.0 (0x801e30000)
> libgio-2.0.so.0 => /usr/local/lib/libgio-2.0.so.0 (0x802031000)
> libjpeg.so.8 => /usr/local/lib/libjpeg.so.8 (0x8023bc000)
> liblz4.so.1 => /usr/local/lib/liblz4.so.1 (0x8025fb000)
> libpixman-1.so.0 => /usr/local/lib/libpixman-1.so.0 (0x802818000)
> libsasl2.so.3 => /usr/local/lib/libsasl2.so.3 (0x802ade000)
> libgstapp-1.0.so.0 => /usr/local/lib/libgstapp-1.0.so.0 (0x802cfb000)
> libgstvideo-1.0.so.0 => /usr/local/lib/libgstvideo-1.0.so.0 (0x802f09000)
> libgstbase-1.0.so.0 => /usr/local/lib/libgstbase-1.0.so.0 (0x8031af000)
> libgstreamer-1.0.so.0 => /usr/local/lib/libgstreamer-1.0.so.0 (0x80340e000)
> libgobject-2.0.so.0 => /usr/local/lib/libgobject-2.0.so.0 (0x803741000)
> libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x80398a000)
> libintl.so.8 => /usr/local/lib/libintl.so.8 (0x803c9d000)
> libcrypto.so.9 => /usr/local/lib/libcrypto.so.9 (0x804000000)
> libssl.so.9 => /usr/local/lib/libssl.so.9 (0x80447a000)
> libz.so.6 => /lib/libz.so.6 (0x8046f2000)
> libm.so.5 => /lib/libm.so.5 (0x80490b000)
> librt.so.1 => /usr/lib/librt.so.1 (0x804b38000)
> liborc-0.4.so.0 => /usr/local/lib/liborc-0.4.so.0 (0x804d3d000)
> libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x804fda000)
> libfontenc.so.1 => /usr/local/lib/libfontenc.so.1 (0x80528c000)
> libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x805493000)
> libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x80578e000)
> libffi.so.6 => /usr/local/lib/libffi.so.6 (0x805a05000)
> libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0 (0x805c0c000)
> libunwind.so.8 => /usr/local/lib/libunwind.so.8 (0x805e0f000)
> libbz2.so.4 => /usr/lib/libbz2.so.4 (0x806028000)
> libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x80623c000)
> liblzma.so.5 => /usr/lib/liblzma.so.5 (0x806452000)

> +

> root at fbl1:/# ldd /usr/local/lib/xorg/modules/drivers/qxl_drv.so
> /usr/local/lib/xorg/modules/drivers/qxl_drv.so:
> libc.so.7 => /lib/libc.so.7 (0x800826000)

> After copying spiceqxl.xorg.conf and starting the Xspice (or Xspice with
> --auto args) Xspice/xorg
> starts successfully and I see that the port is open:

> Xspice --disable-ticketing --xsession /usr/local/bin/fluxbox :1 --port 5900

> (startup log in Xspice-run.txt)

> % sockstat -4l |grep 5900
> root Xorg 80657 7 tcp46 *:5900 *:*

> Also, I see that the fluxbox is launched:

> % ps axf |grep fluxbox

> 80662 3 I+ 0:00.18 [fluxbox]

> But when i try to connect from remote node:

> % spicy -h <Server IP> -p 5900
> GSpice-Message: main channel: opened

> I do not get any images. I've see on server side this messages upon client
> connect:


Are you getting a blank screen or just nothing?


> main_channel_link: add main channel client
> ...

> And when client disconnected:

> red_channel_client_disconnect: rcc=0x823180130 (channel=0x8008b58a0 type=1
> id=0)
> main_channel_client_on_disconnect: rcc=0x823180130
> red_client_destroy: destroy client 0x81e0fac00 with #channels=1

> But can see anything.

> Can somebody help to debug this ?

> PS: client also is FreeBSD, but this work well when Xspice running in same
> way on Debian.

> xorg-7.7
> xorg-server-1.18.4_6,1
> xf86-video-qxl-0.1.5
> spice-0.14.0
> spice-protocol-0.12.13
> spice-gtk-0.33


Frediano


More information about the Spice-devel mailing list