Commit Graph

1953 Commits

Author SHA1 Message Date
Jonathon Jongsma
ff97799487 Move RedsMigSpice to main-channel.h
This is the place that needs the complete type definition. If it is
defined in reds.h, it can create circular references.
2015-08-11 17:24:36 +02:00
Jonathon Jongsma
0eaf34c04b Cleanup: move static function declarations out of header
It doesn't make much sense to have static function declarations in a
header, even a private header. So move them down into the source file.
2015-08-11 17:24:36 +02:00
Marc-André Lureau
e4bbdc3391 worker: remove unused preload_group_id 2015-08-11 17:24:36 +02:00
Marc-André Lureau
26dc05edc4 channel: minor simplification 2015-08-11 17:24:36 +02:00
Marc-André Lureau
6a38af37fc server: remove unused CursorData 2015-08-11 17:24:36 +02:00
Marc-André Lureau
3da1e1ed0c server: use more const CoreInterface 2015-08-11 17:24:36 +02:00
Marc-André Lureau
e3187ebd29 worker: move red_init_*() functions
There is a red_init() methods, we can group all the red_init_*() calls
in it rather than calling red_init() followed by all these calls in our
main function.
2015-08-11 17:21:59 +02:00
Uri Lublin
7c7567292f spice-common: codegen: ptypes.py: keep attribute names in sets
This fixes the build on RHEL-6
2015-08-04 20:36:04 +03:00
Christophe Fergeau
de66161c6e Adjust to new SpiceImageCompress name
This has been renamed to SpiceImageCompression in order to avoid clashes
with older spice-server in the SPICE_IMAGE_COMPRESS_ namespace. This
commit is a straight rename of SpiceImageCompress to
SpiceImageCompression and SPICE_IMAGE_COMPRESS_ to
SPICE_IMAGE_COMPRESSION_
2015-07-29 17:40:48 +02:00
Jeremy White
04d9d79013 Add libraries such as -lm and -lpthread to the tests build line.
This prevents a compile error on Debian Jessie, from git, such as this:
/usr/bin/ld: test_playback.o: undefined reference to symbol 'sin@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line

This is fairly subtle, and Debian specific.  It only happens when you use
autoreconf to generate a new libtool script.  Debian patches that script
to require an explicit setting to link with all dependent libraries.

It should be harmless on other distros, and it does save us Debian guys some
hassle.
2015-07-28 10:12:46 -05:00
Frediano Ziglio
40537f6a3e reds: Assure we don't have stale statistic files before trying to create a new one
If a previous Qemu executable is not able to delete the statistic file
on the next creation with same name (statitics file are based on pid
numbers so if pid get reused for another Qemu process you get the same
name) it fails as you can't open a file with 0444 permissions (these
are the permission used to create these files).
This patch assure there are no stale file trying to remove it before the
creation of the new one. As file is based on pid and name used for spice
you are not deleting another file.

Fixes: rhbz#1177326

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-20 11:19:28 +02:00
Francois Gouget
660bee0e93 server: spice_debug() messages don't need a trailing '\n'.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-07-20 11:15:55 +02:00
Francois Gouget
212ee28a64 server: Weakly try to get a better latency value for the bandwidth test.
NET_TEST_WARMUP_BYTES is 0 so the warmup ping is the same as the one we
use to measure the latency. Even if it was not, the actual latency would
be the MIN() of both anyway so we might as well use both roundtrip times
to ward off latency jitter a bit.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-07-20 11:15:55 +02:00
Francois Gouget
1a8a7df286 server: Don't reset the latency before showing it in the invalid net test error message.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-07-20 11:15:55 +02:00
Pavel Grunt
071647780d Use desired image compression for the first image
red_marshall_image() allows to use other than QUIC compression only
when auto_lz or auto_glz image compression is set. Other images don't
have the problem because they are compressed using red_compress_image()
2015-07-13 11:52:09 +02:00
Javier Celaya
c914e96fb4 Handle preferred image compression messages 2015-06-30 16:49:29 +02:00
Javier Celaya
22c40b9d1f Use image compress constants from spice-protocol 2015-06-30 16:49:29 +02:00
Francois Gouget
aa22138d05 server: Remove the rate_control_is_active field from MJpegEncoder.
It is redundant with the corresponding callbacks.
2015-06-29 18:04:12 +02:00
Francois Gouget
a45ff74b3d server: Fix an incorrect time calculation.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-06-29 17:50:26 +02:00
Francois Gouget
4ad3025249 HAVE_CLOCK_GETTIME is not used so remove it.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-06-29 17:50:26 +02:00
Sandy Stutsman
e4a42e50c2 Lock the pixmap image cache for the entire fill_bits call
Locking the individual calls that access the pixmap cache in fill_bits is
not adequately thread safe.  Often a windows guest with multiple monitors
will be sending the same image via different threads.  Both threads can
be in fill_bits at the same time making changes to the cache for the same
image.  This can result in images being deleted before all the client
channels are finished with them or with the same image being send multiple
times.  Here's what can happen with out the lock in fill_bits

