[Spice-devel] [PATCH 2/3] server: set dispatcher before calling attache_worker

Christophe Fergeau cfergeau at redhat.com
Mon Oct 7 10:50:44 CEST 2013


ACK, too bad we can't easily fix the attache_worker typo :(

On Thu, Oct 03, 2013 at 11:02:06PM +0200, Marc-André Lureau wrote:
> This allows to call spice_qxl_add_memslot during attache_worker(), like
> done in the tests.
> ---
>  server/red_dispatcher.c | 12 +++++++-----
>  server/red_dispatcher.h |  3 ++-
>  server/reds.c           |  2 +-
>  3 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
> index 03a4c4a..fd6c2e1 100644
> --- a/server/red_dispatcher.c
> +++ b/server/red_dispatcher.c
> @@ -1072,7 +1072,7 @@ static RedChannel *red_dispatcher_cursor_channel_create(RedDispatcher *dispatche
>      return cursor_channel;
>  }
>  
> -RedDispatcher *red_dispatcher_init(QXLInstance *qxl)
> +void red_dispatcher_init(QXLInstance *qxl)
>  {
>      RedDispatcher *red_dispatcher;
>      RedWorkerMessage message;
> @@ -1085,6 +1085,8 @@ RedDispatcher *red_dispatcher_init(QXLInstance *qxl)
>      sigset_t curr_sig_mask;
>      ClientCbs client_cbs = { NULL, };
>  
> +    spice_return_if_fail(qxl->st->dispatcher == NULL);
> +
>      quic_init();
>      sw_canvas_init();
>  #ifdef USE_OPENGL
> @@ -1175,12 +1177,12 @@ RedDispatcher *red_dispatcher_init(QXLInstance *qxl)
>          reds_register_channel(cursor_channel);
>      }
>  
> -    qxl->st->qif->attache_worker(qxl, &red_dispatcher->base);
> -    qxl->st->qif->set_compression_level(qxl, calc_compression_level());
> -
> +    qxl->st->dispatcher = red_dispatcher;
>      red_dispatcher->next = dispatchers;
>      dispatchers = red_dispatcher;
> -    return red_dispatcher;
> +
> +    qxl->st->qif->attache_worker(qxl, &red_dispatcher->base);
> +    qxl->st->qif->set_compression_level(qxl, calc_compression_level());
>  }
>  
>  struct Dispatcher *red_dispatcher_get_dispatcher(RedDispatcher *red_dispatcher)
> diff --git a/server/red_dispatcher.h b/server/red_dispatcher.h
> index 7d23b11..907b7c7 100644
> --- a/server/red_dispatcher.h
> +++ b/server/red_dispatcher.h
> @@ -21,9 +21,10 @@
>  #include "red_channel.h"
>  
>  struct RedChannelClient;
> +struct RedDispatcher;
>  typedef struct AsyncCommand AsyncCommand;
>  
> -struct RedDispatcher *red_dispatcher_init(QXLInstance *qxl);
> +void red_dispatcher_init(QXLInstance *qxl);
>  
>  void red_dispatcher_set_mm_time(uint32_t);
>  void red_dispatcher_on_ic_change(void);
> diff --git a/server/reds.c b/server/reds.c
> index 0f81a32..1456b75 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -3771,7 +3771,7 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
>          qxl = SPICE_CONTAINEROF(sin, QXLInstance, base);
>          qxl->st = spice_new0(QXLState, 1);
>          qxl->st->qif = SPICE_CONTAINEROF(interface, QXLInterface, base);
> -        qxl->st->dispatcher = red_dispatcher_init(qxl);
> +        red_dispatcher_init(qxl);
>  
>      } else if (strcmp(interface->type, SPICE_INTERFACE_TABLET) == 0) {
>          spice_info("SPICE_INTERFACE_TABLET");
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20131007/3a16d8df/attachment-0001.pgp>


More information about the Spice-devel mailing list