Commit Graph

3979 Commits

Author SHA1 Message Date
Christophe Fergeau
8669c933ff qxl: Add red_surface_cmd_{new, ref, unref} helpers
Currently, RedWorker is using stack-allocated variables for RedSurfaceCmd.
Surface commands are rare enough that we can dynamically allocate them
instead, and make the API in red-parse-qxl.h consistent with how other
QXL commands are handled.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:58 +00:00
Christophe Fergeau
decfe65d73 qxl: Add red_update_cmd_{new, ref, unref} helpers
Currently, RedUpdateCmd are allocated on the stack, and then
initialized/uninitialized with red_{get,put}_update_cmd
This makes the API inconsistent with what is being done for RedDrawable,
RedCursor and RedMessage. QXLUpdateCmd are not occurring very often,
we can dynamically allocate them instead, and get a consistent API.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:55 +00:00
Christophe Fergeau
74663be7fc qxl: Release QXL resources in red_put_update_cmd
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:52 +00:00
Christophe Fergeau
5840ba2a89 qxl: Add red_message_{new, ref, unref} helpers
Currently, RedMessage are allocated on the stack, and then
initialized/uninitialized with red_{get,put}_message
This makes the API inconsistent with what is being done for RedDrawable
and RedCursor. Since QXLMessage is just a (mostly unused/unsecure) debugging tool,
we can dynamically allocate it instead, and get a consistent API.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:49 +00:00
Christophe Fergeau
60c425011c qxl: Release QXL resource in red_put_message
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:43 +00:00
Christophe Fergeau
fb3c602d75 qxl: Add red_cursor_cmd_{new, ref, unref} helpers
Currently, the cursor channel is allocating RedCursorCmd instances itself, and then
calling into red-parse-qxl.h to initialize it, and doing something
similar when releasing the data. This commit moves this common code to
red-parse-qxl.[ch]
The ref/unref are not strictly needed, red_cursor_cmd_free() would
currently be enough, but this makes the API consistent with
red_drawable_{new,ref,unref}.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:36 +00:00
Christophe Fergeau
f928763db6 qxl: Fix guest resources release in red_put_drawable()
At the moment, we'll unconditionally release the guest QXL resources in
red_put_drawable() even if red_get_drawable() failed and did not
initialize drawable->release_info_ext properly.
This commit only sets RedDrawable::qxl once the guest resource have been
successfully retrieved, and only free the guest QXL resources when
RedDrawable::qxl is set.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:33 +00:00
Christophe Fergeau
179134a4e8 qxl: Make red_{get, put}_drawable static
Rather than needing to call red_drawable_new() and then initialize it
with red_get_drawable(), we can improve slightly red_drawable new so
that red_drawable_{new,ref,unref} is all which is used by code out of
red-parse-qxl.c.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:31 +00:00
Christophe Fergeau
7f8228b540 qxl: Move red_drawable_unref/red_drawable_new
RedDrawable really is a RedDrawCmd which is parsed by red-parse-qxl.h
Moreover, red_drawable_ref() is already defined inline in
red-parse-qxl.h, and red_drawable_unref() is declared there too even if
its code is still in red-worker.c
This commit moves them close to the other functions creating/unref'ing
QXL commands parsed by red-parse-qxl.h.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:20 +00:00
Frediano Ziglio
70f56ad2fa tests: Use g_assert_(non)null instead of g_assert
Just a style change, on more recent GLib would print a more
friendly error report.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-12-04 09:03:27 +00:00
Marc-André Lureau
69a5cfc741 smartcard: set char device state
Follow all other char devices implementation (spicevmc, agent,
stream-device) and set the char device state when
connected/disconnected. This allows qemu to discard writes, optimize a
bit the source polling, and will trigger HUP events.

See related qemu "char/spice: discard write() if backend is
disconnected".

