Commit Graph

607 Commits

Author SHA1 Message Date
Victor Toso
580ca81536 canvas-base: remove user data from CanvasBase
Neither Spice nor spice-gtk are using this since the
following commit in Spice "server: remove OpenGL"
c5c176a5c7718177f23b07981556b5d460627498

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-11-30 15:36:29 +01:00
Pavel Grunt
5f241e655b spice-deps: Set python version based on modules availability
Building spice or spice-gtk from git requires python modules pyparsing
and six. Search for them in the both Python versions and set
the Python version accordingly.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-29 11:43:25 +01:00
Frediano Ziglio
6b409c4a79 Detect LZ4_compress_fast_continue function
Newer lz4 headers give deprecated warning using LZ4_compress_continue
instead of LZ_compress_fast_continue so detect this function
to allow usage and avoid the warning.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-11-28 18:36:21 +00:00
Pavel Grunt
48da2c6654 spice-deps: Make LZ4 check depending on function
LZ4 changed versioning scheme from r131 to v1.7.3 making our configure
fail with (1.7.3 < 129).

Switch from version checking to checking that the necessary function
is available.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-25 14:01:04 +00:00
Pavel Grunt
de1dee75c2 spice-deps: Fix accidently deleted comment
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-24 15:54:09 +00:00
Victor Toso
edaafa187d canvas-base: group ifdef and defined together
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-11-24 15:51:05 +00:00
Victor Toso
2c34cf49b5 canvas-base: use helper to get surface
Moving out a big switch statement that sole purpose is to retrieve the
surface (pixma_image_t)

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-11-24 15:51:01 +00:00
Frediano Ziglio
31819a2424 Define a new SPICE_VERIFY macro
The verify macro used currently has some problem
as it raise a warning in RHEL6.
As suggested in verify.h use verify_expr macro
to avoid the warning.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-14 17:19:18 +00:00
Pavel Grunt
63e575d5fc silence -Wunused-parameter 2016-11-01 15:26:43 +01:00
Victor Toso
215b7571d4 Fix gitignore with new docs folder
The generated spice_protocol.html file and the Makefile were not
included in gitignore. This patch fixes it.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-27 18:05:12 +02:00
Frediano Ziglio
e5a03766ec Add protocol documentation for "channel" and "protocol"
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-10-18 14:57:13 +01:00
Frediano Ziglio
ced5c55925 Fix BNF notation in documentation
Definition names have no angular brackets.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-10-18 14:57:13 +01:00
Frediano Ziglio
4673a61cce More work on attribute protocol documentation
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-10-17 11:43:49 +01:00
Frediano Ziglio
7773c0d59b Extended protocol documentation
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-10-17 11:43:47 +01:00
Frediano Ziglio
89426e491e Start writing some documentation on protocol
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-10-17 11:43:45 +01:00
Frediano Ziglio
3983097ed5 Start adding protocol file documentation
The protocol file is not documented and people have to read code to
understand the specification.
This can lead to unexpected or not optimal results so it's better
to have it documented.
The m4/spice_manual.m4 came from spice server and is meant to be
reused.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-10-17 11:43:26 +01:00
Victor Toso
642308ecec build-sys: requires liblz4 129 or newer
LZ4 data compression on spicevmc channel uses LZ4_compress_default()
API introduced in 129 release (see commit bellow)

[0] https://github.com/Cyan4973/lz4/commit/1b17bf2ab8cf66dd2b740e

Acked-by: Pavel Grunt <pgrunt@redhat.com>
Reported-by: Fabio Fantoni <fantonifabio@tiscali.it>
2016-08-09 16:40:00 +02:00
Francois Gouget
38047fb46f codegen: Fix compatibility with Python 2.6
Python 2.6 does not have a flags parameter.
This is needed for RHEL 6.8.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-07-30 08:57:05 +01:00
Pavel Grunt
22f8dd18f0 codegen: Do not generate extra null check
Spotted by coverity

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-07-26 10:16:31 +01:00
Eduardo Lima (Etrunko)
62f3024f42 Use explicit path for inclusion
As client_marshallers.h is included outisde of spice-common, we need to
specify the path for generated_marsharllers.h so that builds out of the
tree don't fail.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-07-13 15:03:34 -03:00
Christophe Fergeau
073d064b86 codegen: Autogenerate client_marshallers.h
This commit adds autogeneration of a generated_client_marshallers.h
header, which is then included in client_marshallers.h

