Commit Graph

3887 Commits

Author SHA1 Message Date
Frediano Ziglio
d701fac78f dispatcher: Define pollfd variable only if needed
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-06-25 13:12:04 +01:00
Frediano Ziglio
9663ae6785 Do not use bzero
Not defined in MingW.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-06-25 13:12:04 +01:00
Frediano Ziglio
9541cd2fec Use PRIxPTR constant for string formatting
These constants are meant to be used in format string for size_t
types. Use them for portability.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2018-06-25 09:56:37 +01:00
Christophe Fergeau
47ca1f0da0 channel: Remove unused 3rd red_channel_register_client_cbs() arg
It was probably meant to be used as a "user_data" argument for the
various callbacks, but turns out not to be used.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-21 17:54:27 +01:00
Frediano Ziglio
0083207b25 sound: Do not pass unused pointer
Client callbacks in sound channels do not use registered
data so don't pass a valid pointer making clear from
source that the parameter is not used.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-21 17:52:00 +01:00
Christophe Fergeau
8822161833 ssl: Allow to use ECDH ciphers with OpenSSL 1.0
Without an explicit call to SSL_CTX_set_ecdh_auto(reds->ctx, 1), OpenSSL
1.0 (still used by el7) would not use ECDH ciphers (this is now
automatic with OpenSSL 1.1.0). This commit adds this missing call. It's
based on a suggestion from David Jasa

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=1566597
2018-06-20 18:17:02 +02:00
Frediano Ziglio
dbc4bcb24b red-worker: Remove not used include
poll is not used anymore by this file.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Lukáš Hrázký <lhrazky@redhat.com>
2018-06-20 14:20:59 +01:00
Frediano Ziglio
d9689030ec sound: Reduce conditional compilation
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Lukáš Hrázký <lhrazky@redhat.com>
2018-06-20 14:20:44 +01:00
Uri Lublin
3b8e93c7ea spice-common submodule: update url (add .git at the end)
With the move to gitlab.freedesktop.org the spice-common submodule
url changed, and now ends with .git

Update .gitmodules to reflect that.

Without this patch git submodule update (and ./autogen.sh)
fails on RHEL-7 (git version 1.8.3).
On Fedora 28 (git version 2.17.1) it succeeds as it's successfully
redirecting to spice-common.git url.

With git version 1.8.3:
$ git submodule update
Cloning into 'spice-common'...
error: RPC failed; result=22, HTTP code = 404
fatal: The remote end hung up unexpectedly
Clone of 'https://gitlab.freedesktop.org/spice/spice-common' into submodule path 'spice-common' failed

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-20 14:08:35 +01:00
Christophe Fergeau
4b940123fc build: Use SPICE_CHECK_CELT051 in configure.ac
spice-common provides a m4 macro to check for celt, but spice-server is
not using it. With the recent disabling of celt in spice-common, the
default in spice-server got out of sync. It's better to use the same check
everywhere, even though in spice-server its only use is to show
--enable-celt051 in --help output.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-20 13:55:16 +01:00
Snir Sheriber
9f5859c3ba Support h265 in stream-channel
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-20 03:18:45 +01:00
Frediano Ziglio
ab9e194c04 ci: Add make distcheck test
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2018-06-19 09:29:15 +01:00
Frediano Ziglio
cf9bdd532d build: Remove unsupported --enable-automated-tests option on make distcheck
--enable-automated-tests option was removed in commit 6517ea5cbb
("test-display-base: Always compile with AUTOMATED_TESTS enabled").

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-06-18 16:28:33 +01:00
Christophe Fergeau
f5785db105 Update spice-common submodule
This brings in the following changes:

