Commit Graph

1846 Commits

Author SHA1 Message Date
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
Christophe Fergeau
96bde4bf95 char-device: Make RedCharDevice a GObject
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-02 18:06:51 +01:00
Frediano Ziglio
77946c395b Rename some missing names related to RedCharDevice
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-04-01 14:40:44 +01:00
Frediano Ziglio
742612f34d Rename SpiceCharDeviceCallbacks to RedCharDeviceCallbacks
The structure is an internal one so should not have the Spice prefix
but use the Red one.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-04-01 14:33:54 +01:00
Christophe Fergeau
26f874e738 mjpeg: Add missing space to debug string 2016-04-01 15:16:27 +02:00
Jonathon Jongsma
a24ebcae89 Rename RedCharDevice functions
make the function names match the type names. So
spice_char_device_state_* becomes red_char_device_* and
spice_char_device_* also becomes red_char_device_*.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-01 11:59:46 +01:00
Jonathon Jongsma
0fd5b56be7 Rename SpiceCharDeviceClientState to RedCharDeviceClient
Make it consistent with the renamed RedCharDevice and the convention of
using 'Red' namespaces for internal types

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-01 11:59:44 +01:00
Jonathon Jongsma
b693eae580 Rename SpiceCharDeviceState to RedCharDevice
This is more consistent with internal type naming convention, and it
paves the way for a new char device GObject heirarchy

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-01 11:59:43 +01:00
Jonathon Jongsma
f3028e9ada Rename SpiceCharDeviceWriteBuffer to RedCharDeviceWriteBuffer
Internal types should use 'Red' namespace for consistency

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-01 11:59:40 +01:00
Jonathon Jongsma
f02b66a225 Rename SpiceCharDeviceMsgToClient to RedCharDeviceMsgToClient
Internal types should use Red namespace for consistency

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-01 11:59:33 +01:00
Christophe Fergeau
fe3d5d542d char-device: Avoid use-after-free
Reset pointer after freeing the structure pointing to it.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-31 08:07:52 +01:00
Christophe Fergeau
61d41688d4 smartcard: Prepare to turn SmartcardState into a GObject
Move all internal data into a private struct so that it won't be exposed
when we move SmartCardDeviceState into the header.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-30 17:59:59 +01:00
Jonathon Jongsma
5c55955ade Convert Dispatcher and MainDispatcher to GObjects
Allows more explicit inheritance relationship, and numerous other
advantages.

Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-30 17:19:24 +01:00
Christophe Fergeau
8e614edd0f char-device: Move instance data to SpiceCharDeviceState::priv
Create a structure to hold private data.
This helps to make patch for GObject smaller.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-29 10:09:09 +01:00
Frediano Ziglio
4c5c9f6b69 dispatcher: move channel final initialization to red-worker
CursorChannel and DisplayChannel was initialized half in red_worker_new
and half in red_dispatcher_init using some accessor for RedWorker
(red_worker_get_cursor_channel and red_worker_get_display_channel).
Moving directly into red_worker_new make easier to follow code path.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-29 09:26:23 +01:00
Frediano Ziglio
8b1e31c2e7 qxl: use Dispatcher in channel callbacks
There is no need callbacks knows about internal QXLState.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-24 15:38:56 +00:00
Francois Gouget
3486ecde03 server: More clearly identify channels that support multiple clients
Rename the function to channel_supports_multiple_clients() as
channel_is_secondary() is unclear and was coded to return the opposite
of what was originally intended.
Also there are few channel types and whether they support multiple
clients is totally static so we might as well delegate the check to
the compiler.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2016-03-24 15:19:38 +01:00
Frediano Ziglio
5e15934dce do not compile dump_bitmap if not necessary
This function is used only for debugging

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-03-24 13:11:46 +00:00
Frediano Ziglio
6aaca6cf24 make some functions static
No need to have callback registered internally no static

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-03-24 12:55:42 +00:00