Commit Graph

490 Commits

Author SHA1 Message Date
Christophe Fergeau
f7ec855af3 build-sys: Rework SPICE_CHECK_* m4 macros
These macros were automatically appending the needed CFLAGS/LIBS to
variables passed as arguments. This is how spice-common uses them, but
now how spice-gtk/spice want to use them, and is making the macros more
complicated than they could (in particular this makes them use
AS_VAR_APPEND).
This  is also not flexible enough as spice-gtk uses libcacard libraries,
while spice-common does not need them. If SPICE_CHECK_SMARTCARD
unconditionnally libcacard libraries to the variable spice-common passes
it as an argument, we'll end up linking with an unneeded library.

This commit removes this automatic appending from the SPICE_CHECK_*
macros and moves it to spice-common as it's the only one which needs it.
2015-10-13 11:26:01 +02:00
Christophe Fergeau
26a533d6eb build-sys: Use ${PKG_CONFIG} rather than pkg-config
In mingw builds, this will be set to mingw-pkg-config rather than the
host system one. This is fixing a build failure on mingw when
spice-protocol is only installed in the mingw prefix and not
system-wide.
2015-10-07 18:01:17 +02:00
Christophe Fergeau
523875d8c5 Add marshaller test case
This allows to test the spice_marshaller_linearize() fix which was sent
recently.
2015-09-15 17:48:59 +02:00
Javier Celaya
7b146745ee Fix linearization of several marshallers with one item
The linearization optimization that avoids copying only one item must
check that there are no further marshallers in the chain.

Just to be clear, we are trying to marshall a message like this:

message {
    uint32 data_size;
    uint64 *data[data_size] @marshall;
} SomeData;

Where the data field points to an array in dynamic memory. Marshalling
and demarshalling functions look good. The marshalling function creates
a submarshaller for the data field and links it to the root marshaller.
But when it comes to sending the data through the wire, only the
data_size field gets sent. We have observed that, in
spice_marshaller_linearize, execution enters into the optimization that
avoids copying the data when the root marshaller only has one item, but
it ignores the following marshallers in the list. Checking if there are
more marshallers fixes the problem.
2015-09-15 17:38:12 +02:00
Frediano Ziglio
449c5da90f common: Fix typo in comment
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-08-14 19:19:24 +01:00
Christophe Fergeau
dd63a3b656 build-sys: Remove code generation files from EXTRA_DIST
This breaks make distcheck otherwise since commit
7665dcf1 removed these files.
2015-08-14 15:54:14 +02:00
Frediano Ziglio
7665dcf1bb Remove files moved to spice-protocol
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-08-11 10:26:06 +02:00
Christophe Fergeau
f88a7b7bec Use installed spice-protocol for code generation
Now that spice-protocol ships the needed .proto files as well as the
corresponding python scripts, spice-common can use these in order to
generate the C code for the SPICE (de)marshallers.
2015-08-11 10:26:06 +02:00
Christophe Fergeau
c48b0a0672 Remove spice-protocol submodule
spice-protocol is a separate project which is having releases, so there
is no need to have a private spice-protocol copy in each spice-common
user, especially as after installation, the system-wide spice-protocol
copy will be used instead of the private one the module was built
against.
2015-08-11 10:26:06 +02:00
Uri Lublin
53f7f543f9 codegen: ptypes.py: keep attribute names in sets
This patch changes the type of 'valid_attributes' and
'attributes_with_arguments'.
Both of them are list of different strings and are kept in sets.

This was the intention of the original code, but this patch
use a specific set([ strings ]) format, instead of { strings }.

This fixes the build for me on RHEL-6 (python-2.6.6).
Build error is:

File "/home/ulublin/git/spice/spice-common/python_modules/ptypes.py",
line 67
      'end',
           ^
SyntaxError: invalid syntax
2015-08-04 20:10:22 +03:00
Christophe Fergeau
f2ed9a35a2 Update spice-protocol submodule
Christophe Fergeau (3):
      Prepare for spice-protocol 0.12.8 release
      Post-release version bump
      Rename SpiceImageCompress constants