Christophe Fergeau (21):
      quic: Remove configurable RLE_PRED
      quic: Remove configurable PRED
      quic: Get rid of QUIC_RGB #define
      quic: Get rid of RLE_STAT #define
      quic: Get rid of RLE #define
      quic: Factor common code
      quic: Introduce CommonState *state variable in templates
      quic: s/decorrelate_drow/correlate_row
      quic: Add macros to make quic_tmpl.c much closer to quic_rgb_tmpl.c
      quic: Remove unused argument in uncompress_row{0, }
      quic: Use channel->correlate_row in macros
      quic: Add test case for compression/decompression
      build: Ensure we link with -lm if needed
      build: Disable celt 0.5.1 by default
      build: By default, error out if Opus is missing
      build: Use AM_COND_IF
      build: Remove checks for functions which are never called
      build: Remove bitops.h
      build: Move client sources to libspice_common_client_la_SOURCES
      meson: Support auto/true/false for optional dependencies
      meson: Remove check for vfork

Eduardo Lima (Etrunko) (7):
      build: Remove FIXME_SERVER_SMARTCARD hack
      Fix demarshaller code generator
      Fix field names for Smartcard protocol structures
      Fix cast to spice_marshaller_item_free_func function
      Bump glib requirements to 2.38
      test-quic: Fix -Wsign-compare warning
      Add support for building with meson/ninja

Frediano Ziglio (19):
      codegen: Add some comments
      codegen: Removed unused get_type methods
      protocol: Use a typedef to specify stream_id type
      lz: Move ENCODE_PIXEL for RGB24 and RGB32 to a common place
      Fix integer overflows computing sizes
      Write a small test to test possible crash
      Avoid integer overflow computing image sizes
      Fix generation of Smartcard channel
      test-overflow: Remove a leak in the test
      marshaller: Remove initial underscore from static function
      codegen: Remove duplicate client and server code from ChannelType::resolve
      Check for messages with duplicate names inside a channel
      Check for messages with duplicate values inside a channel
      lz: Optimise SAME_PIXEL for RGB16
      lz: Inline GET_{r,g,b} macros
      quic: Remove 'no-inline' hack
      quic: Remove some too strict asserts in hot paths
      quic: Fix endianness encoding
      quic: Use __builtin_clz if available

Jonathon Jongsma (2):
      Remove extra self parameter from member function
      miLineArc(): initialize edge1, edge2

Victor Toso (1):
      messages: document limitation of id in StreamCreate
2018-06-18 17:05:39 +02:00
Christophe Fergeau
5d942a47da build: Explicitly disable celt051 when running make distcheck
With spice-common commit 72b0d603e12, SPICE_CHECK_CELT051 will error out
if celt051-devel is installed, but neither --enable-celt051 nor
--disable-celt051 are specified. This could be a problem when running
make distcheck, so this commit adds --disable-celt051 so that we never
hit that error.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-06-18 14:44:15 +01:00
Frediano Ziglio
83fd1bb4ff Use "base" as pipe item base field name
Most of pipe items use this name for the base field.
This also allows to use SPICE_UPCAST macros instead of a long
SPICE_CONTAINEROF.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-18 13:40:51 +01:00
Frediano Ziglio
b93173c1e0 reds: Remove possible alignment warning using Clang
Although capabilities inside link message are handled as arrays
of 4 bytes unsigned integers we don't need capabilities to be
aligned to 4 bytes just to call g_memdup so use a pointer to
uint8_t instead.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-18 13:40:51 +01:00
Frediano Ziglio
0e5c4880ed red-channel-client: Do not allocate iovec array statically in the class
This array is just used locally in red_channel_client_handle_outgoing
so declare it there.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-18 13:40:35 +01:00
Christophe Fergeau
f1050bfc76 ci: Pass --enable-celt051 to configure
It's now mandatory to explicitly enable/disable CELT at configure time
if celt051-devel is installed.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-06-14 18:41:22 +01:00
Lukáš Hrázký
33d9c38554 Remove excessive logging of an area being drawn
Removes debug messages that are logged on every draw, spamming the log
excessively when debugging.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-08 19:21:31 +02:00
Frediano Ziglio
87965d8dea ci: Add some needed Valgrind suppression rule
From Gitlab CI:

=17955== 16 bytes in 1 blocks are possibly lost in loss record 725 of 2,079
==17955==    at 0x4C2DBAB: malloc (vg_replace_malloc.c:299)
==17955==    by 0x4011D17: tls_get_addr_tail.isra.0 (in /usr/lib64/ld-2.27.so)
==17955==    by 0x4017997: __tls_get_addr (in /usr/lib64/ld-2.27.so)
==17955==    by 0xEE4534B: gnutls_rnd (in /usr/lib64/libgnutls.so.30.20.2)
==17955==    by 0xEE1F254: ??? (in /usr/lib64/libgnutls.so.30.20.2)
==17955==    by 0xEE1F947: ??? (in /usr/lib64/libgnutls.so.30.20.2)
==17955==    by 0xEE231B5: ??? (in /usr/lib64/libgnutls.so.30.20.2)
==17955==    by 0xEE24D67: gnutls_handshake (in /usr/lib64/libgnutls.so.30.20.2)
==17955==    by 0xEBD4FEA: ??? (in /usr/lib64/gio/modules/libgiognutls.so)
==17955==    by 0x7463936: g_task_thread_pool_thread (gtask.c:1331)
==17955==    by 0x7A3E932: g_thread_pool_thread_proxy (gthreadpool.c:307)
==17955==    by 0x7A3DF29: g_thread_proxy (gthread.c:784)
==17955==    by 0x8284563: start_thread (in /usr/lib64/libpthread-2.27.so)
==17955==    by 0x859631E: clone (in /usr/lib64/libc-2.27.so)
==17955==
==17955== 32 bytes in 1 blocks are possibly lost in loss record 1,234 of 2,079
==17955==    at 0x4C2DBAB: malloc (vg_replace_malloc.c:299)
==17955==    by 0x4011D17: tls_get_addr_tail.isra.0 (in /usr/lib64/ld-2.27.so)
==17955==    by 0x4017997: __tls_get_addr (in /usr/lib64/ld-2.27.so)
==17955==    by 0xCAA5173: __cxa_get_globals (in /usr/lib64/libstdc++.so.6.0.25)
==17955==    by 0xCAA6186: __cxa_throw (in /usr/lib64/libstdc++.so.6.0.25)
==17955==    by 0xC601457: ??? (in /usr/lib64/libproxy.so.1.0.0)
==17955==    by 0xC5F6BB6: ??? (in /usr/lib64/libproxy.so.1.0.0)
==17955==    by 0xC5F7089: ??? (in /usr/lib64/libproxy.so.1.0.0)
==17955==    by 0xC5F7470: px_proxy_factory_get_proxies (in /usr/lib64/libproxy.so.1.0.0)
==17955==    by 0xC3E64E3: ??? (in /usr/lib64/gio/modules/libgiolibproxy.so)
==17955==    by 0x7463936: g_task_thread_pool_thread (gtask.c:1331)
==17955==    by 0x7A3E932: g_thread_pool_thread_proxy (gthreadpool.c:307)
==17955==    by 0x7A3DF29: g_thread_proxy (gthread.c:784)
==17955==    by 0x8284563: start_thread (in /usr/lib64/libpthread-2.27.so)
==17955==    by 0x859631E: clone (in /usr/lib64/libc-2.27.so)

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-05 15:25:13 +01:00
Frediano Ziglio
337dad1110 ci: Merge new Valgrind suppression rule from official glib.supp
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-05 15:25:07 +01:00
Frediano Ziglio
48f7188e3c glz-encoder: Avoid double byte swap sending image magic
encode_32 already deals with endian, don't swap twice.
Tested with a ppc64 server machine and a x64 client.

This looks the reverse of a previous patch (59c6c82) supposed to fix big
endian machine. encode_32 has been always:

