Commit Graph

2229 Commits

Author SHA1 Message Date
Jonathon Jongsma
96e94c6f32 Convert RedChannel hierarchy to GObject
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-25 11:32:13 -05:00
Frediano Ziglio
8f43c8348c Remove unused declaration
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-25 15:16:53 +01:00
Frediano Ziglio
afd4d44807 red-worker: Do not include not necessary red-channel-client.h
Definitions are all in red-channel.h

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 17:19:39 +01:00
Frediano Ziglio
177c331c53 Avoid to typedef twice MainChannel
MainChannel is already defined in main-channel.h.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 17:01:19 +01:00
Frediano Ziglio
beec1b4175 display channel: Don't let client set too many surfaces
Limit the n_surfaces argument to avoid overflowing the surfaces array.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 16:43:51 +01:00
Frediano Ziglio
090fbe5eeb Avoid recursive inclusion of headers
red-common.h included utils.h which included red-common.h

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 16:33:20 +01:00
Frediano Ziglio
b0d8ba9a6a Allows to use scripts for "make check"
Allow both compiled and non-compiled tests to be used with "make
check". Compiled tests should be added to check_PROGRAMS, and scripts
that do not need to be built should be added to TESTS.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:45:12 +01:00
Frediano Ziglio
6f32ec1434 Declare same enumerator in a single header
Avoid having duplication and desynchronisation.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:27:50 +01:00
Frediano Ziglio
14d0ac5fb5 Move monitors_config_ref inside red_monitors_config_item_new
This makes red_monitors_config_item_new() and
red_monitors_config_item_free() symmetric.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:26:55 +01:00
Frediano Ziglio
cd631b5819 dcc: Use spice_new instead of spice_malloc
spice_new return directly the correct type.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:25:42 +01:00
Frediano Ziglio
da4a0fbe03 Fix typo in comment
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:24:35 +01:00
Frediano Ziglio
18b93e8527 Make compression image declarations more similar
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:23:58 +01:00
Frediano Ziglio
39b7351d24 Reuse SPICE_N_ELEMENTS macro
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-20 08:22:58 +01:00
Frediano Ziglio
d38ae73683 Include main-channel-client.h where MainChannelClient is used
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
2016-10-19 21:49:49 +01:00
Frediano Ziglio
74a834daca Avoid to typedef twice RedChannel and RedClient
These are already defined in red-channel.h which is included in
red-channel-client.h header.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
2016-10-19 21:49:49 +01:00
Frediano Ziglio
f53093ee90 Include directly used header in dcc.h
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-10-18 18:10:00 +01:00
Jonathon Jongsma
bf7375d834 Improve MainChannel encapsulation
Encapsulate MainChannel a bit better in preparation for proting to
GObject.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-18 18:03:17 +01:00
Frediano Ziglio
530b22b7ec Be consistent with opaque type
vdi_port_read_buf_release is registered passing data as
RedVDIReadBuf*, not RedPipeItem*. Cast opaque to proper
pointer type to avoid the assumption that first field of
RedVDIReadBuf is a RedPipeItem.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-10-18 10:15:57 +01:00
Frediano Ziglio
5feb1d0379 Use a compatibility header to support GLib 2.28
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-10-18 09:52:28 +01:00
Frediano Ziglio
4121547ba8 Do not typedef DisplayChannel twice
Already defined in dcc.h.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-10-18 09:45:45 +01:00
Frediano Ziglio
bd322b68e6 Avoid to typedef twice CursorChannel
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-10-18 09:45:33 +01:00
Uri Lublin
44624ed8bf mjpeg_encoder_new: allocate memory after sanity check
This patch prevents a leak in case the function returns early

Found by coverity.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-17 10:49:41 +01:00
Uri Lublin
09b12a55d0 input-channel: add a comment to mark fallthrough in switch
Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-17 10:49:29 +01:00
Jonathon Jongsma
f9997e14f0 Add CommonGraphicsChannelPrivate struct
Encapsulate private data for CommonGraphicsChannel and prepare for
GObject conversion.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-14 19:17:40 +01:00
Pavel Grunt
40545d0403 rcc: Make OutgoingHandler private
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-14 15:00:23 +01:00
Pavel Grunt
4dd9e8a93c reds: Define openssl lock only if needed
Silence a warning:
 reds.c:150:25: warning: 'lock_cs' defined but not used [-Wunused-variable]
  static pthread_mutex_t *lock_cs;

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-14 13:01:42 +01:00
Francois Gouget
2ebd69c4c5 server: Remove a redundant IncomingHandler typedef
This fixes a compilation error with gcc 4.4.7 on RHEL 6.8.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-14 12:38:12 +01:00
Jonathon Jongsma
efe49fa275 Use macros for casting Channel types
In preparation for converting RedChannel to GObject, switch to using
RED_CHANNEL()-type macros for casting. For now they just do a regular
cast, but it helps reduce the size of the GObject patch to make it
easier to review.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-14 11:49:25 +01:00
Jonathon Jongsma
bcb8503659 Move CommonGraphicsChannel to a new file
Move out of red-worker.c. This requires a little bit of minor
refactoring to avoid accessing some RedWorker internals in the
constructor function, etc.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-14 11:49:12 +01:00
Francois Gouget
c5758b6890 server: Remove a redundant CursorChannelClient typedef
CursorChannelClient is already defined in cursor-channel-client.h.
This fixes compilation errors with gcc 4.4.7 on RHEL 6.8.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-10-14 10:41:12 +01:00
Jonathon Jongsma
b8080dbc21 Don't increment num_clients_mig_wait twice
When MainChannelClient was split to a separate file, the responsibility
for incrementing this field was supposed to belong to the MainChannel
function (main_channel_connect_semi_seamless()), but by mistake it was
incremented both there and in the client function
(main_channel_client_connect_semi_seamless()).

The bug was introduced in a11b785f19

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-13 16:45:50 -05:00
Pavel Grunt
ddf028569e Test agent message filter processing
Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-11 13:49:15 +01:00
Pavel Grunt
dee20d8b43 Add agent message filter test
Test filter initialization and configuration

Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-11 13:48:54 +01:00
Pavel Grunt
dfccfa7083 agent-msg-filter: Remove extra headers
Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-10-11 13:41:37 +01:00
Frediano Ziglio
5193360594 Convert RedChannelClient hierarchy to GObject
Convert the RedChannelClient heirarchy into GObjects. Since the existing
constructors could fail and return NULL, I inherited the base channel
client from GInitable, which introduces a dependency on gio.

When using private structs with GObject, there's a maximum size of (I
think) 64k, which was exceeded by some of the private structs. To avoid
this limitation I changed some members to dynamically allocated.
2016-10-07 14:46:37 -05:00
Frediano Ziglio
32aa710d22 Split RedCharDeviceSmartcard and SmartCardChannelClient 2016-09-30 13:14:03 +01:00
Frediano Ziglio
3e51627991 Cache field to make code easier
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-09-30 13:10:27 +01:00
Frediano Ziglio
696efb98ac Add a comment for marshaller field
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-29 10:08:19 +01:00
Jonathon Jongsma
c96f8c9f9b Generate GTypes for spice-server enums
The GType will be useful to allow these enums to be used as GObject
properties.

Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-27 15:27:05 +01:00
Frediano Ziglio
5d04ad7359 Rename red_surface to surface
Attempt to use consistent naming.
Usually we use surface name for RedSurface.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-27 14:30:16 +01:00
Frediano Ziglio
05150fbe34 Rename surface argument to surface_cmd
Attempt to use consistent naming.
Usually we use surface name for RedSurface so make sure
code reader do not get confused using a different name
for RedSurfaceCmd.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-27 14:29:39 +01:00
Frediano Ziglio
a874ebadff Rename detach_stream to stream_detach_drawable and removed unused argument
This function deal only with Stream.
Also the name was misleading and was not clear if it detached the stream
from the DisplayChannel.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-27 14:25:43 +01:00
Frediano Ziglio
ae01c6d4bc Removed only written roundtrip_stat field
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-27 14:22:04 +01:00
Frediano Ziglio
693a6b8fd9 Removed unused stat field
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-27 14:21:07 +01:00
Frediano Ziglio
c2f0b00fde Use enum value returning invalid value
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-27 13:25:50 +01:00
Frediano Ziglio
fd888a0bfd Check client is using unix sockets in dcc_gl_draw_item_new
Currently this is simply avoided by the fact that Virgl with 3d means
Unix socket. Once you enable (in Qemu) tcp sockets this message will
be added to all clients (supposing multiple clients) so potentially
will be in all queues. The same check is done for dcc_gl_scanout_item_new.
dcc_gl_scanout_item_new is called when Qemu calls spice_qxl_gl_draw_async.
Technically a client can support SPICE_DISPLAY_CAP_GL_SCANOUT but server
cannot send the DRM prime directly as this require a unix socket so
if the test for SPICE_DISPLAY_CAP_GL_SCANOUT is done here it make sense
to do the check for the socket type too.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-27 11:16:54 +01:00
Frediano Ziglio
46a4543d9d Reuse VD_AGENT_HAS_CAPABILITY macro for bit array
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-26 13:46:59 +01:00
Frediano Ziglio
435daaffdb worker: RedCompressBuf optimization
Move large buffer field at the end of structure.
Due to the way machine address memory this usually can reduce code size
and make program sligthly faster.
Actually reduce size by 100 bytes.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-26 10:27:58 +01:00
Frediano Ziglio
b009a7ff34 Prevent setting invalid image compression values
In case of invalid value the original compression is unchanged.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-26 10:11:47 +01:00
Frediano Ziglio
1cf2b16c42 replay: Update pointer in allocated list
Avoid to free invalid pointer.

Reported-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-22 17:00:06 +01:00