Sandy Stutsman (1):
      Add QXL_ESCAPE_MONITOR_CONFIG enum
2015-07-29 17:30:09 +02:00
Frediano Ziglio
a1d1d396cd codegen: Allow to specify C type for index variable
This is to prepare to generate the wireshark dissector which uses
glib types instead of the newer C ones (for compatibility with some
compilers).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-23 11:22:11 +02:00
Frediano Ziglio
f717273002 codegen: Check we don't pop too many indexes 2015-07-23 11:22:11 +02:00
Frediano Ziglio
f0f578abee codegen: Remove old ptr32 attribute
This attribute is not used in code.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-23 11:22:11 +02:00
Frediano Ziglio
eff8b1a0e4 codegen: Do some checks on attributes
Verify that the attribute is known. This could help for instance to
avoid some future typo mistakes.
We also now have a list of attributes that we can comment for
documentation purpose.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-23 11:20:19 +02:00
Frediano Ziglio
179928fceb codegen: Reuse code to fix attribute from prototype file
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-23 11:11:47 +02:00
Frediano Ziglio
365866c4c9 codegen: Remove duplicate variable initialization
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-23 11:11:44 +02:00
Frediano Ziglio
0130e8dc39 codegen: Optimize code indentation and avoid a loop
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-23 11:11:18 +02:00
Frediano Ziglio
184feb541a codegen: Fix typo in variable name
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-23 11:11:16 +02:00
Frediano Ziglio
aa43c0d61e codegen: Simplify if/else blocks
Blocks were mainly the same, this reduces the amount of code.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-23 11:11:03 +02:00
Frediano Ziglio
86b0568055 codegen: Import six module before first use
The module is used in the initial try/except so make sure it is
already imported.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-23 11:10:57 +02:00
Christophe Fergeau
f4c729aad3 codegen: Fix enums.h generation with python3
Trying to generate enums.h with python3 results in
Traceback (most recent call last):
  File "./spice_codegen.py", line 217, in <module>
    write_enums(writer, options.generate_dissector)
  File "./spice_codegen.py", line 99, in write_enums
    write_channel_enums(writer, c, False, False)
  File "./spice_codegen.py", line 17, in write_channel_enums
    if len(messages) == 0:
TypeError: object of type 'filter' has no len()

filter() returns an enumerator object in python3 while it used to return
a list in python2. Using list(filter()) instead fixes that error.
I've checked that the generated enums.h is identical with python2 and
python3.
2015-07-23 10:29:10 +02:00
Christophe Fergeau
5720971c45 proto: Remove space before tab
There are 3 lines in spice.proto/spice1.proto which start with spaces
and then contain a tab. This commit removes the spaces and only keep the
tab.
2015-07-20 20:55:47 +02:00
Christophe Fergeau
2d054e0e69 m4: Add compat AS_VAR_APPEND for older autoconf
This causes failures on EL6 otherwise as autoconf is too old there.
2015-07-02 17:02:21 +02:00
Lukas Venhoda
6183bbde24 ppc: Fix quic magic endianess
Runtime conversion from a string to uint32 is storing the magic with the same
endianness on both LE and BE machines. This requires aditional byte swap
when sending magic between LE/BE machines.

Changing quic magic to a constant will ensure, that it will be always stored in
native endianness, and the second byte swap won't be needed.
2015-07-02 13:31:28 +02:00
Lukas Venhoda
5a7e5876e6 ppc: Fix lz magic endianess
Commit d39dfbfe changes lz magic to be always treated as LE when encoded.

Runtime conversion from a string to uint32 is storing the magic with the same
endianness on both LE and BE machines. This requires aditional byte swap
when sending magic between LE/BE machines.

Changing lz magic to a constant will ensure, that it will be always stored in
native endianness, and the second byte swap won't be needed.

