Commit Graph

2788 Commits

Author SHA1 Message Date
Frediano Ziglio
3cf09bd5b3 stream-channel: Allows to register callback to get new stream request
The channel needs to communicate when it receive a new
stream request from the guest.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:59:14 +01:00
Frediano Ziglio
bc906737bc stream-channel: Allows not fixed size
Remove the fixed size stream and support any display size.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:59:14 +01:00
Frediano Ziglio
60104d818c stream-device: Handle streaming data from device to channel
Handle stream data from device sending to the channel.
The StreamChannel will forward the data to the clients using standard
DisplayChannel messages, and will create and destroy streams as
necessary.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:59:14 +01:00
Frediano Ziglio
09ddeff804 stream-device: Create channel for stream device
So can be used by the device to communicate with the clients.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:59:14 +01:00
Frediano Ziglio
14bc15f656 stream-channel: Start implementing DisplayChannel properly
Handle messages from clients.
Send some messages to clients.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:59:14 +01:00
Frediano Ziglio
efcb765d0a stream-channel: Write a base channel to implement the streaming
Currently only compile, not used and not much sense

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:59:14 +01:00
Frediano Ziglio
58e6781d8a stream-device: Start parsing new protocol from guest
Parse the data sent from the guest to the streaming device.
At the moment, the data is simply discarded after it is parsed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:59:14 +01:00
Frediano Ziglio
a0c184e89b stream-device: Add device to handle streaming
Add a stub device in guest.
The aim of this device is to make it possible for the guest to send a
stream through a DisplayChannel (in the sense of protocol channel).
This stub allows the guest to send some data and you can see some debug
lines of data arrived on host logs.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:59:14 +01:00
Frediano Ziglio
e216c4b4bd Notify client of the creation of new channels dynamically
This allows the server to add channels after the client is connected.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-16 19:58:45 +01:00
Frediano Ziglio
e16d7788db tests: Check leaks registering migration interface
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-10-13 17:10:59 +01:00
Frediano Ziglio
343ac9f78d reds: Remove leak allocating migration state
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-10-13 17:10:53 +01:00
Frediano Ziglio
7a3bfedfbe red-channel: Remove red_channel_init_outgoing_messages_window
This function does not make much sense anymore.
Is called by RedVmcChannel which doesn't use RedChannelClient ACKs
so the variable changed are not used.
Moreover, at red_vmc_channel_constructed() time, there will be no
clients yet, so red_channel_init_outgoing_messages() will be a no-op.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-10-12 16:37:14 +01:00
Frediano Ziglio
617479413e inputs-channel: Check message size handling migration data
Prevent possible buffer reading overflow.
Note that message pointer must be valid and data are checked
value by value so even on overflow you just get an error.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-10-12 16:14:41 +01:00
Frediano Ziglio
dd51cef748 red-pipe-item: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
f14ab204e5 parse-qxl: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
f536ca9f30 pixmap-cache: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
201e4b5d78 image-cache: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
ff1d06f0f8 inputs-channel: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
9f4a54eb88 tree: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
04bc835326 worker: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
62c8715eb5 replay-qxl: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
0b943afccc display-channel: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
1354ce7e68 dcc: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
13fffbf885 reds: Use GLib memory functions for ChannelSecurityOptions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
6e2e98383f reds: Use GLib memory functions for link message
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
68d5f90774 Use GLib memory functions for SpiceChannelEventInfo
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
b30f57dca4 dispatcher: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
4b4647e2af event-loop: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
4bab960c4e char-device: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
777af4fc5d gstreamer-encoder: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
81816e09e6 spicevmc: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
972a878c99 stream: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
02e74c86cb smartcard: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
ca7d588e59 reds-stream: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
c9cbbd6196 mjpeg: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:17 +01:00
Frediano Ziglio
cd25ff8b3b lz4-encoder: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-10-11 12:52:12 +01:00
Christophe Fergeau
657a1d92e8 dcc: Fix seamless migration
Since commit ef4b1bdb "red-channel-client: Prevent too tight loop
waiting for ACKs", after seamless migration, the display is no longer
updated on the client-side, even though the VM is functional (responds
to keyboard input, reconnecting the client restores the display
functionality, ...).

