Commit Graph

1752 Commits

Author SHA1 Message Date
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
Christophe Fergeau
8091df87b3 red-parse-qxl: Use QXLReleaseInfoExt instead of QXLReleaseInfo
This should allow to avoid moving the group_id separately from the QXL
commands all over the code.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:15 +00:00
Christophe Fergeau
4049481882 Remove RedGlzDrawable::group_id
It's unused.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:13 +00:00
Christophe Fergeau
9500c32a30 Remove Drawable::group_id
We can now directly get it from RedDrawable.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:10 +00:00
Christophe Fergeau
e213f09c38 Simplify red_drawable_unref()
Now it no longer needs external state in order to destroy the
RedDrawable instance when needed, so we can remove this from the
prototype.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:08 +00:00
Christophe Fergeau
650ef63782 Add group_id to RedDrawable
Storing a QXLReleaseInfoExt rather than a QXLReleaseInfo in RedDrawable
gives us a place to store group_id for free. Since we are building a
QXLReleaseInfoExt from QXLReleaseInfo and group_id when destroying a
RedDrawable instance, this is a move in the right direction.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:06 +00:00
Christophe Fergeau
7b3bdbfdda Add QXLInstance member to RedDrawable
This allows to get rid of the DisplayChannel parameter to
red_drawable_unref()

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:04 +00:00
Christophe Fergeau
f8617db67a Remove DisplayChannel::red_drawable_count
It's only used in a few debug printfs. If we want these stats, we'll
have to find a better way than forcing a dependency on a high-level
class in a lower-level _unref method just to maintain the stats.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:01 +00:00
Christophe Fergeau
78b495e467 qxl: Remove unused group_id arg to fill_attr
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:28:43 +00:00
Jonathon Jongsma
41d97b037a Add RedsState arg to all stat functions
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:04:02 +00:00
Frediano Ziglio
47223da1a3 revert new event-loop code for timers
Was causing sporadic crashes.
Also cause compatibility problems with RHEL 6.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-02-12 17:44:57 +00:00
Frediano Ziglio
6e43433ec2 tests: add a new case for event loop timers
Check that cancelling a timer the timer callback is not called.

This can happen in latency code (red-channel.c).
In red_channel_client_cancel_ping_timer latency timer is cancelled and
state is set to PING_STATE_NONE however if timer was already active what
happens is that the red_channel_client_ping_timer is called and the line

  spice_assert(rcc->latency_monitor.state == PING_STATE_TIMER);

is triggered causing spice-server to abort.
This happens as GLib loop add all active sources to an array but if the
timer is deactivated before the event is dispatched the event will be
dispatched unless the source is destroyed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-02-12 17:44:47 +00:00
Jonathon Jongsma
006e44b077 MainChannel: don't use global 'reds' variable
Add RedsState arg to main_channel_new(), and use the 'reds' property
that is stored in the base RedChannel struct rather than the global
'reds' variable.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-12 15:41:47 +00:00
Jonathon Jongsma
8b24bed220 Add RedsState arg to reds_set_migration_dest_info()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-12 15:33:11 +00:00