This commit reverts d39dfbfe changes in lz.c while keeping the rest.
They will be needed in future commit for quic.c
2015-07-02 13:31:28 +02:00
Lukas Venhoda
c04d4d55bc ppc: Fix quic decode endianess
Converts all decoded words in quic from little endian to local
machine endianness.
2015-07-02 13:31:28 +02:00
Christophe Fergeau
dcebede0ca Update spice-protocol
Christophe Fergeau (1):
      Post-release version bump

Javier Celaya (2):
      Update enums.h for preferred compression message
      Add a preferred compression capability
2015-06-22 20:04:21 +02:00
Javier Celaya
127a76a3b8 Proto: Add preferred compression message and constants.
When accessing a virtual desktop from different devices, some may have
different image compression requirements, e.g. slow devices may prefer
the faster LZ4 over GLZ. This message instructs the server to switch the
image compression algorithm. This patch also promotes the
SPICE_IMAGE_COMPRESS_* constants so that they are available from both
the server and the client.
2015-06-22 19:54:30 +02:00
Christophe Fergeau
1b5edbe49e m4: Add macro for --enable-lz4
It's not directly used by spice-common, but this way spice-gtk and
spice-server can share the same implementation.
2015-06-17 19:25:05 +02:00
Victor Toso
fec803156b Update spice-protocol submodule
This includes volume synchronization protocol;
2015-04-24 17:17:59 +02:00
Christophe Fergeau
b216f66f10 codegen: Use six.PY3 rather than six.PY2
Older versions of python-six (at least 1.3.0) defined six.PY3 but not
six.PY2. six.PY2 is only used twice in straightforward tests so it's
easy to use six.PY3 instead.
2015-04-14 16:08:43 +02:00
Christophe Fergeau
838ec7d87b configure.ac: Check for needed python modules for git builds
After the patch adding support for python 3 to the code generator,
python-six is required when building from git. Since I got 2 different
reports of SPICE build failures right after introducing it, it's
probably better to check for the needed python modules from configure,
and exit with an error if they are missing.
This commit adds a --enable-python-checks configure flag for that
though, since we only want to do that when building from git. It assumes
that people running from git will be running autogen.sh, while people
building from tarballs will run configure.
2015-04-13 13:08:11 +02:00
Erlon Cruz
c6e6dacb30 ppc: build-sys: Add big-endian support
A few files (the generated marshalling code and pixman-related utils)
make use of WORDS_BIGENDIAN in order to do the right thing depending on
endianness. configure.ac must call AC_C_BIGENDIAN for it to be defined.

Signed-off-by: Erlon R. Cruz <erlon.cruz@br.flextronics.com>
Signed-off-by: Rafael F. Santos <fonsecasantos.rafael@gmail.com>
Signed-off-by: Fabiano Fidêncio <Fabiano.Fidêncio@fit-tecnologia.org.br>
2015-04-10 20:20:49 +02:00
Erlon Cruz
d39dfbfef9 ppc: Fix lz magic endianness
Signed-off-by: Erlon R. Cruz <erlon.cruz@br.flextronics.com>
Signed-off-by: Rafael F. Santos <fonsecasantos.rafael@gmail.com>
Signed-off-by: Fabiano Fidêncio <Fabiano.Fidêncio@fit-tecnologia.org.br>
2015-04-10 20:20:49 +02:00
Alexander Wauck
ba52c4cae2 Make spice_codegen.py work on both Python 2 and 3
This is a new version of my previous patch that does not include six.py.
It's still kind of big, but at least it's all spice-common changes now.
There are also a few other fixes that Christophe brought to my attention.
Note that six now needs to be installed on the system (python-six on
Fedora and Debian, six on PyPI).

