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

xserver-xorg-video-qxl: Changes to 'debian-unstable'



 Makefile.am                         |    8 
 README.xspice                       |  114 ++++++++++
 TODO.xspice                         |   23 ++
 configure.ac                        |   57 ++++-
 examples/Makefile.am                |   24 ++
 examples/spiceqxl.xorg.conf.example |  101 +++++++++
 scripts/Makefile.am                 |   24 ++
 scripts/xspice                      |  125 +++++++++++
 src/Makefile.am                     |   37 +++
 src/qxl.h                           |  115 ++++++++++
 src/qxl_driver.c                    |  377 ++++++++++++++++++++++++++--------
 src/qxl_mem.c                       |   22 +
 src/qxl_ring.c                      |   21 +
 src/qxl_surface.c                   |   12 -
 src/spiceqxl_display.c              |  341 ++++++++++++++++++++++++++++++
 src/spiceqxl_display.h              |   33 ++
 src/spiceqxl_driver.c               |  156 ++++++++++++++
 src/spiceqxl_driver.h               |   33 ++
 src/spiceqxl_inputs.c               |  397 ++++++++++++++++++++++++++++++++++++
 src/spiceqxl_inputs.h               |   30 ++
 src/spiceqxl_io_port.c              |  279 +++++++++++++++++++++++++
 src/spiceqxl_io_port.h              |   32 ++
 src/spiceqxl_main_loop.c            |  339 ++++++++++++++++++++++++++++++
 src/spiceqxl_main_loop.h            |   32 ++
 src/spiceqxl_spice_server.c         |  327 +++++++++++++++++++++++++++++
 src/spiceqxl_spice_server.h         |   35 +++
 26 files changed, 2988 insertions(+), 106 deletions(-)

New commits:
commit dd90fa9277283b4806aba307ca952bea0402b534
Author: Alon Levy <alevy@redhat.com>
Date:   Sat Jul 23 12:55:42 2011 +0300

    0.0.16
    
    Brown paper bag release: fix scripts/xspice to run.
    
    Did a few more fixes in the same time:
     less verbose error messages by default
     add missing command line in xspice for --x509-cert-file
     check for existance of certificates before running Xorg

diff --git a/configure.ac b/configure.ac
index e5eda8f..581521e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-qxl],
-        [0.0.15],
+        [0.0.16],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-qxl])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 7c4804541084ba8f1d11c4c86f0276235520c7be
Author: Alon Levy <alevy@redhat.com>
Date:   Sat Jul 23 13:36:10 2011 +0300

    scripts/xspice: prevent running with missing certificates
    
    since spice-server aborts if it is missing any of the ca-cert, server cert
    or server key, when running with --tls-port, check for them ourselves first.
    
    also add missing --x509-cert-file switch, and add --disable-ticketing
    to example in --help.

diff --git a/scripts/xspice b/scripts/xspice
index edf3203..f411619 100755
--- a/scripts/xspice
+++ b/scripts/xspice
@@ -37,7 +37,7 @@ def add_boolean(flag, *args, **kw):
 
 wan_compression_options = ['auto', 'never', 'always']
 parser = argparse.ArgumentParser("xspice",
-    description="X and Spice server. example usage: xspice --port 5900 :1.0",
+    description="X and Spice server. example usage: xspice --port 5900 --disable-ticketing :1.0",
     usage="xspice [xspice and Xorg options intermixed]",
     epilog="Any options not parsed by xspice get passed to Xorg as is.")
 parser.add_argument('--xorg', default=which('Xorg'))
@@ -48,9 +48,10 @@ parser.add_argument('--port', type=int, help='standard spice port')
 parser.add_argument('--tls-port', type=int, help='spice tls port')
 add_boolean('--disable-ticketing', help="do not require a client password")
 add_boolean('--sasl', help="enable sasl")
-parser.add_argument('--x509-dir', help="x509 directory for tls")
+parser.add_argument('--x509-dir', help="x509 directory for tls", default='.')
 parser.add_argument('--cacert-file', help="ca certificate file for tls")
