Commit Graph

1864 Commits

Author SHA1 Message Date
Francois Gouget
8a5ba34c01 server: Correctly handle and trace stream report errors
We may get stream reports after the stream has been closed, and even, in
extreme cases, after a new stream has started reusing the same stream
id. Neither case should cause the server to crash.
So restore dcc_handle_stream_report() to how it was before being moved
to dcc.c.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-05-04 10:49:13 +01:00
Snir Sheriber
69edf8307d Using already exists function instead of SPICE_CONTAINEROF
Using spicevmc_red_channel_client_get_state(rcc) (which already
exists) instead of SPICE_CONTAINEROF(rcc->channel, SpiceVmcState,
channel).

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-05-04 10:46:35 +01:00
Jonathon Jongsma
a08bf51383 Name MainChannelClient methods consistently
Always use main_channel_client_ prefix instead of just main_channel_ in
some cases.
2016-04-29 15:49:56 -05:00
Jonathon Jongsma
88d76a9faa Call public RedClient API instead of poking internals
Use red_client_during_migrate_at_target() instead of checking
rcc->client->during_target_migrate.
2016-04-29 14:58:21 -05:00
Jonathon Jongsma
f38cddfacf Don't touch RedClient internals from RedChannelClient
Change red_channel_client_set_migration_seamless() so that it returns a
boolean which RedClient can use to update its internal count of
num_migrated_channels rather than having RedChannelClient reaching into
the internals of RedClient
2016-04-29 14:57:34 -05:00
Christophe Fergeau
fb1ccd0f0d audio: Remove global 'playback_compression' variable
This variable belongs to SpiceServerConfig rather than being a static
global variable hidden in sound.c

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-27 10:27:35 -05:00
Christophe Fergeau
8551280d43 Remove dead code in reds_fill_channels()
channels_info->num_of_channels is assigned, its value is not used, and
then it's assigned a different value. The first assignment can be
removed.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-27 10:27:31 -05:00
Christophe Fergeau
8e5bacd8b1 Improve Reds/RedMainChannel interface
Instead of exporting 2 methods to get number of channels, and to fill
channel information, and use that from the main channel code, it's
better to do everything in one go in reds.c, and call that single method
from the main channel code.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-27 10:27:27 -05:00
Christophe Fergeau
b0cc5bfcbd Add _config_ to SpiceServerConfig accessors
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-27 10:27:23 -05:00
Christophe Fergeau
b41220b144 Mark unused public API methods/code as deprecated
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-27 10:27:08 -05:00
Christophe Fergeau
4b45b74144 Add RedServerConfig
This wraps/groups the various parameters that can be set by spice-server
users through the spice_server_set_xxx public API.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-27 10:27:05 -05:00
Jonathon Jongsma
920e117c24 Rename all RedPipeItem subclasses
Use 'Red' prefix to match internal type naming convention

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-27 10:22:26 -05:00
Jonathon Jongsma
b9720d80e0 Rename PipeItem to RedPipeItem
Following internal type naming conventions

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-27 10:22:01 -05:00
Christophe Fergeau
64dc3ab244 Use weak gobject ref instead of reds_on_char_device_state_destroy
RedCharDevice implementation had to callback into reds.c in order to let
it know a char device was being destroyed. Now that RedCharDevice is a
gobject, a weak reference can be used instead allowing to remove that
coupling.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-27 09:41:01 -05:00
Christophe Fergeau
d232e92794 Use GQueue for RedCharDevice::send_queue
There was an extra RedCharDeviceMsgToClientItem type whose only
purpose was to manage a linked list of items to send. GQueue has the
same purpose as this type in addition to being generic. As the length of
the send queue is tracked, a GQueue is more appropriate than a GList and
allow to remove RedCharDevice::send_queue_size.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-27 09:41:01 -05:00
Jonathon Jongsma
18d3876b78 UpgradeItem: use base PipeItem for refcounting
No need to re-implement refcounting in this subclass.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-27 09:40:57 -05:00
Jonathon Jongsma
50a2c2fce2 Store display in Drawable struct
If the Drawable keeps a pointer to the Display channel that it is
associated with, we can unref it directly and not need to pass the
'display' parameter separately to the unref function

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-27 09:40:43 -05:00
Marc-André Lureau
c6b1fc3551 worker: remove check for canvas during cursor connect
We want the cursor to be initialized even if there is no canvas,
especially when using a GL scanout. This solves some client warnings
when using qemu with GL scanout-only (patches under review on qemu ML).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-26 16:29:04 +01:00
Christophe Fergeau
0f947b425c Remove use of opaque from vdi_port_read_one_msg_from_device
We can get 'reds' from the RedCharDevice accessible from the
SpiceCharDeviceInstance passed as an argument.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-20 14:27:18 -05:00
Jonathon Jongsma
39b00dc71e char device: use _reset_dev_instance() to set 'sin'
Internally, use the method to set the 'sin' member variable so that we
don't have to duplicate the g_object_notify() calls, and there are
consistent debug statements whenever this value is modified. This also
means that we need to handle NULL arguments to this function.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-20 14:27:18 -05:00
Jonathon Jongsma
82024257b6 char device: use 'device' rather than 'state' for var names
Since the type name was changed, use variable names / debug statements
that are consistent with the new name.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-20 14:27:18 -05:00
Jonathon Jongsma
c28773f17a char-device: notify when device instance is changed
Since the device instance ("sin") is a gobject property, we should make
sure to notify when it changes, particularly since we do some
initialization in response to the "notify::sin" signal.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-20 14:27:18 -05:00
Pavel Grunt
064f846c5e sw-canvas: Get rid of unsused SW_CANVAS_IMAGE_CACHE
See spice-common commit edac1b36b572cbd8988c44341185a9f51ea3eeb5
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-19 14:06:04 +02:00
Christophe Fergeau
48e85a11c7 char-device: Remove RedCharDeviceClass::{un, }ref_msg_to_client
Now that client messages are always RedPipeItem, we don't need virtual
functions to know how to ref/unref them.
2016-04-15 11:14:36 -05:00
Christophe Fergeau
021d960471 char-device: Replace RedCharDeviceMsgToClient with PipeItem
Now that all derived classes use a type deriving from PipeItem for their
RedCharDeviceMsgToClient, we can make this explicit in the
RedCharDeviceClass vfuncs, and remove the RedCharDeviceMsgToClient
typedef.
2016-04-15 11:14:36 -05:00
Jonathon Jongsma
521dd24ffb dcc: Use refcounting for MonitorsConfigItem 2016-04-15 11:14:34 -05:00
Jonathon Jongsma
e09598ec75 StreamClipItem: use base class refcounting
PipeItem already implements refcounting. Use it.
2016-04-15 09:59:10 -05:00
Jonathon Jongsma
889a0b880f DrawablePipeItem: use base class for refcounting
Since PipeItem already implements refcounting, there's no need to
re-implement it here.
2016-04-15 09:59:08 -05:00
Jonathon Jongsma
3bd6b215d3 dcc: use PipeItem refcounting for ImageItem
Since the base class now implements refcounting, there's no need to
re-invent it here.
2016-04-15 09:53:19 -05:00
Christophe Fergeau
75a2873c6b SpiceVmcPipeItem: use base PipeItem for ref counting
This allows to reuse pipe_item_{ref, unref} rather than
reimplementing them in spicevmc.c
2016-04-15 09:53:18 -05:00
Christophe Fergeau
eee63f9e28 smartcard: Use base PipeItem for MsgItem refcounting
This allows to reuse pipe_item_{ref, unref} rather than
reimplementing them in smartcard.c
2016-04-15 09:50:20 -05:00
Christophe Fergeau
cc47d9eba8 reds: Derive VDIPortReadBuf from PipeItem
Since PipeItem is already refcounted, this allows to remove various
layers of ref/unref helpers from reds.c, and use the generic
pipe_item_{ref, unref} instead.
2016-04-15 09:50:20 -05:00
Christophe Fergeau
c1b7f67b82 Add reference counting to PipeItem class
A user-defined callback is called when the refcount drops to 0.

Reference counting is manually coded for several classes deriving from
PipeItem, so this change will help to share this code, and allow to remove
some ref/unref virtual functions in some interfaces when we can assume
every instance derives from this base class.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-15 09:50:18 -05:00
Frediano Ziglio
b3aebf9136 red-channel: make red_client_{ref,unref} thread safe
These function are called on both sides of dispatcher so the
increment/decrement of the counter is done in multiple threads.
This caused the counter to not get incremented correctly and
freed the structure too early, leaving a dangling pointer in
the other thread.

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

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-12 16:28:07 +01:00
Christophe Fergeau
7d616b3de3 char-device: Fix el6 compilation
One more duplicate typedef, once in reds.c and another time in
reds-private.h
RedsState::agent_dev is defined in reds-private.h but only used in
reds.c, so longer term this could all be moved back to reds.c
2016-04-11 09:28:46 +02:00
Christophe Fergeau
0c6e51011b Move RedCharDeviceCallbacks into RedCharDeviceClass
This structure holding virtual function pointers was kept until now as a
RedCharDevice member in order to make the GObject conversion easier.
Now that all RedCharDevice children are converted to GObject, it can be
moved into RedCharDeviceClass.
2016-04-07 11:42:37 -05:00
Christophe Fergeau
87b6b9273d reds: Remove red_char_device_new()
Nothing is using it anymore now that CharDevice classes are
gobjectified.
2016-04-07 11:42:24 -05:00
Christophe Fergeau
1cec1c5118 reds: Make VDIPortState a GObject
This inherits from RedCharDevice.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-06 11:54:53 -05:00
Jonathon Jongsma
eaaa8985fd Rename VDIPortState to RedCharDeviceVDIPort
Consistent with internal naming conventions, and prepares for
conversion to GObject
2016-04-06 11:45:28 -05:00
Christophe Fergeau
d2e6696fb3 smartcard: Turn RedCharDeviceSmartcard into a GObject
This inherits from RedCharDevice. Once all char device states are
converted, we can turn the associated vfuncs into RedCharDeviceClass
vfuncs.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-06 11:37:07 -05:00
Jonathon Jongsma
756f0d5d0b Rename SmartCardDeviceState to RedCharDeviceSmartcard
More consistent with naming conventions, and prepares for converting
this type to a GObject which inherits from RedCharDevice.
2016-04-06 11:35:36 -05:00
Christophe Fergeau
05093f2187 qxl: Remove duplicate QXLState typedef
We can directly include spice-qxl.h in red-qxl.h as it already gets it indirectly anyway.
>
2016-04-06 10:30:00 +02:00
Christophe Fergeau
e37f97a9f8 reds: Move RedsState typedef to red-common.h
This allows to stop using struct RedsState * rather than RedsState * in
headers which cannot include reds.h. This also allows to remove the
duplicate RedsState typedef in reds.h and reds-stream.h which is causing
issues with older gcc versions.
2016-04-06 10:30:00 +02:00
Christophe Fergeau
852a9824a1 char-device: Fix property name in red_char_device_new()
This method will be removed in a subsequent commit, but for now it's
causing breakage since it's setting "reds" instead of "spice-server"
2016-04-06 10:30:00 +02:00
Christophe Fergeau
bbee12d2b8 audio: Improve snd_receive type-safety
We can pass it a SndChannel rather than an opaque void* data pointer
which we then blindly cast.
This came to light through a -Wshadow warning as there was a local
variable 'data' in addition to the 'data' parameter.
2016-04-05 16:49:40 +02:00
Christophe Fergeau
4d3c8bdb98 char-device: Remove duplicate typedef 2016-04-05 16:49:40 +02:00
Christophe Fergeau
eb58bc9ad0 gobject: Add g_type_init() for older glibs
Older glib versions require g_type_init() to be called before using
GObject.
2016-04-05 16:49:40 +02:00
Christophe Fergeau
d5c17b50bc reds: Prepare to make VDIPortState a GObject
This inherits from RedCharDevice.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-02 18:19:50 +01:00
Christophe Fergeau
9bf65f1c58 reds: Make VDIPortState private to reds.c
VDIPortState and VDIReadBuf don't really need to be defined in a header
file as they are only used in reds.c

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-02 18:15:32 +01:00
Christophe Fergeau
39b7c5a0c0 spicevmc: Introduce RedCharDeviceSpiceVmc GObject
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-02 18:07:15 +01:00