On the server in red_worker.c:fill_bits
 Thread 1 calls pixmap_cache_hit for Image A and finds it isn't in cache
 Thread 2 calls pixmap_cache_hit for Image A and finds it isn't in cache

 Thread 1 adds Image 1 to pixmap_cache (1x)
 Thread 2 adds Image 1 to pixmap_cache (2x)

On the client
 Channel 1 adds Image A to image_cache (1x)
 Channel 2 replaces Image A in image_cache (1x)

On server
 Thread 1 sends Image A rendering commands
 Thread N removes Image A from pixmap_cache (image remains - 1x)
 Thread 2 sends Image A rendering commands

On client
 Channe1 renders from Image A
 Channel N removes Image a from image_cache (image is completely removed)
 Channel2 render command hangs waiting for Image A
2015-06-29 13:21:14 +02:00
Frediano Ziglio
6d4e58f70d server: allows to set maximum monitors
spice-server will attempt to limit number of monitors.
Guest machine can send monitor list it accepts. Limiting the number sent
by guest will limit the number of monitors client will try to enable.
The guest usually see client monitors enabled and start using it so
not seeing client monitor won't try to enable more monitor.
In this case the additional monitor guest can support will always be
seen as heads with no attached monitors.
This allows limiting monitors number without changing guest drivers.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-06-26 16:17:42 +02:00
Christophe Fergeau
878d81dae4 build-sys: Fix build with automake < 1.13
AC_CONFIG_MACRO_DIRS is not available with older automake versions,
which causes autogen.sh failures on RHEL6. m4_include() can be used
instead.
2015-06-26 16:01:34 +02:00
Francois Gouget
f017d7a421 mjpeg: Convert rate control checks to asserts in encoder
The checks would lead the reader to think these functions can be called
when bit rate control is off when in fact they are only called when it
is active.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-06-22 19:47:58 +02:00
Francois Gouget
03af3f382d server: Refresh the input fps every 5 second, without a timer.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-06-22 19:47:58 +02:00
Christophe Fergeau
e0a5cb591c build-sys: Use spice-common m4 macro for lz4
This will allow to share this detection code with spice-gtk.
2015-06-22 19:47:58 +02:00
Christophe Fergeau
27636d80de build-sys: Use spice-common m4 macro for opengl
This factorizes a bit of configure.ac m4 code.
2015-06-22 19:47:58 +02:00
Christophe Fergeau
fe2ca14fc2 build-sys: Use spice-common m4 macro for smartcard
Besides the code factorization, this will allow smartcard support to be
automatically enabled if libcacard is present and --disable-smartcard is
not used.
2015-06-22 19:47:58 +02:00
Marc-André Lureau
55bc82f070 reds: increase listening socket backlog
With a TCP socket, the backlog doesn't seem to matter much,
perhaps because of latency or underlying protocol behaviour. However,
on UNIX socket, it is fairly easy to reach the backlog limit and the
client will get an EAGAIN error (but not ECONNREFUSED as stated in
listen(7)) that is not easy to deal with: attempting to reconnect in a
loop might busy-loop forever as there are no guarantee the server will
accept new connections, so it will be inherently racy.

