Commit Graph

2623 Commits

Author SHA1 Message Date
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
f48e05275d Update spice-common submodule
Mostly to get fixes for older glib versions (both at compile time and
runtime).

Changes this brings in:

Christophe Fergeau (4):
      tests: Fix glib version check
      log: Clamp SPICE_DEBUG_LEVEL if it's too high
      log: Use SPICE_CONSTRUCTOR_FUNC
      log: Make sure glib threading is initialized

Eduardo Lima (Etrunko) (2):
      Fix build in systems with Glib version older than 2.38
      Add check for openssl
2016-04-06 10:30:00 +02: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
b248815119 doc: Be more explicit about virgl requirements
This is an attempt at listing the versions of the various packages which
needs to be up to date for a functional virgl + spice.
2016-04-01 15:16:44 +02:00
Christophe Fergeau
26f874e738 mjpeg: Add missing space to debug string 2016-04-01 15:16:27 +02:00
Christophe Fergeau
281eeed189 build-sys: Update libtool versioning for 0.13.1 2016-04-01 15:16:27 +02:00
Christophe Fergeau
80832dd17e Update NEWS for 0.13.1 2016-04-01 15:16:24 +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
Christophe Fergeau
782c7508e2 doc: Add virgl documentation
Document how to use virgl with QEMU/libvirt

virt-manager documentation still needs to be added.
2016-03-24 13:56:59 +01: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
Frediano Ziglio
f34779dc9c removed unused red_qxl_set_mm_time
This helper call a deprecated callback.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-03-24 12:50:56 +00:00
Frediano Ziglio
ee4b8a1480 remove unused reds_set_mm_time
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-03-24 12:48:38 +00:00
Frediano Ziglio
44a97b6095 use constructor/destructor macros
Initialize global images at load time:
- make sure these stuff are initialized without using runtime
resources;
- make sure stuff are initialize really earlier.
Do not use atexit function but a destructor.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-23 16:31:02 +00:00
Frediano Ziglio
088add2b98 qxl: implement QXLWorker interface, do not use as a base class
QXLWorker is the old interface now completely deprecated.
Remove the strict dependency of having it as a base class.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-23 14:30:07 +00:00
Frediano Ziglio
5c48cdc61d declare and use message for RED_WORKER_MESSAGE_GL_SCANOUT
All other messages (even empty ones) have a structure defined.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-23 14:09:53 +00:00
Frediano Ziglio
c51f1126eb build-sys: use safer SPICE_CONTAINEROF version
Enable additional checks for this macro.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-23 13:44:22 +00:00
Jonathon Jongsma
4f6c1765c7 Remove last usage of global 'reds' variable
This should be the final piece of removing the global reds variable. We
still need a global variable to clean up during the atexit() function,
but we use a GList of servers (even though we technically don't support
multiple servers in the same process yet).

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-23 08:21:57 +00:00
Christophe Fergeau
5981cf2645 char-device: Add helpers for SpiceCharDeviceCallbacks vfuncs
Add helper functions wrapping calls to the virtual functions
defined in SpiceCharDeviceCallbacks.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-22 10:29:39 +00:00