-parser.add_argument('--x509-key-file', help="key file for tls")
+parser.add_argument('--x509-cert-file', help="server certificate file for tls")
+parser.add_argument('--x509-key-file', help="server key file for tls")
 parser.add_argument('--x509-key-password', help="key file password for tls")
 parser.add_argument('--tls-ciphers')
 parser.add_argument('--dh-file')
@@ -79,6 +80,26 @@ if cgdb:
 
 args, xorg_args = parser.parse_known_args(sys.argv[1:])
 
+def tls_files(args):
+    if args.tls_port == 0:
+        return {}
+    files = {}
+    for k, var in [('ca-cert', 'cacert_file'),
+                   ('server-key', 'x509_key_file'),
+                   ('server-cert', 'x509_cert_file')]:
+        files[k] = os.path.join(args.x509_dir, k + '.pem')
+        if getattr(args, var):
+            files[k] = getattr(args, var)
+    return files
+
+# XXX spice-server aborts if it can't find the certificates - avoid by checking
+# ourselves. This isn't exhaustive - if the server key requires a password
+# and it isn't supplied spice will still abort, and Xorg with it.
+for key, filename in tls_files(args).items():
+    if not os.path.exists(filename):
+        print "missing %s - %s does not exist" % (key, filename)
+        sys.exit(1)
+
 def error(msg, exit_code=1):
     print "xspice: %s" % msg
     sys.exit(exit_code)
@@ -87,7 +108,8 @@ if not args.xorg:
     error("Xorg missing")
 
 var_args = ['port', 'tls_port', 'disable_ticketing',
-    'x509_dir', 'sasl', 'cacert_file', 'x509_key_file', 'x509_key_password',
+    'x509_dir', 'sasl', 'cacert_file', 'x509_cert_file',
+    'x509_key_file', 'x509_key_password',
     'tls_ciphers', 'dh_file', 'password', 'image_compression',
     'jpeg_wan_compression', 'zlib_glz_wan_compression',
     'streaming_video']

commit 432c5870104f583166234b9655628f359983bbfa
Author: Alon Levy <alevy@redhat.com>
Date:   Sat Jul 23 13:11:54 2011 +0300

    spiceqxl_io_port: make dprint silent
    
    and read XSPICE_IO_PORT_DEBUG_LEVEL environment variable.

diff --git a/src/spiceqxl_io_port.c b/src/spiceqxl_io_port.c
index 3968d5f..386cab7 100644
--- a/src/spiceqxl_io_port.c
+++ b/src/spiceqxl_io_port.c
@@ -52,14 +52,25 @@
         ret = &m_item->el;                                              \
     }
 
-static int spiceqxl_io_port_debug_level = 5;
+static int spiceqxl_io_port_debug_level = -1;
 