This allows to remove the SpiceMessageMarshallers struct from this file,
which has to match what the generated code expects.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-06-24 10:02:58 +01:00
Frediano Ziglio
0eb567e6fb codegen: Improve header guard generation
Until now, the same header guard was used for all generated .h files.
Now the header guard name is based on the name of the file being
generated so that it's different for each .h file.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-06-24 10:02:06 +01:00
Christophe Fergeau
806d3273fa codegen: Use "" rather than <> for cmdline includes
Includes specified on the command line are currently #included with <>
rather than "". However, they are usually spice-common headers, so it
makes more sense to include them using ""

Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-06-24 09:36:49 +01:00
Christophe Fergeau
3029eae630 codegen: Fix 'registred' typo
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-06-24 07:47:41 +01:00
Frediano Ziglio
15b8f28c14 Use a macro to simplify ring_get_length
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-06-21 12:52:27 +01:00
Frediano Ziglio
57570953dc extend a comment for type attributes
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-06-21 12:52:25 +01:00
Frediano Ziglio
c5a61aaa30 add a check for negate cases on enumerations
Not supported by code so trigger an error to avoid invalid usages

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-06-21 12:52:18 +01:00
Christophe Fergeau
1d47225a8e Adjust verify.h licence
verify.h can be licensed as LGPLv2+ rather than GPLv3, see
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=modules/verify;h=5216ce890dac58e596a27341e31258e5d6c0d702;hb=HEAD

A verify.h file with the appropriate licence can be generated from a
gnulib clone using:
gnulib-tool --lgpl=2 --import verify

This will fail if the 'verify' module is not licensed under a compatible
license.
2016-06-21 12:26:38 +02:00
Christophe Fergeau
8f722db28e codegen: Remove unused write_message_marshaller argument
"is_server" is not used in this method
2016-06-20 15:05:34 +02:00
Christophe Fergeau
62b996ffb0 Update verify.h to latest version 2016-06-20 15:03:44 +02:00
Eduardo Lima (Etrunko)
5359304713 Make LZ4 dependency check more robust
Add a new 'HAVE_LZ4' automake conditional to really tell if we have the
dependency installed on the system. It will later be used in Makefile to
decide whether or not the specific files related to LZ4 should be built.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-06-16 10:36:48 -03:00
snir sheriber
4284011bdc Add LZ4 data compression and use it in spicevmc channel
Compressed message type is CompressedData which contains compression
type (1 byte) followed by the uncompressed data size (4 bytes-exists
only if data was compressed) followed by the compressed data

