Commit Graph

2290 Commits

Author SHA1 Message Date
Frediano Ziglio
eef0e07a0f sound: Peep hole optimisation
Reduce SpiceVolumeState structure size on 64 architectures
swapping the order of two fields.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-12 09:39:28 +00:00
Frediano Ziglio
4e9a274c04 sound: Minor simplification due to volume move
Reuse more code in snd_send_volume and snd_send_mute.
Reduce conversions in on_new_playback_channel and
on_new_record_channel.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-12 09:39:23 +00:00
Frediano Ziglio
c3aece7601 sound: Move volume field to SndWorker
This field is common to SpicePlaybackState and SpiceRecordState
which are based on SndWorker.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-12 09:38:25 +00:00
Frediano Ziglio
79c0426194 replay: Remove time argument from recording functions
Time is always the the current real time so avoid to compute
it for every call but move to red-record-qxl.c.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-10 21:51:25 +00:00
Frediano Ziglio
5902960d39 Make red-replay-qxl.h a public header
The functions declared in that header are all exported by the
library.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-10 06:37:15 +00:00
Frediano Ziglio
d0f4910c1d replay: Check properly version number
0 as version was never used so don't allow it

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-10 06:37:12 +00:00
Frediano Ziglio
c6881ad1a0 replay: Replicate wakeups properly
Instead of waking up the command loop for every command queued,
handle saved wakeups and replicate these.
This better reproduces what happened in the server.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-10 06:32:58 +00:00
Frediano Ziglio
1b15983415 Make QXLMessage handling safe
The QXLMessage has no size so potentially a guest could give an
address that cause the string to overflow out of the video memory.
The current solution is to parse the message, release the resources
associated without printing the message from the client.
This also considering that the QXLMessage usage was deprecated
a while ago (I don't know exactly when).
This patches limit the string to 100000 characters (guest can feed
so much logs in other way) and limit to video memory.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-09 16:43:40 +00:00
Frediano Ziglio
e702371372 red-parse-qxl: Use same fuction to parse blend and copy commands
SpiceBlend and SpiceCopy are just different names for the same
structure.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-09 16:34:14 +00:00
Frediano Ziglio
4c23b55e7e syntax-check: Silent a wrong positive
Due to syntax-check limitation this free calls results in
a syntax error.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-09 16:20:22 +00:00
Frediano Ziglio
6b56c730a8 syntax-check: Include config.h file #include <>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-09 16:20:20 +00:00
Frediano Ziglio
fa1e077de9 syntax-check: Remove empty line at end of file
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-09 16:20:18 +00:00
Frediano Ziglio
6b2b931a0a Fix typo in comment
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-09 14:19:30 +00:00
Frediano Ziglio
389edb684b Revert accidentally merged experimental patches
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-09 13:54:58 +00:00
Frediano Ziglio
7766fbfb35 build a structure to hold all DCC stream fields
try to understand streams
2016-11-07 17:23:26 +00:00
Frediano Ziglio
7ef8efe104 NOTES 2016-11-07 17:23:26 +00:00
Frediano Ziglio
c84dc2e04c channel: cap roundtrip using Linux information if available
Linux kernel already compute roundtrip.
If available use it to limit discovered one.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-07 17:23:26 +00:00
Jonathon Jongsma
680cab338e RedChannelClient: use Gobject properties
Use g_param_spec_object() instead of g_param_spec_pointer() for the
'client' and 'channel' properties now that these types are GObjects.
This improves refcounting and typesafety slightly.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-07 17:22:03 +00:00
Pavel Grunt
2051007e05 spice-options-test: Convert to gtest to catch criticals
Fail on glib warnings instead of ignoring them

Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-07 17:18:45 +00:00
Frediano Ziglio
6a3917f653 spicevmc: Change creation of RedCharDeviceSpiceVmc
Instead of having channel and device object create one the other
create the objects at the beginning and then join them.

This make explicit the code that links the two objects and separate
the objects creation from the linking.

Also remove some boilerplate code.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-07 10:37:20 +00:00
Jonathon Jongsma
b6cca46d75 spicevmc: use 'channel' instead of 'state'
After renaming the object to RedVmcChannel, the local variables still
used the old 'state' terminology. Changing these variables to 'channel'
makes things a bit more consistent.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-04 11:02:25 +00:00
Jonathon Jongsma
7e70be6d16 Remove spicevmc_red_channel_client_get_state()
This helper function does nothing but cast the return from
red_channel_client_get_channel(), and it has a confusing name
(_get_state(), but returns a channel)

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-04 09:15:17 +00:00
Frediano Ziglio
97e299cc50 spicevmc: Clear RedVmcChannel on red_char_device_spicevmc_dispose
This move object destructions from spicevmc_device_disconnect
to RedCharDeviceSpiceVmc destructor functions assuring any possible
RedCharDeviceSpiceVmc object free will clear its references.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-04 08:59:18 +00:00
Frediano Ziglio
d80d7447e7 spicevmc: More RedVmcChannel::recv_from_client_buf cleanup to finalize
No reason why this should be done only on spicevmc_device_disconnect.
red_char_device_write_buffer_release can be called with first pointer
NULL.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-04 08:59:16 +00:00
Frediano Ziglio
cd7d3d3486 spicevmc: Free pipe_item in finalize
Assure field is freed at the end and not used or allocate again.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-04 08:59:06 +00:00
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
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
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