Commit Graph

3152 Commits

Author SHA1 Message Date
Frediano Ziglio
973cbb4df2 Revert "replay: Replicate wakeups properly"
This reverts commit c6881ad1a0.

This patch cause the replay utility run at full speed
to slow down a lot and in some cases getting stuck.
I don't understand the reason and when I tested was working
but as we are going to release would be a pity if this test utility
won't work as useful to get feedback and reports.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-17 11:03:51 +00:00
Pavel Grunt
720f0d0a59 Define G_LOG_DOMAIN
Otherwise messages produced by g_{warn, return, ...} are not prefixed
like the spice_ variants.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-17 09:01:23 +00:00
Jonathon Jongsma
a7829c9609 Fix build when builddir != srcdir
The following build error occurs when building outside of the source
directory:

glib-mkenums --template spice-server-enums.tmpl.c ../../server/spice-server.h > spice-server-enums.c
Can't open spice-server-enums.tmpl.c: No such file or directory
Makefile:1111: recipe for target 'spice-server-enums.c' failed

Make/Automake uses VPATH to determine that the spice-server-enums.tmpl.c
file listed in the prerequisites for the rule is located in the srcdir.
When we use an automatic variable (e.g. $<), the full path to the
resolved file is used. But when we use the literal filename directly
within the rule definition, this won't happen. So we need to explicitly
specify that the input template file is located in srcdir.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-16 10:47:26 -06:00
Frediano Ziglio
002c7c9eeb Make RedStatFile private inside stat-file.c
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-16 16:38:32 +00:00
Frediano Ziglio
41c042ca36 Avoid leaking file descriptor for statistics
mmap memory area will remain even if the descriptor is closed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-16 16:38:30 +00:00
Frediano Ziglio
d163f17a36 Use g_strdup_printf instead of manually malloc/snprintf
Make the code easier and shorter.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-16 16:38:27 +00:00
Frediano Ziglio
5209d33977 Add a base test for statistic file
Create a file and add/remove some nodes.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-16 16:38:24 +00:00
Frediano Ziglio
fe543c6b45 Fix node removal
Avoid to produce loop in the tree removing and adding nodes.
Unlink the node from the containing tree.
This possibly will create unlinked trees if a parent node is
deleted.

What was happening is that the creation of loops inside
the tree caused some statistical function to go into an
infinite loop (and reds_stat tool too).

Nodes were only invalidated but still linked so when reused
the new node could point to an already existing node (like a
sibling) which pointed to the new reused one.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-16 16:38:21 +00:00
Frediano Ziglio
f9ccabfaea Separate code to manage statistic file
Code is quite independent so move in separate file.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-16 16:38:13 +00:00
Pavel Grunt
99eff8500b Do not use gstreamer in default codecs if not available
Avoid the following warning when build with disabled gstreamer:
Spice-WARNING **: reds.c:3660:reds_set_video_codecs: spice: unsupported video encoder gstreamer

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-16 14:33:48 +00:00
Pavel Grunt
b4981f78ff ci: Test syntax-check
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-15 17:28:46 +00:00
Pavel Grunt
e496772cb8 ci: Print results of tests on failure
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-15 17:28:12 +00:00
Frediano Ziglio
1b4e8855ea Remove core_public and core_interface_adapter globals usage
Avoid not constant globals.

We started encapsulating all global state into RedsState however
there are still some global variable. This patch remove the
core_public global variable.

To implement this a new SpiceCoreInterface *public_interface
field is added to SpiceCoreInterfaceInternal and the
SpiceCoreInterfaceInternal* argument is passed to callbacks to
understand which external interface to use.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-15 16:49:09 +00:00
Frediano Ziglio
de27dc034d Handle top down bitmaps dumping
The top down flag can be specified using negative heights.

According to
https://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx:

"The height of the bitmap, in pixels. If biHeight is positive, the
bitmap is a bottom-up DIB and its origin is the lower-left corner.
If biHeight is negative, the bitmap is a top-down DIB and its origin
is the upper-left corner."

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-15 14:12:25 +00:00
Frediano Ziglio
2e34c83391 spicevmc: Remove some duplicate typedefs
These cause compiler errors using RHEL6.
These typedefs are defined in the same file some lines above.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-15 11:50:27 +00:00
Frediano Ziglio
ffb47ecd88 gstreamer: Use pthread to avoid Glib compatibility issues with RHEL6
GCond/GMutex interface is different between Glib 2.32 and
previous versions. Use pthread for compatibility.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-15 10:41:00 +00:00
Frediano Ziglio
1a68768415 sound: Remove sin field from SpicePlaybackState and SpiceRecordState
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-14 21:56:57 +00:00
Frediano Ziglio
e4a1b5a9e6 sound: Reuse code for spice_server_get_best_{record,playback}_rate
These function were really similar.
Factor out a new snd_get_best_rate to avoid code duplication.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-14 21:56:57 +00:00
Frediano Ziglio
20c984d769 sound: Move frequency 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-14 21:56:51 +00:00
Frediano Ziglio
d1fac9e646 sound: Free worker volume in common function
The common function is supposed to clear the state of SndWorker
so clear even volume which now is in SndWorker

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-14 21:50:31 +00:00
Frediano Ziglio
b900147870 Fix header include order for some files
Include common and libraries includes before local ones as
stated by style.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-14 17:48:21 +00:00
Frediano Ziglio
eb02c0653d syntax-check: Use templates for glib-mkenums
Syntax checker complained about autoconf variable expansion used
inside Makefile.am.
This patch uses template files instead of options.
This also reduces quoting making template code more readable.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-14 17:45:32 +00:00
Frediano Ziglio
c18b696f1c Use SPICE_VERIFY macro for RHEL6 compatibility
The verify macro used currently has some problem
as it raise a warning in RHEL6.
Use new SPICE_VERIFY macro defined in spice-common
to avoid this issue.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-14 17:22:02 +00:00
Jonathon Jongsma
e86f9521db char-device: add 'self' param to vfuncs
Add a 'self' parameter to all of the char device virtual functions so
that we don't have to play games with the 'opaque' pointer.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-14 14:30:47 +00:00
Christophe Fergeau
f611228bd0 build: Cleanup disabled warnings a bit
Some C-specific warnings were turned off as the spice module used to
ship a C++ spice client. It's long gone, so we can reenable these
warnings.
There were warnings disabled for tunnel support and CEGUI usage which
have both been removed too.
-Wno-format-nonliteral was disabled twice.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-14 09:51:29 +00:00
Frediano Ziglio
81dbb18ccd Fix typo in comment
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-12 09:59:17 +00:00
Frediano Ziglio
37b7c6dd7a replay: Update comment
Function just return the command, has no ext_cmd parameter to fill.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-11-12 09:58:09 +00:00
Jonathon Jongsma
590acf3c55 Sound: change on_new_*_channel() signatures
Pass the new sound channel to these functions rather than setting
worker->connection before calling the function and expecting it to be
set when the function is called. The fewer unenforced assumptions that
must be true for a function to work properly, the easier it will be to
maintain.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-12 09:55:47 +00:00
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
46b6372865 build: Disable some newly added warnings
-Wshift-overflow cause an error to be detected in Glib headers.
-Wformat-signedness and -Wnull-dereference probably could be
fixed but currently they produce lot of errors.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-10 12:11:55 +00:00
Frediano Ziglio
12c97d2fea build: Update manywarnings.m4
Allows to catch more issues.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-10 12:11:10 +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
1db88a7216 syntax-check: Remove space at end of line
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-09 16:19:32 +00:00
Christophe Fergeau
8c36a85d16 syntax-check: Add exception for server/stat.h
Due to the use of static inline functions, the headers uses
G_GNUC_UNUSED, which the sc_avoid_attribute_unused_in_header test
complains about.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-11-09 15:37:45 +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