-#define dprint(_level, _fmt, ...)                                 \
-    do {                                                                \
-        if (spiceqxl_io_port_debug_level >= _level) {                                    \
-            fprintf(stderr, _fmt, ## __VA_ARGS__);                      \
-        }                                                               \
-    } while (0)
+static void dprint(int _level, const char *_fmt, ...)
+{
+    if (spiceqxl_io_port_debug_level == -1) {
+        if (getenv("XSPICE_IO_PORT_DEBUG_LEVEL")) {
+            spiceqxl_io_port_debug_level = atoi(
+                getenv("XSPICE_IO_PORT_DEBUG_LEVEL"));
+        } else {
+            spiceqxl_io_port_debug_level = 0;
+        }
+    }
+    if (spiceqxl_io_port_debug_level >= _level) {
+        va_list ap;
+        va_start(ap, _fmt);
+        vfprintf(stderr, _fmt, ap);
+        va_end(ap);
+    }
+}
 
 void xspice_init_qxl_ram(qxl_screen_t *qxl)
 {

commit 345c0b9818d5624858cfeb6b9ddba92d4eb64a0d
Author: Alon Levy <alevy@redhat.com>
Date:   Sat Jul 23 13:11:19 2011 +0300

    scripts/xspice: fix --cgdb

diff --git a/scripts/xspice b/scripts/xspice
index 48c680c..edf3203 100755
--- a/scripts/xspice
+++ b/scripts/xspice
@@ -27,9 +27,9 @@ def which(x):
             return candidate
     return None
 
-cgdb = which('cgdb') and os.path.exists(
+cgdb = which('cgdb') if os.path.exists(
     os.path.join(os.path.dirname(sys.modules[__name__].__file__),
-                 'configure.ac'))
+                 'Makefile.am')) else None
 
 def add_boolean(flag, *args, **kw):
     parser.add_argument(flag, action='store_const', const='1', default='0',

commit a596303cb1f6bfcbb3ea9575faa8e984c52eb5a8
Author: Alon Levy <alevy@redhat.com>
Date:   Sat Jul 23 12:55:10 2011 +0300

    scripts/xspice: fix to run

diff --git a/scripts/xspice b/scripts/xspice
index f6146b4..48c680c 100755
--- a/scripts/xspice
+++ b/scripts/xspice
@@ -90,7 +90,7 @@ var_args = ['port', 'tls_port', 'disable_ticketing',
     'x509_dir', 'sasl', 'cacert_file', 'x509_key_file', 'x509_key_password',
     'tls_ciphers', 'dh_file', 'password', 'image_compression',
     'jpeg_wan_compression', 'zlib_glz_wan_compression',
-    'playback_compression', 'streaming_video']
+    'streaming_video']
 for arg in var_args:
     if getattr(args, arg):
         os.environ['XSPICE_' + arg.upper()] = str(getattr(args, arg))

commit ec418d246d083cb5c2317d2f5f6a775de252a5b9
Author: Alon Levy <alevy@redhat.com>
Date:   Fri Jul 22 03:53:20 2011 +0300

    0.0.15: now with xspice!
    
    xspice is a new X server that is also a Spice server. See
    README.xspice for more information.
    
     + added configure options to accomodate an extra driver (spiceqxl_drv.so)
       built alongside existing qxl_drv.so
     + XSPICE define where the code could not be split easily (qxl_driver.c
       and qxl.h)
     - no functional changes to driver.
     + some small cleanups (still too many warnings)

diff --git a/configure.ac b/configure.ac
index c2bcc7d..e5eda8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-qxl],
-        [0.0.14],
+        [0.0.15],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-qxl])
 AC_CONFIG_SRCDIR([Makefile.am])

commit a84cc00d777ee2e078eae94f3f65f8174dba9bdd
Author: Alon Levy <alevy@redhat.com>
Date:   Fri Jul 22 04:33:40 2011 +0300

    add missing copyright headers

diff --git a/src/qxl_mem.c b/src/qxl_mem.c
index 705eb83..fed88ad 100644
--- a/src/qxl_mem.c
+++ b/src/qxl_mem.c
@@ -1,3 +1,25 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "qxl.h"
 #include "mspace.h"
 
diff --git a/src/spiceqxl_display.c b/src/spiceqxl_display.c
index b26bbfb..1e01268 100644
--- a/src/spiceqxl_display.c
+++ b/src/spiceqxl_display.c
@@ -1,3 +1,25 @@
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include <spice.h>
 
 #include "qxl.h"
diff --git a/src/spiceqxl_display.h b/src/spiceqxl_display.h
index 3194176..1113f6a 100644
--- a/src/spiceqxl_display.h
+++ b/src/spiceqxl_display.h
@@ -1,3 +1,25 @@
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #ifndef QXL_SPICE_DISPLAY_H
 #define QXL_SPICE_DISPLAY_H
 
diff --git a/src/spiceqxl_driver.c b/src/spiceqxl_driver.c
index d1c23a2..0b6392a 100644
--- a/src/spiceqxl_driver.c
+++ b/src/spiceqxl_driver.c
@@ -1,5 +1,31 @@
-/* most of the code is still in qxl_driver.c, but for clarity parts are moved
- * here, and only used / compiled if XSPICE is defined */
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/** \file spiceqxl_driver.c
+ * \author Alon Levy <alevy@redhat.com>
+ *
+ * most of the code is still in qxl_driver.c, but for clarity parts are moved
+ * here, and only used / compiled if XSPICE is defined
+ */
 
 #include "qxl.h"
 #include "spiceqxl_driver.h"