Typically, Spice server can easily have up to 15 concurrent incoming
connections that are established during initialization of the session.
To improve the situation, raise the backlog limit to the default maximum
system value, which is 128 on Linux.
2015-06-17 15:58:56 +02:00
Cédric Bosdonnat
939e643c2a Add password length check
Don't allow setting a too long password.
2015-06-16 09:53:35 +02:00
Frediano Ziglio
3c77eaa1d7 Use spice_malloc instead of malloc
Do not just check and give warning before crashing the program
accessing a NULL pointer but use spice_malloc which exits with a
proper message.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-06-16 09:53:35 +02:00
Jonathon Jongsma
a94836a467 Remove duplicate streaming enumeration
There is already a enumeration in a public header that defines the
different streaming options, so there's no need to duplicate that
enumeration internally. Just use the public enum values.
2015-06-15 13:08:42 -05:00
Jonathon Jongsma
edc52a4ead Use AS_HELP_STRING for configure options 2015-06-15 13:08:42 -05:00
Frediano Ziglio
7b0ad8d44c Fix typo in comment
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-06-11 16:54:41 +02:00
Frediano Ziglio
6ec714e855 Use MIN macro to compute a minimum
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-06-11 16:54:41 +02:00
Javier Celaya
7a081a7ced LZ4: warn if trying to set lz4 but not supported 2015-06-11 16:45:52 +02:00
Francois Gouget
0feb705cbf server: Remove an unused structure. 2015-06-09 16:36:16 +02:00
Marc-André Lureau
f10de4bc08 sound: do not modify client state on migration
During migration, a volume jump is observed by the client. This is due
to qemu setting up destination server with default sound state, and the
server sending it after the client is connected. The volume is later
restored after migration is finished so there is no need to send this
default state values on connection.

Tested with both AC97 & HDA devices.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1012868
2015-06-04 17:49:30 +02:00
Christophe Fergeau
05502a9440 build-sys: Pass --enable-python-checks when running autogen.sh
This will tell spice-common configure.ac to test for the availability of
python-six when building from git.
2015-04-23 10:38:24 +02:00
Christophe Fergeau
d8b5f1861a Update spice-common submodule
This fixes a few issues with older python-six versions:

Christophe Fergeau (2):
      configure.ac: Check for needed python modules for git builds
      codegen: Use six.PY3 rather than six.PY2
2015-04-23 10:37:46 +02:00
Christophe Fergeau
f80eef8f9c build-sys: Replace cpu detection error with warning
configure.ac currently errors out when trying to build on
non-x86/non-ARM CPUs. Since the previous commits improved
big endian support a lot, this commit replaces the error
with a warning at configure time to make testing on big
endian platforms easier.
2015-04-10 20:24:15 +02:00
Christophe Fergeau
5b813b4340 build-sys: Remove unused 'X86_64' conditional
X86_64 was defined as an AM_CONDITIONAL, but then nothing was using it.
This commit gets rid of it.
2015-04-10 20:24:15 +02:00
Christophe Fergeau
59c6c829e7 ppc: Fix glz magic endianess
This is a modified version of a patch initially by Erlon R. Cruz
<erlon.cruz@br.flextronics.com>
2015-04-10 20:24:15 +02:00
Christophe Fergeau
f55f73b702 ppc: Fixing endianness for channel messages
This is a modified version of a patch initially from
Erlon R. Cruz <erlon.cruz@br.flextronics.com>
2015-04-10 20:24:15 +02:00
Christophe Fergeau
418a56edc9 ppc: Update spice-common for endianness-related fixes
Alexander Wauck (1):
      Make spice_codegen.py work on both Python 2 and 3

Christophe Fergeau (17):
      Remove unused header file
      build-sys: Remove unused X check
      build-sys: Remove unused win32 check
      build-sys: Remove unused WITH_SMARTCARD conditional
      build-sys: Small cleanup of AM_CPPFLAGS
      build-sys: Add fallback for AS_VAR_APPEND
      build-sys: Move posix checks to a separate m4 macro
      build-sys: Move smartcard check to m4 macro
      build-sys: Move celt check to m4 macro
      build-sys: Move opus check to m4 macro
      build-sys: Move opengl check to m4 macro
      build-sys: Move pixman check to m4 macro
      Remove unused 'invers' arg from canvas_get_*
      Remove redundant #if defined(SW_CANVAS_CACHE) ||
defined(SW_CANVAS_IMAGE_CACHE)
      Remove another redundant (SW_CANVAS_CACHE) ||
(SW_CANVAS_IMAGE_CACHE) #ifdef
      Get rid of SW_CANVAS_IMAGE_CACHE
      ssl_verify: Move wincrypt.h related #ifdef closer to the include

Erlon Cruz (2):
      ppc: Fix lz magic endianness
      ppc: build-sys: Add big-endian support

Fabiano Fidêncio (1):
      Fix typo in pixman_image_get_stride() function