This *should* be enough to make spice_codegen.py work on both Python 2
and Python 3.  The major changes are as follows:

 * cStringIO.StringIO -> io.StringIO
 * str vs. unicode updates (io.StringIO doesn't like str)
 * integer division
 * foo.has_key(bar) -> bar in foo
 * import internal_thing -> from . import internal_thing
 * removed from __future__ import with_statement
   (might break Python 2.5?)
 * changed some lambdas to list comprehensions (done by 2to3)
 * cast some_dict.keys() to list where needed (e.g. for sorting)
 * use normal type names with isinstance instead of types.WhateverType

Signed-off-by: Alexander Wauck <awauck@codeweavers.com>
2015-04-01 13:39:03 +02:00
Christophe Fergeau
14218d7d6b ssl_verify: Move wincrypt.h related #ifdef closer to the include
Both wincrypt.h and openssl try to define X509_NAME. The wincrypt.h one
is not useful for us, so we currently #undef it if this was set.
However, it's done very late, right before including x509v3.h which
defines the X509_NAME type. Any header included in between may try to
 #include x509v3.h so it's better to undefine X509_NAME right after
including wincrypt.h.
2015-03-26 10:15:04 +01:00
Christophe Fergeau
edac1b36b5 Get rid of SW_CANVAS_IMAGE_CACHE
Every time it's used, it's in constructs similar to:

 #ifdef SW_CANVAS_CACHE
                             , SpiceImageCache *bits_cache
                             , SpicePaletteCache *palette_cache
 #elif defined(SW_CANVAS_IMAGE_CACHE)
                             , SpiceImageCache *bits_cache
 #endif

This can be rewritten as:

                             , SpiceImageCache *bits_cache
 #ifdef SW_CANVAS_CACHE
                             , SpicePaletteCache *palette_cache
 #endif

allowing to get rid of SW_CANVAS_IMAGE_CACHE.
2015-03-26 10:15:04 +01:00
Christophe Fergeau
d2ee99e15f Remove another redundant (SW_CANVAS_CACHE) || (SW_CANVAS_IMAGE_CACHE) #ifdef 2015-03-26 10:15:04 +01:00
Fabiano Fidêncio
37325b4e88 Fix typo in pixman_image_get_stride() function
pixman_image_surface_get_stride -> pixman_image_get_stride
2015-02-25 17:25:03 +01:00
Javier Celaya
3aad79d9c6 LZ4: Do not include arpa/inet.h in Windows builds 2015-02-03 13:28:54 +01:00
Javier Celaya
9287e53b6c LZ4: Add support for 24bit pixman surfaces 2015-02-03 10:46:34 +01:00
Javier Celaya
d167e2ead8 LZ4: Fix the row alignment when it is not on a 32bit boundary
Fix the row alignment for 16/24 bpp images when it is not in a 32bit
boundary. This is needed for 16bpp images when the width is an odd
number, and for the future support of 24bpp images.
2015-02-03 10:46:34 +01:00
Javier Celaya
f76fc28fc5 LZ4: Decode the image format from the stream 2015-02-03 10:43:31 +01:00
Javier Celaya
83c0d642ed LZ4: Adjust reading the top_down flag
Adjust the way the top_down flag is read to the corresponding change in
the wire protocol.
2015-02-03 10:43:31 +01:00
Javier Celaya
6049db492f LZ4: Fix output buffer size 2015-02-03 10:43:31 +01:00
Christophe Fergeau
ac26fd7acb Remove redundant #if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE)
SW_CANVAS_CACHE is always defined when building spice-gtk,
SW_CANVAS_IMAGE_CACHE is always defined when building spice-server, and
they are the only 2 users of spice-common. Moreover, build when none of
these is defined is broken.
2015-01-23 16:24:04 +01:00
Christophe Fergeau
062bf67442 Remove unused 'invers' arg from canvas_get_*
All canvas_get_{quic,jpeg,lz4,jpeg_alpha,lz} methods have an 'invers'
argument, but are always called with that argument being 0, so we can
drop it from the argument list, and remove the code triggerring when
it's true.
2015-01-23 16:24:03 +01:00
Victor Toso
619b99511d common: fix build with mingw 2015-01-06 18:02:50 +01:00
Christophe Fergeau
862b9b1a9e build-sys: Move pixman check to m4 macro 2014-12-09 16:40:25 +01:00