Commit Graph

2579 Commits

Author SHA1 Message Date
Frediano Ziglio
44a97b6095 use constructor/destructor macros
Initialize global images at load time:
- make sure these stuff are initialized without using runtime
resources;
- make sure stuff are initialize really earlier.
Do not use atexit function but a destructor.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-23 16:31:02 +00:00
Frediano Ziglio
088add2b98 qxl: implement QXLWorker interface, do not use as a base class
QXLWorker is the old interface now completely deprecated.
Remove the strict dependency of having it as a base class.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-23 14:30:07 +00:00
Frediano Ziglio
5c48cdc61d declare and use message for RED_WORKER_MESSAGE_GL_SCANOUT
All other messages (even empty ones) have a structure defined.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-23 14:09:53 +00:00
Frediano Ziglio
c51f1126eb build-sys: use safer SPICE_CONTAINEROF version
Enable additional checks for this macro.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-23 13:44:22 +00:00
Jonathon Jongsma
4f6c1765c7 Remove last usage of global 'reds' variable
This should be the final piece of removing the global reds variable. We
still need a global variable to clean up during the atexit() function,
but we use a GList of servers (even though we technically don't support
multiple servers in the same process yet).

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-23 08:21:57 +00:00
Christophe Fergeau
5981cf2645 char-device: Add helpers for SpiceCharDeviceCallbacks vfuncs
Add helper functions wrapping calls to the virtual functions
defined in SpiceCharDeviceCallbacks.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-22 10:29:39 +00:00
Christophe Fergeau
4bf53c23d8 Remove dependency of vdi_port_read_buf_process on RedsState
This makes it easier to move the VDIPort API to a different file, and
make it as self-contained as possible.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-21 10:34:31 +00:00
Christophe Fergeau
0df59fcfc9 agent: Sync AgentMsgFilter state upon agent connection
AgentMsgFilter needs to know whether monitors config messages need to be
filtered or not. This used to be done from within
agent_msg_filter_config() using the global RedsState, but this got more
tricky as it was removed.
A first attempt a1e62fa5ae caused crashes on qemu startup with
"qemu-system-x86_64 -spice port=5900" (without -vga qxl). A second
attempt added a RedsState* argument to agent_msg_filter_config() which
in my opinion is not really nice from a layering point of view.

This new attempt makes sure AgentMsgFilter state is correct when the
filter is set to stop discarding all data, which allows to remove direct
use of RedsState from within AgentMsgFilter.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-21 10:34:29 +00:00
Christophe Fergeau
79e02e98ab Revert "fix regression due to callback called earlier"
Passing Reds into agent-msg-filter.[ch] isn't the right thing to do from
a layering point of view.

This reverts commit a1e62fa5ae.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-21 10:34:22 +00:00
Christophe Fergeau
722ad4c76b Remove red_channel_set_data()
It's always called at the same time as red_channel_register_client_cbs()
and the data is used by the callbacks, so we can pass the data as an
argument to red_channel_register_client_cbs().

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-17 18:54:52 +00:00
Christophe Fergeau
fe9977c469 Use red_qxl_check_qxl_version in red-worker
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-17 16:26:58 +00:00
Christophe Fergeau
ae931c7dab Add more red_qxl_ methods
Add red_qxl_ methods wrapping the QXLInterface vfuncs. This allows to
remove most of the qxl_get_interface() use outside of red-qxl.c

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-17 16:26:56 +00:00
Christophe Fergeau
e45ab9cf23 Use QXLInstance instead of QXLState in red_qxl_*
This seems to make more sense this way, QXLInstance is the 'main' object
with QXLState being its private data. External users then use QXLInstance
rather than passing a pointer to the private data to red-qxl.h methods.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-17 16:26:33 +00:00
Francois Gouget
768ec149db server: Add some comments to the sound structures.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-16 16:36:52 -05:00
Francois Gouget
5bb27f240b server: Give the SndChannel's ref and unref methods their expected name
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-16 16:36:48 -05:00
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
Marc-André Lureau
264a80264a Update spice-common
Pick codegen build fix (codegen is back in spice-common, see related
commits & discussion thread)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2016-03-11 12:58:11 +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