Commit Graph

4093 Commits

Author SHA1 Message Date
Frediano Ziglio
8031558ee3 tests: Provide alarm replacement for Windows
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-05-07 10:13:58 +01:00
Frediano Ziglio
50be664da2 windows: Do not use conflicting preprocessor macros
"interface" and "MAX_MONITORS" are defined in some Windows system
headers causing garbage code to be fed to the compiler.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-05-07 10:13:56 +01:00
Frediano Ziglio
992226d6f2 Avoids %m in formatting for Windows
Not supported, %m is a GNU extension of sscanf.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-05-07 10:13:53 +01:00
Frediano Ziglio
0643d67557 build: Detect Windows build and change some definitions
Windows needs some specific setting to use network.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-05-07 10:13:48 +01:00
Uri Lublin
0c4c3a6916 gitlab-ci: build out-of-tree too
One test is enough -- do it in makecheck.

Must git clean first any previous builds.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-05-01 19:38:09 +01:00
Frediano Ziglio
ed68d491fd Do not check for HAVE_CONFIG_H
This should always be defined and including config.h is a requirement.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-04-30 09:26:55 +01:00
Frediano Ziglio
0dcb859c92 syntax-check: Remove exclude rules of now compliant code
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-04-30 09:25:28 +01:00
Frediano Ziglio
7cbd70b931 build: Prepare for 0.14.2 release
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-04-30 09:05:07 +01:00
Benjamin Tissoires
ff9c8d4908 inputs-channel: Attempt to have a reliable led state
We can not consider the qemu led state to be reliable. It by default has
50ms of delay, so if we want to achieve something reliable, this won't do.

We need to keep our own internal state, and consider it as reliable.
We update it immediately after receiving the key presses, meaning that this
is now the future state of the guest.

When we receive a keymap event, we check against this 'ideal' state and
only update the guest if we 'counted' that it won't have the correct state.

When the guest notifies its change, the modifiers_watch is supposed to
fix any wrong state.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-04-30 09:05:07 +01:00
Frediano Ziglio
9ff2997a05 Update spice-protocol version
We require version after 0.12.15 which was released as 0.14.0.
Check against a valid released instead of checking for a non existing one.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-04-26 11:45:12 +01:00
Frediano Ziglio
2ac16c1635 meson: Bump libcacard requirement to 2.5.1
This had already been done for Meson in commit
afb2ec312b.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-04-26 11:45:04 +01:00
Francois Gouget
5efc8fc8ad video-stream: use the dcc local variable
In update_client_playback_delay()

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-04-11 09:51:40 +00:00
Frediano Ziglio
39654c03a0 Fix meson build importing spice-common fix
This brings in the following changes:

Eduardo Lima (Etrunko) (1):
      meson: Make targets list store dictionaries instead of lists

Frediano Ziglio (2):
      meson: Fix dependency of generated files
      meson: Do not build generated files twice

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-04-05 17:12:37 +01:00
Frediano Ziglio
2eeacd1e0d Update spice-common submodule
This brings in the following changes:

Christophe Fergeau (8):
      canvas_base: Fix variable shadowing warning
      backtrace: Add missing include
      lz: Don't try to print uninitialized variable
      build: Add missing G_GNUC_PRINTF annotations
      build: Update verify.h to latest version
      test-marshallers: Fix header guard
      quic: Fix QUIC_VERSION definition
      log: Let gcc know about the logging macros which abort

Frediano Ziglio (13):
      codegen: Rename --prefix parameter to --suffix
      ci: Remove dependencies from copr build
      build: Remove snd_codec.h from EXTRA_DIST
      test-ssl-verify: Improve subject_to_x509_name coverage
      meson: Remove some useless checks
      codegen: Factor out a function to write output file
      codegen: Generate headers while generating code
      codegen: Allows to generate C declarations automatically
      Allow to generate C declarations for spice.proto
      Generate automatically most C message declarations
      recorder: Update
      build: Add new check for recorder library
      proto: Fix typo in message name

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-04-03 10:38:13 +01:00
Frediano Ziglio
20daba6bc3 red-worker: Remove unused definitions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-29 15:18:49 +00:00
Frediano Ziglio
e8fb0957ef red-worker: Use bool for driver_cap_monitors_config
Easier to understand.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-29 15:18:47 +00:00
Frediano Ziglio
70612bf297 red-channel: Small comment on "core" field
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-29 15:18:35 +00:00
Frediano Ziglio
62bc14d81d display-channel: Inline red_migrate_display function
The only caller only called that function.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-28 20:20:25 +00:00
Frediano Ziglio
ee5cdb7e2f Move image_compression field from RedWorker to DisplayChannel
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-28 20:20:25 +00:00
Frediano Ziglio
163b3c39b6 Check image compression value earlier
Do not check it after assigning to reds->config->image_compression,
check the value as soon as possible.
This prevent potential invalid settings.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-28 20:20:25 +00:00
Frediano Ziglio
bd55e74f64 red-worker: Remove only assigned fields
DisplayChannelClient get them directly from reds (they are changed
only during initialisation so they can be read freely from any
thread).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-28 20:20:25 +00:00
Jonathon Jongsma
14403117b5 Make channel client callbacks virtual functions
Rather than having an API to register client callbacks for each channel
type, make them vfuncs.