diff --git a/src/spiceqxl_driver.h b/src/spiceqxl_driver.h
index 25e4ce5..c1a7c48 100644
--- a/src/spiceqxl_driver.h
+++ b/src/spiceqxl_driver.h
@@ -1,3 +1,25 @@
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #ifndef SPICEQXL_DRIVER_H
 #define SPICEQXL_DRIVER_H 1
 
diff --git a/src/spiceqxl_inputs.c b/src/spiceqxl_inputs.c
index 86ce477..ae08a57 100644
--- a/src/spiceqxl_inputs.c
+++ b/src/spiceqxl_inputs.c
@@ -1,3 +1,25 @@
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 /* Handle inputs channel for spice, and register the X parts,
  * a mouse and a keyboard device pair.
  */
diff --git a/src/spiceqxl_inputs.h b/src/spiceqxl_inputs.h
index 03286cf..8b2c815 100644
--- a/src/spiceqxl_inputs.h
+++ b/src/spiceqxl_inputs.h
@@ -1,3 +1,25 @@
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #ifndef QXL_SPICE_INPUTS_H
 #define QXL_SPICE_INPUTS_H
 
diff --git a/src/spiceqxl_io_port.c b/src/spiceqxl_io_port.c
index 2c95091..3968d5f 100644
--- a/src/spiceqxl_io_port.c
+++ b/src/spiceqxl_io_port.c
@@ -1,3 +1,25 @@
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include <pthread.h>
 
 #include <spice.h>
diff --git a/src/spiceqxl_io_port.h b/src/spiceqxl_io_port.h
index 839ded6..0a452f1 100644
--- a/src/spiceqxl_io_port.h
+++ b/src/spiceqxl_io_port.h
@@ -1,3 +1,25 @@
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #ifndef SPICEQXL_IO_PORT_H
 #define SPICEQXL_IO_PORT_H
 
diff --git a/src/spiceqxl_main_loop.c b/src/spiceqxl_main_loop.c
index 8ab7767..fb12bd2 100644
--- a/src/spiceqxl_main_loop.c
+++ b/src/spiceqxl_main_loop.c
@@ -1,3 +1,25 @@
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include <sys/time.h>
 
 #include <spice.h>
diff --git a/src/spiceqxl_main_loop.h b/src/spiceqxl_main_loop.h
index 373756c..4cd5073 100644
--- a/src/spiceqxl_main_loop.h
+++ b/src/spiceqxl_main_loop.h
@@ -1,3 +1,25 @@
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #ifndef QXL_MAIN_LOOP_H
 #define QXL_MAIN_LOOP_H
 

commit 51003b11a0ad3ecccdb07319398ca7fb43af5271
Author: Alon Levy <alevy@redhat.com>
Date:   Fri Jul 22 02:25:46 2011 +0300

    xspice: fix make distcheck

diff --git a/Makefile.am b/Makefile.am
index 736b3c3..c19e659 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -30,3 +30,9 @@ ChangeLog:
 	$(CHANGELOG_CMD)
 
 dist-hook: ChangeLog INSTALL
+
+EXTRA_DIST = \
+	README			\
+	README.xspice
+
+DISTCHECK_CONFIGURE_FLAGS=--enable-xspice
diff --git a/src/Makefile.am b/src/Makefile.am
index 1777d56..2695614 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -64,10 +64,15 @@ spiceqxl_drv_la_SOURCES =				\
 	spiceqxl_spice_server.c			\
 	spiceqxl_spice_server.h			\
 	spiceqxl_io_port.c			\
+	spiceqxl_io_port.h			\
 	spiceqxl_driver.c			\
+	spiceqxl_driver.h			\
 	spiceqxl_main_loop.c			\
+	spiceqxl_main_loop.h		\
 	spiceqxl_display.c			\
+	spiceqxl_display.h			\
 	spiceqxl_inputs.c			\