This is mainly caused because after migration,
red_channel_client_waiting_for_ack() will be true until
red_channel_client_ack_zero_messages_window() is called.

What happens is the following:
The dcc is created, and dcc_start() pushes a RED_PIPE_ITEM_TYPE_SET_ACK
message.
This calls prepare_pipe_add(), which will enable write event on the dcc
watch. red_channel_client_event() will be called, which will trigger a
red_channel_client_push(). Since red_channel_client_waiting_for_ack()
returns true, we won't get any item to push, and (because of commit
ef4b1bdb), we will disable write notifications on the watch.
At this point, rcc->priv->pipe is no longer empty, so prepare_pipe_add()
is not going to reenable the write notifications.

Then red_channel_client_ack_zero_messages_window() is finally called as
part of dcc_handle_migrate_data(), so from this point on,
red_channel_client_waiting_for_ack() is no longer true.

However, nothing ever reenables WRITE events, nor empties
rcc->priv->pipe, so nothing ever gets pushed, causing no display updates
at all after a migration, even if the VM is functional (input, ...)
apart from that.

This commit reenables WRITE events in
red_channel_client_ack_zero_messages_window() if we were waiting for
ack.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-10-10 12:35:59 +02:00
Frediano Ziglio
78f1381f14 gl: fix client mouse mode
Since 2.8, QEMU no longer creates QXL primary surfaces when using GL.
This change broke client-side mouse mode, because Spice server relies on
having a primary surface.

When GL is enabled, use GL scanout informations.
Mouse mode is always client when GL surfaces are used.

This patch and most of the message are based on a patch from
Marc-André Lureau, just moving responsibility from reds to RedQxl.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2017-10-04 10:57:39 +01:00
Christophe Fergeau
67484cd98b tests: Automatically determine free port to use
Currently, the port used by most tests is hardcoded to 5912. However,
the test suite can be run in parallel, so if 2 tests run in parallel,
the 2nd one is not going to be able to bind to port 5912 and will fail.

After this commit, test_new() will try to find a free port between 5912
and 5922 and will abort if it can't find any.

The issue can be reproduced by adding a usleep(1000000) to the beginning
of test_destroy().

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-09-21 17:32:23 +02:00
Frediano Ziglio
5ccad96671 Use GLib memory functions for RedsMigSpice::cert_subject
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19 16:17:11 +01:00
Frediano Ziglio
b4e05a0398 reds: Use GLib memory functions for RedServerConfig
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19 16:17:11 +01:00
Frediano Ziglio
f6af788540 reds: Use GLib memory functions for RedServerConfig::mig_spice
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19 16:17:11 +01:00
Frediano Ziglio
5c4df2f6c3 Use GLib memory functions for RedsMigSpice::host
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19 16:17:11 +01:00
Frediano Ziglio
30205766b6 reds: Use GLib memory functions for migration data
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19 16:17:11 +01:00
Frediano Ziglio
e1a8571cea reds: Use GLib memory functions for link
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19 16:17:11 +01:00
Frediano Ziglio
7922e8c78e reds: Start using GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19 16:17:11 +01:00
Frediano Ziglio
0da0673bd3 sound: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19 16:17:11 +01:00
Frediano Ziglio
8626f5bf3e image-encoders: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19 16:17:10 +01:00
Frediano Ziglio
a99043771a Start using GLib memory allocation
Start reducing the usage of spice_new*/spice_malloc allocations.
They were designed in a similar way to GLib ones.
Now that we use GLib make sense to remove them.
However the versions we support for GLib can use different memory
allocators so we have to match g_free with GLib allocations
and spice_* ones (which uses always malloc allocator) with free().
This patch remove some easy ones.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19 16:17:10 +01:00
Frediano Ziglio
1de104acfe tests: Add a test to check tight loop during ack waiting
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-19 10:50:39 +01:00