Commit Graph

3095 Commits

Author SHA1 Message Date
Jonathon Jongsma
f751eb9fdb spicevmc: store channel in char device
Store the channel in the char device object, and unref it in dispose.
Previously, we were just creating a channel and potentially allowing it
to leak.  There may be better long-term solutions, but this works for
now.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-04 08:58:38 +00:00
Jonathon Jongsma
fe1583a6a9 Convert RedClient to GObject
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-02 19:30:58 +00:00
Jonathon Jongsma
bc8d967e67 Move RedClient to a separate file
Also move the RedClient struct out of the header to avoid accessing the
internals from other files.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-02 19:30:58 +00:00
Jonathon Jongsma
1f4705e130 Re-arrange channel client creation to avoid exposing client lock
Instead of requiring the channel client to lock the client's lock,
re-arrange things so that all of the locking can be internal to
RedClient methods. So instead of having a pre-create validate function,
we simply move the check to red_client_add_channel() and return an error
if a channel already exists. This encapsulates the client implementation
better and also reduces code duplication in RedChannelClient and
DummyChannelClient.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-02 19:30:53 +00:00
Jonathon Jongsma
b3b5ab3663 Convert RedsState::clients to GList
Switch from a Ring to a GList so that we can hide the internals of
RedClient in a future commit.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-02 16:10:18 +00:00
Frediano Ziglio
19744b41c2 Avoid to typedef twice RedChannel
It's already defined in the same file some lines above.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-02 16:07:25 +00:00
Frediano Ziglio
654dfa4ca5 red-channel-client: Change initialization order
Make the order of initialization closer to what it was before
conversion to GObject.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-02 15:48:04 +00:00
Frediano Ziglio
bac3a682c8 red-channel-client: Move incoming/ougoing initialization to constructor
These fields need just channel to be set to be initialized.
Move their initialization to constructor to make sure
they are initialized as soon as possible.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-02 15:47:59 +00:00
Frediano Ziglio
f5c0e555d3 red-channel-client: Init pipe field during init
There was a chance that on error GQueue were not
initialized but an attempt to destroy it is made.
This ensures GQueue is initialized as soon as
possible. Note that red_channel_client_initable_init
is called after all init and construction callbacks.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-02 15:47:39 +00:00
Pavel Grunt
2837896974 Add .gitlab-ci.yml
Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 16:53:57 +01:00
Jonathon Jongsma
e09f8bab6c Rename SpiceVmcState to RedVmcChannel
Internal types use the 'Red' prefix by convention, rather than the
'Spice' prefix. In addition, this type inherits from RedChannel, so
makes the code a lot clearer to call it a 'channel' rather than a
'state'.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 15:02:18 +00:00
Frediano Ziglio
5d88c28786 red-channel-client: Remove only written field
id field of RedChannelClient is not used and marked as debugging.
Also it's value is quite confusing.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-11-01 14:24:39 +00:00
Christophe Fergeau
c7f492b75c syntax-check: Add missing license headers
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:48:26 +00:00
Christophe Fergeau
c979647a77 syntax-check: Remove unused header includes
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:48:20 +00:00
Christophe Fergeau
9c21b474c0 syntax-check: Add missing <config.h> includes
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:47:14 +00:00
Christophe Fergeau
d6c5b5c058 syntax-check: Remove trailing whitespace from EOL and EOF
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:46:16 +00:00
Christophe Fergeau
b7c7a6ca9d syntax-check: Add missing contributors names to AUTHORS
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:43:07 +00:00
Christophe Fergeau
05b7afb3fb syntax-check: Change tabs to spaces
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:43:05 +00:00
Christophe Fergeau
e91c1844f1 syntax-check: Add missing license
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:42:49 +00:00
Francois Gouget
fff92908b2 streaming: Clarify GStreamer's virtual buffer size documentation
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:36:04 +00:00
Jonathon Jongsma
207cd10dcc Limit maximum "n-surfaces" via param spec
In commit beec1b41, we manually limited this property value in
_set_property(). But there's a simpler way to do it: via the param spec
for the property.

This also means that we can remove the warning log in red_worker_new()
since GObject will automatically warn if a property is assigned a value
outside of its valid range.

Change the minimum and default value for this property from 0 to 1 so
that we always have a primary surface.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 12:28:36 +00:00
Pavel Grunt
5fba8dd1a3 Do not enable statistic by default
It is more a feature for developers, not force them.

Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 11:36:33 +00:00
Pavel Grunt
38b741795f Allow to compile without RED_STATISTICS
Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-01 11:36:27 +00:00
Frediano Ziglio
b4c40ea51f Do not declare image_encoders_compress_lz4 if LZ4 is not available
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-01 10:30:27 +00:00
Frediano Ziglio
c5059edb82 Remove red_pipe_add_verb family function
These functions were implementing the same stuff as empty
messages functions provided by RedChannel so reuse them.

The implementation seems a bit different but the result
is the same. Specifically:
- RedEmptyMsgPipeItem::msg is int while RedVerbItem::verb was
  uint16_t however this data goes into the message type which
  is uint16_t (a 16 bit on the network protocol);
- red_channel_client_send_empty_msg calls
  red_channel_client_begin_send_message while red_marshall_verb
  does not. However red_marshall_verb is called only by
  cursor_channel_send_item and dcc_send_item which always
  calls red_channel_client_begin_send_message.
  Note that in dcc_send_item when an empty message is sent
  red_channel_client_send_message_pending always returns
  true;