+	spiceqxl_inputs.h			\
 	qxl_driver.c				\
 	qxl_image.c				\
 	qxl_surface.c				\

commit fa1700964a3da4cba85f61f4f563d39d09cd4cd4
Author: Alon Levy <alevy@redhat.com>
Date:   Fri Jul 22 01:20:58 2011 +0300

    xspice: add most options existing in qemu
    
    Add (copy from ui/spice-core.c) most of the options from qemu for
    spice server. Notable exception is per channel port selection, so
    the only sure way to verify all channels use the secure port (or
    the normal one) is to not set the port (or not set the secure port).
    
    About options: All options are settable either from environment
    variables called XSPICE_SOMETHING or by a SpiceSomething parameter
    in the Device section of the xorg configuration file. The xspice wrapper
    added later makes use of those environment variables and gives a
    more standard command line parameter interface.

diff --git a/src/Makefile.am b/src/Makefile.am
index e99e081..1777d56 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -61,6 +61,8 @@ spiceqxl_drv_la_LIBADD = uxa/libuxa.la
 
 spiceqxl_drv_la_SOURCES =				\
 	qxl.h					\
+	spiceqxl_spice_server.c			\
+	spiceqxl_spice_server.h			\
 	spiceqxl_io_port.c			\
 	spiceqxl_driver.c			\
 	spiceqxl_main_loop.c			\
diff --git a/src/qxl.h b/src/qxl.h
index 86927df..23ed2dc 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -101,6 +101,27 @@ typedef struct qxl_surface_t qxl_surface_t;
 enum {
 #ifdef XSPICE
     OPTION_SPICE_PORT = 0,
+    OPTION_SPICE_TLS_PORT,
+    OPTION_SPICE_ADDR,
+    OPTION_SPICE_X509_DIR,
+    OPTION_SPICE_SASL,
+    OPTION_SPICE_AGENT_MOUSE,
+    OPTION_SPICE_DISABLE_TICKETING,
+    OPTION_SPICE_PASSWORD,
+    OPTION_SPICE_X509_KEY_FILE,
+    OPTION_SPICE_STREAMING_VIDEO,
+    OPTION_SPICE_PLAYBACK_COMPRESSION,
+    OPTION_SPICE_ZLIB_GLZ_WAN_COMPRESSION,
+    OPTION_SPICE_JPEG_WAN_COMPRESSION,
+    OPTION_SPICE_IMAGE_COMPRESSION,
+    OPTION_SPICE_DISABLE_COPY_PASTE,
+    OPTION_SPICE_IPV4_ONLY,
+    OPTION_SPICE_IPV6_ONLY,
+    OPTION_SPICE_X509_CERT_FILE,
+    OPTION_SPICE_X509_KEY_PASSWORD,
+    OPTION_SPICE_TLS_CIPHERS,
+    OPTION_SPICE_CACERT_FILE,
+    OPTION_SPICE_DH_FILE,
 #endif
     OPTION_COUNT,
 };
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index f0d6541..2e5a9d6 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -43,6 +43,7 @@
 #include "spiceqxl_display.h"
 #include "spiceqxl_inputs.h"
 #include "spiceqxl_io_port.h"
+#include "spiceqxl_spice_server.h"
 #endif /* XSPICE */
 
 #if 0