Update the required protocol to 0.12.12:

Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-06-13 23:00:28 +01:00
Frediano Ziglio
d0139f824e Remove a warning compiling under Windows
On Windows long is always 32 bit so under x64 the cast from pointer to
"unsigned long" cause a warning.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-06-13 18:38:25 +01:00
Frediano Ziglio
bbd8f9a5e2 Remove deprecated init functions
No need to keep API compatibility in spice-common.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Marc-André Lureau <mlureau@redhat.com>
2016-06-13 11:28:58 +01:00
Frediano Ziglio
73282208f0 simplify #ifdef code
Reduce conditional code

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-06-02 10:01:48 +01:00
Frediano Ziglio
d3dd8bcea3 fix wrong assert check
The assert were never triggered as always True

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-06-02 08:34:19 +01:00
Frediano Ziglio
1c97fea956 Explicitly specify size of SpiceMsgSmartcardData
Without this, the demarshalling code does not know we expect exactly
SpiceMsgSmartcardData::length bytes, and has to guess it from the
amount of data which was sent

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-05-13 13:32:10 +01:00
Pavel Grunt
384698af37 Remove GL support
It is not needed since spice-server commit
c5c176a5c7718177f23b07981556b5d460627498

Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-05-11 16:54:23 +01:00
Pavel Grunt
ad862c4d4b test-logging: Include stdlib.h for _Exit()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-05-09 10:20:32 +02:00
Fabiano Fidêncio
74439e8e6e Use g_getenv() instead of getenv()
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-25 09:09:17 +02:00
Fabiano Fidêncio
a8f756eabf coverity: remove structurally dead code
The loop (for (;;)) will be executed only once, so, no reason for
keeping it.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-25 09:09:17 +02:00
Fabiano Fidêncio
83b84428ec coverity: remove unused value
len is overwritten in the match label with the value from
"ip - anchor".

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-25 09:09:17 +02:00
Fabiano Fidêncio
657e1c5291 coverity: avoid division or modulo by zero
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-04-25 09:09:17 +02:00
Fabiano Fidêncio
3312a0f70b coverity: avoid dereference after null check
All decompress functions used after this check take into account that
encoder->palette is not NULL. So, if we already detected that the
palette is NULL, let's just return early.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-04-25 09:09:17 +02:00
Fabiano Fidêncio
89b902789b coverity: avoid resource leak
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-25 08:34:54 +02:00
Fabiano Fidêncio
bc73df4e47 coverity: avoid use after free
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-04-25 08:34:14 +02:00
Pavel Grunt
739a859d79 Define canvas_fix_alignment when is used
It is used in canvas_get_lz4() which is guarded by USE_LZ4, and
in canvas_get_lz() which is guarded by SW_CANVAS_CACHE.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-19 13:49:50 +02:00
Lin Ma
2eaf7c9572 build-sys: Define opengl GL_LIBS and GL_CFLAGS in generated Makefile.in
SPICE_COMMON_{CFLAGS,LIBS} references '$(GL_{CFLAGS,LIBS)', so these
variables are going to be expanded at 'make' time rather than at
'configure' time.
The linker flag and the compiler flag won't be substituted in the
generated Makefile without AC_SUBST.
It causes spice-gtk building failure with --enable-opengl option.

The patch fixes this issue.

Signed-off-by: Lin Ma <lma@suse.com>
2016-04-18 10:59:07 +02:00
Frediano Ziglio
5603961ffa fix 16 bpp LZ image decompression
LZ image decompression was broken for 16 bpp:
- stride was computed not computed correctly (as width*4). This caused
  also a buffer underflow;
- stride in pixman is always multiple of 4 bytes (so for 16 bpp is
  ALIGN(width*2, 4)) so image decompressed by lz_decode as some missing
  bytes to be fixed.

The alignment code is reused from LZ4 function.

This fix also https://bugzilla.redhat.com/show_bug.cgi?id=1285469.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-04-15 14:25:58 +01:00
Christophe Fergeau
2a4bf49edd log: Make sure glib threading is initialized
While testing spice-server on EL6, I was getting random crashes in the
glib logging code because g_logv was called recursively even though this
was not visible in a backtrace.

It turns out on older glib versions (EL6 has 2.28), g_logv is not
thread-safe unless g_thread_init() is called first. If g_thread_init()
is not called, the GMutex/GPrivate calls g_logv makes are turned into
no-ops, which is going to cause the recursion issue I was seeing.

This commit adds a call to g_thread_init() for these older glib
versions.

(gdb) bt
    0x7fff9f9fb110 "item.type: 114", unused_data=0x0) at gmessages.c:863
    format=0x7ffff50e72ac "item.type: %d", args1=0x7fff9f9fb640) at gmessages.c:517
    SPICE_LOG_LEVEL_DEBUG, strloc=0x7ffff50e72ba "dcc.c:1652", function=
    0x7ffff50e7320 "release_item_before_push", format=0x7ffff50e72ac "item.type: %d", args=
    0x7fff9f9fb640) at log.c:163
    SPICE_LOG_LEVEL_DEBUG, strloc=0x7ffff50e72ba "dcc.c:1652", function=
    0x7ffff50e7320 "release_item_before_push", format=0x7ffff50e72ac "item.type: %d") at log.c:195
    at dcc.c:1652
    at dcc.c:1719
    at dcc-send.c:2450
    at red-channel.c:578
    at red-channel.c:1587
    at event-loop.c:122
    0x7ffff4fb2ef2 <watch_func>, user_data=0x7fff980244e0) at giounix.c:166
    0x7ffff86ec770) at gmain.c:3092
2016-04-05 15:38:18 +02:00