Commit Graph

947 Commits

Author SHA1 Message Date
Frediano Ziglio
3caedf3bc2 canvas_base: Rename blend to copy for canvas_draw_blend argument
SpiceCopy and SpiceBlend are typedefs of the same structure.
This to prove that canvas_draw_blend and canvas_draw_copy do
exactly the same thing.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2020-04-24 17:18:50 +01:00
Frediano Ziglio
a971c59166 canvas_base: Format canvas_draw_blend similarly to canvas_draw_copy
Just minor style changes.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2020-04-24 17:18:45 +01:00
Frediano Ziglio
05c0c26839 agent: Fix incompatibility with Visual Studio compiler
Flexible arrays cannot have other fields following, even
if the fields are from a containing structure.
To fix this use an union and put the additional field inside
other structure in the union.
The final layout is the same but the compiler is not complaining.
This works on both GCC and Visual Studio.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-24 09:42:46 +01:00
Frediano Ziglio
bb03ff099b Add helper code for agent messages
Add agent.h and agent.c to deal with some common agent job:
- checking message from network and fixing network order.
- send back file transfer status.

Code based on Linux agent and Windows agent.
AgentXxxx and agent_xxx are used to avoid conflicts with protocol.

See agent.h for more detail on how to use these APIs.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-24 09:42:46 +01:00
Frediano Ziglio
8470ef9df2 helper-fuzzer-demarshallers: Add an helper for fuzzy testing demarshallers code
See usage with AFL in the source file initial comment.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-09 09:11:04 +01:00
Frediano Ziglio
402bc6b237 build: Allows to request a greater SPICE protocol version
Containing project can request a greater SPICE protocol version.
This will be taken into account while checking our requirements.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2020-04-08 14:28:40 +01:00
Frediano Ziglio
47e149705a proto: Generate correct constants for smartcard support
Of all SPICE_MSGC_SMARTCARD_xxx constants only SPICE_MSGC_SMARTCARD_DATA
is used by both spice-gtk and spice-server.
Generate the right constant, all obsolete ones will not be generated.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-04-07 11:07:33 +01:00
Frediano Ziglio
81f0331469 messages: Remove obsolete structure definition
This structure is not used by both spice-gtk and spice-server.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-04-07 11:07:23 +01:00
Frediano Ziglio
61ce54ef6c proto: Allows to specify @deprecated option for flags and enums
We want to obsolete from enumeration values, currently CELT.
The removal of check in has_attr is not an issue, as the attributes
are already checked by fix_attributes calls.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-04-07 10:22:33 +01:00
Frediano Ziglio
713a3e09fb build: Allow to build disabling code generation
Reduce dependencies if used by agents which do not need
marshallers/demarshallers code.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-03 14:31:26 +01:00
Kevin Pouget
8f9eb611f8 spice.proto: add quality_indicator messages
These messages are used to exchange Streaming Quality messages between
SPICE client and SPICE server:

- `SPICE_MSGC_MAIN_QUALITY_INDICATOR`: a client->server message on the
  Main channel. This message is used by the client to share streaming
  quality observation with the server and the adaptive streaming
  control center. The format of the string message is not specified
  yet, it will depend of the sender/receiver final implementation.

- `SPICE_MSG_DISPLAY_QUALITY_INDICATOR`: a server->client message on
  the Display channel. This message is used to inform the client about
  adaptive-streaming specific details. The client should use it to
  configure its quality-message generation algorithms. The format of
  the string message is not specified yet, it will depend of the
  sender/receiver final implementation.

