Commit Graph

779 Commits

Author SHA1 Message Date
Frediano Ziglio
7a6980def8 quic: Make {UN, }COMPRESS_xx macros closer
Define COMPRESS_xx/UNCOMPRESS_xx macros in a more similar way between
quic_tmpl.c and quic_rgb_tmpl.c using channel suffixes. Instead of
having #define COMPRESS(channel) do_something(channel), we'll now have
 #define COMPRESS(channel) do_something(channel_##channel), and call it
with COMPRESS(a)

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
1ca7e2d765 quic: Add SAME_PIXEL macro
This helps making the code in quic_tmpl.c and quic_rgb_tmpl.c more
similar.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
499b10e494 quic: Rework PIXEL_A/PIXEL_B macros
This makes them identical to their counterparts in quic_rgb_tmpl.c

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
946d3dda22 quic: Add UPDATE_MODEL_COMP macro to iterate over channels
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
6ea60433de meson: Remove -std=c99
This flag disable some compiler feature which is used by some system header
potentially introducing some limitations.
Autotools won't add any flag to limit compiler features to C99, instead it
currently only add flags to support C99 when needed.
For instance some Posix limitations changes (like _POSIX_OPEN_MAX).
As compiler feature for instance _Static_assert is not used.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 09:54:19 +01:00
Christophe Fergeau
9bf4c32288 build: Define GLIB_VERSION_MIN_REQUIRED/GLIB_VERSION_MAX_ALLOWED
This is defined for the meson build, but not the autotools build. This
commit makes them consistent.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 18:12:16 +02:00
Christophe Fergeau
204ff1ae2e pixman: Use g_error() rather than g_abort()
g_abort() was only added in glib 2.50, which causes meson build failures
since this defines GLIB_VERSION_MIN_REQUIRED/GLIB_VERSION_MAX_ALLOWED

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 18:11:54 +02:00
Christophe Fergeau
b4e07c31cf build: Remove spice_common.h
Most users of spice_common.h don't need it, or only need log.h. It only
has a few users outside of spice-common. It's not very well defined
which headers it should contain. This commit removes spice_common.h in
favour of direct inclusion of the needed headers.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 06:46:15 +01:00
Christophe Fergeau
8069bf498d common: Remove spice_abort()
There are only 2 users in spice-common, and none in spice-gtk/spice

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 06:46:13 +01:00
Christophe Fergeau
31d4622687 log: Remove SPICE_DISABLE_ABORT
spice-gtk was the last user, and stopped using it on Jun 14th 2017
in 040090ccba34 "build-sys: remove -DSPICE_DISABLE_ABORT"

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 06:46:05 +01:00
Frediano Ziglio
bb8d75bf31 canvas_base: Avoid misaligned access decoding LZ4 data
Make code faster on platforms not supporting unaligned access by
default.
SPICE_UNALIGNED_CAST is just silencing possible alignment warning and,
if enabled, produces some logs, however in this case we know that the
pointer can be misaligned.
Use packed structures to tell compiler to generate best code possible.
For more details see comment on commit 74e50b57ae ("Make the
compiler work out better way to write unaligned memory").

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-05 09:38:30 +01:00
Christophe Fergeau
6496437e80 meson: Remove '(default: xxx)' from option description
'meson configure' will show the current value of an option, specifying
the default value in the option description does not add much to that
output.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-07-05 10:37:35 +02:00
Frediano Ziglio
e98e08594c canvas_base: Fix minor indentation issues
This patch just changes some spaces fixing some possible misleading
indentation.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-07-05 09:23:14 +01:00
Christophe Fergeau
3def5a8448 swcanvas: Remove canvas_create()
Nothing calls it in spice-gtk or spice-server

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-04 10:04:02 +02:00
Frediano Ziglio
cd932df7a2 quic: Call encode from golomb_coding
golomb_coding is always followed by a encode call.
Simplify code calling directly it, no reason to pass back output
using pointers.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-03 19:37:39 +01:00
Eduardo Lima (Etrunko)
75863fb69f test-region: Decrease loop count by a factor of 10
This test was timing out when running in gitlab-ci, so decreasing the
loop count in order to make it run faster. Example:

https://gitlab.freedesktop.org/etrunko/spice-common/-/jobs/6546

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-03 11:43:24 -03:00
Eduardo Lima (Etrunko)
246f3a02b4 Update gitlab-ci to use meson
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-03 11:30:55 -03:00
Frediano Ziglio
2b5cadcd8a test-marshallers: Check for "zero" attribute
Check the previous fix for "zero" attribute works correctly
(commit bc9df58162, "marshal: Fix a bug
with zero attribute").

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-03 12:25:31 +01:00
Eduardo Lima (Etrunko)
7050511d9e meson: Cleanup optional dependency checks
We can follow the same practice as in headers and function checks above,
by using the dependency name itself to set the configuration data.

Also, if a combo is used, the first value is used as default if none is
specified. Thus, we can remove the default value for opus from
meson_options.txt.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-29 16:25:14 -03:00
Eduardo Lima (Etrunko)
1eff0d1207 meson: Enable '-std=c99' build flag
The only file preventing this flag was bitops.h which has been removed
since the following commit:

commit 992ebac6b5
Author: Christophe Fergeau <cfergeau@redhat.com>
Date:   Tue Jun 5 11:27:01 2018 +0200

    build: Remove bitops.h

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-29 16:22:18 -03:00
Frediano Ziglio
4b0c25823f log: Remove spice_printerr macro
All usages of this macro were removed.
A library should not log to standard error but use log facilities
so remove this macro to avoid possible future usage.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-29 19:02:21 +01:00
Frediano Ziglio
0385a67ef8 build: Reindent macros
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-28 13:34:14 +01:00
Frediano Ziglio
da4926bd26 build: Reuse TEST_MARSHALLERS macro
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-28 13:34:14 +01:00
Christophe Fergeau
f90ab1f19b snd: Replace spice_printerr() use with g_warning
This allows users of the library to redirect where these messages go
through use of g_log_set_default_handler() rather than unconditionally
printing on stderr.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-28 13:39:52 +02:00
Frediano Ziglio
252d1b61ed ptypes: Improve some attribute documentation
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-06-27 21:51:42 +01:00
Frediano Ziglio
bc9df58162 marshal: Fix a bug with zero attribute
If this attribute was specified during marshaller the field was
marshalled twice.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-06-27 21:44:19 +01:00
Frediano Ziglio
1378d5cfc4 canvas_base: Make sure top_down is a boolean
Should be a 0/1 but just in case make sure.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-06-27 21:44:17 +01:00
Frediano Ziglio
16deca6f1c marshaller: Fix a possible leak
The possible file descriptor associated to the message (currently
can be only the DRM descriptor from Virgl) is not freed in case
the marshaller is reset/destroyed.
This can happen connecting/disconnecting client.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-06-27 21:44:05 +01:00
Christophe Fergeau
5110dbcbb7 test-region: Add g_assert() checks
At the moment, test success/failure is only printed to stdout. This
commit adds some g_assert() so that test failures can be automatically
detected.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-27 13:17:55 +01:00
Christophe Fergeau
cfbae20c48 test-region: Replace spice_assert() with g_assert_true()
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-27 13:17:53 +01:00
Christophe Fergeau
968ce158f0 test-region: Remove unneeded printf
__FUNCTION__ will always be rect_is_valid, and there is a g_assert to
check the region is valid, so we will get notified anyway if the
validity check fails.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-27 13:17:51 +01:00
Christophe Fergeau
30ff9c3807 test-region: Don't call region_dump() by default
This prints to stdout, which is not desirable in an automated test.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-27 13:17:48 +01:00
Christophe Fergeau
3a6a84e172 test-region: Replace direct printf with g_debug() calls
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-27 13:17:45 +01:00
Christophe Fergeau
e13c1d66b7 test-region: Use GTest API
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-27 13:17:43 +01:00
Frediano Ziglio
0ac8e55ddf test-region: Create proper test for region from source code
region.c contained code to test the module.
Separate test code into a proper test.
Test is copied verbatim from the original code.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-27 13:17:41 +01:00
Frediano Ziglio
8e8476d932 ssl_verify: Fix build for newer LibreSSL
LibreSSL 2.7 defines ASN1_STRING_get0_data, like OpenSSL 1.1.
This fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229044.
Original patch from Piotr Kubaj.

Reported-by: Jack L. <xxjack12xx@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-26 18:30:58 +01:00
Frediano Ziglio
3f04e2649d Revert "ssl_verify: Fix build for newer LibreSSL"
This reverts commit 638c77f3e6.
Commit had a misleading comment.
2018-06-26 18:30:58 +01:00
Frediano Ziglio
638c77f3e6 ssl_verify: Fix build for newer LibreSSL
LibreSSL 2.7 does not define ASN1_STRING_get0_data, like OpenSSL 1.1.
This fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229044.
Original patch from Piotr Kubaj.

Reported-by: Jack L. <xxjack12xx@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-26 17:58:44 +01:00
Frediano Ziglio
345557f044 test-quic: Increase test timeout using Meson
This test can take quite some amount of time to run.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-26 17:57:02 +01:00
Frediano Ziglio
818b820644 canvas_base: Rework DUMP_JPEG debugging
The DUMP_JPEG compile time flag is used to dump all jpeg images
to files.
The code was saving garbage instead of proper data.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reported-by: 谢 昆明 <KunMing.Xie@hotmail.com>
Tested-by: 谢 昆明 <KunMing.Xie@hotmail.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-26 17:55:04 +01:00
Frediano Ziglio
656106b304 test-quic: Allows to specify multiple images to test
Make easier to test an entire set of files

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-26 10:45:46 +01:00
Christophe de Dinechin
258123318d Add SPICE_ATTR_NORETURN on prototype of error functions
The error functions are supposed to not return.  Using the attribute
documents that in the interface, and is better for the compiler
because most noreturn-related optimizations and spurious warning
eliminations happen at the call site.

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-26 10:25:42 +01:00
Christophe Fergeau
0fc3d4209f test-logging: Improve debug level tests
These tests were checking that the expected messages were output, but
they were not checking that the messages we don't want are not output.
This commit adds this to make sure our log implementation does not
output unwanted debug messages.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-21 07:03:25 +01:00
Christophe Fergeau
82a5f19d99 log: Only install glib log handler if SPICE_DEBUG_LEVEL is set
Calling g_log_set_handler() is problematic as this means applications
using spice-server won't be able to use g_log_set_default_handler to
manage spice logging output themselves. Since this call is only needed
for backwards compatibility (so that calling g_log together with
SPICE_DEBUG_LEVEL set has the expected behaviour), we can install it
only when SPICE_DEBUG_LEVEL is set.
Then we should deprecate SPICE_DEBUG_LEVEL once and for all.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-20 17:35:43 +01:00
Snir Sheriber
a3598f62aa protocol: Add support for h265 video codec
Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-19 15:29:27 +01:00
Christophe Fergeau
32e2ed57b5 build: Add __pycache__/*.pyc to DISTCLEANFILES
Python 3 puts its .pyc files in a __pycache__ subdirectory, This commit
adds these to DISTCLEANFILES. My main motivation for doing this is so
that git.mk can then properly add them to .gitignore.

Acked-by: Victor Toso <victortoso@redhat.com>
2018-06-18 14:08:10 +01:00
Christophe Fergeau
a526fea413 build: Remove docs/.gitignore
It was added together with the meson build, but it's currently being
managed by git.mk, so it should not be in git

Acked-by: Victor Toso <victortoso@redhat.com>
2018-06-18 14:08:07 +01:00
Christophe Fergeau
26dce6fede build: Update git.mk to latest version
https://raw.githubusercontent.com/behdad/git.mk/master/git.mk has a
newer version than what we are using now.

Acked-by: Victor Toso <victortoso@redhat.com>
2018-06-18 14:08:03 +01:00
Eduardo Lima (Etrunko)
95743f40a2 Add .gitlab-ci.yml file
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-06-06 13:41:47 +01:00
Christophe Fergeau
a84f868e48 meson: Remove check for vfork
Nothing in spice-common calls vfork. The autotools-based build can
fallback to vfork if fork is not available/working through the
AC_FUNC_FORK macro, but the meson build is not implementing this magic.
However, fork() is only called once in backtrace.h, and this part of the
code is optional (it's not compiled in on Windows for example), and
anyway, I doubt anyone is going to try to compile SPICE code on a
platform without fork, so we can remove this check, it's always possible
to readd it when we have a clear bug report about what is
missing/needed.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-06 12:16:31 +01:00