@@ -52,9 +53,53 @@
 
 const OptionInfoRec DefaultOptions[] = {
 #ifdef XSPICE
-    { OPTION_SPICE_PORT,  "SpicePort",    OPTV_INTEGER, {5912}, FALSE },
+    { OPTION_SPICE_PORT,
+        "SpicePort",                OPTV_INTEGER,   {5900}, FALSE },
+    { OPTION_SPICE_TLS_PORT,
+        "SpiceTlsPort",             OPTV_INTEGER,   {0}, FALSE},
+    { OPTION_SPICE_ADDR,
+        "SpiceAddr",                OPTV_STRING,    {0}, FALSE},
+    { OPTION_SPICE_X509_DIR,
+        "SpiceX509Dir",             OPTV_STRING,    {0}, FALSE},
+    { OPTION_SPICE_SASL,
+        "SpiceSasl",                OPTV_BOOLEAN,   {0}, FALSE},
+    /* VVV qemu defaults to 1 - not implemented in xspice yet */
+    { OPTION_SPICE_AGENT_MOUSE,
+        "SpiceAgentMouse",          OPTV_BOOLEAN,   {0}, FALSE},
+    { OPTION_SPICE_DISABLE_TICKETING,
+        "SpiceDisableTicketing",    OPTV_BOOLEAN,   {0}, FALSE},
+    { OPTION_SPICE_PASSWORD,
+        "SpicePassword",            OPTV_STRING,    {0}, FALSE},
+    { OPTION_SPICE_X509_KEY_FILE,
+        "SpiceX509KeyFile",         OPTV_STRING,    {0}, FALSE},
+    { OPTION_SPICE_STREAMING_VIDEO,
+        "SpiceStreamingVideo",      OPTV_STRING,    {.str="filter"}, FALSE},
+    { OPTION_SPICE_PLAYBACK_COMPRESSION,
+        "SpicePlaybackCompression", OPTV_BOOLEAN,   {1}, FALSE},
+    { OPTION_SPICE_ZLIB_GLZ_WAN_COMPRESSION,
+        "SpiceZlibGlzWanCompression", OPTV_STRING,  {.str="auto"}, FALSE},
+    { OPTION_SPICE_JPEG_WAN_COMPRESSION,
+        "SpiceJpegWanCompression",  OPTV_STRING,    {.str="auto"}, FALSE},
+    { OPTION_SPICE_IMAGE_COMPRESSION,
+        "SpiceImageCompression",    OPTV_STRING,    {.str="auto_glz"}, FALSE},
+    { OPTION_SPICE_DISABLE_COPY_PASTE,
+        "SpiceDisableCopyPaste",    OPTV_BOOLEAN,   {0}, FALSE},
+    { OPTION_SPICE_IPV4_ONLY,
+        "SpiceIPV4Only",            OPTV_BOOLEAN,   {0}, FALSE},
+    { OPTION_SPICE_IPV6_ONLY,
+        "SpiceIPV6Only",            OPTV_BOOLEAN,   {0}, FALSE},
+    { OPTION_SPICE_X509_CERT_FILE,
+        "SpiceX509CertFile",        OPTV_STRING,    {0}, FALSE},
+    { OPTION_SPICE_X509_KEY_PASSWORD,
+        "SpiceX509KeyPassword",     OPTV_STRING,    {0}, FALSE},
+    { OPTION_SPICE_TLS_CIPHERS,
+        "SpiceTlsCiphers",          OPTV_STRING,    {0}, FALSE},
+    { OPTION_SPICE_CACERT_FILE,
+        "SpiceCacertFile",          OPTV_STRING,    {0}, FALSE},
+    { OPTION_SPICE_DH_FILE,
+        "SpiceDhFile",              OPTV_STRING,    {0}, FALSE},
 #endif
-    { -1,                 NULL,           OPTV_NONE,    {0},    FALSE }
+    { -1, NULL, OPTV_NONE, {0}, FALSE }
 };
 
 int
@@ -895,15 +940,6 @@ setup_uxa (qxl_screen_t *qxl, ScreenPtr screen)
 
 #ifdef XSPICE
 