- when a PipeItem is created red_channel_client_pipe_add_empty_msg
  calls red_channel_client_push while red_pipe_add_verb does not.
  This actually make very little difference as this kind of item are
  never removed from the queue and a push is forced in every case
  running the event handler for the stream watch (see
  prepare_pipe_add and red_channel_client_event).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-01 02:15:28 +00:00
Frediano Ziglio
ed9d759ba4 Constify video_codec_caps
This remove a writable global variable.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2016-10-31 13:28:33 +00:00
Frediano Ziglio
909841b312 worker: Remove dependencies from red-worker.h
red_drawable_unref declaration was moved to red-parse-qxl.h.
Result is that only RedDispatcher know of the existence of RedWorker.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-10-31 10:26:39 +00:00
Frediano Ziglio
2307bb45b5 Move capability initialisation into channel creation
No reason why RedWorker should know the capabilities of
DisplayChannel.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-31 09:40:40 +00:00
Francois Gouget
96818da95d streaming: Limit the h264 image compression level
When uncapped x264enc can compress the frames beyond recognition in low
bitrate situation. Beyond the set limit the gains are modest and it is
better to drop frames to reduce the bit rate further.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-29 10:33:36 +01:00
Frediano Ziglio
2f18466293 Allows to have more than 1 QXL device
This was introduced with 96e94c6f32
(Convert RedChannel hierarchy to GObject).
The id of CursorChannel/DisplayChannel were always 0 causing
a wrong assertion on the code.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-28 15:04:48 +01:00
Frediano Ziglio
6fe8d5d49d Call parent constructor always at the beginning
In this case there is not much change but better
to follow that style as all other constructors
do.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-28 15:04:44 +01:00
Frediano Ziglio
695dd7c58d Fix handle-acks regression
This was introduced with 96e94c6f32
(Convert RedChannel hierarchy to GObject).
The handle-acks settings was TRUE for CursorChannel and DisplayChannel.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-28 15:02:36 +01:00
Frediano Ziglio
f96a78fc4b Fix typo in comment
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-27 17:05:44 +01:00
Frediano Ziglio
2f5d0b502f Make reds_stat utility work with both 32 and 64 bit architectures.
Due to alignment problems the structure of statistics file is
different between 32 and 64 bit. This as on 32 bit uint64_t is
aligned to 4 bytes instead of 8 so sizeof(SpiceStat) can be either
20 (32 bit) or 24 (64 bit).
This cause reds_stat utility to be bit dependent.
Detect the correct SpiceStat size and use that information.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-10-27 15:51:27 +01:00
Frediano Ziglio
13e9cf0194 Fix core-interface type regression
This was introduced with 96e94c6f32
(Convert RedChannel hierarchy to GObject).
The type for "core-interface" property should be
SpiceCoreInterfaceInternal, not SpiceCoreInterface.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-27 10:36:56 +01:00
Frediano Ziglio
542bc47846 Remove g_smartcard_channel global
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-27 10:28:59 +01:00
Frediano Ziglio
555886c8d7 Remove duplicate include
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-26 09:45:57 +01:00
Pavel Grunt
840040b51e Add missing header to Makefile.am
Fix make distcheck

Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-26 07:47:44 +01:00
Jonathon Jongsma
35b7f4d5ef Implement vfuncs for DummyChannel
96e94c6f inadvertantly introduced a regression where an assert was
triggered in red_channel_constructed for DummyChannel since DummyChannel
didn't implement any of the expected RedChannel vfuncs. This patch
avoids the assert by assigning some empty vfuncs.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-25 16:24:03 -05:00
Jonathon Jongsma
96e94c6f32 Convert RedChannel hierarchy to GObject
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-25 11:32:13 -05:00
Frediano Ziglio
8f43c8348c Remove unused declaration
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-25 15:16:53 +01:00
Frediano Ziglio
afd4d44807 red-worker: Do not include not necessary red-channel-client.h
Definitions are all in red-channel.h

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 17:19:39 +01:00
Frediano Ziglio
177c331c53 Avoid to typedef twice MainChannel
MainChannel is already defined in main-channel.h.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 17:01:19 +01:00
Frediano Ziglio
beec1b4175 display channel: Don't let client set too many surfaces
Limit the n_surfaces argument to avoid overflowing the surfaces array.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 16:43:51 +01:00
Frediano Ziglio
090fbe5eeb Avoid recursive inclusion of headers
red-common.h included utils.h which included red-common.h

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 16:33:20 +01:00
Frediano Ziglio
b0d8ba9a6a Allows to use scripts for "make check"
Allow both compiled and non-compiled tests to be used with "make
check". Compiled tests should be added to check_PROGRAMS, and scripts
that do not need to be built should be added to TESTS.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:45:12 +01:00
Frediano Ziglio
6f32ec1434 Declare same enumerator in a single header
Avoid having duplication and desynchronisation.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:27:50 +01:00
Frediano Ziglio
14d0ac5fb5 Move monitors_config_ref inside red_monitors_config_item_new
This makes red_monitors_config_item_new() and
red_monitors_config_item_free() symmetric.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:26:55 +01:00
Frediano Ziglio
cd631b5819 dcc: Use spice_new instead of spice_malloc
spice_new return directly the correct type.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:25:42 +01:00
Frediano Ziglio
da4a0fbe03 Fix typo in comment
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:24:35 +01:00