As an example, a `SPICE_MSG_DISPLAY_QUALITY_INDICATOR` message can
inform the client about the requested framerate (say, 60 FPS); and the
client will send a `SPICE_MSGC_MAIN_QUALITY_INDICATOR` warning message
when the measured framerate drops below 45 FPS.

Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-02 13:32:04 +01:00
Frediano Ziglio
911a7aa9c6 ci: Use spice-protocol master for make-win job
All other projects just use master version of spice-protocol.
Do this also on Windows to use the last sources, it could happen
that we need them and not last packaged version.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-22 10:32:22 +00:00
Frediano Ziglio
6a64d86d1d test-logging: Do not use G_PASTE to join level
"level" can have value "DEBUG". In some environment "DEBUG" is
used as preprocessor name to enable some debugging code.
Using -DDEBUG option (or similar) cause "DEBUG" to be defined as "1"
so "G_PASTE(G_LOG_LEVEL_, level)" will be expanded to "G_LOG_LEVEL_1"
instead of "G_LOG_LEVEL_DEBUG".
Just concatenate the two literal to avoid "DEBUG" expansion.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-03-19 14:47:08 +00:00
Frediano Ziglio
365d7019d5 lz_common: Remove unused commented out define
The DEBUG macro is not used in lz code (or even spice-common).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-17 17:08:17 +00:00
Frediano Ziglio
35a9debe93 ci: Fix build of spice-protocol
spice-protocol is not using Autoconf anymore.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-03-17 17:07:29 +00:00
Victor Toso
31a14b20d0 sound: remove celt support
Follow up of spice-protocol's deprecation of celt mode.
See: https://gitlab.freedesktop.org/spice/spice-protocol/-/merge_requests/15

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-17 16:38:10 +00:00
Frediano Ziglio
11009d1b64 build: Use warning_level option for Meson
warning_level 2 setting for Meson add the same "-Wall -Wextra"
options to GCC compiler.
This removes a warning using Meson.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2020-03-12 12:48:39 +00:00
Frediano Ziglio
a3ec7c173d test-utils: Add a test for some utils.h functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-05 18:38:12 +00:00
Kevin Pouget
ec4e44200a utils: add set_bitmap/test_bitmap functions
This patch introduces `set_bitmap` and `test_bitmap` + relevant
macros, adapted from `<qemu>/include/qemu/bitops.h`.

These functions differ from `set_bit`/`test_bit` as they can set/test
bits in bit arrays longer than scalar data-types.

Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-04 16:43:48 +00:00
Frediano Ziglio
b2f919f109 Add missing dependency in Autoconf integration
spice-common depends on Glib2, so automatically add to the
dependency list.
You can define a GLIB2_MIN_VER m4 variable in configure.ac
to raise the default GLib2 required version.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-04 09:58:42 +00:00
Frediano Ziglio
19ea60416c m4: Make easier to integrate in other projects
Add a common.m4 file to be included directly in other project.
This include will include all needed checks to use spice-common.
Just include directly this file in your configure.ac.
This will define SPICE_COMMON_CFLAGS and SPICE_COMMON_DIR (for
linking .la files) which are needed to use spice-common.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-02 13:54:12 +00:00
Frediano Ziglio
2cec5f99af test-quic: Run 1 random quic test per color mode
Reduce execution time. No need to run so much tests, coverage
stays more or less the same.
We iterate twice to check RGB mode with alpha, otherwise the
coverage reduce about 10-20%.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2020-03-02 09:57:56 +00:00
Frediano Ziglio
27fd63ff72 test-quic: Reduce height of test image
There's no much need for than size to be so big, limit to
reduce execution time, coverage stays more or less the same.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2020-03-02 09:57:54 +00:00
Frediano Ziglio
df66d9a151 test-quic: Cache gdk_pixbuf_get_byte_length value
Do not call the function for every iteration

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2020-03-02 09:57:50 +00:00
Frediano Ziglio
8e82bf5661 test-quic: Avoid namespace conflict with Gdk API
Avoid possible conflict in the future.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2020-03-02 09:57:44 +00:00
Eduardo Lima (Etrunko)
03e1fb94e4 build: Unconditionally link with libm if found
New versions of gcc have implemented __has_builtin which causes meson
to detect functions in libm, such as hypot() and sqrt() as built-ins
during configure time, while they are actually part of libm. This has
been causing build failures in Fedora 32 Rawhide and has been reported
in meson for some time now: https://github.com/mesonbuild/meson/issues/3740