static inline void encode_32(Encoder *encoder, unsigned int word)
{
    encode(encoder, (uint8_t)(word >> 24));
    encode(encoder, (uint8_t)(word >> 16) & 0x0000ff);
    encode(encoder, (uint8_t)(word >> 8) & 0x0000ff);
    encode(encoder, (uint8_t)(word & 0x0000ff));
}

while encode basically is similar to a putc on a FILE stream so is writing
numbers from host endian to big endian order.
The "main" endian (the one more tested since ever) is host/guest being
little endian. So if you call encode_32 with a 0x01020304 you get 4 bytes
in the order 1, 2, 3, 4.
Before and after 59c6c82 LZ_MAGIC was defined as:
  #define LZ_MAGIC (*(uint32_t *)"LZ  ")
so on little endian this was 0x4c, 0x5a, 0x20, 0x20 that is 0x20205a4c
which written through encode_32 become 0x20, 0x20, 0x5a, 0x4c so we can say
that at the end on the network we must have 0x20, 0x20, 0x5a, 0x4c.
On big endian however LZ_MAGIC got the value 0x4c5a2020 which written
through encode_32 get 0x4c, 0x5a, 0x20, 0x20 which is the opposite
expected. So patch 59c6c82 reverted the order having again 0x20, 0x20,
0x5a, 0x4c on the network.
However commit 5a7e587 (spice-common), in an attempt to avoid double
swapping on LZ, changed LZ_MAGIC to
  #define LZ_MAGIC 0x20205a4c
breaking endianness again for GLZ code.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-05 14:13:27 +01:00
Frediano Ziglio
90a11093e6 README: Update required spice protocol version
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-05 09:39:22 +01:00
Christophe Fergeau
612c94c61b worker: Remove display_is_connected()
It's only called once, and when it's called, we will have dereferenced
worker->display_channel a few lines before in
display_channel_set_monitors_config_to_primary(), so this cannot be
NULL. The 'if (worker->display_channel)' check can thus be removed, so
display_is_connected() becomes just red_channel_is_connected().

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24 17:29:06 +01:00
Christophe Fergeau
ca8ffdb8ef worker: Use more local vars in dev_create_primary_surface
There's already a 'display' variable equal to worker->display_channel
which is not consistently used. This commit also adds a new 'channel'
local variable to limit the number of  upcasts to RedChannel.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24 17:29:06 +01:00
Frediano Ziglio
c0f1c65b30 char-device: Avoid possible invalid function pointer cast
This is reported by GCC 8.0.1 (Fedora 28).
Instead of doing a possible invalid cast destroy and create the
queue again.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-05-10 22:30:52 +01:00
Frediano Ziglio
ee3ca34722 red-channel: Avoid possible invalid function pointer type cast
Avoid casting function pointer with different argument providing
a proper utility instead.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-05-10 22:30:52 +01:00
Frediano Ziglio
aac08a1642 event-loop: Avoid possible compiler warning
With GCC 8.0.1 (Fedora 28), cast to different function pointer
can lead to warnings, like:

  event-loop.c: In function ‘watch_update_mask’:
  event-loop.c:146:42: error: cast between incompatible function types from ‘gboolean (*)(GIOChannel *, GIOCondition,  void *)’ {aka ‘int (*)(struct _GIOChannel *, enum <anonymous>,  void *)’} to ‘gboolean (*)(void *)’ {aka ‘int (*)(void *)’} [-Werror=cast-function-type]
       g_source_set_callback(watch->source, (GSourceFunc)watch_func, watch, NULL);
                                          ^
  cc1: all warnings being treated as errors

As g_source_set_callback expect a function pointer which type
changes based on the type of source (so is expected) silent
the possible warning.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-05-10 22:30:52 +01:00
Snir Sheriber
6f19579254 docs: Update links in README and manual
Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-05-10 16:59:35 +03:00
Frediano Ziglio
04e7f512d2 glz-encoder: Do not discard top bits of lower part sending 64 bit ints
When GLZ code attempts to send a 64 bit integer the 8 top bit of
the lower (32 bits) part of the number are stripped due to a bug.

