summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-04-26glz-encoder: Do not discard top bits of lower part sending 64 bit ints0.14Frediano Ziglio1-1/+1
When GLZ code attempts to send a 64 bit integer the 8 top bit of the lower (32 bits) part of the number are stripped due to a bug. This was discovered by Zhongqiang Huang <useprxf@gmail.com> Reported-by: Zhongqiang Huang <useprxf@gmail.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-01-22ci: Install python3 packages to fix compile on new FedoraFrediano Ziglio1-1/+4
Fedora 26 removed dependency from python-pyparsing/python-six to python but we require the executable to run some scripts Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
2018-01-22red-parse-qxl: Copy correctly brush positionFrediano Ziglio1-0/+1
This issue caused the glitches using the rectangular selection tool in PaintShop 6. The line was removed accidentally by "red_parse_qxl: fix throwing away drawables that have masks" (812b65984d286414170c6243bd3323b73a405ec3) Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Pavel Grunt <pavelgrunt@gmail.com>
2017-10-11spice-server 0.14.0 releasev0.14.0Christophe Fergeau2-1/+10
2017-10-10dcc: Fix seamless migrationChristophe Fergeau1-0/+6
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-04Mention vmport in user manualJonathon Jongsma1-4/+7
For server mode mouse to work properly with spice, vmport must be disabled in qemu. To do this, we need to pass vmport=off to the -machine option.
2017-10-04gl: fix client mouse modeFrediano Ziglio3-14/+23
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-09-25build: Update spice-common submodulev0.13.91Christophe Fergeau1-0/+0
Frediano Ziglio (1): quic: avoid crash on specific images
2017-09-25build: Prepare for 0.13.91 releaseChristophe Fergeau2-1/+16
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-09-21tests: Automatically determine free port to useChristophe Fergeau3-13/+41
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-19Use GLib memory functions for RedsMigSpice::cert_subjectFrediano Ziglio2-4/+4
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19reds: Use GLib memory functions for RedServerConfigFrediano Ziglio1-2/+2
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19reds: Use GLib memory functions for RedServerConfig::mig_spiceFrediano Ziglio1-2/+2
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19Use GLib memory functions for RedsMigSpice::hostFrediano Ziglio2-4/+4
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19reds: Use GLib memory functions for migration dataFrediano Ziglio1-9/+9
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19reds: Use GLib memory functions for linkFrediano Ziglio1-2/+2
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19reds: Start using GLib memory functionsFrediano Ziglio1-10/+11
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19sound: Use GLib memory functionsFrediano Ziglio1-8/+8
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19image-encoders: Use GLib memory functionsFrediano Ziglio1-10/+10
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-09-19Start using GLib memory allocationFrediano Ziglio15-57/+56
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-19tests: Add a test to check tight loop during ack waitingFrediano Ziglio2-0/+349
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-19Introduce a macro to help declaring new GObjectFrediano Ziglio1-0/+26
The macro will implement most of the boilerplate needed to declare an object. Its usage is similar to GLib G_DECLARE_*_TYPE macros. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-19red-channel-client: Prevent too tight loop waiting for ACKsFrediano Ziglio1-1/+4
RedChannelClient has a "handle-acks" feature. If this feature is enabled, after the configured number of messages it waits for an ACK from the client. If is waiting for an ACK it stops sending messages. However the write notification was not disabled, causing the loop event to always trigger, as the socket in this case is ready to accept data. Specifically red_channel_client_event is continuously called. This is noticeable using slow network environments and having some additional loop instrumentation. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-19red-channel-client: Introduce a helper to update watch event maskFrediano Ziglio1-11/+18
This helper will be reused by following patch. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-18red-qxl: Reuse red_qxl_async_completeFrediano Ziglio1-5/+2
Now that the function is a wrapper reuse it. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-18red-qxl: Remove AsyncCommandFrediano Ziglio4-64/+33
This structure was used to store the cookie for the async reply and the message for the generic async callback. Most async messages do not require extra action beside sending back the cookie for the reply so instead of having a switch on the message type in red_qxl_async_complete, this commit moves the message-specific behaviour to the callers, which allows us to store the cookie directly in RedWorkerMessageAsync rather than needing an intermediate AsyncCommand structure. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-18channel-client: Remove red_channel_client_pipe_add_tail_pushFrediano Ziglio4-12/+2
Now the push is done automatically when a PipeItem is added (cfr commit 5c460de1a3972b7cf2b9b2944d0b500c3affc363 "worker: push data when clients can receive them"), forcing a push cause only network fragmentation and is required only if you are handling data in a polling loop (and thus, you are preventing the default event loop from running). Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-18channel: Fix leak in red_channel_remove_clientChristophe Fergeau1-1/+1
It was using g_list_remove_link() to remove an element from the RedChannel::clients list while it really meant to be using g_list_delete_link() which frees the memory associated with the link. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-09-18tests: Rename stat-main.c to test-stat.cFrediano Ziglio2-1/+1
All main test module have this test-XXXX.c naming, make test-stat coherent. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-18tests: Separate Makefile.am in sectionsFrediano Ziglio1-18/+22
Put non-trivial programs in separate sections, which makes it easier to understand the relationship between macros. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-18tests: Ignore test output resultsFrediano Ziglio1-0/+2
New automake test harness produce *.log and *.trs files for each test. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-18smartcard: Fix typo in commentFrediano Ziglio1-1/+1
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-14reds_stat: Show single spice file if only one is presentFrediano Ziglio1-3/+29
Simple usage improvement. If only one process using spice is present allow to call reds_stat not passing any pid. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe de Dinechin <cdupontd@redhat.com>
2017-09-13stream: Simplify FOREACH_STREAMS macroFrediano Ziglio1-3/+1
This macro is exactly doing what RING_FOREACH just passing streams ring. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe de Dinechin <cdupontd@redhat.com>
2017-09-12channel: Remove no longer used red_channel_apply_clients{_data,}Christophe Fergeau2-16/+0
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-09-12channel: Remove red_channel_client_disconnect_if_pending_send()Christophe Fergeau3-11/+14
There is exactly one user in RedChannel, and this can be reimplemented using already public RedChannelClient API. No need for an extra function very specialized function with a not great name. This commit thus removes one method from RedChannelClient public API, and replaces it with an equivalent private helper in RedChannel. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-09-12channel: Call red_channel_disconnect_if_pending_send() from ↵Christophe Fergeau4-15/+9
red_channel_wait_all_sent() red_channel_disconnect_if_pending_send() and red_channel_wait_all_sent() are always called together, we can remove one of the 2 methods. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-09-12tests: Avoid to disable all deprecation warnings just for expect functionsFrediano Ziglio2-12/+22
In case GLib don't provide these functions we use replacements so there's no need to have a warning if these functions are called. This potentially capture other compatibility issues in the tests that would be ignored having all deprecation warnings disabled. Tested with GLib 2.28 and 2.52. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12red-worker: Start processing commands as soon as possibleFrediano Ziglio1-0/+1
When the worker is started it could take a while to start processing commands. The reason is that the dispatcher handler is called after the worker so GLib will receive a FALSE answer to both prepare and check callbacks of the RedWorkerSource causing GLib to wait till another event is received. This is a regression since the introduction of GLib event loop, before the command processing was always attempted after any events. Commands (from QXL interface for cursor and display) are processed during the RedWorkerSource dispatch so if they are not processed just when the VM is started they will be processed on next event which could be from dispatcher (main thread requests), from existing connections or from pending timers. However in the case there are no clients connected and no other requests from main thread the worker thread won't process them. Setting the event_timeout to 0 cause the prepare callback to return TRUE so GLib will dispatch the RedWorkerSource. This was discovered attempting to use the tests in server/tests directory to reproduce a leak in RedWorker. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12test-gst: Free pipelinesFrediano Ziglio1-0/+15
Pipelines are never freed. These are detected as leaks by leak detector tools like address sanitizer. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12test-gst: Remove options parsing leaksFrediano Ziglio1-12/+24
Command line options are not freed at the end of the program. These are detected as leaks by leak detector tools like address sanitizer. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12test-gst: Remove useless checkFrediano Ziglio1-5/+0
encoder_name is never NULL as already initialized with "mjpeg" value. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12reds: Fix leaks if reds_init_client_ssl_connection failsFrediano Ziglio1-3/+4
If a client is unable to complete the TLS handshake phase reds_init_client_ssl_connection leaked some memory as the stream is not correctly freed. This also causes the stream to send the SPICE_CHANNEL_EVENT_DISCONNECTED event. Otherwise only SPICE_CHANNEL_EVENT_CONNECTED was sent. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12tests: Check leaks in spice_server_add_ssl_clientFrediano Ziglio2-0/+13
Currently is possible to trigger a leak by passing an invalid connection. This can happen if the client opens a connection and then closes it without writing or reading any data. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-12red-channel-client: Early check for valid streamFrediano Ziglio1-8/+14
The code tests for the presence of RedChannelClient::stream while initializing RedChannelClient. However, the check was done too late, and a RedChannelClient::config_socket implementation (for example snd_channel_client_config_socket) could have tried to use it before the check that it's not NULL. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-11mjpeg: Reuse realloc instead of implementing it manuallyFrediano Ziglio1-5/+1
This potentially can also save the copy if there is enough space to resize the buffer in place. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-11reds-stream: Remove shutdown fieldFrediano Ziglio2-7/+6
This field was used only by RedChannelClient to mark when the socket was shutdown. This condition can simply be tested by RedChannelClient checking if there's a watch as is the only condition (beside object destroying/disconnecting) where the watch is removed. In any case the shutdown was used to understand if there were possible data still to read. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-11docs: Add some documentation on spice threading modelFrediano Ziglio3-2/+79
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-08red-qxl: Remove unused includesFrediano Ziglio1-2/+0
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-09-08red-qxl: Move private declarations to red-worker.hFrediano Ziglio3-244/+250
RedQxl and RedWorker are quite bound together running CursorChannel and DisplayChannel in a separate thread marshalling (RedQxl) and unmarshalling and executing (RedWorker) requests. Make the communication between them private trying to facilitate maintaining these two files. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>