Note: sif->state() should probably be handled at the char-device
level. I am not sure what the smartcard channel really brings over
plain spicevmc...

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-03 17:02:09 +00:00
Christophe Fergeau
920dabdd88 dcc: Add debug log when setting compression
Without this it's not obvious that a compression setting took effect.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-11-26 13:03:00 +00:00
Frediano Ziglio
ac14cd5378 tests: Add a small test for red_record_ APIs
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-11-16 17:39:15 +00:00
Frediano Ziglio
96160ae50c test-leaks: Avoid clashing with test-display-base ports
Is possible that port 5913 is already in use as tests that uses
test_new will attempt to use ports from 5912 to 5921 so use a port
not in that range.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-11-16 16:37:27 +00:00
Frediano Ziglio
1bad26b663 test-display-base: Fix warning message avoidance
test_new function attempts to detect attempts to listen to tcp ports
already in listening state detecting some messages during
spice_server_init. However the check is wrong (broken in recent
34a44d3e94 "test-display-base: Avoid spurious errors due to listen
failures") and incomplete (missing message).

To better test this conditions put some of the ports in listening
state (like with a "nc -l 5912 & nc -l 5913 &" command) and run
tests in parallel (like with a "make check -j" command).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-11-16 16:37:20 +00:00
Frediano Ziglio
91b15b6de3 ci: Ignore leak from GnuTLS p11 call
Fix Fedora 29 one-time leak.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-11-16 15:28:32 +00:00
Frediano Ziglio
e02d58f0a7 ci: Merge new glib.supp file
Merge from GLib master repository.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-11-16 15:28:32 +00:00
Frediano Ziglio
faa0271acb red-replay-qxl: Remove useless end of line
Spice log functions already add an end of line.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-11-16 10:17:32 +00:00
Frediano Ziglio
34a44d3e94 test-display-base: Avoid spurious errors due to listen failures
To set up a listening socket usually you call in sequence:
- socket;
- bind;
- listen.
If you try to bind() to a port when another socket is already
listening on that port, the bind() will fail.
However, it is possible that the bind() may succeed and the listen()
will fail, as demonstrated in the following sequence:
- socket() create socket 1;
- bind() to port N on socket 1;
- socket() create socket 2;
- bind() to port N on socket 2;
- listen() on socket 1;
- listen() on socket 2 <-- failure.

When running tests (especially multiple tests running in parallel), it
may sometimes happen that there are other tests already listening on
the port that we are trying to use. In this case, we want to ignore
this error and simply try to listen on a different port. We already
attempted to handle this scenario, but we were only ignoring bind()
errors and not listen() errors. So in the scenario mentioned above,
the listen() error was causing the entire test to fail instead of
allowing us to try to listen on another port.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-11-10 08:19:01 +00:00
Frediano Ziglio
a618d5df57 ci: Do not try to downgrade asciidoc anymore
Is not more necessary to downgrade asciidoc, the issue was fixed
in Fedora 29, now used by CI.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-11-08 16:46:31 +00:00
Frediano Ziglio
1c523c90e4 char-device: Remove initial underscores from __red_char_device_write_buffer_get
Just cosmetic changes, the static function had underscores to
distinguish from the exported one which was recently renamed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Lukáš Hrázký <lhrazky@redhat.com>
2018-11-08 10:22:17 +00:00
Lukáš Hrázký
72ceb62d0e reds: move vdagent write buffer creation into a function
Adds a function to create a write buffer for sending a message to
vdagent from the server to prevent code duplication.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-11-08 08:08:34 +00:00
Lukáš Hrázký
e810b48fcd char-device: separate functions to get write buffer for client and server
Instead of having a single red_char_device_write_buffer_get function to
get both client and server buffers and decide by testing client == NULL,
have separate function for a client and for a server. The situation
should always be clear (you're either on the client or on the server
side) and you shouldn't need to parametrize that.

For the server case, add a use_token parameter instead of a separate
red_char_device_write_buffer_get_server_no_token function, as you may
want to parametrize that.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-11-08 08:08:28 +00:00
Frediano Ziglio
585b534c0c reds: Use monotonic time for ticket expiration
Avoid time adjustment issues.
For instance ticket validity can change when daylight time changes.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Lukáš Hrázký <lhrazky@redhat.com>
2018-10-30 10:17:19 +00:00
Frediano Ziglio
c4e26a54d0 Use new common demarshallers.h
Avoids mismatching duplicate declarations causing potentially
ABI incompatibilities.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-15 13:39:10 +01:00
Frediano Ziglio
3deedc3b6b utils: Get monotonic time in a coherent way
Use a single function to get monotonic time.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-09 15:34:10 +01:00
Frediano Ziglio
b27e0e6f0b display-channel: Remove useless parenthesis
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-09 12:54:14 +01:00
Frediano Ziglio
9a0d8b2db8 red-stream: Propagate RedStreamSslStatus type
Do not convert RedStreamSslStatus enumeration type back to int.
This allows compilers to perform some more type safe checks.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-09 12:52:48 +01:00
Christophe Fergeau
f84b26f801 utils: Remove spice_get_monotonic_time_ms
This is a thin wrapper over g_get_monotonic_time_ms, and is called only
once, so we can call directly g_get_monotonic_time_ms instead.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-10-08 17:15:55 +02:00
Frediano Ziglio
8b5543dc6a ci: Use release build with Meson
Some compiler warnings are triggered only if optimisations are
turned on. By default with debug build optimisations are disabled.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-09-28 13:44:33 +01:00
Eduardo Lima (Etrunko)
7b97489bda Bump meson requirement to 0.47.2
This new version ships the fix for the issue where 'check' keyword could
not be used in project definition, so we had to run that command again
only to check if it succeeded.

https://github.com/mesonbuild/meson/issues/3944

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-09-26 11:21:59 +01:00
Lukáš Hrázký
d191450ee5 red-qxl: remove an unnecessary level of indirection in create/destroy surface
Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-09-25 17:12:40 +02:00
Lukáš Hrázký
145362b046 Count display channels for tablet mode check
Having a single QXL interface is not enough, there can be other (e.g.
streaming) display channels that make the tablet unusable. Add a check for the
number of display channels also being equal to 1. We still need the check for
QXL interaces, because the tablet only works with QXL.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-09-21 10:03:10 +01:00
Frediano Ziglio
4f08f50de9 syntax-check: Add missing contributors names to AUTHORS
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-09-19 20:31:31 +01:00
Changqing Li
fea0c0c16f spice: fix compile error
fix below compile error:
format '%d' expects argument of type 'int', but argument 6 has
type 'long unsigned int' [-Werror=format=]

spice compile failed on 32bit system, since upstream commit
9541cd2fe change %ld to %PRIdPTR, %PRIdPTR is %d, but argument
strm.total_out is uLong.

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-09-19 16:11:10 +01:00
Eduardo Lima (Etrunko)
99b08f0dd2 meson: Fix usage of add_project_arguments()
This function does accept a list of arguments, so there is no need to
iterate over it.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-09-03 08:49:56 +01:00
Eduardo Lima (Etrunko)
b60acbab53 ci: Workaround asciidoc failure
Since commit e5a93d7a30 asciidoc has been
failing. Frediano noticed that there is no such problem with Fedora 27,
and it looks like asciidoc version 8.6.10 in Fedora 28 is causing
the problem. Downgrading it to 8.6.8 seems to fix it while we don't
find the definite solution.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-08-31 07:30:25 +01:00
Eduardo Lima (Etrunko)
e5a93d7a30 Update gitlab-ci to use meson
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-08-30 11:10:56 -03:00
Eduardo Lima (Etrunko)
495d1612c4 Add support for building with meson/ninja
In a comparison with current autotools build system, meson/ninja
provides a huge improvement in build speed, while keeping the same
functionalities currently available and being considered more user
friendly.

The new system coexists within the same repository with the current one,
so we can do more extensive testing of its functionality before deciding
if the old system can be removed, or for some reason, has to stay for
good.

- Meson: https://mesonbuild.com

  This is the equivalent of autogen/configure step in autotools. It
  generates the files that will be used by ninja to actually build the
  source code.

  The project has received lots of traction recently, with many GNOME
  projects willing to move to this new build system. The following wiki
  page has more details of the status of the many projects being ported:

    https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting

  Meson has a python-like syntax, easy to read, and the documentation
  on the project is very complete, with a dedicated page on how to port
  from autotools, explaining how most common use cases can be
  implemented using meson.

    http://mesonbuild.com/Porting-from-autotools.html

  Other important sources of information:

    http://mesonbuild.com/howtox.html
    http://mesonbuild.com/Syntax.html
    http://mesonbuild.com/Reference-manual.html

- Ninja: https://ninja-build.org

  Ninja is the equivalent of make in an autotools setup, which actually
  builds the source code. It has being used by large and complex
  projects such as Google Chrome, Android and LLVM. There is not much to
  say about ninja (other than it is much faster than make) because we
  won't interact directly with it as much, as meson does the middle man
  job here. The reasoning for creating ninja in the first place is
  explained on the following post:

    http://neugierig.org/software/chromium/notes/2011/02/ninja.html

  Also its manual provides more in-depth information about the design
  principles:

    https://ninja-build.org/manual.html

- Basic workflow:

  Meson package is available for most if not all distros, so, taking
  Fedora as an example, we only need to run:

    # dnf -y install meson ninja-build.

  With Meson, building in-tree is not possible at all, so we need to
  pass a directory as argument to meson where we want the build to be
  done. This has the advantage of creating builds with different options
  under the same parent directory, e.g.:

    $ meson ./build --prefix=/usr
    $ meson ./build-extra -Dextra-checks=true -Dalignment-checks=true

  After configuration is done, we call ninja to actually do the build.

    $ ninja -C ./build
    $ ninja -C ./build install

  Ninja defaults to parallel builds, and this can be changed with the -j
  flag.

    $ ninja -j 10 -C ./build

- Hacking:

  * meson.build: Mandatory for the project root and usually found under
                 each directory you want something to be built.

  * meson_options.txt: Options that can interfere with the result of the
                       build.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-08-30 11:10:45 -03:00
Snir Sheriber
4ed9e3b92c Support h265 in stream-channel
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-08-22 16:58:14 +02:00
Christophe Fergeau
eaa07ef15c build: Prepare for 0.14.1 release
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-08-22 16:48:17 +02:00
Christophe Fergeau
f60021f864 Revert "Support h265 in stream-channel"
This commit needs an unreleased version of spice-protocol.
The revert is temporary in order to get the spice-server 0.14.1 release
out.

This reverts commit 9f5859c3ba.
2018-08-22 13:30:51 +02:00
Christophe Fergeau
65c018fbbb docs: Add documentation for the streaming device
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-08-17 14:23:48 +02:00
Frediano Ziglio
94c1a35fee Update spice-common submodule
This brings in the following changes:

Eduardo Lima (Etrunko) (5):
      ci: Fix typo: celt501 -> celt051
      meson: Make options accessible through parent project
      meson: Fix checking for python
      Meson: Make use of dictionary type introduced in version 0.47
      Meson: Make use of 'feature' option type introduced in version 0.47

Frediano Ziglio (2):
      ci: Fix Meson feature option
      Fix flexible array buffer overflow

Lukáš Hrázký (1):
      spice*.proto: Replace tabs with the appropriate number of spaces

Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-08-16 21:29:52 +01:00
Uri Lublin
0669178da3 Remove unused structs QXLDrawArea and QXLDevInfo
The structure usage was removed from commit
  2ba69f9f88
  ("libspice: add surface 0 support").

They were never used by Qemu.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-08-09 18:02:40 +01:00
Lukáš Hrázký
5c98338479 test-stream-device: Expect the g_log warning about invalid message
Fixes test-stream-device after adding a log warning about an invalid
message received on the stream device, glib tests fail on unexpected
warning messages.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-08-09 11:28:29 +01:00
Christophe Fergeau
81480cc3cc build: Fix build from tarballs
Following commit fcaf8d1a1, build from tarballs/make distcheck is broken
as spice-server-enums.h is not regenerated when building from tarballs,
and we don't have a -I$(top_srcdir) in our build flags, just
-I$(srcdir). This commit changes #include <server/spice-server-enums.h>
to #include <spice-server-enums.h> which avoids the problem fixed by
commit fcaf8d1a1 without breaking make distcheck.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-08-09 11:27:47 +01:00
Lukáš Hrázký
dde6fed81f Log the invalid message from the stream device
Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-08-08 18:41:15 +02:00
Christophe Fergeau
fcaf8d1a1c build: Use <> rather than "" for including spice-server-enums.h
When using #include "spice-server-enums.h", it will be looked up first
in the directory containing the file being build, which is going to be
$srcdir when dcc.c includes it. However, spice-server-enums.h is a
generated file, so it will be in $builddir, not in $srcdir. This most of
the time won't be causing any problems, except when you happen to have
an invalid spice-server-enums.h in $srcdir and you are doing an
out-of-tree build.
Using #include <spice-server-enums.h> instead allows the correct
spice-server-enums.h file to be looked up.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Lukáš Hrázký <lhrazky@redhat.com>
2018-08-08 17:03:06 +02:00
Victor Toso
606f747bcc README: Report bugs to gitlab issue tracker
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2018-08-06 15:14:57 +02:00