Since the client callbacks are registered identically for each channel
of the same type, it doesn't make sense for to require these to be
registered separately for each object.  It's cleaner to have these be
per-class properties, so they've been converted to virtual functions.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-28 20:20:25 +00:00
Frediano Ziglio
fe52264204 Check running state in red_qxl_set_client_capabilities
No reasons to expose red_qxl_is_running, this was used to not
send capability is the state was not running.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-28 20:20:25 +00:00
Frediano Ziglio
0399cd2f90 Move DisplayChannel callbacks from RedWorker to DisplayChannel
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-28 20:20:25 +00:00
Jonathon Jongsma
b0eab081be Save running property in QXLState
This is a preparatory patch that states the running property in QXLState
and provides accessor functions that allows us to check whether the QXL
device is running from different threads.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-28 20:20:25 +00:00
Frediano Ziglio
571dc645c5 Move thread/dispatching handling to RedChannel
Currently channel threading/handling is spread between RedQxl,
RedWorker and RedChannel.
Move more to RedChannel simplify RedQxl and RedWorker.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-28 20:20:25 +00:00
Frediano Ziglio
46efdc1e09 dispatcher: Allows to manage messages without registering them
The only way to add new message to Dispatcher was to register
using a number. These numbers corresponded to array indexes.
This is good if the list of messages is allocated statically
and contiguously, on the contrary this method is not that
flexible.
Writing a header of 4 or 16 bytes using system call does not
make much difference so pass all message information in the
payload header.
A new dispatcher_send_message_custom function allows to send
a message passing all message information, including the
pointer to the handler.
This will allow for instance a Dispatcher associate to a given
thread to be reused by different classes.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-28 15:38:16 +00:00
Frediano Ziglio
f0f6380b81 docs: Fix typo
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-03-27 08:36:35 +00:00
Frediano Ziglio
dab09ad66b build: Clean a generated file
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2019-03-26 15:47:44 +00:00
谢 昆明
699151e198 Remove a duplicated line
Signed-off-by: kunming.xie <kunming.xie@hotmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-22 10:16:30 +00:00
Francois Gouget
10870a0e0f Consistently check if drm_dma_buf_fd is greater or lower than zero
Based on a patch by Frediano Ziglio.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-21 12:01:25 +00:00
Francois Gouget
7988d2fe12 dcc: Remove a redundant NULL pointer check in dcc_create_surface()
dcc_create_surface() already returns immediately if dcc is NULL.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-21 11:31:41 +00:00
Christophe Fergeau
4f8db6fac3 worker: Fix potential sprintf overflow
If worker->qxl->id is bigger than 0x7ffffff (in other words, it's a
negative signed int) then
printf(worker_str, "display[%d]", worker->qxl->id);
will need:

"display[]" -> 9 bytes
%d -> 11 bytes

The trailing \0 will thus overflow our 20 bytes destination.
As QXLInstance::id should be an unsigned int, this commit changes the
format string to use %u. This also switches to snprintf.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-21 11:14:53 +00:00
Frediano Ziglio
bcf55b978f red-worker: Use mnemonic for statistic buffer
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-21 11:14:30 +00:00
Frediano Ziglio
d071944043 main-dispatcher: Use reds as opaque for dispatcher
No reason to pass through MainDispatcher, the purpose of
MainDispatcher is to call reds functions from the right thread.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-20 20:40:03 +00:00
Frediano Ziglio
fe4662a99a main-dispatcher: Inline main_dispatcher_self_handle_channel_event
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-20 20:40:03 +00:00
Frediano Ziglio
cd899c4fbd dispatcher: Use NULL for pointer check
handler is a pointer, check for NULL, not 0.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-03-20 16:29:23 +00:00
Frediano Ziglio
c213bbe7cf reds: Check we don't register a channel twice in reds_register_channel
To avoid potential regressions, check it only if extra checks are
enabled.
This allows to check previous "Move channel registration to constructed
vfunc" commit.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2019-03-20 10:43:17 +00:00
Frediano Ziglio
52f716e1d2 test-stream-device: Remove interface before next loop
We should not reuse the same interface twice as doing so will
cause dangling pointers.
Unregister it at every iteration.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-19 13:59:04 +00:00
Frediano Ziglio
7f57ff0186 Remove support for 64 bit pointers on protocol
Import "codegen: Remove support for --ptrsize" change from spice-common
and update code accordingly.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-18 12:42:32 +00:00
Frediano Ziglio
2ad499ab1f Update spice-common submodule
This brings in the following changes:

Frediano Ziglio (11):
      codegen: Document ptr_array attribute
      codegen: Use a better type for pointer converted to integer
      codegen: Reduce indentation
      codegen: Fix c_type result for TypeAlias
      codegen: Check wrong attribute
      codegen: Add a test for attribute combination
      mem: Fix compile error if alignment-checks option is used
      log: Remove useless includes
      proto: Remove obsolete TunnelChannel
      protocol: Add a dummy TunnelChannel
      messages: Remove fields not used by the protocol

Marc-André Lureau (1):
      docs: add spice URI scheme

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-18 12:42:07 +00:00
Frediano Ziglio
4666ff241d syntax-check: Add missing contributors names to AUTHORS
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-18 12:37:32 +00:00
Douglas Paul
116ff8ca89 video-stream: prevent crash on stream reattach
I experienced some crashes with qemu 3.1.0 compiled with libspice-server
0.14.0 on Gentoo.

The problem reproduced reliably with a guest running Ubuntu 18.04.2 LTS.
If I connect a viewer at system startup, I would get a crash just after
the fade-in of the login prompt in GDM.

Interestingly, I usually was unable to reproduce the issue if I waited
to connect until after the greeter was fully displayed.

The patch I used to correct the issue for me applies to the master
branch cleanly, so I suspect the problem may still exist.

The only other references to this issue I could find were two abrt
reports in CentOS:
https://bugs.centos.org/view.php?id=15171
https://bugs.centos.org/view.php?id=15441

I'm not sure if the agent->video_encoder is supposed to be guaranteed to
exist when this function is called.

Signed-off-by: Douglas Paul <doug@bogon.ca>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-18 10:41:46 +00:00
Jonathon Jongsma
6f90c003e8 Move channel registration to constructed vfunc
For the Display Channel and the Cursor channel, move the call to
reds_register_channel() to the _constructed() vfunc rather than calling
it explicitly from RedWorker. This matches what other channels do.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-15 09:01:28 +00:00
Victor Toso
679b63fe6e display-channel: monitors config debug: add head number
The difference is subtle but compared to what client receives, this
could help identify values set to the wrong head, e.g:

First we received:
 | display-channel.c:180:monitors_config_debug: monitors config count:2 max:4
 | display-channel.c:184:monitors_config_debug: +0+0 1015x805
 | display-channel.c:184:monitors_config_debug: +1015+0 1024x740

And then:
 | display-channel.c:180:monitors_config_debug: monitors config count:3 max:4
 | display-channel.c:184:monitors_config_debug: +0+0 1015x805
 | display-channel.c:184:monitors_config_debug: +0+0 0x0
 | display-channel.c:184:monitors_config_debug: +1015+0 1024x740

In the first debug it would be helpful to have "head 0" and "head 1",
to point out the temporary error in monitor's config message.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-11 08:53:25 +00:00
Jonathon Jongsma
105e63dd81 Switch some boolean fields to 'bool' type
For coding style consistency, use 'bool' when we want to represent a
boolean value.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-06 18:59:36 +00:00
Jonathon Jongsma
4c8b485ac4 Only send device display info to supported agents
Only send the graphics device display info to agents that advertise the
VD_AGENT_CAP_GRAPHICS_DEVICE_INFO capability

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-06 18:59:34 +00:00
Jonathon Jongsma
6cb0c19daf Refactor agent_adjust_capabilities() function
Make this a RedsState member function rather than a standalone function.
This means that we simply pass RedsState* as an argument rather than the
internal member variables of RedsState. This enables the following
commit which handles the VD_AGENT_CAP_GRAPHICS_DEVICE_INFO capability to
avoid sending graphics device info to agents that do not support it.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-06 18:59:23 +00:00
Frediano Ziglio
89796d2446 test-stat: Adjust delay checks
usleep under Windows does not seem to have the required precision.
Use milliseconds and adjust check times according.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-03-06 11:59:54 +00:00
Frediano Ziglio
98b8c725f2 Use proper format strings for spice_log
Formatting string should be compatible with GLib.
GLib uses formatting types compatible with GNU.
For Linux this is not an issue as both systems (like a printf) and
GLib one uses the same formatting type.  However on Windows they
differs potentially causing issues.
This is also make worse as GLib 2.58 changed format attribute from
__printf__ to gnu_printf (Microsoft compatibility formats like %I64d
are still supported but you'll get warnings using GCC/Clang
compilers).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-03-05 13:55:47 +00:00