This was discovered by Zhongqiang Huang <useprxf@gmail.com>

Reported-by: Zhongqiang Huang <useprxf@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-04-24 15:58:43 +01:00
Frediano Ziglio
169d8462e3 stream-channel: Implements monitors_config
Although not necessary for a single monitor DisplayChannel implementation
this make the DisplayChannels more coherent from the client
point of view.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-04-20 21:32:04 +01:00
Victor Toso
12c2739b9e tests: add test-listen executable to gitignore
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-19 07:57:04 +01:00
Christophe Fergeau
d8b1098850 qxl: Remove 'blackness' and 'invers' put/get methods
SpiceWhiteness/SpiceBlackness/SpiceInvers are 3 typedef for the same
type, no need to have 3 identical red_put_xxx/red_get_xxx methods.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-17 20:17:32 +01:00
Christophe Fergeau
24094348dd qxl: Remove red_put_blend()
SpiceBlend is a typedef to SpiceCopy, and red_put_blend() and
red_put_copy() are identical, so we can add a #define red_put_blend
red_put_copy similar to the one we already have for red_get_blend.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-17 19:42:37 +01:00
Frediano Ziglio
357677af9a common-graphics-channel: Use manual flushing on stream to decrease packet fragmentation
In order to use the new TCP_CORK feature, disable auto flush.

Depending on channel implementation and purpose of the channel enabling
blindly for all channels could cause performance issues, specifically if
flush is not done at the right time.
CommonGraphicsChannel channels were tested to make sure is not that case.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-04-17 15:45:39 +01:00
Frediano Ziglio
4b1d33d384 red-stream: Implements flush using TCP_CORK
Cork is a system interface implemented by Linux and some *BSD systems to
tell the system that other data are expected to be written to a socket.
This allows the system to reduce network fragmentation waiting for network
packets to be complete.

Using some replay capture and some instrumentation resulted in a
bandwith reduction of 11% and a packet reduction of 56%.

The tests was done using replay utility so results could be a bit different
from real cases as:
- replay goes as fast as it can, for instance packets could
  be merged by the kernel decreasing packet numbers and a bit
  byte spent (this actually make the following improves worse);
- there are fewer channels (no much cursor, sound, etc).
The following tests shows count packet and total bytes from server to
client using a real network. I used a direct cable connection using 1gb
connection and 2 laptops.

cork: 537 1582240
cork: 681 1823754
cork: 524 1583287
cork: 538 1582350
no cork: 1329 1834630
no cork: 1290 1829094
no cork: 1289 1830164
no cork: 1317 1833589
no cork: 1320 1835705

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-04-17 15:45:35 +01:00
Frediano Ziglio
63d02ab10e red-stream: Define interface for manual flush
The writing to network was always immediate.
Every write in the stream causes a write to the OS.
This can have some penalty if you don't write large data as network
packets can be more fragmented or you encrypt data in smaller chunks
(when data are encrypted some padding is added then data is split in
multiple of encryption block which is usually the size of encryption
key and this is done for every write).
Define an interface to allow higher levels code to tell low level when
data should be sent to remote or when can wait more data.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-04-17 15:45:28 +01:00
Frediano Ziglio
ac05eee08a ci: Workaround bug in Valgrind detecting memcpy instead of memmove
Due to a bug in current packaged Valgrind in the CI (1:3.13.0-13.fc27)
check-valgrind is failing with:

==17986== Source and destination overlap in memcpy_chk(0x72c060, 0x72c068, 33)
==17986==    at 0x4C344F0: __memcpy_chk (vg_replace_strmem.c:1581)
==17986==    by 0x40E7E9: check_vmc_error_message (test-stream-device.c:166)
==17986==    by 0x40EFD4: test_stream_device_format_after_data (test-stream-device.c:349)
==17986==    by 0x7A012E9: test_case_run (gtestutils.c:2157)
==17986==    by 0x7A012E9: g_test_run_suite_internal (gtestutils.c:2241)
==17986==    by 0x7A0121A: g_test_run_suite_internal (gtestutils.c:2253)
==17986==    by 0x7A014C1: g_test_run_suite (gtestutils.c:2329)
==17986==    by 0x7A014E0: g_test_run (gtestutils.c:1594)
==17986==    by 0x40951A: main (test-stream-device.c:410)
==17986==

By default during CI build _FORTIFY_SOURCE is enabled, which turns memmove
into __memmove_chk, which is wrongly turned into __memcpy_chk when running
under Valgrind.
Setting _FORTIFY_SOURCE to 0 prevents the use of __memmove_chk, and avoids
triggering the Valgrind bug.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-04-17 12:16:14 +01:00
Christophe Fergeau
3ad15fb5ca Slight simplification of red_channel_client_push() logic
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-16 16:38:01 +01:00
Christophe Fergeau
050c1f55ab cursor: Rename cursor_marshall to red_marshall_cursor
The name is more consistent with red_marshall_cursor_init.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-16 11:46:32 +02:00
Christophe Fergeau
b547919190 cursor: Delay release of QXL guest cursor resources
There's an implicit API/ABI contract between QEMU and SPICE that SPICE
will keep the guest QXL resources alive as long as QEMU can hold a
pointer to them. This implicit contract was broken in 1c6e7cf7 "Release
cursor as soon as possible", causing crashes at migration time.
While the proper fix would be in QEMU so that spice-server does not need
to have that kind of knowledge regarding QEMU internal implementation,
this commit reverts to the pre-1c6e7cf7 behaviour to avoid a regression
while QEMU is being fixed.

This version of the fix is based on a suggestion from Frediano Ziglio.

https://bugzilla.redhat.com/show_bug.cgi?id=1540919

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-16 11:46:01 +02:00
Frediano Ziglio
2a3d562438 test-stream-device: Test we can read empty capabilities
Code can have problems reading empty messages, check we can
handle it.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-04-11 12:34:27 +01:00
Frediano Ziglio
262af0a920 stream-device: Handle capabilities
Handle capabilities from guest device.
Send capability to the guest when device is opened.
Currently there's no capabilities set on the message sent.
On the tests we need to discard the capability message before
reading the error.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-04-11 12:34:25 +01:00
Frediano Ziglio
4e27551f06 stream-device: Factor out function to fill message headers
This function will be reused to initialise different message
headers.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-04-11 12:34:14 +01:00
Frediano Ziglio
48e7f4c999 red-parse-qxl: Remove unused device_data field
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-04-10 13:52:10 +01:00
Christophe Fergeau
216bf191b8 cursor: Consistently use g_memdup() for cursor data
Currently, red-parse-qxl.c uses g_malloc+memcpy to duplicate the cursor
data when it could use g_memdup() instead. red-stream-device.c does the
same thing but uses spice_memdup(). This commit makes use of g_memdup()
in both cases so that this memory is consistently allocated through
glib.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-04-10 14:34:44 +02:00
Frediano Ziglio
8e302a7596 syntax-check: Add missing contributors names to AUTHORS
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-04-06 08:30:01 +01:00
Lukáš Hrázký
68b6211865 Rename the virtio port for streaming
The name 'com.redhat.stream.0' is too generic and in no way denotes it
belongs to SPICE. It is preferred to have the project's domain in the
name and Red Hat doesn't own the project. Rename it to
org.spice-space.stream.0.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-05 16:46:06 +02:00
Frediano Ziglio
50e43f1161 video-stream: Improve RedUpgradeItem documentation
Artifacts are due to lossy compression of streaming

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2018-03-19 16:35:33 +00:00