Commit Graph

386 Commits

Author SHA1 Message Date
Francois Gouget
2eeb092204 protocol: Group the VDAgent clipboard message definitions
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-17 16:37:57 +01:00
Christophe Fergeau
91825a909b Update NEWS for 0.10.12 release 2016-07-07 15:20:13 +02:00
snir sheriber
73614b831a LZ4 compression is now available at the Spicevmc channel
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-06-13 23:03:13 +01:00
Marc-André Lureau
de68d1c074 build-sys: post-release bump
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2016-03-11 16:08:55 +01:00
Marc-André Lureau
1adb66c638 NEWS: update for 0.12.11 release
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2016-03-10 17:04:11 +01:00
Marc-André Lureau
2a6e51c7ee Remove codegen
Codegen generates code specific to spice-common submodule. It's not
meant as a generic protocol header or specification. See discussion and
commits about spice-common codegen re-import.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2016-03-10 16:57:08 +01:00
Francois Gouget
7937915d67 protocol: Add support for the VP8 and h264 video codecs
Clients that support multiple codecs must advertise the
SPICE_DISPLAY_CAP_MULTI_CODEC capability and one
SPICE_DISPLAY_CAP_CODEC_XXX per supported codec.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-03 17:04:44 +00:00
Frediano Ziglio
0721716bb8 macros: do not use more type safe CONTAINEROF version if not requested
This prevents incompatibility if users (like old spice-server/spice-gtk)
are not expected to have this additional restriction.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-02 12:05:55 +00:00
Marc-André Lureau
4707655962 codegen: simplify FdType
This patch is a left-over from the fd passing commit 267391c8fd as
suggested by Frediano Ziglio during review.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-19 14:43:23 +00:00
Marc-Andre Lureau
3fc2221e96 protocol: add unix GL scanout messages
Add 2 new messages to the display channel to stream pre-rendered GL
images of the display. This is only possible when the client supports
SPICE_DISPLAY_CAP_GL_SCANOUT capability.

The first message, SPICE_MSG_DISPLAY_GL_SCANOUT_UNIX, sends a gl image
file handle via socket ancillary data, and can be imported in a GL
context with the help of eglCreateImageKHR() (as with the 2d canvas, the
SPICE_MSG_DISPLAY_MONITORS_CONFIG will give the monitors
coordinates (x/y/w/h) within the image). There can be only one scanount
per display channel.

A SPICE_MSG_DISPLAY_GL_DRAW message is sent with the coordinate of the
region within the scanount to (re)draw on the client display. For each
draw, once the client is done with the rendering, it must acknowldge it
by sending a SPICE_MSGC_DISPLAY_GL_DRAW_DONE message, in order to
release the context (it is expected to improve this in the future with a
cross-process GL fence).

The relation with the existing display channel messages is that all
other messages are unchanged: the last drawing command received must be
displayed. However the scanout display is all or nothing. Consequently,
if a 2d canvas draw is received, the display must be switched to the
drawn canvas. In other words, if the last message received is a GL draw
the display should switch to the GL display, if it's a 2d draw message
the display should be switched to the client 2d canvas.

(there will probably be a stipped-down "gl-only" channel in the future,
or support for other streaming methods, but this protocol change should
be enough for basic virgl or other gpu-accelerated support)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-14 11:52:41 +00:00
Marc-Andre Lureau
267391c8fd protocol: learn to describe fd passing in messages
Add a new type, "unix_fd", used to describe file descriptor sharing via
socket ancillary data (these messages are local only).

The marshaller/demarshaller can't serialize this in memory (consume_fd
implementation is empty), so it is the responsability of the marshaller
user to handle sending and receiving the handles, which are appended at
the end of the message with an extra stream byte (because some Unix
requires sending at least a byte with ancillary data).

Even if there is no fd to send (or if the fd is invalid etc), the
receiver side expects an extra byte anyway.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-14 11:46:16 +00:00
Christophe Fergeau
6b86c1a510 Use gcc builtin rather than asm for memory barriers
This should make things more portable.

On my machine, __sync_synchronize() uses mfence rather than lock; addl;
Looking at the kernel memory barriers, this should be fine:
http://lxr.free-electrons.com/source/arch/x86/um/asm/barrier.h

