[Spice-devel] [PATCH 20/23] server/red_channel: add more ack api

Marc-André Lureau marcandre.lureau at gmail.com
Sat Feb 12 11:56:02 PST 2011


ack

On Fri, Feb 11, 2011 at 6:23 PM, Alon Levy <alevy at redhat.com> wrote:
> ---
>  server/red_channel.c |   10 ++++++++++
>  server/red_channel.h |    3 +++
>  server/red_worker.c  |   12 +++++-------
>  3 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/server/red_channel.c b/server/red_channel.c
> index 5abb9ec..be1d9f9 100644
> --- a/server/red_channel.c
> +++ b/server/red_channel.c
> @@ -632,3 +632,13 @@ void red_channel_pipe_clear(RedChannel *channel)
>     channel->pipe_size = 0;
>  }
>
> +void red_channel_ack_zero_messages_window(RedChannel *channel)
> +{
> +    channel->ack_data.messages_window = 0;
> +}
> +
> +void red_channel_ack_set_client_window(RedChannel *channel, int client_window)
> +{
> +    channel->ack_data.client_window = client_window;
> +}
> +
> diff --git a/server/red_channel.h b/server/red_channel.h
> index 299aa8d..c662186 100644
> --- a/server/red_channel.h
> +++ b/server/red_channel.h
> @@ -224,6 +224,9 @@ void red_channel_pipe_add_tail(RedChannel *channel, PipeItem *item);
>  /* for types that use this routine -> the pipe item should be freed */
>  void red_channel_pipe_add_type(RedChannel *channel, int pipe_item_type);
>
> +void red_channel_ack_zero_messages_window(RedChannel *channel);
> +void red_channel_ack_set_client_window(RedChannel *channel, int client_window);
> +
>  // TODO: unstaticed for display/cursor channels. they do some specific pushes not through
>  // adding elements or on events. but not sure if this is actually required (only result
>  // should be that they ""try"" a little harder, but if the event system is correct it
> diff --git a/server/red_worker.c b/server/red_worker.c
> index f3c3dff..473473c 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -8684,7 +8684,7 @@ static void on_new_display_channel(RedWorker *worker)
>     if (!display_channel_wait_for_init(display_channel)) {
>         return;
>     }
> -    display_channel->common.base.ack_data.messages_window = 0;
> +    red_channel_ack_zero_messages_window(&display_channel->common.base);
>     if (worker->surfaces[0].context.canvas) {
>         red_current_flush(worker, 0);
>         push_new_primary_surface(worker);
> @@ -8978,8 +8978,7 @@ static int display_channel_handle_migrate_data(DisplayChannel *channel, size_t s
>     }
>
>     red_channel_pipe_add_type((RedChannel *)channel, PIPE_ITEM_TYPE_INVAL_PALLET_CACHE);
> -
> -    channel->common.base.ack_data.messages_window = 0;
> +    red_channel_ack_zero_messages_window(&channel->common.base);
>     return TRUE;
>  }
>
> @@ -9087,8 +9086,8 @@ static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_i
>     common->worker = worker;
>     // TODO: Should this be distinctive for the Display/Cursor channels? doesn't
>     // make sense, does it?
> -    channel->ack_data.client_window = IS_LOW_BANDWIDTH() ? WIDE_CLIENT_ACK_WINDOW :
> -                                                      NARROW_CLIENT_ACK_WINDOW;
> +    red_channel_ack_set_client_window(channel,
> +        IS_LOW_BANDWIDTH() ? WIDE_CLIENT_ACK_WINDOW : NARROW_CLIENT_ACK_WINDOW);
>
>     event.events = EPOLLIN | EPOLLOUT | EPOLLET;
>     event.data.ptr = &common->listener;
> @@ -9274,8 +9273,7 @@ static void on_new_cursor_channel(RedWorker *worker)
>     CursorChannel *channel = worker->cursor_channel;
>
>     ASSERT(channel);
> -
> -    channel->common.base.ack_data.messages_window = 0;
> +    red_channel_ack_zero_messages_window(&channel->common.base);
>     red_channel_pipe_add_type(&channel->common.base, PIPE_ITEM_TYPE_SET_ACK);
>     if (worker->surfaces[0].context.canvas && !channel->common.base.migrate) {
>         red_channel_pipe_add_type(&worker->cursor_channel->common.base, PIPE_ITEM_TYPE_CURSOR_INIT);
> --
> 1.7.4
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>



-- 
Marc-André Lureau


More information about the Spice-devel mailing list