Commit Graph

2517 Commits

Author SHA1 Message Date
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
Jonathon Jongsma
36b0735192 Add RedsState arg to inputs_channel_new()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-12 15:32:47 +00:00
Jonathon Jongsma
dc4051fb9a Store a reference to RedsState in Channel base class
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-12 15:27:03 +00:00
Jonathon Jongsma
abcbf20d8b Add RedsState arg to smartcard_device_connect()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-12 15:10:53 +00:00
Frediano Ziglio
efe5a0c501 dcc: remove not necessary volatile specifications
These automatic variable are used just inside the function.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-12 06:17:32 +00:00
Frediano Ziglio
fbdea0fa79 CommonChannel: hold a reference to QXLInstance instead of RedWorker
CommonChannel does not need to know about RedWorker.
This reduce a bit dependencies between objects.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-11 23:51:46 +00:00
Frediano Ziglio
79e50495fe ccc: remove unused field
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-11 23:51:46 +00:00
Frediano Ziglio
1df9510581 worker: remove unused red_worker_get_memslot function
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-11 23:51:46 +00:00
Frediano Ziglio
721528fe37 remove unused structure definition
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-11 23:51:46 +00:00
Frediano Ziglio
d56745df19 dcc: remove group_id from compression functions
The parameter was not used.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-11 23:51:45 +00:00
Frediano Ziglio
448700bfb4 channel: rename misleading functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-11 23:51:42 +00:00
Frediano Ziglio
b98aa6860d worker: simplify process loops
It was not clear when req_cmd_notification was called.
This code reproduce just the old behavior but is easier to read.

Steps are:

// original

if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
    worker->display_poll_tries++;
    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
    return n;
}
if (worker->display_poll_tries > CMD_RING_POLL_RETRIES ||
             worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
    worker->display_poll_tries++;
    return n;
}
continue;

// split if

if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
    worker->display_poll_tries++;
    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
    return n;
}
if (worker->display_poll_tries > CMD_RING_POLL_RETRIES) {
    worker->display_poll_tries++;
    return n;
}
if (worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
    worker->display_poll_tries++;
    return n;
}
continue;

// order inside if

if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
    worker->display_poll_tries++;
    return n;
}
if (worker->display_poll_tries > CMD_RING_POLL_RETRIES) {
    worker->display_poll_tries++;
    return n;
}
if (worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
    worker->display_poll_tries++;
    return n;
}
continue;

// consider cases

if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
    worker->display_poll_tries++;
    return n;
}
if (worker->display_poll_tries > CMD_RING_POLL_RETRIES) {
    worker->display_poll_tries++;
    return n;
}
if (worker->display_poll_tries == CMD_RING_POLL_RETRIES) {
    if (worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
        worker->display_poll_tries++;
        return n;
    }
    continue;
}
// unreachable

// invert if

if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
    worker->display_poll_tries++;
    return n;
}
if (worker->display_poll_tries > CMD_RING_POLL_RETRIES) {
    worker->display_poll_tries++;
    return n;
}
if (worker->display_poll_tries == CMD_RING_POLL_RETRIES) {
    if (!worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
        continue;
    }
    worker->display_poll_tries++;
    return n;
}
// unreachable

// reuse code

if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
} else if (worker->display_poll_tries > CMD_RING_POLL_RETRIES) {
} else if (worker->display_poll_tries == CMD_RING_POLL_RETRIES) {
    if (!worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
        continue;
    }
}
worker->display_poll_tries++;
return n;

// remove empty if

if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
} else if (worker->display_poll_tries == CMD_RING_POLL_RETRIES) {
    if (!worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
        continue;
    }
}
worker->display_poll_tries++;
return n;

// collapse two conditions

if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
} else if (worker->display_poll_tries == CMD_RING_POLL_RETRIES &&
           !worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
    continue;
}
worker->display_poll_tries++;
return n;

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
2016-02-11 23:45:30 +00:00
Frediano Ziglio
fa2668319e dispatcher: remove unused async_commands ring
The only usage of this ring was to have a message when there was no
commands on the list.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-11 19:57:20 +00:00
Frediano Ziglio
5c1d744d85 Store 'renderers' as GArray in RedsState
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11 19:12:53 +00:00
Jonathon Jongsma
127e3ad191 Add RedsState arg to activate_modifiers_watch()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11 13:57:44 +00:00
Jonathon Jongsma
a8dc9b0936 Add RedsState arg to spicevmc_device_connect|disconnect()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11 13:57:41 +00:00
Jonathon Jongsma
d576c76a70 Add RedsState arg to red_on_main_agent_tokens()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11 13:57:39 +00:00
Jonathon Jongsma
ec7d59c902 Store a reference to RedsState in RedsMigTargetClient
This allows RedsMigTargetClient methods to use local variables rather
than the global 'reds' variable

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11 13:57:37 +00:00