Commit Graph

1765 Commits

Author SHA1 Message Date
Jonathon Jongsma
df214cd031 Remove use of global 'reds' within RedWorker
Get the server variable from the QXLState instead of using the
global variable

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-05 10:29:26 +00:00
Jonathon Jongsma
37ccf6cdf4 Add red_qxl_get_server()
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-05 10:14:09 +00:00
Jonathon Jongsma
c3d43fdea7 Store reference to RedsState in QXLState
Remove use of global 'reds' variable from QXLState functions.
Instead store the owning RedsState variable inside the QXLState
struct and use that when necessary.

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-05 10:13:51 +00:00
Frediano Ziglio
95fa8bfb13 worker: remove useless qxl_state
qxl_state can be extracted easily from qxl.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-04 15:47:50 +00:00
Frediano Ziglio
e9ed125dbd use QXLState instead of RedDispatcher
Considering that:
- QXLState is the state of QXLInstance implementation;
- RedDispatcher is the implementation of QXL;
- qif (QXLInterface*) field can be computed really easy from QXLInstance;
- most of its state is private.
Make all structure private and use QXLState instead of RedDispatcher.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-04 15:47:45 +00:00
Frediano Ziglio
5916dd8fa6 rename red-dispatcher.* files to red-qxl.*
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-04 15:27:41 +00:00
Frediano Ziglio
a8ff771ee8 rename red_dispatcher_ functions to red_qxl_
RedDispatcher is basically implementing QXLInstance.
After some internal discussion we decided to use QXLState structure
and red_qxl_ as function prefix.
This is the first of 3 patches that rename functions, structure
and files.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-04 15:27:39 +00:00
Frediano Ziglio
994099dd3d fix indentation
Fix indentation for spice_debug call.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-04 14:24:59 +00:00
Frediano Ziglio
3fdc1775a6 optimize handle_dev_input call
Pass directly dispatcher to handle_dev_input callback.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-04 14:24:57 +00:00
Frediano Ziglio
597f30d5b7 reduce header dependencies
Avoid to include headers in cursor-channel.h which are only
used by cursor-channel.c

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-04 14:24:54 +00:00
Francois Gouget
968d7df719 server: Fix the order of the attach_stream() asserts
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-03 15:29:38 -06:00
Christophe Fergeau
55b9478b9c Make use of the new reds_core_timer_* API
This makes the code more readable.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-03 16:56:07 +00:00
Christophe Fergeau
79cbe5ce53 Introduce reds_core_timer_* 2016-03-03 16:47:05 +00:00
Christophe Fergeau
ebbe4779fc Introduce reds_core_watch_*
These methods wrap the RedsCoreInterface::watch_add,
RedsCoreInterface::watch_remove and RedsCoreInterface::watch_update_mask
vfuncs.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-03 16:45:36 +00:00
Uri Lublin
d82b8b0789 replay: do not use argv after g_option_context_parse
Apparently, after using g_option_context_parse with G_OPTION_REMAINING
argv is modified and should not be used.
This patch uses "file" instead of "argv" and makes sure
file is freed later.
No free is called upon error - exit takes care of it.
2016-03-03 11:57:44 +00:00
Francois Gouget
aa5a5fa630 server: Store the opaque pointer in VideoEncoderRateControlCbs
It has the same lifetime as the corresponding structure so this
simplifies keeping track of it.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-03 11:47:49 +00:00
Francois Gouget
2510f79fd4 server: Don't call snd_channel_get_server() if we don't have a channel
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-26 12:19:42 +00:00
Francois Gouget
f7bc8c0cd9 server: Remove an unnecessary cast in spice_replay_next_cmd()
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-25 09:18:06 +00:00
Michal Privoznik
2306c364d2 Update .gitignore files
The first part updates the .gitignore file in the root directory
because the file is obviously generated by automake but poison
our working tree.
The second part updates the .gitignore under server/tests/
directory because since 0db1137d we have a noinst test library
libtest.a. However, like in previous case, git should never track
this file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-25 09:12:51 +00:00
Frediano Ziglio
badb08a859 use G_N_ELEMENTS instead of manually compute array size
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-23 17:49:35 +00:00
Frediano Ziglio
b92588bf2c constify some global variables
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-23 17:49:26 +00:00
Frediano Ziglio
39ab6b3279 fix possible core calling timer callback
Was possible to have ping_timer_cb called with a NULL pointer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-20 13:16:46 +00:00
Frediano Ziglio
a1e62fa5ae fix regression due to callback called earlier
Patch 1f21008060 ("Remove use of global
'reds' from AgentMsgFilter") introduced a regression. This because
QXLInterface->client_monitors_config was called before returning
from spice_add_interface. Some client of spice-server expect the
spice_add_interface already returned and some state change was done
before client_monitors_config was called.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-19 09:51:25 +00:00
Frediano Ziglio
aa724b170b memslot: do not crash if guest provide a wrong address
This could happen with buggy driver.

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

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-18 10:36:26 +00:00
Frediano Ziglio
2094e8f1db reds: remove unneeded variable
Remove version_string variable.
Was never changed and used in a single place.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-17 13:55:53 +00:00
Jonathon Jongsma
3644783e24 CommonChannel -> CommonGraphicsChannel
Rename this struct to make it clear that it's only the base class for
graphics channels (e.g. display and cursor), not all channels.

Also renamed CommonChannelClient to CommonGraphicsChannelClient.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-17 12:58:40 +00:00
Pavel Grunt
af3aa4b1f4 compress-stat: Add not compressed image to statistics
To see how many images and data could not be compressed.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-17 08:51:16 +00:00
Pavel Grunt
1948566ce8 dcc: Move COMPRESS_DEBUG to compression functions
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-17 08:51:13 +00:00
Pavel Grunt
f401eb07f9 dcc: Rewrite dcc_image_compress
Rules are now:

Compression type:
  off      -> uncompressed
  quic     -> jpeg if possible else quic else off
  lz       -> lz if possible else off
  glz      -> glz if possible else lz else off
  auto_lz  -> lz if possible else jpeg else quic else off
  auto_glz -> glz if possible else lz else jpeg else quic else off
  lz4      -> lz4 if possible else lz else off

jpeg is used only when jpeg-wan-compression allows it

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-17 08:50:43 +00:00
Frediano Ziglio
51bd316ce5 make RedDataChunk structure private inside red-parse-qxl.c
The structure is strictly used by the parser only, no reason to make it
public.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-16 13:13:00 +00:00
Frediano Ziglio
c111bfa8c3 worker: removed unused red_worker_get_qxl function
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-16 13:09:33 +00:00
Frediano Ziglio
0ebd3b0d04 dcc: move id from CommonChannelClient to DisplayChannelClient
Was not used by CursorChannelClient but only by DisplayChannelClient.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-16 13:07:08 +00:00
Jonathon Jongsma
1438b7ccf2 Add GObject to build requirements
Preparation for GObject-ifying some internals

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-16 11:22:04 +00:00
Christophe Fergeau
2db21168d8 Remove redundant argument to vdi_port_read_buf_process
The 'port' argument can be determined from VDIPortState, so no need to
pass both (through RedsState) to vdi_port_read_buf_process().

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-16 11:21:25 +00:00
Jonathon Jongsma
1f21008060 Remove use of global 'reds' from AgentMsgFilter
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 10:54:30 +00:00
Jonathon Jongsma
4ac21bc649 Remove use of global 'reds' from sound.c
Pass RedsState variable to snd_attach_(playback|record) and get a
reference to this variable when needed by various functions.

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 10:54:30 +00:00
Jonathon Jongsma
2a18e874a2 Remove global main_dispatcher variable
Requires changing a bunch of internal API to take MainDispatcher
arguments, etc. The main dispatcher object is now owned by RedsState,
since that is the object that previously created (initialized) it.

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 10:54:10 +00:00
Jonathon Jongsma
bc5c07a881 Add red_channel_get_server()
Instead of poking into the internals of the RedChannel, provide an
accessor.

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 10:54:03 +00:00
Jonathon Jongsma
de2572815b Add RedsState reference to RedsStream
Allows us to remove use of global 'reds' variable from reds-stream.c.
Requires changing the RedsStream constructor to accept a RedsState arg.

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 10:45:46 +00:00
Frediano Ziglio
aadb945570 Remove global 'dispatchers', 'num_active_workers' variables
Since these are server-level variables, move them into RedsState.
However, num_active_workers was removed because:
- each dispatcher always has 1 active worker, so we can determine the
  number of active workers by counting the dispatchers
- it was never actually set correctly. Even if there was more than one
  worker, this variable was always only set to either 0 or 1.

This change required moving a bunch of helper code into RedsState as
well, an providing some RedDispatcher interfaces to access dispatcher
information from RedsState.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 10:10:58 +00:00
Frediano Ziglio
faa5364732 move red_dispatcher_on_vm_stop and red_dispatcher_on_vm_start to RedsState
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 09:39:33 +00:00
Frediano Ziglio
7ac2bfc2d8 remove unused function
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 09:39:30 +00:00
Frediano Ziglio
577966e482 use list in RedsState for ic_change and sv_change
Instead of using list in RedDispatcher (which is going to be removed)
use the one in RedsState.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 09:39:28 +00:00
Frediano Ziglio
0435ab30d5 keep dispatcher list in RedsState
This duplicate the other list which will be removed

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 09:39:26 +00:00
Frediano Ziglio
e98ed23bc2 move calc_compression_level to reds
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 09:39:24 +00:00
Frediano Ziglio
2e688f91ed add RedsState parameter to update_client_mouse_allowed
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 09:39:22 +00:00
Frediano Ziglio
8bdc63495a remove num_active_workers
This global variable was mainly 1.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16 09:39:12 +00:00
Frediano Ziglio
3108fb37e3 Revert "dcc: remove not necessary volatile specifications"
This reverts commit efe5a0c501.

Due to a problem in the compiler this causes compile to fail.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-15 16:09:49 +00:00
Christophe Fergeau
7870c27fca display-channel: Remove extra group_id arguments
They are now carried in the appropriate command through
QXLReleaseInfoExt, so we don't need to pass them around explicitly.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:18 +00:00
Christophe Fergeau
705be34b5e Remove CursorItem::group_id
Now that the group_id is known to RedCursorCmd, we don't need to store
it separately in CursorItem.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:16 +00:00