Javier Celaya (6):
      LZ4: Fix output buffer size
      LZ4: Adjust reading the top_down flag
      LZ4: Decode the image format from the stream
      LZ4: Fix the row alignment when it is not on a 32bit boundary
      LZ4: Add support for 24bit pixman surfaces
      LZ4: Do not include arpa/inet.h in Windows builds

Victor Toso (1):
      common: fix build with mingw
2015-04-10 20:24:05 +02:00
Christophe Fergeau
14b7f5c8cf ppc: Fix endianness handling in initial SPICE connection
This commit fixes enough endianness issues that it's possible to
connect to a spice-server/qemu running on a big-endian box with a client
running on a little-endian machine.

I haven't tested more than getting to the bios/bootloader and typing a
bit on the keyboard as I did not manage to boot a distro afterwards :(

This is based on patches send by Erlon R. Cruz
<erlon.cruz@br.flextronics.com>
2015-04-10 20:16:54 +02:00
Uri Lublin
b2c48e7eba m4: WARN FLAGS: Drop -Wenum-compare
My RHEL-6 gcc (4.4.7) complains a lot about it:
   cc1: warning: command line option "-Wenum-compare" is
   valid for C++/ObjC++ but not for C

For older gcc version (e.g. 4.4.7), man gcc says
-Wenum-compare is "C++ and Objective-C++ only".

For newer gcc (e.g. 4.9.2), man gcc says
"In C this warning is enabled by -Wall."
2015-03-15 13:57:12 +02:00
Fabiano Fidêncio
6b4c036bdb Do not compress bitmaps on UNIX socket
On UNIX socket do not perform unnecessary image compression
2015-02-25 17:18:29 +01:00
Fabiano Fidêncio
423fbe9fcd tests: Fix build on Hurd
As PATH_MAX is not defined on Hurd, let's check for it and define
whenever it is necessary.

https://bugs.freedesktop.org/show_bug.cgi?id=74313
2015-02-24 15:39:24 +01:00
Uri Lublin
0c1f5b00e7 char-device: spice_char_device_write_to_device: protect against recursion
This fixes Spice's smart card support and is related to
commit 697f3214fd.

Reported-by: Swapna Krishnan <skrishna@redhat.com>

Recursion is now possible starting with spice_char_device_write_to_device
going through spice_char_device_wakeup (after going through qemu),
calling again to spice_char_device_write_to_device.

The protecting code is the same as the one protecting the read path.

This function call loop makes the program to abort with the following messages:

  usb-ccid: chardev: unexpected message of type 3000000
  qemu: qemu_mutex_lock: Resource deadlock avoided

Backtrace:

(gdb) bt
* #0  0x00007ffff3fc78c7 in raise () from /lib64/libc.so.6
* #1  0x00007ffff3fc952a in abort () from /lib64/libc.so.6
* #2  0x0000555555969a95 in error_exit (err=35,
*     msg=0x5555559f8c90 <__func__.5119> "qemu_mutex_lock")
*     at util/qemu-thread-posix.c:48
* #3  0x0000555555969b82 in qemu_mutex_lock (mutex=0x5555562c4d60)
*     at util/qemu-thread-posix.c:79
* #4  0x0000555555714771 in qemu_chr_fe_write (s=0x5555562c4d60,
*     buf=0x7fffffffd2a0 "", len=12) at qemu-char.c:219
* #5  0x000055555586be49 in ccid_card_vscard_send_msg (s=0x5555565c5f80,
*     type=VSC_Error, reader_id=0, payload=0x7fffffffd2e0 "", length=4)
*     at hw/usb/ccid-card-passthru.c:75
* #6  0x000055555586bf00 in ccid_card_vscard_send_error (s=0x5555565c5f80,
*     reader_id=0, code=VSC_GENERAL_ERROR) at
*     hw/usb/ccid-card-passthru.c:91
* #7  0x000055555586c559 in ccid_card_vscard_handle_message (
*     card=0x5555565c5f80, scr_msg_header=0x5555565c6008)
*     at hw/usb/ccid-card-passthru.c:254
* #8  0x000055555586c72f in ccid_card_vscard_read (opaque=0x5555565c5f80,
*     buf=0x5555565034b0 "", size=12) at hw/usb/ccid-card-passthru.c:289
* #9  0x00005555557149db in qemu_chr_be_write (s=0x5555562c4d60,
*     buf=0x5555565034b0 "", len=12) at qemu-char.c:305
* #10 0x000055555571cde5 in vmc_write (sin=0x5555562c4e78,
*     buf=0x5555565034b0 "", len=12) at spice-qemu-char.c:41
* #11 0x00007ffff4fa86aa in spice_char_device_write_to_device (
*     dev=0x55555657f210) at char_device.c:462
* #12 0x00007ffff4fa9b48 in spice_char_device_wakeup (dev=0x55555657f210)
*     at char_device.c:862
* #13 0x00007ffff4ff7658 in spice_server_char_device_wakeup
*     (sin=0x5555562c4e78) at reds.c:2955
* #14 0x000055555571d1d2 in spice_chr_write (chr=0x5555562c4d60,
*     buf=0x7fffffffd560 "", len=12) at spice-qemu-char.c:189
* #15 0x0000555555714789 in qemu_chr_fe_write (s=0x5555562c4d60,
*     buf=0x7fffffffd560 "", len=12) at qemu-char.c:220
* #16 0x000055555586be49 in ccid_card_vscard_send_msg (s=0x5555565c5f80,
*     type=VSC_Error, reader_id=0, payload=0x7fffffffd5a0 "", length=4)
*     at hw/usb/ccid-card-passthru.c:75
* #17 0x000055555586bf00 in ccid_card_vscard_send_error
* (s=0x5555565c5f80,
*     reader_id=0, code=VSC_SUCCESS) at hw/usb/ccid-card-passthru.c:91
* #18 0x000055555586c4fc in ccid_card_vscard_handle_message (
*     card=0x5555565c5f80, scr_msg_header=0x5555565c6008)
*     at hw/usb/ccid-card-passthru.c:242
* #19 0x000055555586c72f in ccid_card_vscard_read (opaque=0x5555565c5f80,
*     buf=0x5555565034b0 "", size=12) at hw/usb/ccid-card-passthru.c:289
* #20 0x00005555557149db in qemu_chr_be_write (s=0x5555562c4d60,
*     buf=0x5555565034b0 "", len=12) at qemu-char.c:305
* #21 0x000055555571cde5 in vmc_write (sin=0x5555562c4e78,
*     buf=0x5555565034b0 "", len=12) at spice-qemu-char.c:41
* #22 0x00007ffff4fa86aa in spice_char_device_write_to_device (
*     dev=0x55555657f210) at char_device.c:462
* #23 0x00007ffff4fa8d37 in spice_char_device_write_buffer_add (
*     dev=0x55555657f210, write_buf=0x555556501f70) at char_device.c:597
* #24 0x00007ffff501142d in smartcard_channel_write_to_reader (
*     write_buf=0x555556501f70) at smartcard.c:669
* #25 0x00007ffff501034c in smartcard_char_device_notify_reader_add (
*     st=0x55555657ef00) at smartcard.c:335
* #26 0x00007ffff50112b3 in smartcard_add_reader (scc=0x555556493ee0,
*     name=0x5555565023cc "E-Gate 0 0") at smartcard.c:642
* #27 0x00007ffff50118d2 in smartcard_channel_handle_message (
*     rcc=0x555556493ee0, type=101, size=22, msg=0x5555565023c0 "\003")
*     at smartcard.c:757
* #28 0x00007ffff4fbc168 in red_peer_handle_incoming
*     (stream=0x555556588250, handler=0x555556497ff0) at red_channel.c:308
* #29 0x00007ffff4fbc231 in red_channel_client_receive
*     (rcc=0x555556493ee0) at red_channel.c:326
* #30 0x00007ffff4fc0019 in red_channel_client_event (fd=59, event=1,
*     data=0x555556493ee0) at red_channel.c:1574
* #31 0x00005555558b6076 in watch_read (opaque=0x5555565002f0)
*     at ui/spice-core.c:101
* #32 0x00005555558e8d48 in qemu_iohandler_poll (pollfds=0x5555562b7630,
*     ret=2) at iohandler.c:143
* #33 0x00005555558e89a4 in main_loop_wait (nonblocking=0) at
* main-loop.c:495
* #34 0x00005555557219b0 in main_loop () at vl.c:1794
* #35 0x0000555555729257 in main (argc=40, argv=0x7fffffffddc8,
*     envp=0x7fffffffdf10) at vl.c:4350
2015-02-08 13:13:46 +02:00