Commit Graph

1780 Commits

Author SHA1 Message Date
Uri Lublin
2480eb6979 replay: skip the first N (slow) commands
Note that the commands are executed by spice-server.
The "skip" is only done on the "sleep" part of the
"slow" command-line option.

This is helpful to run quickly through uninsteresting commands
in a beginning of a recorded file and going slowly when
interesting parts appear

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-16 10:09:07 +00:00
Uri Lublin
07cb94d7ab replay: count commands
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-16 10:08:48 +00:00
Christophe Fergeau
3ae8ce38a1 Use more explicit variable name in marshall_gl_scanout()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-15 21:36:10 +00:00
Christophe Fergeau
a33f874249 Fix typo in variable name in function prototype
num_common_cap rather than num_common_caps was not consistent with
the naming of the other arguments.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-15 21:36:07 +00:00
Christophe Fergeau
aa87700682 Remove unused red_qxl_set_dispatcher_opaque
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-15 21:33:10 +00:00
Christophe Fergeau
4c1471d0b6 Remove spice_server_set_keepalive_timeout
This public API is no longer needed as the keepalive interval does not
need to be configurable.
This API was present in the 0.13.0 release, but was never added to a
stable release, in my opinion it's still acceptable to remove it without
changing soname.
2016-03-11 18:27:51 +01:00
Christophe Fergeau
7199ce961a Always enable TCP keepalive
Always enabled, hardcoded interval
as per https://bugzilla.redhat.com/show_bug.cgi?id=1298590
2016-03-11 18:27:51 +01:00
Christophe Fergeau
23d328f713 smartcard: Move private constant to C file
APDUBufSize is only used within smartcard.c, no need to expose it in
smartcard.h

Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-10 11:52:52 +00:00
Christophe Fergeau
a653044011 Rename red_channel_pipe_item_init to pipe_item_init
The RedChannel argument is not used by pipe_item_init. Removing it
will make code simpler in places where we don't have a RedChannel
directly available.
This is acting on a PipeItem object so correct name is pipe_item_init.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-10 11:36:52 +00:00
Christophe Fergeau
3484b739a9 char-device: Refactor spice_char_device_client_add a bit
Factor out CharDeviceClientState creation out of
spice_char_device_client_add.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-10 10:48:11 +00:00
Christophe Fergeau
91bab2ff1c Replace RedsPrivate::mig_wait_disconnect_clients with a GList
The code was introducing an intermediate RedsMigWaitDisconnectClient type to
hold linked list elements, resulting in a memory handling behaviour very
similar to a GList. Using GList directly makes the code shorter and more
readable.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-09 17:33:53 +00:00
Christophe Fergeau
30f718aae2 Replace RedsPrivate::char_devs_state with a GList
The code was introducing an intermediate SpiceCharDevStateItem type to
hold linked list elements, resulting in a memory handling behaviour very
similar to a GList. Using GList directly makes the code shorter and more
readable.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-09 17:33:49 +00:00
Christophe Fergeau
e5c89b0b60 Introduce spice_char_device_get_interface()
Hides awkward casting/dereferencing to go from a
SpiceCharDeviceInstance to a SpiceCharDeviceInterface

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-09 17:33:43 +00:00
Frediano Ziglio
6fef38c86e Fix regression initialising QXL interface
st field in QXLInstance was not checked for NULL before
initialisation.
The additional check make Xspice crash during startup.

Reported-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-09 10:37:06 +00:00
Marc-André Lureau
acd53b97fb Fix dcc_start() regression
Commit e9ed125d introduced a dead-lock regression by taking twice the
same lock recursively. The previous code checked if a dmabuf was set
without taking the lock, for queuing scanout messages. Since the message
is being processed later on, it make sense to queue and delay until it
is sent to check if there is a scanout.