-SpiceServer *xspice_get_spice_server(void)
-{
-    static SpiceServer *spice_server;
-    if (!spice_server) {
-        spice_server = spice_server_new();
-    }
-    return spice_server;
-}
-
 static void
 spiceqxl_screen_init(int scrnIndex, ScrnInfoPtr pScrn, qxl_screen_t *qxl)
 {
@@ -912,10 +948,7 @@ spiceqxl_screen_init(int scrnIndex, ScrnInfoPtr pScrn, qxl_screen_t *qxl)
     // Init spice
     if (!qxl->spice_server) {
         qxl->spice_server = xspice_get_spice_server();
-        // some common initialization for all display tests
-        spice_server_set_port(qxl->spice_server, qxl->options[OPTION_SPICE_PORT].value.num);
-        spice_server_set_noauth(qxl->spice_server); // TODO - take this from config
-        // TODO - parse rest of parameters (streaming, compression, jpeg, etc.) from config
+        xspice_set_spice_server_options(qxl->options);
         core = basic_event_loop_init();
         spice_server_init(qxl->spice_server, core);
         qxl_add_spice_display_interface(qxl);
diff --git a/src/spiceqxl_spice_server.c b/src/spiceqxl_spice_server.c
new file mode 100644
index 0000000..61f20d1
--- /dev/null
+++ b/src/spiceqxl_spice_server.c
@@ -0,0 +1,327 @@
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/** \file spiceqxl_spice_server.c
+ * \author Alon Levy <alevy@redhat.com>
+ *
+ * spice server helpers for spiceqxl.
+ */
+
+#include "qxl.h"
+#include "spiceqxl_spice_server.h"
+
+/* Single instance of spice server per Xorg executable.
+ */
+SpiceServer *xspice_get_spice_server(void)
+{
+    static SpiceServer *spice_server;
+    if (!spice_server) {
+        spice_server = spice_server_new();
+    }
+    return spice_server;
+}
+
+static
+int get_int_option(OptionInfoPtr options, int option_index,
+                   const char *env_name)
+{
+    if (getenv(env_name)) {
+        return atoi(getenv(env_name));
+    }
+    return options[option_index].value.num;
+}
+
+static
+const char *get_str_option(OptionInfoPtr options, int option_index,
+                           const char *env_name)
+{
+    if (getenv(env_name)) {
+        return getenv(env_name);
+    }
+    return options[option_index].value.str;
+}
+
+static
+int get_bool_option(OptionInfoPtr options, int option_index,
+                     const char *env_name)
+{
+    if (getenv(env_name)) {
+        /* we don't support the whole range of boolean true and
+         * false values documented in man xorg.conf, just the c
+         * convention - 0 is false, anything else is true, so
+         * just like a number. */
+        return !!atoi(getenv(env_name));
+    }
+    return options[option_index].value.bool;
+}
+
+#define X509_CA_CERT_FILE "ca-cert.pem"
+#define X509_SERVER_KEY_FILE "server-key.pem"
+#define X509_SERVER_CERT_FILE "server-cert.pem"
+
+/* config string parsing */
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+static int name2enum(const char *string, const char *table[], int entries)
+{
+    int i;
+
+    if (string) {
+        for (i = 0; i < entries; i++) {
+            if (!table[i]) {
+                continue;
+            }
+            if (strcmp(string, table[i]) != 0) {
+                continue;
+            }
+            return i;
+        }
+    }
+    return -1;
+}
+
+static int parse_name(const char *string, const char *optname,
+                      const char *table[], int entries)
+{
+    int value = name2enum(string, table, entries);
+
+    if (value != -1) {
+        return value;
+    }
+    fprintf(stderr, "spice: invalid %s: %s\n", optname, string);
+    exit(1);
+}
+
+static const char *stream_video_names[] = {
+    [ SPICE_STREAM_VIDEO_OFF ]    = "off",
+    [ SPICE_STREAM_VIDEO_ALL ]    = "all",
+    [ SPICE_STREAM_VIDEO_FILTER ] = "filter",
+};
+#define parse_stream_video(_name) \
+    name2enum(_name, stream_video_names, ARRAY_SIZE(stream_video_names))
+
+static const char *compression_names[] = {
+    [ SPICE_IMAGE_COMPRESS_OFF ]      = "off",
+    [ SPICE_IMAGE_COMPRESS_AUTO_GLZ ] = "auto_glz",
+    [ SPICE_IMAGE_COMPRESS_AUTO_LZ ]  = "auto_lz",
+    [ SPICE_IMAGE_COMPRESS_QUIC ]     = "quic",
+    [ SPICE_IMAGE_COMPRESS_GLZ ]      = "glz",
+    [ SPICE_IMAGE_COMPRESS_LZ ]       = "lz",
+};
+#define parse_compression(_name)                                        \
+    parse_name(_name, "image compression",                              \
+               compression_names, ARRAY_SIZE(compression_names))
+
+static const char *wan_compression_names[] = {
+    [ SPICE_WAN_COMPRESSION_AUTO   ] = "auto",
+    [ SPICE_WAN_COMPRESSION_NEVER  ] = "never",
+    [ SPICE_WAN_COMPRESSION_ALWAYS ] = "always",
+};
+#define parse_wan_compression(_name)                                    \
+    parse_name(_name, "wan compression",                                \
+               wan_compression_names, ARRAY_SIZE(wan_compression_names))
+
+void xspice_set_spice_server_options(OptionInfoPtr options)
+{
+    /* environment variables take precedense. If not then take
+     * parameters from the config file. */
+    int addr_flags;
+    int len;
+    spice_image_compression_t compression;
+    spice_wan_compression_t wan_compr;
+    int port = get_int_option(options, OPTION_SPICE_PORT, "XSPICE_PORT");
+    int tls_port =
+        get_int_option(options, OPTION_SPICE_TLS_PORT, "XSPICE_TLS_PORT");
+    const char *password =
+        get_str_option(options, OPTION_SPICE_PASSWORD, "XSPICE_PASSWORD");
+    int disable_ticketing =
+        get_bool_option(options, OPTION_SPICE_DISABLE_TICKETING, "XSPICE_DISABLE_TICKETING");
+    const char *x509_dir =
+        get_str_option(options, OPTION_SPICE_X509_DIR, "XSPICE_X509_DIR");
+    int sasl = get_bool_option(options, OPTION_SPICE_SASL, "XSPICE_SASL");
+    const char *x509_key_file_base =
+        get_str_option(options, OPTION_SPICE_X509_KEY_FILE,
+                       "XSPICE_X509_KEY_FILE");
+    char *x509_key_file = NULL;
+    const char *x509_cert_file_base =
+        get_str_option(options, OPTION_SPICE_X509_CERT_FILE,
+                       "XSPICE_X509_CERT_FILE");
+    char *x509_cert_file = NULL;
+    const char *x509_key_password =
+        get_str_option(options, OPTION_SPICE_X509_KEY_PASSWORD,
+                    "XSPICE_X509_KEY_PASSWORD");
+    const char *tls_ciphers =
+        get_str_option(options, OPTION_SPICE_TLS_CIPHERS,
+                    "XSPICE_TLS_CIPHERS");
+    const char *x509_cacert_file_base =
+        get_str_option(options, OPTION_SPICE_CACERT_FILE,
+                    "XSPICE_CACERT_FILE");
+    char *x509_cacert_file = NULL;
+    const char * addr =
+        get_str_option(options, OPTION_SPICE_ADDR, "XSPICE_ADDR");
+    int ipv4 =
+        get_bool_option(options, OPTION_SPICE_IPV4_ONLY, "XSPICE_IPV4_ONLY");
+    int ipv6 =
+        get_bool_option(options, OPTION_SPICE_IPV6_ONLY, "XSPICE_IPV6_ONLY");
+    const char *x509_dh_file =
+        get_str_option(options, OPTION_SPICE_DH_FILE, "XSPICE_DH_FILE");
+    int disable_copy_paste =
+        get_bool_option(options, OPTION_SPICE_DISABLE_COPY_PASTE,
+                        "XSPICE_DISABLE_COPY_PASTE");
+    const char *image_compression =
+        get_str_option(options, OPTION_SPICE_IMAGE_COMPRESSION,
+                       "XSPICE_IMAGE_COMPRESSION");
+    const char *jpeg_wan_compression =
+        get_str_option(options, OPTION_SPICE_JPEG_WAN_COMPRESSION,
+                       "XSPICE_JPEG_WAN_COMPRESSION");
+    const char *zlib_glz_wan_compression =
+        get_str_option(options, OPTION_SPICE_ZLIB_GLZ_WAN_COMPRESSION,
+                       "XSPICE_ZLIB_GLZ_WAN_COMPRESSION");


Reply to: