Commit Graph

1825 Commits

Author SHA1 Message Date
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
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
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
Christophe Fergeau
4bf53c23d8 Remove dependency of vdi_port_read_buf_process on RedsState
This makes it easier to move the VDIPort API to a different file, and
make it as self-contained as possible.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-21 10:34:31 +00:00
Christophe Fergeau
0df59fcfc9 agent: Sync AgentMsgFilter state upon agent connection
AgentMsgFilter needs to know whether monitors config messages need to be
filtered or not. This used to be done from within
agent_msg_filter_config() using the global RedsState, but this got more
tricky as it was removed.
A first attempt a1e62fa5ae caused crashes on qemu startup with
"qemu-system-x86_64 -spice port=5900" (without -vga qxl). A second
attempt added a RedsState* argument to agent_msg_filter_config() which
in my opinion is not really nice from a layering point of view.

This new attempt makes sure AgentMsgFilter state is correct when the
filter is set to stop discarding all data, which allows to remove direct
use of RedsState from within AgentMsgFilter.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-21 10:34:29 +00:00
Christophe Fergeau
79e02e98ab Revert "fix regression due to callback called earlier"
Passing Reds into agent-msg-filter.[ch] isn't the right thing to do from
a layering point of view.

This reverts commit a1e62fa5ae.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-21 10:34:22 +00:00
Christophe Fergeau
722ad4c76b Remove red_channel_set_data()
It's always called at the same time as red_channel_register_client_cbs()
and the data is used by the callbacks, so we can pass the data as an
argument to red_channel_register_client_cbs().

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-17 18:54:52 +00:00
Christophe Fergeau
fe9977c469 Use red_qxl_check_qxl_version in red-worker
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-17 16:26:58 +00:00
Christophe Fergeau
ae931c7dab Add more red_qxl_ methods
Add red_qxl_ methods wrapping the QXLInterface vfuncs. This allows to
remove most of the qxl_get_interface() use outside of red-qxl.c

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-17 16:26:56 +00:00
Christophe Fergeau
e45ab9cf23 Use QXLInstance instead of QXLState in red_qxl_*
This seems to make more sense this way, QXLInstance is the 'main' object
with QXLState being its private data. External users then use QXLInstance
rather than passing a pointer to the private data to red-qxl.h methods.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-17 16:26:33 +00:00
Francois Gouget
768ec149db server: Add some comments to the sound structures.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-16 16:36:52 -05:00
Francois Gouget
5bb27f240b server: Give the SndChannel's ref and unref methods their expected name
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-16 16:36:48 -05:00
Uri Lublin
2480eb6979 replay: skip the first N (slow) commands
Note that the commands are executed by spice-server.
The "skip" is only done on the "sleep" part of the
"slow" command-line option.

This is helpful to run quickly through uninsteresting commands
in a beginning of a recorded file and going slowly when
interesting parts appear

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-16 10:09:07 +00:00
Uri Lublin
07cb94d7ab replay: count commands
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-16 10:08:48 +00:00
Christophe Fergeau
3ae8ce38a1 Use more explicit variable name in marshall_gl_scanout()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-15 21:36:10 +00:00
Christophe Fergeau
a33f874249 Fix typo in variable name in function prototype
num_common_cap rather than num_common_caps was not consistent with
the naming of the other arguments.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-15 21:36:07 +00:00
Christophe Fergeau
aa87700682 Remove unused red_qxl_set_dispatcher_opaque
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-15 21:33:10 +00:00