backtrace:
 #0  red_qxl_get_gl_scanout (qxl_state=0x5555582373c0) at red-qxl.c:828
 #1  0x00007fffec1ae654 in marshall_gl_scanout (rcc=0x7fffda6a7010,
 #m=0x7fff44025e60, item=0x7fff440958a0) at dcc-send.c:2310
 #2  0x00007fffec1aec7b in dcc_send_item (dcc=0x7fffda6a7010,
 #pipe_item=0x7fff440958a0) at dcc-send.c:2441
 #3  0x00007fffec1730f6 in send_item (rcc=0x7fffda6a7010,
 #item=0x7fff440958a0) at display-channel.c:1963
 #4  0x00007fffec1504c3 in
 #red_channel_client_send_item (rcc=0x7fffda6a7010, item=0x7fff440958a0)
 #at red-channel.c:578
 #5  0x00007fffec152d98 in red_channel_client_push (rcc=0x7fffda6a7010)
 #at red-channel.c:1365
 #6  0x00007fffec1a387e in dcc_push_monitors_config (dcc=0x7fffda6a7010)
 #at dcc.c:563
 #7  0x00007fffec1a3489 in dcc_start (dcc=0x7fffda6a7010) at dcc.c:475

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-08 15:24:56 +00:00
Jonathon Jongsma
df214cd031 Remove use of global 'reds' within RedWorker
Get the server variable from the QXLState instead of using the
global variable

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-05 10:29:26 +00:00
Jonathon Jongsma
37ccf6cdf4 Add red_qxl_get_server()
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-05 10:14:09 +00:00
Jonathon Jongsma
c3d43fdea7 Store reference to RedsState in QXLState
Remove use of global 'reds' variable from QXLState functions.
Instead store the owning RedsState variable inside the QXLState
struct and use that when necessary.

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-05 10:13:51 +00:00
Frediano Ziglio
95fa8bfb13 worker: remove useless qxl_state
qxl_state can be extracted easily from qxl.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-04 15:47:50 +00:00
Frediano Ziglio
e9ed125dbd use QXLState instead of RedDispatcher
Considering that:
- QXLState is the state of QXLInstance implementation;
- RedDispatcher is the implementation of QXL;
- qif (QXLInterface*) field can be computed really easy from QXLInstance;
- most of its state is private.
Make all structure private and use QXLState instead of RedDispatcher.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-04 15:47:45 +00:00
Frediano Ziglio
5916dd8fa6 rename red-dispatcher.* files to red-qxl.*
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-04 15:27:41 +00:00
Frediano Ziglio
a8ff771ee8 rename red_dispatcher_ functions to red_qxl_
RedDispatcher is basically implementing QXLInstance.
After some internal discussion we decided to use QXLState structure
and red_qxl_ as function prefix.
This is the first of 3 patches that rename functions, structure
and files.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-04 15:27:39 +00:00
Frediano Ziglio
994099dd3d fix indentation
Fix indentation for spice_debug call.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-04 14:24:59 +00:00
Frediano Ziglio
3fdc1775a6 optimize handle_dev_input call
Pass directly dispatcher to handle_dev_input callback.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-04 14:24:57 +00:00
Frediano Ziglio
597f30d5b7 reduce header dependencies
Avoid to include headers in cursor-channel.h which are only
used by cursor-channel.c

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-04 14:24:54 +00:00
Francois Gouget
968d7df719 server: Fix the order of the attach_stream() asserts
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-03 15:29:38 -06:00
Christophe Fergeau
55b9478b9c Make use of the new reds_core_timer_* API
This makes the code more readable.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-03 16:56:07 +00:00
Christophe Fergeau
79cbe5ce53 Introduce reds_core_timer_* 2016-03-03 16:47:05 +00:00
Christophe Fergeau
ebbe4779fc Introduce reds_core_watch_*
These methods wrap the RedsCoreInterface::watch_add,
RedsCoreInterface::watch_remove and RedsCoreInterface::watch_update_mask
vfuncs.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-03 16:45:36 +00:00
Uri Lublin
d82b8b0789 replay: do not use argv after g_option_context_parse
Apparently, after using g_option_context_parse with G_OPTION_REMAINING
argv is modified and should not be used.
This patch uses "file" instead of "argv" and makes sure
file is freed later.
No free is called upon error - exit takes care of it.
2016-03-03 11:57:44 +00:00
Francois Gouget
aa5a5fa630 server: Store the opaque pointer in VideoEncoderRateControlCbs
It has the same lifetime as the corresponding structure so this
simplifies keeping track of it.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-03 11:47:49 +00:00
Francois Gouget
2510f79fd4 server: Don't call snd_channel_get_server() if we don't have a channel
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-26 12:19:42 +00:00
Francois Gouget
f7bc8c0cd9 server: Remove an unnecessary cast in spice_replay_next_cmd()
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-25 09:18:06 +00:00
Michal Privoznik
2306c364d2 Update .gitignore files
The first part updates the .gitignore file in the root directory
because the file is obviously generated by automake but poison
our working tree.
The second part updates the .gitignore under server/tests/
directory because since 0db1137d we have a noinst test library
libtest.a. However, like in previous case, git should never track
this file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-25 09:12:51 +00:00
Frediano Ziglio
badb08a859 use G_N_ELEMENTS instead of manually compute array size
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-23 17:49:35 +00:00
Frediano Ziglio
b92588bf2c constify some global variables
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-23 17:49:26 +00:00
Frediano Ziglio
39ab6b3279 fix possible core calling timer callback
Was possible to have ping_timer_cb called with a NULL pointer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-20 13:16:46 +00:00
Frediano Ziglio
a1e62fa5ae fix regression due to callback called earlier
Patch 1f21008060 ("Remove use of global
'reds' from AgentMsgFilter") introduced a regression. This because
QXLInterface->client_monitors_config was called before returning
from spice_add_interface. Some client of spice-server expect the
spice_add_interface already returned and some state change was done
before client_monitors_config was called.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-19 09:51:25 +00:00
Frediano Ziglio
aa724b170b memslot: do not crash if guest provide a wrong address
This could happen with buggy driver.

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1264356

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-18 10:36:26 +00:00
Frediano Ziglio
2094e8f1db reds: remove unneeded variable
Remove version_string variable.
Was never changed and used in a single place.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-17 13:55:53 +00:00
Jonathon Jongsma
3644783e24 CommonChannel -> CommonGraphicsChannel
Rename this struct to make it clear that it's only the base class for
graphics channels (e.g. display and cursor), not all channels.

Also renamed CommonChannelClient to CommonGraphicsChannelClient.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-17 12:58:40 +00:00
Pavel Grunt
af3aa4b1f4 compress-stat: Add not compressed image to statistics
To see how many images and data could not be compressed.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-17 08:51:16 +00:00
Pavel Grunt
1948566ce8 dcc: Move COMPRESS_DEBUG to compression functions
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-17 08:51:13 +00:00
Pavel Grunt
f401eb07f9 dcc: Rewrite dcc_image_compress
Rules are now:

Compression type:
  off      -> uncompressed
  quic     -> jpeg if possible else quic else off
  lz       -> lz if possible else off
  glz      -> glz if possible else lz else off
  auto_lz  -> lz if possible else jpeg else quic else off
  auto_glz -> glz if possible else lz else jpeg else quic else off
  lz4      -> lz4 if possible else lz else off

jpeg is used only when jpeg-wan-compression allows it

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-17 08:50:43 +00:00
Frediano Ziglio
51bd316ce5 make RedDataChunk structure private inside red-parse-qxl.c
The structure is strictly used by the parser only, no reason to make it
public.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-16 13:13:00 +00:00
Frediano Ziglio
c111bfa8c3 worker: removed unused red_worker_get_qxl function
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-16 13:09:33 +00:00
Frediano Ziglio
0ebd3b0d04 dcc: move id from CommonChannelClient to DisplayChannelClient
Was not used by CursorChannelClient but only by DisplayChannelClient.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-16 13:07:08 +00:00
Jonathon Jongsma
1438b7ccf2 Add GObject to build requirements
Preparation for GObject-ifying some internals

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-16 11:22:04 +00:00
Christophe Fergeau
2db21168d8 Remove redundant argument to vdi_port_read_buf_process
The 'port' argument can be determined from VDIPortState, so no need to
pass both (through RedsState) to vdi_port_read_buf_process().

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-16 11:21:25 +00:00
Jonathon Jongsma
1f21008060 Remove use of global 'reds' from AgentMsgFilter
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 10:54:30 +00:00