[Spice-devel] [PATCH 01/18] remove num_active_workers
Fabiano Fidêncio
fidencio at redhat.com
Mon Feb 15 22:37:34 UTC 2016
On Mon, 2016-02-15 at 16:01 +0000, Frediano Ziglio wrote:
> This global variable was mainly 1.
>
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/red-dispatcher.c | 35 ++++++++++-------------------------
> server/red-dispatcher.h | 1 -
> server/reds.c | 3 +--
> 3 files changed, 11 insertions(+), 28 deletions(-)
>
> diff --git a/server/red-dispatcher.c b/server/red-dispatcher.c
> index 11355e4..81f2ed9 100644
> --- a/server/red-dispatcher.c
> +++ b/server/red-dispatcher.c
> @@ -39,7 +39,6 @@
>
> #include "red-dispatcher.h"
>
> -static int num_active_workers = 0;
>
> struct AsyncCommand {
> RedWorkerMessage message;
> @@ -191,11 +190,6 @@ static void
> red_dispatcher_cursor_migrate(RedChannelClient *rcc)
> &payload);
> }
>
> -int red_dispatcher_qxl_count(void)
> -{
> - return num_active_workers;
> -}
> -
> static void update_client_mouse_allowed(void)
> {
> static int allowed = FALSE;
> @@ -203,22 +197,18 @@ static void update_client_mouse_allowed(void)
> int x_res = 0;
> int y_res = 0;
>
> - if (num_active_workers > 0) {
> - allow_now = TRUE;
> - RedDispatcher *now = dispatchers;
> - while (now && allow_now) {
> - if (now->primary_active) {
> - allow_now = now->use_hardware_cursor;
> - if (num_active_workers == 1) {
> - if (allow_now) {
> - x_res = now->x_res;
> - y_res = now->y_res;
> - }
> - break;
> - }
> + allow_now = TRUE;
> + RedDispatcher *now = dispatchers;
> + while (now && allow_now) {
> + if (now->primary_active) {
> + allow_now = now->use_hardware_cursor;
> + if (allow_now) {
> + x_res = now->x_res;
> + y_res = now->y_res;
> }
> - now = now->next;
> + break;
> }
> + now = now->next;
> }
>
> if (allow_now || allow_now != allowed) {
> @@ -247,10 +237,6 @@ int
> red_dispatcher_use_client_monitors_config(void)
> {
> RedDispatcher *now = dispatchers;
>
> - if (num_active_workers == 0) {
> - return FALSE;
> - }
> -
> for (; now ; now = now->next) {
> if (!red_dispatcher_check_qxl_version(now, 3, 3) ||
> !now->qxl->st->qif->client_monitors_config ||
> @@ -1101,7 +1087,6 @@ void red_dispatcher_init(QXLInstance *qxl)
> reds_register_channel(reds, channel);
>
> red_worker_run(worker);
> - num_active_workers = 1;
>
> qxl->st->dispatcher = red_dispatcher;
> red_dispatcher->next = dispatchers;
> diff --git a/server/red-dispatcher.h b/server/red-dispatcher.h
> index 11a4f2a..4aa5854 100644
> --- a/server/red-dispatcher.h
> +++ b/server/red-dispatcher.h
> @@ -33,7 +33,6 @@ void red_dispatcher_on_vm_stop(void);
> void red_dispatcher_on_vm_start(void);
> int red_dispatcher_count(void);
> uint32_t red_dispatcher_qxl_ram_size(void);
> -int red_dispatcher_qxl_count(void);
> void red_dispatcher_async_complete(struct RedDispatcher *,
> AsyncCommand *);
> struct Dispatcher *red_dispatcher_get_dispatcher(struct
> RedDispatcher *);
> int red_dispatcher_use_client_monitors_config(void);
> diff --git a/server/reds.c b/server/reds.c
> index 01d4db5..e621a25 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -572,10 +572,9 @@ gboolean reds_get_agent_mouse(const RedsState
> *reds)
> static void reds_update_mouse_mode(RedsState *reds)
> {
> int allowed = 0;
> - int qxl_count = red_dispatcher_qxl_count();
>
> if ((reds->agent_mouse && reds->vdagent) ||
> - (inputs_channel_has_tablet(reds->inputs_channel) &&
> qxl_count == 1)) {
> + (inputs_channel_has_tablet(reds->inputs_channel))) {
> allowed = reds->dispatcher_allows_client_mouse;
> }
> if (allowed == reds->is_client_mouse_allowed) {
Acked-by: Fabiano Fidêncio <fidencio at redhat.com>
More information about the Spice-devel
mailing list