The kernel favours using mfence, but falls back to lock; addl; when it's
not available (32 bit non-SSE machines).

https://bugs.freedesktop.org/show_bug.cgi?id=86997
2016-01-08 15:31:38 +01:00
Frediano Ziglio
cffb8baee1 macros: make SPICE_CONTAINEROF more typesafe
Check the pointer given is the same type as member pointer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-04 11:15:12 +00:00
Christophe Fergeau
95b5617874 build-sys: Use $datadir for .proto files/codegen scripts
They are not arch-specific, so installing them in $libdir is not needed.
2015-10-02 12:51:51 +02:00
Jonathon Jongsma
017ddbe7a7 post-release version bump 2015-09-25 13:17:20 -05:00
Jonathon Jongsma
c9b3648f48 Update NEWS for 0.12.10 release 2015-09-22 15:30:54 -05:00
Frediano Ziglio
b397eca557 macros: fix compatibility with non-clang compilers
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-08-20 11:16:31 +01:00
Victor Toso
39be7a8fce macros: fix alignment issue reported by clang
char_device.c:131:52: warning: cast from 'uint8_t *'
(aka 'unsigned char *') to 'SpiceCharDeviceMsgToClientItem *'
(aka 'struct SpiceCharDeviceMsgToClientItem *')
increases required alignment from 1 to 8 [-Wcast-align]

 SpiceCharDeviceMsgToClientItem *msg_item = SPICE_CONTAINEROF(item,
                                            ^~~~~~~~~~~~~~~~~~~~~~~

../spice-common/spice-protocol/spice/macros.h:142:6: note: expanded
from macro 'SPICE_CONTAINEROF'

 ((struct_type *)((uint8_t *)(ptr) - SPICE_OFFSETOF(struct_type, member)))
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2015-08-20 11:05:19 +01:00
Victor Toso
fa19ebb83f macros: verify if __alloc_size__ works with clang
So we can avoid using using an attribute not supported for the compiler.

warning:
../spice-common/common/mem.h:91:80: warning: unknown attribute
'__alloc_size__' ignored [-Wunknown-attributes]

void *spice_malloc0_n(size_t n_blocks, size_t n_block_bytes)
SPICE_GNUC_MALLOC SPICE_GNUC_ALLOC_SIZE2(1,2);

../spice-common/spice-protocol/spice/macros.h:52:52: note: expanded
from macro 'SPICE_GNUC_ALLOC_SIZE2'

 #define SPICE_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y)))
                                                    ^
2015-08-20 11:00:35 +01:00
Frediano Ziglio
2cd036e9d4 Fix endianess compatibility with old GCC versions
GCC 4.4.7 does not define __BYTE_ORDER__ macros so use architecture
macro to attempt to detect endianess.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reported-by: Swapna Krishnan <skrishna@redhat.com>
Tested-by: Swapna Krishnan <skrishna@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2015-08-19 15:42:10 +01:00
Christophe Fergeau
726c6520ae Use 0xffu everywhere in new SPICE_MAGIC_CONST macro
This should have been squashed in the commit introducing the macro, but
I forgot to commit this before pushing it.
2015-08-12 14:17:16 +02:00
Frediano Ziglio
295d05e733 Define and use new SPICE_MAGIC_CONST macro
This macro allow to define magic constants without using weird
memory tweacks.
This remove some possible warning from some compiler and
make code more optimized as compiler is able to compute the
constant.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-08-12 14:15:27 +02:00
Frediano Ziglio
3ab16f2dad Detects processor endianess using preprocessor
This allow to define macros based on endianess in public headers

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-08-12 14:15:27 +02:00
Christophe Fergeau
03a28f5856 build-sys: Make installed spice_codegen.py is executable
Files listed as _DATA in Makefile.am are installed without the
executable bit set, files listed as _SCRIPT do get the executable bit
set. As spice_codegen.py is meant to be run by spice-protocol users,
make sure this bit is set.
2015-08-10 18:00:45 +02:00
Christophe Fergeau
52ae5ed2c8 build-sys: Make sure aclocal picks up macros in the m4/ dir
Older aclocal version needs to have ACLOCAL_FLAGS defined in Makefile.am
in order to be able to pick up macros stored in m4/ in the source
directory.
2015-08-07 12:55:07 +02:00
Christophe Fergeau
3f0eaa717b build-sys: Add m4 file for AX_PYTHON_MODULE
This fixes a build failure on older distros (EL6) which do not have
this macro readily available.
2015-08-07 12:53:59 +02:00
Christophe Fergeau
8a3def14e3 proto: Use proper type for preferred_compression field
No need to use an uint8 typed member, we can directly use the
appropriate enum8 type here, which makes everything more explicit.
2015-08-07 12:07:26 +02:00
Christophe Fergeau
e857cd9a37 proto: Rename image_compress to image_compression
Re-using the SPICE_IMAGE_COMPRESS_ prefix in newer spice-protocol
releases is going to cause issues as there will be clashing enum members
in older spice-server releases. Using SPICE_IMAGE_COMPRESSION_ as a
prefix sidesteps these backward compability issues.
2015-08-07 12:07:26 +02:00
Christophe Fergeau
1830e216c4 build-sys: Install code generation data/scripts
spice-common generate code from these python scripts and the installed
SPICE .proto. This commit installs them during make install, and adds a
codegendir variable to the pkgconfig file so that spice-common can
locate the scripts.
2015-08-07 11:54:48 +02:00
Christophe Fergeau
2b9d15c1d3 build-sys: Add --enable-code-generator
This flag is only used for git builds, and can usually safely be
disabled.
When it's enabled, configure.ac will check that python-six and pyparsing
are available, and will use these together with the codegen python
scripts in order to automatically regenerate enums.h when the .proto
files change.
2015-08-07 11:54:47 +02:00
Christophe Fergeau
eb2e8ba0e8 build-sys: Make sure new files are dist'ed
The just added .proto files and python code generation code need to be
added to EXTRA_DIST in order to be distributed in tarballs, and
we need to recurse in the new python_modules directory.
2015-08-07 11:54:46 +02:00
Christophe Fergeau
26eb4e0f2e Merge protocol code generation bits from spice-common
The history for spice*.proto, spice_codegen.py and python_modules/ was
extracted from spice-common using git filter-branch:

git filter-branch \
    --prune-empty \
    --index-filter '
        git ls-tree -z -r --name-only --full-tree $GIT_COMMIT \
        | grep -z -v "^python_modules/" \
        | grep -z -v "^spice.proto" \
        | grep -z -v "^spice1.proto" \
        | grep -z -v "^spice_codegen.py" \
        | xargs -0 -r git rm -f --cached -r
    ' \
    -- \
    --all

git filter-branch --force \
    --prune-empty \
    --index-filter '
        git rm -f spice-protocol --cached  --ignore-unmatch
    ' \
    -- \
    --all
2015-08-07 11:52:25 +02:00
Sandy Stutsman
666b5c5780 Add VD_AGENT_CAP_MONITORS_CONFIG_POSITION capability to client.
This indicates the client's ability to handle multi-monitor
configurations that are not multi-head.

This commit addresses:
https://bugzilla.redhat.com/show_bug.cgi?id=1248196
https://bugzilla.redhat.com/show_bug.cgi?id=1248189
2015-08-06 11:52:00 +02:00
Uri Lublin
1d026b9a71 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
246825477f Post-release version bump 2015-07-29 17:46:59 +02:00
Christophe Fergeau
715c007eb0 Release 0.12.9 2015-07-29 17:44:07 +02:00
Christophe Fergeau
cd78176038 Rename SpiceImageCompress constants
Having these constants use the same name as the ones in spice-server
0.12.5 causes compilation issues for spice-server users when using
spice-server 0.12.5 or older, and spice-protocol 0.12.8.
2015-07-23 16:22:56 +02:00
Frediano Ziglio
de1286ad80 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
08384ac7fb codegen: Check we don't pop too many indexes 2015-07-23 11:22:11 +02:00
Frediano Ziglio
f6506a2563 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
25c48ddd2c 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
6f729cb32c 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
13aabda256 codegen: Remove duplicate variable initialization
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-23 11:11:44 +02:00
Frediano Ziglio
553be71067 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
233c463e34 codegen: Fix typo in variable name
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-07-23 11:11:16 +02:00
Frediano Ziglio
5bad231e80 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
4a2a996674 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
9625b45edb 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
5adcb1c340 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
4ba5072b28 Post-release version bump 2015-06-30 16:55:48 +02:00