Meson always adds --as-needed to linker arguments so, it does not hurt
to link against libm even though no functions from that library will be
used.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-02-27 14:41:20 +00:00
Frediano Ziglio
35f45282d4 snd_codec: Update field names in function documentation
in_data field was renamed to in_ptr.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-02-07 17:07:57 +00:00
Frediano Ziglio
b699221f00 codegen: Check unsafe values alone
This rule remove possible integer overflows.
Current code generated is not affected by these integer overflows
as the computations are done using 64 bit but better safe then sorry.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-02-07 16:14:53 +00:00
Frediano Ziglio
ea864c70d9 lz_compress: Cleanup unused macros
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-02-07 15:27:03 +00:00
Frediano Ziglio
d5d1d5b0bf lz_decompress: Read "ctrl" inside loop
Remove code duplication

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-02-07 15:27:00 +00:00
Frediano Ziglio
a446b5b27b lz_decompress: Move variable declaration in nested scope
No need to compute these variable always, only if we have
a reference to a previous sequence.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-02-07 15:26:58 +00:00
Frediano Ziglio
08fafdbb33 lz_decompress: Reindented comment
Just space changes

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-02-07 15:26:56 +00:00
Frediano Ziglio
6595de58a2 lz_decompress: Simplify loop
The loop is always executed once so use a do {} while construct
to avoid the repetition.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-02-07 15:26:53 +00:00
Frediano Ziglio
109f6a4802 lz_decompress: Do not execute nested checks
Boundaries checks already done some lines above, no needs
to repeat for each pixel.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-02-07 15:26:51 +00:00
Frediano Ziglio
ac4763bd89 lz_decompress: Constify some variable
Make clear they are not supposed to be changed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-02-07 15:26:34 +00:00
Frediano Ziglio
48944f6f41 marshallers: Avoid some useless pointers in SpiceMarshallerData
"buffers" and "marshallers" are always pointing to the static
buffers inside the same structure.
Use single array fields to avoid having initialize and have them.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Julien Rope <jrope@redhat.com>
2020-02-07 14:52:29 +00:00
Frediano Ziglio
87e2db9798 Reuse new spice_extra_assert macro
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-02-07 13:26:00 +00:00
Frediano Ziglio
e761c2d4de log: Add spice_extra_assert
This macro was suggested to simplify hot path expensive checks
which should be disable in production environments.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-02-07 13:24:45 +00:00
Frediano Ziglio
151c23d235 test-quic: Convert image to get more testing (gray, rgb16)
Allows to check QUIC algorithm and code with multiple input/output
formats.
Was limited to just RGB and RGBA.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-02-07 10:59:18 +00:00
Frediano Ziglio
26d3f6e138 build: Clean up some configure checks
Remove some system checks.
Specifically:
- functions in the standard C (memset, memmove);
- functions we use but we assume in the specific implementation
  present (dup2, fork);
- functions we don't use (error_at_line);
- headers in the standard C (stddef.h, stdint.h, string.h);
- headers present in all systems we support if are not checked
  in the source files (malloc.h);
- types we assume being present (XintYY_t, pid_t).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-02-06 19:26:21 +00:00
Frediano Ziglio
f3d6c5f322 snd_codec: Do not include not needed headers
Include headers required for implementation only in the
implementation file.
This remove dependency and avoid the user component having to
check for header flags (in this case HAVE_CELT051 and HAVE_OPUS).
This make easier integration in other components.
This also make compilation faster.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-02-06 19:26:21 +00:00
Frediano Ziglio
da6a405f25 snd_codec: Avoid some useless casts declaring struct type
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-15 21:24:27 +00:00
Frediano Ziglio
2561f62283 quic: Do not include quic_config.h in quic.h
quic_config is used only by the implementation so include it
only from the implementation file.
This remove dependency.
This make easier integration in other components.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-10 08:22:02 +00:00
Frediano Ziglio
34807c600c quic: Use G_UNLIKELY in some hot paths
The buffers provided should be big enough to avoid to ask
for more space much often.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-10 08:13:11 +00:00
Frediano Ziglio
5a31a3850d quic: Remove unused include header
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-26 13:38:07 +00:00
Fabrice Fontaine
785ac8de4f meson: add tests option
Allow the user to disable tests through -Dtests=false

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-18 11:07:59 +00:00
Fabrice Fontaine
32beff2ff5 configure.ac: add --enable-tests
Allow the user to disable tests through --disable-tests, this is
especially useful for example to disable gdk-pixbuf dependency

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-18 11:07:56 +00:00
Frediano Ziglio
ead7790d47 codegen: Ignore path generating include guards
Make sure that guard do no change building out-of-tree or
with Meson.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-11-04 11:08:10 +00:00
Kevin Pouget
f191053a8c build: Introduce the agent-interface as an alternative instrumentation library
The agent-interface is an experimental instrumentation library for
capturing and sharing Spice performance indicators with an external
agent.

    --enable-instrumentation=[recorder/agent/no]
             Enable instrumentation [default=no]

The former configuration option '--enable-recorder' is transformed
into '--enable-instrumentation=recorder'.

Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-10-18 17:04:09 +01:00
Kevin Pouget
3331ad1a04 agent-interface: add configuration functions
agent_interface_start: this function allows launching the agent
interface (ie, its listening socket) on a given port.

agent_interface_set_on_connect_cb: this function allows passing a
callback function that will be triggered when a client (a Local Agent)
connects to the Agent Interface socket.

agent_interface_set_forward_quality_cb: this function allows SPICE to
provide a function that will forward Quality messages received by the
Agent Interface towards SPICE server, for a centralized processing of
the messages.

Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-10-18 17:04:06 +01:00