On Tue, Feb 08, 2011 at 09:59:49PM +0100, Marc-André Lureau wrote: > Ack. I don't see the need for item_pushed argument, is it used later > in your patch series? >
You should really look at both RedChannel implementations, the one in red_worker.c and the one in red_channel.[ch]. I think it's mainly for keeping track of what to free (if it has not been pushed it is only on the pipe, not in the outgoing). I don't remember more atm. > On Mon, Feb 7, 2011 at 7:20 PM, Alon Levy <al...@redhat.com> wrote: > > --- > > server/red_worker.c | 19 ++++++++++--------- > > 1 files changed, 10 insertions(+), 9 deletions(-) > > > > diff --git a/server/red_worker.c b/server/red_worker.c > > index 8c39d09..50038bf 100644 > > --- a/server/red_worker.c > > +++ b/server/red_worker.c > > @@ -350,7 +350,7 @@ typedef struct LocalCursor { > > typedef struct RedChannel RedChannel; > > typedef void (*channel_disconnect_proc)(RedChannel *channel); > > typedef void (*channel_hold_pipe_item_proc)(PipeItem *item); > > -typedef void (*channel_release_pipe_item_proc)(RedChannel *channel, void > > *item); > > +typedef void (*channel_release_pipe_item_proc)(RedChannel *channel, > > PipeItem *item, int item_pushed); > > typedef int (*handle_parsed_proc)(RedChannel *channel, uint32_t size, > > uint16_t type, void *message); > > > > struct RedChannel { > > @@ -1845,7 +1845,8 @@ static void > > red_clear_surface_drawables_from_pipe(RedWorker *worker, int surface > > PipeItem *tmp_item = item; > > item = (PipeItem *)ring_prev(ring, (RingItem *)item); > > ring_remove(&tmp_item->link); > > - > > worker->display_channel->common.base.release_item(&worker->display_channel->common.base, > > tmp_item); > > + worker->display_channel->common.base.release_item( > > + &worker->display_channel->common.base, tmp_item, FALSE); > > worker->display_channel->common.base.pipe_size--; > > > > if (!item) { > > @@ -7331,7 +7332,7 @@ static void inline channel_release_res(RedChannel > > *channel) > > if (!channel->send_data.item) { > > return; > > } > > - channel->release_item(channel, channel->send_data.item); > > + channel->release_item(channel, channel->send_data.item, FALSE); > > channel->send_data.item = NULL; > > } > > > > @@ -7345,7 +7346,7 @@ static void red_send_data(RedChannel *channel) > > if (!n) { > > channel->send_data.blocked = FALSE; > > if (channel->send_data.item) { > > - channel->release_item(channel, channel->send_data.item); > > + channel->release_item(channel, channel->send_data.item, > > FALSE); > > channel->send_data.item = NULL; > > } > > break; > > @@ -9458,12 +9459,12 @@ static void display_channel_hold_pipe_item(PipeItem > > *item) > > } > > } > > > > -static void display_channel_release_item(RedChannel *channel, void *item) > > +static void display_channel_release_item(RedChannel *channel, PipeItem > > *item, int item_pushed /* ignored */) > > { > > CommonChannel *common = SPICE_CONTAINEROF(channel, CommonChannel, base); > > > > ASSERT(item); > > - switch (((PipeItem *)item)->type) { > > + switch (item->type) { > > case PIPE_ITEM_TYPE_DRAW: > > case PIPE_ITEM_TYPE_STREAM_CREATE: > > release_drawable(common->worker, SPICE_CONTAINEROF(item, Drawable, > > pipe_item)); > > @@ -9601,12 +9602,12 @@ static void cursor_channel_hold_pipe_item(PipeItem > > *item) > > ((CursorItem *)item)->refs++; > > } > > > > -static void cursor_channel_release_item(RedChannel *channel, void *item) > > +static void cursor_channel_release_item(RedChannel *channel, PipeItem > > *item, int item_pushed) > > { > > CommonChannel *common = SPICE_CONTAINEROF(channel, CommonChannel, base); > > > > ASSERT(item); > > - red_release_cursor(common->worker, item); > > + red_release_cursor(common->worker, SPICE_CONTAINEROF(item, CursorItem, > > pipe_data)); > > } > > > > static void red_connect_cursor(RedWorker *worker, RedsStreamContext *peer, > > int migrate) > > @@ -9755,7 +9756,7 @@ static void red_wait_pipe_item_sent(RedChannel > > *channel, PipeItem *item) > > } > > } > > > > - channel->release_item(channel, item); > > + channel->release_item(channel, item, FALSE); > > red_unref_channel(channel); > > } > > > > -- > > 1.7.4 > > > > _______________________________________________ > > Spice-devel mailing list > > Spice-devel@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/spice-devel > > > > > > -- > Marc-André Lureau _______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel