[Spice-commits] 28 commits - docs/spice_style.txt server/agent-msg-filter.h server/char-device.h server/cursor-channel.c server/dcc-send.c server/dcc.c server/dcc.h server/demarshallers.h server/display-channel.c server/display-channel.h server/glz-encode.tmpl.c server/glz-encoder-priv.h server/inputs-channel.c server/inputs-channel.h server/main-channel.c server/migration-protocol.h server/red-channel.c server/red-channel.h server/reds-private.h server/smartcard.c server/smartcard.h server/sound.h server/spicevmc.c server/stat.h server/stream.c server/stream.h server/video-encoder.h server/zlib-encoder.h
Frediano Ziglio
fziglio at kemper.freedesktop.org
Wed May 18 03:27:23 UTC 2016
docs/spice_style.txt | 15 +++++++
server/agent-msg-filter.h | 3 +
server/char-device.h | 7 +--
server/cursor-channel.c | 72 +++-------------------------------
server/dcc-send.c | 10 ++--
server/dcc.c | 92 +-------------------------------------------
server/dcc.h | 6 --
server/demarshallers.h | 3 +
server/display-channel.c | 9 ----
server/display-channel.h | 2
server/glz-encode.tmpl.c | 17 ++------
server/glz-encoder-priv.h | 5 +-
server/inputs-channel.c | 7 ---
server/inputs-channel.h | 2
server/main-channel.c | 45 ++++++++-------------
server/migration-protocol.h | 1
server/red-channel.c | 36 ++++-------------
server/red-channel.h | 3 -
server/reds-private.h | 5 ++
server/smartcard.c | 12 -----
server/smartcard.h | 2
server/sound.h | 6 +-
server/spicevmc.c | 14 ------
server/stat.h | 2
server/stream.c | 37 +++++++++++++++--
server/stream.h | 7 ++-
server/video-encoder.h | 3 +
server/zlib-encoder.h | 2
28 files changed, 137 insertions(+), 288 deletions(-)
New commits:
commit fb10f5bf52fefb9d95dd2e6d7bd36aa173055ac8
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue May 17 16:22:44 2016 +0100
Simplify #ifdef/#endif in glz code
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/glz-encode.tmpl.c b/server/glz-encode.tmpl.c
index 8fc551d..6d2b000 100644
--- a/server/glz-encode.tmpl.c
+++ b/server/glz-encode.tmpl.c
@@ -409,26 +409,21 @@ match: // RLE or dictionary (both are encoded by distance from ref (-1) a
/* update the hash at match boundary */
#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32)
- if (ip > anchor) {
+ if (ip > anchor)
#endif
+ {
HASH_FUNC(hval, ip);
UPDATE_HASH(encoder->dict, hval, seg_idx, ip - ((PIXEL *)seg->lines));
- ip++;
-#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32)
- } else {ip++;
}
-#endif
+ ip++;
#if defined(LZ_RGB24) || defined(LZ_RGB32)
- if (ip > anchor) {
+ if (ip > anchor)
#endif
+ {
HASH_FUNC(hval, ip);
UPDATE_HASH(encoder->dict, hval, seg_idx, ip - ((PIXEL *)seg->lines));
- ip++;
-#if defined(LZ_RGB24) || defined(LZ_RGB32)
- } else {
- ip++;
}
-#endif
+ ip++;
/* assuming literal copy */
encode_copy_count(encoder, MAX_COPY - 1);
continue;
commit 3349610652ad13705890428a8094b0a312d8afa4
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue May 17 08:30:29 2016 +0100
char-device: Update function names in documentation
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/char-device.h b/server/char-device.h
index 885cccc..39bff4e 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -93,10 +93,11 @@ GType red_char_device_get_type(void) G_GNUC_CONST;
* Writing to the device
* ---------------------
* Write the data into RedCharDeviceWriteBuffer:
- * call red_char_device_buffer_get in order to get an appropriate buffer.
- * call red_char_device_buffer_add in order to push the buffer to the write queue.
+ * call red_char_device_write_buffer_get/red_char_device_write_buffer_get_server_no_token
+ * in order to get an appropriate buffer.
+ * call red_char_device_write_buffer_add in order to push the buffer to the write queue.
* If you choose not to push the buffer to the device, call
- * red_char_device_buffer_release
+ * red_char_device_write_buffer_release
*
* reading from the device
* -----------------------
commit f36c3887ba956aef57393d4746b4ad2e5ef2ba6e
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Wed May 18 00:01:57 2016 +0100
Make sure all headers are independent
Make sure is possible to include any headers alone.
I used this script to check independence (run under server directory):
----
#!/bin/bash
set -e
# check not already modified
if grep -q libheaders.la Makefile.am; then
echo "Header library already prepared" >&2
exit 1
fi
add_lib() {
local hdr="$1"
hdr=${hdr%.h}
c="mao_${hdr}.c"
echo "#include \"${hdr}.h\"" > $c
echo -e "\t$c \\" >&3
}
# add library to compile all headers alones
exec 3>> Makefile.am
echo "
noinst_LTLIBRARIES += libheaders.la
libheaders_la_SOURCES = \\" >&3
for hdr in *.h; do
case $hdr in
spice-bitmap-utils.h)
add_lib $hdr
;;
spice*.h)
;;
*)
add_lib $hdr
;;
esac
done
echo -e "\t\$(NULL)" >&3
exec 3>&-
----
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/agent-msg-filter.h b/server/agent-msg-filter.h
index 836ddbd..1835ef9 100644
--- a/server/agent-msg-filter.h
+++ b/server/agent-msg-filter.h
@@ -21,6 +21,9 @@
#ifndef _H_AGENT_MSG_FILTER
#define _H_AGENT_MSG_FILTER
+#include <inttypes.h>
+#include <glib.h>
+
/* Possible return values for agent_msg_filter_process_data */
enum {
AGENT_MSG_FILTER_OK,
diff --git a/server/demarshallers.h b/server/demarshallers.h
index c3d770d..dc35645 100644
--- a/server/demarshallers.h
+++ b/server/demarshallers.h
@@ -17,6 +17,9 @@
#ifndef _H_DEMARSHAL
#define _H_DEMARSHAL
+#include <stddef.h>
+#include <inttypes.h>
+
typedef void (*message_destructor_t)(uint8_t *message);
typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor,
size_t *size_out, message_destructor_t *free_message);
diff --git a/server/glz-encoder-priv.h b/server/glz-encoder-priv.h
index 919c439..a4609d9 100644
--- a/server/glz-encoder-priv.h
+++ b/server/glz-encoder-priv.h
@@ -18,7 +18,10 @@
#ifndef GLZ_ENCODER_PRIV_H_
#define GLZ_ENCODER_PRIV_H_
-#include "red-common.h"
+#include <pthread.h>
+#include <common/lz_common.h>
+
+#include "glz-encoder-dict.h"
/* Interface for using the dictionary for encoding.
Data structures are exposed for the encoder for efficiency
diff --git a/server/inputs-channel.h b/server/inputs-channel.h
index fce757f..9213aec 100644
--- a/server/inputs-channel.h
+++ b/server/inputs-channel.h
@@ -24,6 +24,8 @@
#include <stdint.h>
#include <spice/vd_agent.h>
+#include "red-channel.h"
+
typedef struct InputsChannel InputsChannel;
InputsChannel* inputs_channel_new(RedsState *reds);
diff --git a/server/migration-protocol.h b/server/migration-protocol.h
index 16eafbe..3f08150 100644
--- a/server/migration-protocol.h
+++ b/server/migration-protocol.h
@@ -20,6 +20,7 @@
#include <spice/macros.h>
#include <spice/vd_agent.h>
+#include <common/log.h>
#include "glz-encoder-dict.h"
diff --git a/server/reds-private.h b/server/reds-private.h
index 5724f16..0408f25 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -19,6 +19,11 @@
#define REDS_PRIVATE_H
#include <spice/protocol.h>
+#include <spice/stats.h>
+
+#include "main-dispatcher.h"
+#include "main-channel.h"
+#include "inputs-channel.h"
#define MIGRATE_TIMEOUT (MSEC_PER_SEC * 10)
#define MM_TIME_DELTA 400 /*ms*/
diff --git a/server/smartcard.h b/server/smartcard.h
index 6bda594..2d1356e 100644
--- a/server/smartcard.h
+++ b/server/smartcard.h
@@ -20,6 +20,8 @@
#include <glib-object.h>
+#include "char-device.h"
+
#define RED_TYPE_CHAR_DEVICE_SMARTCARD red_char_device_smartcard_get_type()
#define RED_CHAR_DEVICE_SMARTCARD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE_SMARTCARD, RedCharDeviceSmartcard))
diff --git a/server/sound.h b/server/sound.h
index 25e59f0..76174cf 100644
--- a/server/sound.h
+++ b/server/sound.h
@@ -18,7 +18,9 @@
#ifndef SOUND_H_
#define SOUND_H_
-#include "spice.h"
+#include "red-common.h"
+
+struct RedClient;
void snd_attach_playback(RedsState *reds, SpicePlaybackInstance *sin);
void snd_detach_playback(SpicePlaybackInstance *sin);
@@ -28,6 +30,6 @@ void snd_detach_record(SpiceRecordInstance *sin);
void snd_set_playback_compression(int on);
-void snd_set_playback_latency(RedClient *client, uint32_t latency);
+void snd_set_playback_latency(struct RedClient *client, uint32_t latency);
#endif
diff --git a/server/stat.h b/server/stat.h
index 7db27ee..f6f7a04 100644
--- a/server/stat.h
+++ b/server/stat.h
@@ -21,6 +21,8 @@
#include <stdint.h>
#include <glib.h>
+#include "spice.h"
+
typedef uint32_t StatNodeRef;
#define INVALID_STAT_REF (~(StatNodeRef)0)
diff --git a/server/video-encoder.h b/server/video-encoder.h
index 9833e13..8aa7783 100644
--- a/server/video-encoder.h
+++ b/server/video-encoder.h
@@ -21,6 +21,9 @@
#ifndef _H_VIDEO_ENCODER
#define _H_VIDEO_ENCODER
+#include <inttypes.h>
+#include <common/draw.h>
+
enum {
VIDEO_ENCODER_FRAME_UNSUPPORTED = -1,
VIDEO_ENCODER_FRAME_DROP,
diff --git a/server/zlib-encoder.h b/server/zlib-encoder.h
index 0620fc7..2800102 100644
--- a/server/zlib-encoder.h
+++ b/server/zlib-encoder.h
@@ -30,6 +30,8 @@
#ifndef _H_ZLIB_ENCODER
#define _H_ZLIB_ENCODER
+#include <inttypes.h>
+
typedef struct ZlibEncoder ZlibEncoder;
typedef struct ZlibEncoderUsrContext ZlibEncoderUsrContext;
commit 9fd82215d12e249006ee7a715025edffab1462ed
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue May 17 14:55:26 2016 +0100
style: Add some documentation for names
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/docs/spice_style.txt b/docs/spice_style.txt
index b042d79..957e017 100644
--- a/docs/spice_style.txt
+++ b/docs/spice_style.txt
@@ -131,6 +131,21 @@ Names
* Structures, class and enum names - one or more words, each word start with upper case (e.g., Name, SampleStructName)
* Defines and enum items names - uppercase words separated using underscores (e.g., NAME, SAMPLE_DEFINE_NAME)
+Type prefix
+~~~~~~~~~~~
+In the code there are some common prefixes for types, `Red` and `Spice`.
+As a basic rule `Spice` refers to types in the public external headers while `Red` is used for internal types.
+
+Common abbreviations
+~~~~~~~~~~~~~~~~~~~~
+`rcc` RedChannelClient
+
+`dcc` DisplayChannelClient
+
+`sin` spice instance
+
+`sif` spice interface
+
Optimization
------------
commit e72fec2289eeb4aa258f6937cb03b57a36aeef28
Merge: 8e1859a c6fa38f
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Wed May 18 00:22:43 2016 +0100
Use more reference counting on RedPipeItem
This is the continuation of Christophe patches using reference
counting for RedPipeItem.
Extend it's usage.
This for instance leads to the removal of release_item callback.
commit c6fa38f468ced712403ca2f3778556a01d5d1fb1
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Sun May 15 20:51:13 2016 +0100
Use reference counting for RedPipeItem
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-channel.c b/server/red-channel.c
index 803570c..9aef363 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -578,7 +578,7 @@ static void red_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *ite
rcc->channel->channel_cbs.send_item(rcc, item);
return;
}
- free(item);
+ red_pipe_item_unref(item);
}
static inline void red_channel_client_release_sent_item(RedChannelClient *rcc)
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 1e9406e..14d34b4 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -431,7 +431,7 @@ static void spicevmc_red_channel_send_item(RedChannelClient *rcc,
break;
default:
spice_error("bad pipe item %d", item->type);
- free(item);
+ red_pipe_item_unref(item);
return;
}
red_channel_client_begin_send_message(rcc);
commit 879b28004925db0db8513e276e444f3a01c48003
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Sat May 14 01:07:29 2016 +0100
Reuse red_channel_client_release_sent_item function
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-channel.c b/server/red-channel.c
index 77eb4be..803570c 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -1757,10 +1757,7 @@ int red_channel_is_connected(RedChannel *channel)
static void red_channel_client_clear_sent_item(RedChannelClient *rcc)
{
- if (rcc->send_data.item) {
- red_pipe_item_unref(rcc->send_data.item);
- rcc->send_data.item = NULL;
- }
+ red_channel_client_release_sent_item(rcc);
rcc->send_data.blocked = FALSE;
rcc->send_data.size = 0;
}
commit 7f570579e52c0dcc28e2e48f990a3238eb1f9ec8
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Sat May 14 01:04:52 2016 +0100
Make red_channel_client_clear_sent_item static
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-channel.c b/server/red-channel.c
index b7ec11e..77eb4be 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -1755,7 +1755,7 @@ int red_channel_is_connected(RedChannel *channel)
return channel && (channel->clients_num > 0);
}
-void red_channel_client_clear_sent_item(RedChannelClient *rcc)
+static void red_channel_client_clear_sent_item(RedChannelClient *rcc)
{
if (rcc->send_data.item) {
red_pipe_item_unref(rcc->send_data.item);
commit b1476746d478e3ded31dc0257e37db75f5e0dd33
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Sat May 14 01:03:08 2016 +0100
Remove red_channel_client_release_item
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-channel.c b/server/red-channel.c
index 4d7c1b1..b7ec11e 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -581,16 +581,10 @@ static void red_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *ite
free(item);
}
-static void red_channel_client_release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
-{
- red_pipe_item_unref(item);
-}
-
static inline void red_channel_client_release_sent_item(RedChannelClient *rcc)
{
if (rcc->send_data.item) {
- red_channel_client_release_item(rcc,
- rcc->send_data.item, TRUE);
+ red_pipe_item_unref(rcc->send_data.item);
rcc->send_data.item = NULL;
}
}
@@ -1654,7 +1648,7 @@ static inline gboolean client_pipe_add(RedChannelClient *rcc, RedPipeItem *item,
spice_assert(rcc && item);
if (SPICE_UNLIKELY(!red_channel_client_is_connected(rcc))) {
spice_debug("rcc is disconnected %p", rcc);
- red_channel_client_release_item(rcc, item, FALSE);
+ red_pipe_item_unref(item);
return FALSE;
}
if (ring_is_empty(&rcc->pipe) && rcc->stream->watch) {
@@ -1764,7 +1758,7 @@ int red_channel_is_connected(RedChannel *channel)
void red_channel_client_clear_sent_item(RedChannelClient *rcc)
{
if (rcc->send_data.item) {
- red_channel_client_release_item(rcc, rcc->send_data.item, TRUE);
+ red_pipe_item_unref(rcc->send_data.item);
rcc->send_data.item = NULL;
}
rcc->send_data.blocked = FALSE;
@@ -1780,7 +1774,7 @@ void red_channel_client_pipe_clear(RedChannelClient *rcc)
}
while ((item = (RedPipeItem *)ring_get_head(&rcc->pipe))) {
ring_remove(&item->link);
- red_channel_client_release_item(rcc, item, FALSE);
+ red_pipe_item_unref(item);
}
rcc->pipe_size = 0;
}
@@ -2024,7 +2018,7 @@ void red_channel_client_pipe_remove_and_release(RedChannelClient *rcc,
RedPipeItem *item)
{
red_channel_client_pipe_remove(rcc, item);
- red_channel_client_release_item(rcc, item, FALSE);
+ red_pipe_item_unref(item);
}
/*
@@ -2389,7 +2383,7 @@ int red_channel_client_wait_pipe_item_sent(RedChannelClient *rcc,
red_channel_client_push(rcc);
}
- red_channel_client_release_item(rcc, item, TRUE);
+ red_pipe_item_unref(item);
if (item_in_pipe) {
spice_warning("timeout");
return FALSE;
commit fef7bec4a9df5da0ca913475f2c2ad5f69aa1d0c
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 19:23:53 2016 +0100
Remove release_item callback
Just a call to red_pipe_item_unref.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-channel.c b/server/red-channel.c
index 0d35fc0..4d7c1b1 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -583,16 +583,7 @@ static void red_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *ite
static void red_channel_client_release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
{
- switch (item->type) {
- case RED_PIPE_ITEM_TYPE_SET_ACK:
- case RED_PIPE_ITEM_TYPE_EMPTY_MSG:
- case RED_PIPE_ITEM_TYPE_MIGRATE:
- case RED_PIPE_ITEM_TYPE_PING:
- free(item);
- break;
- default:
- rcc->channel->channel_cbs.release_item(rcc, item, item_pushed);
- }
+ red_pipe_item_unref(item);
}
static inline void red_channel_client_release_sent_item(RedChannelClient *rcc)
@@ -1016,11 +1007,6 @@ void red_channel_client_default_migrate(RedChannelClient *rcc)
red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_MIGRATE);
}
-static void red_channel_release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
-{
- red_pipe_item_unref(item);
-}
-
RedChannel *red_channel_create(int size,
RedsState *reds,
const SpiceCoreInterfaceInternal *core,
@@ -1045,9 +1031,6 @@ RedChannel *red_channel_create(int size,
channel->handle_acks = handle_acks;
channel->migration_flags = migration_flags;
memcpy(&channel->channel_cbs, channel_cbs, sizeof(ChannelCbs));
- if (!channel->channel_cbs.release_item) {
- channel->channel_cbs.release_item = red_channel_release_item;
- }
channel->reds = reds;
channel->core = core;
diff --git a/server/red-channel.h b/server/red-channel.h
index 03e6407..63cb2d9 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -159,8 +159,6 @@ typedef void (*channel_disconnect_proc)(RedChannelClient *rcc);
typedef int (*channel_configure_socket_proc)(RedChannelClient *rcc);
typedef void (*channel_send_pipe_item_proc)(RedChannelClient *rcc, RedPipeItem *item);
typedef void (*channel_hold_pipe_item_proc)(RedChannelClient *rcc, RedPipeItem *item);
-typedef void (*channel_release_pipe_item_proc)(RedChannelClient *rcc,
- RedPipeItem *item, int item_pushed);
typedef void (*channel_on_incoming_error_proc)(RedChannelClient *rcc);
typedef void (*channel_on_outgoing_error_proc)(RedChannelClient *rcc);
@@ -188,7 +186,6 @@ typedef struct {
channel_disconnect_proc on_disconnect;
channel_send_pipe_item_proc send_item;
channel_hold_pipe_item_proc hold_item;
- channel_release_pipe_item_proc release_item;
channel_alloc_msg_recv_buf_proc alloc_recv_buf;
channel_release_msg_recv_buf_proc release_recv_buf;
channel_handle_migrate_flush_mark_proc handle_migrate_flush_mark;
commit 7b49fc836b7b3e1e9e0679c0859d06294e77a60f
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 19:21:38 2016 +0100
Remove main_channel_release_pipe_item
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/main-channel.c b/server/main-channel.c
index 433b46c..d540796 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -165,9 +165,6 @@ enum NetTestStage {
NET_TEST_STAGE_COMPLETE,
};
-static void main_channel_release_pipe_item(RedChannelClient *rcc,
- RedPipeItem *base, int item_pushed);
-
int main_channel_is_connected(MainChannel *main_chan)
{
return red_channel_is_connected(&main_chan->base);
@@ -726,7 +723,7 @@ static void main_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
spice_printerr("Init msg for client %p was not sent yet "
"(client is probably during semi-seamless migration). Ignoring msg type %d",
rcc->client, base->type);
- main_channel_release_pipe_item(rcc, base, FALSE);
+ red_pipe_item_unref(base);
return;
}
switch (base->type) {
@@ -797,12 +794,6 @@ static void main_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
red_channel_client_begin_send_message(rcc);
}
-static void main_channel_release_pipe_item(RedChannelClient *rcc,
- RedPipeItem *base, int item_pushed)
-{
- red_pipe_item_unref(base);
-}
-
static void main_channel_client_handle_migrate_connected(MainChannelClient *mcc,
int success,
int seamless)
@@ -1164,7 +1155,6 @@ MainChannel* main_channel_new(RedsState *reds)
channel_cbs.on_disconnect = main_channel_client_on_disconnect;
channel_cbs.send_item = main_channel_send_item;
channel_cbs.hold_item = main_channel_hold_pipe_item;
- channel_cbs.release_item = main_channel_release_pipe_item;
channel_cbs.alloc_recv_buf = main_channel_alloc_msg_rcv_buf;
channel_cbs.release_recv_buf = main_channel_release_msg_rcv_buf;
channel_cbs.handle_migrate_flush_mark = main_channel_handle_migrate_flush_mark;
commit 5b6adf091c094859ce8ad1683bef11c46117a2ae
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 19:19:35 2016 +0100
Simplify main_channel_release_pipe_item
Reuse RedPipeItem facilities.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/main-channel.c b/server/main-channel.c
index 98ce660..433b46c 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -250,13 +250,20 @@ static RedPipeItem *main_agent_tokens_item_new(RedChannelClient *rcc, uint32_t n
return &item->base;
}
+static void main_agent_data_item_free(RedAgentDataPipeItem *item)
+{
+ item->free_data(item->data, item->opaque);
+ free(item);
+}
+
static RedPipeItem *main_agent_data_item_new(RedChannelClient *rcc, uint8_t* data, size_t len,
spice_marshaller_item_free_func free_data,
void *opaque)
{
RedAgentDataPipeItem *item = spice_malloc(sizeof(RedAgentDataPipeItem));
- red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_AGENT_DATA);
+ red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_MAIN_AGENT_DATA,
+ (GDestroyNotify)main_agent_data_item_free);
item->data = data;
item->len = len;
item->free_data = free_data;
@@ -302,12 +309,19 @@ static RedPipeItem *main_uuid_item_new(MainChannelClient *mcc, const uint8_t uui
return &item->base;
}
+static void main_notify_item_free(RedNotifyPipeItem *data)
+{
+ free(data->msg);
+ free(data);
+}
+
static RedPipeItem *main_notify_item_new(RedChannelClient *rcc, void *data, int num)
{
RedNotifyPipeItem *item = spice_malloc(sizeof(RedNotifyPipeItem));
const char *msg = data;
- red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_NOTIFY);
+ red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_MAIN_NOTIFY,
+ (GDestroyNotify)main_notify_item_free);
item->msg = spice_strdup(msg);
return &item->base;
}
@@ -786,22 +800,7 @@ static void main_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
static void main_channel_release_pipe_item(RedChannelClient *rcc,
RedPipeItem *base, int item_pushed)
{
- switch (base->type) {
- case RED_PIPE_ITEM_TYPE_MAIN_AGENT_DATA: {
- RedAgentDataPipeItem *data = (RedAgentDataPipeItem *)base;
-
- data->free_data(data->data, data->opaque);
- break;
- }
- case RED_PIPE_ITEM_TYPE_MAIN_NOTIFY: {
- RedNotifyPipeItem *data = (RedNotifyPipeItem *)base;
- free(data->msg);
- break;
- }
- default:
- break;
- }
- free(base);
+ red_pipe_item_unref(base);
}
static void main_channel_client_handle_migrate_connected(MainChannelClient *mcc,
commit 33883bd163645826027a8222a6aa815578c21c4a
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 19:11:26 2016 +0100
Use a default release_item implementation in RedChannel
Avoid having to provide a lot of empty implementations
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index b0fd95f..c0b2fda 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -359,11 +359,6 @@ static void cursor_channel_hold_pipe_item(RedChannelClient *rcc, RedPipeItem *it
cursor_pipe_item_ref(cursor_pipe_item);
}
-static void cursor_channel_release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
-{
- red_pipe_item_unref(item);
-}
-
CursorChannel* cursor_channel_new(RedWorker *worker)
{
CursorChannel *cursor_channel;
@@ -372,7 +367,6 @@ CursorChannel* cursor_channel_new(RedWorker *worker)
.on_disconnect = cursor_channel_client_on_disconnect,
.send_item = cursor_channel_send_item,
.hold_item = cursor_channel_hold_pipe_item,
- .release_item = cursor_channel_release_item
};
spice_info("create cursor channel");
diff --git a/server/display-channel.c b/server/display-channel.c
index 302daed..1487f10 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1946,11 +1946,6 @@ static void hold_item(RedChannelClient *rcc, RedPipeItem *item)
}
}
-static void release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
-{
- red_pipe_item_unref(item);
-}
-
static int handle_migrate_flush_mark(RedChannelClient *rcc)
{
DisplayChannel *display_channel = SPICE_CONTAINEROF(rcc->channel, DisplayChannel, common.base);
@@ -1992,7 +1987,6 @@ DisplayChannel* display_channel_new(SpiceServer *reds, RedWorker *worker,
.on_disconnect = on_disconnect,
.send_item = send_item,
.hold_item = hold_item,
- .release_item = release_item,
.handle_migrate_flush_mark = handle_migrate_flush_mark,
.handle_migrate_data = handle_migrate_data,
.handle_migrate_data_get_serial = handle_migrate_data_get_serial
diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 0ce12de..a3c9fb2 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -254,12 +254,6 @@ static void inputs_channel_send_migrate_data(RedChannelClient *rcc,
spice_marshaller_add_uint16(m, icc->motion_count);
}
-static void inputs_channel_release_pipe_item(RedChannelClient *rcc,
- RedPipeItem *base, int item_pushed)
-{
- free(base);
-}
-
static void inputs_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
{
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -627,7 +621,6 @@ InputsChannel* inputs_channel_new(RedsState *reds)
channel_cbs.on_disconnect = inputs_channel_on_disconnect;
channel_cbs.send_item = inputs_channel_send_item;
channel_cbs.hold_item = inputs_channel_hold_pipe_item;
- channel_cbs.release_item = inputs_channel_release_pipe_item;
channel_cbs.alloc_recv_buf = inputs_channel_alloc_msg_rcv_buf;
channel_cbs.release_recv_buf = inputs_channel_release_msg_rcv_buf;
channel_cbs.handle_migrate_data = inputs_channel_handle_migrate_data;
diff --git a/server/red-channel.c b/server/red-channel.c
index a99c6c6..0d35fc0 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -1016,6 +1016,11 @@ void red_channel_client_default_migrate(RedChannelClient *rcc)
red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_MIGRATE);
}
+static void red_channel_release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
+{
+ red_pipe_item_unref(item);
+}
+
RedChannel *red_channel_create(int size,
RedsState *reds,
const SpiceCoreInterfaceInternal *core,
@@ -1030,7 +1035,7 @@ RedChannel *red_channel_create(int size,
spice_assert(size >= sizeof(*channel));
spice_assert(channel_cbs->config_socket && channel_cbs->on_disconnect && handle_message &&
- channel_cbs->alloc_recv_buf && channel_cbs->release_item);
+ channel_cbs->alloc_recv_buf);
spice_assert(channel_cbs->handle_migrate_data ||
!(migration_flags & SPICE_MIGRATE_NEED_DATA_TRANSFER));
channel = spice_malloc0(size);
@@ -1040,6 +1045,9 @@ RedChannel *red_channel_create(int size,
channel->handle_acks = handle_acks;
channel->migration_flags = migration_flags;
memcpy(&channel->channel_cbs, channel_cbs, sizeof(ChannelCbs));
+ if (!channel->channel_cbs.release_item) {
+ channel->channel_cbs.release_item = red_channel_release_item;
+ }
channel->reds = reds;
channel->core = core;
diff --git a/server/smartcard.c b/server/smartcard.c
index c8e9eb0..a75f01c 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -504,12 +504,6 @@ static void smartcard_channel_send_item(RedChannelClient *rcc, RedPipeItem *item
red_channel_client_begin_send_message(rcc);
}
-static void smartcard_channel_release_pipe_item(RedChannelClient *rcc,
- RedPipeItem *item, int item_pushed)
-{
- red_pipe_item_unref(item);
-}
-
static void smartcard_channel_on_disconnect(RedChannelClient *rcc)
{
SmartCardChannelClient *scc = SPICE_CONTAINEROF(rcc, SmartCardChannelClient, base);
@@ -792,7 +786,6 @@ static void smartcard_init(RedsState *reds)
channel_cbs.on_disconnect = smartcard_channel_on_disconnect;
channel_cbs.send_item = smartcard_channel_send_item;
channel_cbs.hold_item = smartcard_channel_hold_pipe_item;
- channel_cbs.release_item = smartcard_channel_release_pipe_item;
channel_cbs.alloc_recv_buf = smartcard_channel_alloc_msg_rcv_buf;
channel_cbs.release_recv_buf = smartcard_channel_release_msg_rcv_buf;
channel_cbs.handle_migrate_flush_mark = smartcard_channel_client_handle_migrate_flush_mark;
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 5724023..1e9406e 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -437,13 +437,6 @@ static void spicevmc_red_channel_send_item(RedChannelClient *rcc,
red_channel_client_begin_send_message(rcc);
}
-static void spicevmc_red_channel_release_pipe_item(RedChannelClient *rcc,
- RedPipeItem *item,
- int item_pushed)
-{
- red_pipe_item_unref(item);
-}
-
static void spicevmc_connect(RedChannel *channel, RedClient *client,
RedsStream *stream, int migration, int num_common_caps,
uint32_t *common_caps, int num_caps, uint32_t *caps)
@@ -505,7 +498,6 @@ RedCharDevice *spicevmc_device_connect(RedsState *reds,
channel_cbs.on_disconnect = spicevmc_red_channel_client_on_disconnect;
channel_cbs.send_item = spicevmc_red_channel_send_item;
channel_cbs.hold_item = spicevmc_red_channel_hold_pipe_item;
- channel_cbs.release_item = spicevmc_red_channel_release_pipe_item;
channel_cbs.alloc_recv_buf = spicevmc_red_channel_alloc_msg_rcv_buf;
channel_cbs.release_recv_buf = spicevmc_red_channel_release_msg_rcv_buf;
channel_cbs.handle_migrate_flush_mark = spicevmc_channel_client_handle_migrate_flush_mark;
commit 44352ca84608e80c7d5fa65614f1dd7eaccf5020
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 19:01:46 2016 +0100
Remove dcc_release_item
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 0f645a9..f0f2e16 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -2455,7 +2455,7 @@ void dcc_send_item(DisplayChannelClient *dcc, RedPipeItem *pipe_item)
spice_warn_if_reached();
}
- dcc_release_item(dcc, pipe_item, FALSE);
+ red_pipe_item_unref(pipe_item);
// a message is pending
if (red_channel_client_send_message_pending(rcc)) {
diff --git a/server/dcc.c b/server/dcc.c
index 7d9d366..b9e4eb3 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1607,8 +1607,3 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
red_channel_client_ack_zero_messages_window(RED_CHANNEL_CLIENT(dcc));
return TRUE;
}
-
-void dcc_release_item(DisplayChannelClient *dcc, RedPipeItem *item, int item_pushed)
-{
- red_pipe_item_unref(item);
-}
diff --git a/server/dcc.h b/server/dcc.h
index 63a7496..864a768 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -203,9 +203,6 @@ void dcc_append_drawable (DisplayCha
void dcc_add_drawable_after (DisplayChannelClient *dcc,
Drawable *drawable,
RedPipeItem *pos);
-void dcc_release_item (DisplayChannelClient *dcc,
- RedPipeItem *item,
- int item_pushed);
void dcc_send_item (DisplayChannelClient *dcc,
RedPipeItem *item);
int dcc_clear_surface_drawables_from_pipe (DisplayChannelClient *dcc,
diff --git a/server/display-channel.c b/server/display-channel.c
index 7715b95..302daed 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1948,10 +1948,7 @@ static void hold_item(RedChannelClient *rcc, RedPipeItem *item)
static void release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
{
- DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
-
- spice_return_if_fail(item != NULL);
- dcc_release_item(dcc, item, item_pushed);
+ red_pipe_item_unref(item);
}
static int handle_migrate_flush_mark(RedChannelClient *rcc)
commit 6db1afd262e5c3a16e49f03a52f5df7fad834d39
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:59:11 2016 +0100
Simplify pipe items release in CursorChannel
All RedPipeItems can be freed with red_pipe_item_unref.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 2d57c59..b0fd95f 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -222,38 +222,6 @@ static void cursor_channel_client_on_disconnect(RedChannelClient *rcc)
red_reset_cursor_cache(rcc);
}
-// TODO: share code between before/after_push since most of the items need the same
-// release
-static void cursor_channel_client_release_item_before_push(CursorChannelClient *ccc,
- RedPipeItem *item)
-{
- switch (item->type) {
- case RED_PIPE_ITEM_TYPE_CURSOR:
- red_pipe_item_unref(item);
- break;
- case RED_PIPE_ITEM_TYPE_INVAL_ONE:
- case RED_PIPE_ITEM_TYPE_VERB:
- case RED_PIPE_ITEM_TYPE_CURSOR_INIT:
- case RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
- free(item);
- break;
- default:
- spice_error("invalid pipe item type");
- }
-}
-
-static void cursor_channel_client_release_item_after_push(CursorChannelClient *ccc,
- RedPipeItem *item)
-{
- switch (item->type) {
- case RED_PIPE_ITEM_TYPE_CURSOR:
- red_pipe_item_unref(item);
- break;
- default:
- spice_critical("invalid item type");
- }
-}
-
static void red_marshall_cursor_init(RedChannelClient *rcc, SpiceMarshaller *base_marshaller,
RedPipeItem *pipe_item)
{
@@ -345,7 +313,6 @@ static inline void red_marshall_inval(RedChannelClient *rcc,
static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
{
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
- CursorChannelClient *ccc = RCC_TO_CCC(rcc);
switch (pipe_item->type) {
case RED_PIPE_ITEM_TYPE_CURSOR:
@@ -369,7 +336,7 @@ static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_it
spice_error("invalid pipe item type");
}
- cursor_channel_client_release_item_before_push(ccc, pipe_item);
+ red_pipe_item_unref(pipe_item);
red_channel_client_begin_send_message(rcc);
}
@@ -394,16 +361,7 @@ static void cursor_channel_hold_pipe_item(RedChannelClient *rcc, RedPipeItem *it
static void cursor_channel_release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
{
- CursorChannelClient *ccc = RCC_TO_CCC(rcc);
-
- spice_assert(item);
-
- if (item_pushed) {
- cursor_channel_client_release_item_after_push(ccc, item);
- } else {
- spice_debug("not pushed (%d)", item->type);
- cursor_channel_client_release_item_before_push(ccc, item);
- }
+ red_pipe_item_unref(item);
}
CursorChannel* cursor_channel_new(RedWorker *worker)
commit da39bb1b1276b6865e96648291b0aced0a445cf5
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:56:39 2016 +0100
Reuse RedPipeItem facilities for RedCursorPipeItem
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 4df5c66..2d57c59 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -48,7 +48,6 @@ G_STATIC_ASSERT(sizeof(CursorItem) <= QXL_CURSUR_DEVICE_DATA_SIZE);
typedef struct RedCursorPipeItem {
RedPipeItem base;
CursorItem *cursor_item;
- int refs;
} RedCursorPipeItem;
struct CursorChannel {
@@ -82,6 +81,8 @@ struct CursorChannelClient {
#include "cache-item.tmpl.c"
#undef CLIENT_CURSOR_CACHE
+static void cursor_pipe_item_free(RedCursorPipeItem *pipe_item);
+
static CursorItem *cursor_item_new(QXLInstance *qxl, RedCursorCmd *cmd)
{
CursorItem *cursor_item;
@@ -136,8 +137,8 @@ static RedPipeItem *new_cursor_pipe_item(RedChannelClient *rcc, void *data, int
{
RedCursorPipeItem *item = spice_malloc0(sizeof(RedCursorPipeItem));
- red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_CURSOR);
- item->refs = 1;
+ red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_CURSOR,
+ (GDestroyNotify)cursor_pipe_item_free);
item->cursor_item = data;
item->cursor_item->refs++;
return &item->base;
@@ -203,14 +204,9 @@ void cursor_channel_disconnect(CursorChannel *cursor_channel)
}
-static void put_cursor_pipe_item(RedCursorPipeItem *pipe_item)
+static void cursor_pipe_item_free(RedCursorPipeItem *pipe_item)
{
spice_return_if_fail(pipe_item);
- spice_return_if_fail(pipe_item->refs > 0);
-
- if (--pipe_item->refs) {
- return;
- }
spice_assert(!red_pipe_item_is_linked(&pipe_item->base));
@@ -232,11 +228,9 @@ static void cursor_channel_client_release_item_before_push(CursorChannelClient *
RedPipeItem *item)
{
switch (item->type) {
- case RED_PIPE_ITEM_TYPE_CURSOR: {
- RedCursorPipeItem *cursor_pipe_item = SPICE_CONTAINEROF(item, RedCursorPipeItem, base);
- put_cursor_pipe_item(cursor_pipe_item);
+ case RED_PIPE_ITEM_TYPE_CURSOR:
+ red_pipe_item_unref(item);
break;
- }
case RED_PIPE_ITEM_TYPE_INVAL_ONE:
case RED_PIPE_ITEM_TYPE_VERB:
case RED_PIPE_ITEM_TYPE_CURSOR_INIT:
@@ -252,11 +246,9 @@ static void cursor_channel_client_release_item_after_push(CursorChannelClient *c
RedPipeItem *item)
{
switch (item->type) {
- case RED_PIPE_ITEM_TYPE_CURSOR: {
- RedCursorPipeItem *cursor_pipe_item = SPICE_CONTAINEROF(item, RedCursorPipeItem, base);
- put_cursor_pipe_item(cursor_pipe_item);
+ case RED_PIPE_ITEM_TYPE_CURSOR:
+ red_pipe_item_unref(item);
break;
- }
default:
spice_critical("invalid item type");
}
@@ -384,9 +376,8 @@ static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_it
static RedCursorPipeItem *cursor_pipe_item_ref(RedCursorPipeItem *item)
{
spice_return_val_if_fail(item, NULL);
- spice_return_val_if_fail(item->refs > 0, NULL);
- item->refs++;
+ red_pipe_item_ref(item);
return item;
}
commit 52b9f2e8b3de4fc04d76e3dbca0929b5a93ab7ff
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:51:12 2016 +0100
Remove unused parameter from put_cursor_pipe_item
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 444d89b..4df5c66 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -203,8 +203,7 @@ void cursor_channel_disconnect(CursorChannel *cursor_channel)
}
-static void put_cursor_pipe_item(CursorChannelClient *ccc,
- RedCursorPipeItem *pipe_item)
+static void put_cursor_pipe_item(RedCursorPipeItem *pipe_item)
{
spice_return_if_fail(pipe_item);
spice_return_if_fail(pipe_item->refs > 0);
@@ -235,7 +234,7 @@ static void cursor_channel_client_release_item_before_push(CursorChannelClient *
switch (item->type) {
case RED_PIPE_ITEM_TYPE_CURSOR: {
RedCursorPipeItem *cursor_pipe_item = SPICE_CONTAINEROF(item, RedCursorPipeItem, base);
- put_cursor_pipe_item(ccc, cursor_pipe_item);
+ put_cursor_pipe_item(cursor_pipe_item);
break;
}
case RED_PIPE_ITEM_TYPE_INVAL_ONE:
@@ -255,7 +254,7 @@ static void cursor_channel_client_release_item_after_push(CursorChannelClient *c
switch (item->type) {
case RED_PIPE_ITEM_TYPE_CURSOR: {
RedCursorPipeItem *cursor_pipe_item = SPICE_CONTAINEROF(item, RedCursorPipeItem, base);
- put_cursor_pipe_item(ccc, cursor_pipe_item);
+ put_cursor_pipe_item(cursor_pipe_item);
break;
}
default:
commit 1b081c17ea3d0e242cf38048a179b03c38fb7e92
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:46:34 2016 +0100
Simplify spicevmc_red_channel_release_pipe_item
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/spicevmc.c b/server/spicevmc.c
index bdaa3c3..5724023 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -441,11 +441,7 @@ static void spicevmc_red_channel_release_pipe_item(RedChannelClient *rcc,
RedPipeItem *item,
int item_pushed)
{
- if (item->type == RED_PIPE_ITEM_TYPE_SPICEVMC_DATA) {
- red_pipe_item_unref(item);
- } else {
- free(item);
- }
+ red_pipe_item_unref(item);
}
static void spicevmc_connect(RedChannel *channel, RedClient *client,
commit 1c1facdb4cad141af87418058840ab913d3331ef
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:46:18 2016 +0100
Simplify smartcard_channel_release_pipe_item
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/smartcard.c b/server/smartcard.c
index b2fb766..c8e9eb0 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -507,11 +507,7 @@ static void smartcard_channel_send_item(RedChannelClient *rcc, RedPipeItem *item
static void smartcard_channel_release_pipe_item(RedChannelClient *rcc,
RedPipeItem *item, int item_pushed)
{
- if (item->type == RED_PIPE_ITEM_TYPE_SMARTCARD_DATA) {
- red_pipe_item_unref(item);
- } else {
- free(item);
- }
+ red_pipe_item_unref(item);
}
static void smartcard_channel_on_disconnect(RedChannelClient *rcc)
commit 8dbd52f42ab0f1f7f3c35c18b81257a2890d663c
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:45:56 2016 +0100
Simplify dcc_release_item
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc.c b/server/dcc.c
index 20ba6ee..7d9d366 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1608,46 +1608,7 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
return TRUE;
}
-static void release_item_after_push(RedPipeItem *item)
-{
- red_pipe_item_unref(item);
-}
-
-// TODO: share code between before/after_push since most of the items need the same
-// release
-static void release_item_before_push(DisplayChannelClient *dcc, RedPipeItem *item)
-{
- spice_debug("item.type: %d", item->type);
- switch (item->type) {
- case RED_PIPE_ITEM_TYPE_STREAM_CREATE:
- case RED_PIPE_ITEM_TYPE_STREAM_DESTROY:
- case RED_PIPE_ITEM_TYPE_DRAW:
- case RED_PIPE_ITEM_TYPE_STREAM_CLIP:
- case RED_PIPE_ITEM_TYPE_UPGRADE:
- case RED_PIPE_ITEM_TYPE_IMAGE:
- case RED_PIPE_ITEM_TYPE_MONITORS_CONFIG:
- case RED_PIPE_ITEM_TYPE_CREATE_SURFACE:
- case RED_PIPE_ITEM_TYPE_INVAL_ONE:
- case RED_PIPE_ITEM_TYPE_VERB:
- case RED_PIPE_ITEM_TYPE_MIGRATE_DATA:
- case RED_PIPE_ITEM_TYPE_PIXMAP_SYNC:
- case RED_PIPE_ITEM_TYPE_DESTROY_SURFACE:
- case RED_PIPE_ITEM_TYPE_PIXMAP_RESET:
- case RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE:
- case RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT:
- case RED_PIPE_ITEM_TYPE_GL_SCANOUT:
- case RED_PIPE_ITEM_TYPE_GL_DRAW:
- red_pipe_item_unref(item);
- break;
- default:
- spice_critical("invalid item type");
- }
-}
-
void dcc_release_item(DisplayChannelClient *dcc, RedPipeItem *item, int item_pushed)
{
- if (item_pushed)
- release_item_after_push(item);
- else
- release_item_before_push(dcc, item);
+ red_pipe_item_unref(item);
}
commit ce9a770dd94b70b18be0d93420d72d60318d08b7
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:42:19 2016 +0100
Simplify release_item_after_push
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc.c b/server/dcc.c
index 286514c..20ba6ee 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1610,22 +1610,7 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
static void release_item_after_push(RedPipeItem *item)
{
- switch (item->type) {
- case RED_PIPE_ITEM_TYPE_DRAW:
- case RED_PIPE_ITEM_TYPE_IMAGE:
- case RED_PIPE_ITEM_TYPE_STREAM_CLIP:
- case RED_PIPE_ITEM_TYPE_MONITORS_CONFIG:
- case RED_PIPE_ITEM_TYPE_UPGRADE:
- red_pipe_item_unref(item);
- break;
- case RED_PIPE_ITEM_TYPE_GL_SCANOUT:
- case RED_PIPE_ITEM_TYPE_GL_DRAW:
- case RED_PIPE_ITEM_TYPE_VERB:
- free(item);
- break;
- default:
- spice_critical("invalid item type");
- }
+ red_pipe_item_unref(item);
}
// TODO: share code between before/after_push since most of the items need the same
commit 767818da66d962814b4f36bc3919cbdf3d7a4ed9
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Sun May 15 06:18:48 2016 +0100
Handle STREAM_CREATE and STREAM_DESTROY pipe items more coherently
The items of these pipe items were allocated staticaly inside the
StreamAgent structure. All others RedPipeItem are allocated dynamically.
This could solve possible future maintenance as the life of these
item is more easier to understand.
It's more easier to understand why reference where incremented.
It also make the StreamAgent structure a bit smaller.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 5f967cc..0f645a9 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -2383,8 +2383,8 @@ void dcc_send_item(DisplayChannelClient *dcc, RedPipeItem *pipe_item)
marshall_inval_palette(rcc, m, (RedCacheItem *)pipe_item);
break;
case RED_PIPE_ITEM_TYPE_STREAM_CREATE: {
- StreamAgent *agent = SPICE_CONTAINEROF(pipe_item, StreamAgent, create_item);
- marshall_stream_start(rcc, m, agent);
+ StreamCreateDestroyItem *item = SPICE_CONTAINEROF(pipe_item, StreamCreateDestroyItem, base);
+ marshall_stream_start(rcc, m, item->agent);
break;
}
case RED_PIPE_ITEM_TYPE_STREAM_CLIP: {
@@ -2393,8 +2393,8 @@ void dcc_send_item(DisplayChannelClient *dcc, RedPipeItem *pipe_item)
break;
}
case RED_PIPE_ITEM_TYPE_STREAM_DESTROY: {
- StreamAgent *agent = SPICE_CONTAINEROF(pipe_item, StreamAgent, destroy_item);
- marshall_stream_end(rcc, m, agent);
+ StreamCreateDestroyItem *item = SPICE_CONTAINEROF(pipe_item, StreamCreateDestroyItem, base);
+ marshall_stream_end(rcc, m, item->agent);
break;
}
case RED_PIPE_ITEM_TYPE_UPGRADE:
diff --git a/server/dcc.c b/server/dcc.c
index 39ece29..286514c 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -335,28 +335,6 @@ void dcc_add_drawable_after(DisplayChannelClient *dcc, Drawable *drawable, RedPi
red_channel_client_pipe_add_after(RED_CHANNEL_CLIENT(dcc), &dpi->dpi_pipe_item, pos);
}
-static void dcc_release_stream_create(RedPipeItem *item)
-{
- StreamAgent *agent = SPICE_CONTAINEROF(item, StreamAgent, create_item);
- DisplayChannel *display = (DisplayChannel*)agent->dcc->common.base.channel;
- stream_agent_unref(display, agent);
-
- /* this RedPipeItem is quite weird, basically it's always present */
- red_pipe_item_init_full(&agent->create_item, RED_PIPE_ITEM_TYPE_STREAM_CREATE,
- (GDestroyNotify)dcc_release_stream_create);
-}
-
-static void dcc_release_stream_destroy(RedPipeItem *item)
-{
- StreamAgent *agent = SPICE_CONTAINEROF(item, StreamAgent, destroy_item);
- DisplayChannel *display = (DisplayChannel*)agent->dcc->common.base.channel;
- stream_agent_unref(display, agent);
-
- /* this RedPipeItem is quite weird, basically it's always present */
- red_pipe_item_init_full(&agent->destroy_item, RED_PIPE_ITEM_TYPE_STREAM_DESTROY,
- (GDestroyNotify)dcc_release_stream_destroy);
-}
-
static void dcc_init_stream_agents(DisplayChannelClient *dcc)
{
int i;
@@ -367,10 +345,6 @@ static void dcc_init_stream_agents(DisplayChannelClient *dcc)
agent->stream = &display->streams_buf[i];
region_init(&agent->vis_region);
region_init(&agent->clip);
- red_pipe_item_init_full(&agent->create_item, RED_PIPE_ITEM_TYPE_STREAM_CREATE,
- (GDestroyNotify)dcc_release_stream_create);
- red_pipe_item_init_full(&agent->destroy_item, RED_PIPE_ITEM_TYPE_STREAM_DESTROY,
- (GDestroyNotify)dcc_release_stream_destroy);
}
dcc->use_video_encoder_rate_control =
red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(dcc), SPICE_DISPLAY_CAP_STREAM_REPORT);
diff --git a/server/stream.c b/server/stream.c
index 35eb7c2..4c733de 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -63,6 +63,36 @@ void stream_agent_stats_print(StreamAgent *agent)
#endif
}
+static void stream_create_destroy_item_release(RedPipeItem *base)
+{
+ StreamCreateDestroyItem *item = SPICE_CONTAINEROF(base, StreamCreateDestroyItem, base);
+ DisplayChannel *display = (DisplayChannel*)item->agent->dcc->common.base.channel;
+ stream_agent_unref(display, item->agent);
+ free(item);
+}
+
+static RedPipeItem *stream_create_destroy_item_new(StreamAgent *agent, gint type)
+{
+ StreamCreateDestroyItem *item = spice_new0(StreamCreateDestroyItem, 1);
+
+ red_pipe_item_init_full(&item->base, type,
+ (GDestroyNotify)stream_create_destroy_item_release);
+ agent->stream->refs++;
+ item->agent = agent;
+ return &item->base;
+}
+
+static RedPipeItem *stream_create_item_new(StreamAgent *agent)
+{
+ return stream_create_destroy_item_new(agent, RED_PIPE_ITEM_TYPE_STREAM_CREATE);
+}
+
+static RedPipeItem *stream_destroy_item_new(StreamAgent *agent)
+{
+ return stream_create_destroy_item_new(agent, RED_PIPE_ITEM_TYPE_STREAM_DESTROY);
+}
+
+
void stream_stop(DisplayChannel *display, Stream *stream)
{
DisplayChannelClient *dcc;
@@ -78,7 +108,6 @@ void stream_stop(DisplayChannel *display, Stream *stream)
stream_agent = &dcc->stream_agents[get_stream_id(display, stream)];
region_clear(&stream_agent->vis_region);
region_clear(&stream_agent->clip);
- spice_assert(!red_pipe_item_is_linked(&stream_agent->destroy_item));
if (stream_agent->video_encoder && dcc->use_video_encoder_rate_control) {
uint64_t stream_bit_rate = stream_agent->video_encoder->get_bit_rate(stream_agent->video_encoder);
@@ -89,8 +118,7 @@ void stream_stop(DisplayChannel *display, Stream *stream)
dcc->streams_max_bit_rate = stream_bit_rate;
}
}
- stream->refs++;
- red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &stream_agent->destroy_item);
+ red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), stream_destroy_item_new(stream_agent));
stream_agent_stats_print(stream_agent);
}
display->streams_size_total -= stream->width * stream->height;
@@ -702,7 +730,6 @@ void dcc_create_stream(DisplayChannelClient *dcc, Stream *stream)
spice_return_if_fail(region_is_empty(&agent->vis_region));
- stream->refs++;
if (stream->current) {
agent->frames = 1;
region_clone(&agent->vis_region, &stream->current->tree_item.base.rgn);
@@ -728,7 +755,7 @@ void dcc_create_stream(DisplayChannelClient *dcc, Stream *stream)
} else {
agent->video_encoder = mjpeg_encoder_new(0, NULL);
}
- red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &agent->create_item);
+ red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), stream_create_item_new(agent));
if (red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(dcc), SPICE_DISPLAY_CAP_STREAM_REPORT)) {
RedStreamActivateReportItem *report_pipe_item = spice_malloc0(sizeof(*report_pipe_item));
diff --git a/server/stream.h b/server/stream.h
index 3c8d761..511d752 100644
--- a/server/stream.h
+++ b/server/stream.h
@@ -82,8 +82,6 @@ typedef struct StreamAgent {
vis_region will contain c2 and also the part of c1/c2 that still
displays fragments of the video */
- RedPipeItem create_item;
- RedPipeItem destroy_item;
Stream *stream;
uint64_t last_send_time;
VideoEncoder *video_encoder;
@@ -109,6 +107,11 @@ typedef struct RedStreamClipItem {
RedStreamClipItem * red_stream_clip_item_new (StreamAgent *agent);
+typedef struct StreamCreateDestroyItem {
+ RedPipeItem base;
+ StreamAgent *agent;
+} StreamCreateDestroyItem;
+
typedef struct ItemTrace {
red_time_t time;
red_time_t first_frame_time;
commit f94ef59de8f0ccfa9dd5cb7c01b545bd69e14393
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:39:16 2016 +0100
Simplify release of STREAM_CREATE and STREAM_DESTROY pipe items
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc.c b/server/dcc.c
index a6d4fc4..39ece29 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -335,6 +335,28 @@ void dcc_add_drawable_after(DisplayChannelClient *dcc, Drawable *drawable, RedPi
red_channel_client_pipe_add_after(RED_CHANNEL_CLIENT(dcc), &dpi->dpi_pipe_item, pos);
}
+static void dcc_release_stream_create(RedPipeItem *item)
+{
+ StreamAgent *agent = SPICE_CONTAINEROF(item, StreamAgent, create_item);
+ DisplayChannel *display = (DisplayChannel*)agent->dcc->common.base.channel;
+ stream_agent_unref(display, agent);
+
+ /* this RedPipeItem is quite weird, basically it's always present */
+ red_pipe_item_init_full(&agent->create_item, RED_PIPE_ITEM_TYPE_STREAM_CREATE,
+ (GDestroyNotify)dcc_release_stream_create);
+}
+
+static void dcc_release_stream_destroy(RedPipeItem *item)
+{
+ StreamAgent *agent = SPICE_CONTAINEROF(item, StreamAgent, destroy_item);
+ DisplayChannel *display = (DisplayChannel*)agent->dcc->common.base.channel;
+ stream_agent_unref(display, agent);
+
+ /* this RedPipeItem is quite weird, basically it's always present */
+ red_pipe_item_init_full(&agent->destroy_item, RED_PIPE_ITEM_TYPE_STREAM_DESTROY,
+ (GDestroyNotify)dcc_release_stream_destroy);
+}
+
static void dcc_init_stream_agents(DisplayChannelClient *dcc)
{
int i;
@@ -345,8 +367,10 @@ static void dcc_init_stream_agents(DisplayChannelClient *dcc)
agent->stream = &display->streams_buf[i];
region_init(&agent->vis_region);
region_init(&agent->clip);
- red_pipe_item_init(&agent->create_item, RED_PIPE_ITEM_TYPE_STREAM_CREATE);
- red_pipe_item_init(&agent->destroy_item, RED_PIPE_ITEM_TYPE_STREAM_DESTROY);
+ red_pipe_item_init_full(&agent->create_item, RED_PIPE_ITEM_TYPE_STREAM_CREATE,
+ (GDestroyNotify)dcc_release_stream_create);
+ red_pipe_item_init_full(&agent->destroy_item, RED_PIPE_ITEM_TYPE_STREAM_DESTROY,
+ (GDestroyNotify)dcc_release_stream_destroy);
}
dcc->use_video_encoder_rate_control =
red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(dcc), SPICE_DISPLAY_CAP_STREAM_REPORT);
@@ -1634,20 +1658,10 @@ static void release_item_after_push(RedPipeItem *item)
// release
static void release_item_before_push(DisplayChannelClient *dcc, RedPipeItem *item)
{
- DisplayChannel *display = DCC_TO_DC(dcc);
-
spice_debug("item.type: %d", item->type);
switch (item->type) {
- case RED_PIPE_ITEM_TYPE_STREAM_CREATE: {
- StreamAgent *agent = SPICE_CONTAINEROF(item, StreamAgent, create_item);
- stream_agent_unref(display, agent);
- break;
- }
- case RED_PIPE_ITEM_TYPE_STREAM_DESTROY: {
- StreamAgent *agent = SPICE_CONTAINEROF(item, StreamAgent, destroy_item);
- stream_agent_unref(display, agent);
- break;
- }
+ case RED_PIPE_ITEM_TYPE_STREAM_CREATE:
+ case RED_PIPE_ITEM_TYPE_STREAM_DESTROY:
case RED_PIPE_ITEM_TYPE_DRAW:
case RED_PIPE_ITEM_TYPE_STREAM_CLIP:
case RED_PIPE_ITEM_TYPE_UPGRADE:
commit 68c6d52e32f72d33bfb90e402673c9d9b38ee5af
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:03:25 2016 +0100
Simplify release of CREATE_SURFACE and DESTROY_SURFACE pipe items
Putting base as first item the default free function is fine.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc.c b/server/dcc.c
index 6f08cd9..a6d4fc4 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1653,24 +1653,12 @@ static void release_item_before_push(DisplayChannelClient *dcc, RedPipeItem *ite
case RED_PIPE_ITEM_TYPE_UPGRADE:
case RED_PIPE_ITEM_TYPE_IMAGE:
case RED_PIPE_ITEM_TYPE_MONITORS_CONFIG:
- red_pipe_item_unref(item);
- break;
- case RED_PIPE_ITEM_TYPE_CREATE_SURFACE: {
- RedSurfaceCreateItem *surface_create = SPICE_CONTAINEROF(item, RedSurfaceCreateItem,
- pipe_item);
- free(surface_create);
- break;
- }
- case RED_PIPE_ITEM_TYPE_DESTROY_SURFACE: {
- RedSurfaceDestroyItem *surface_destroy = SPICE_CONTAINEROF(item, RedSurfaceDestroyItem,
- pipe_item);
- free(surface_destroy);
- break;
- }
+ case RED_PIPE_ITEM_TYPE_CREATE_SURFACE:
case RED_PIPE_ITEM_TYPE_INVAL_ONE:
case RED_PIPE_ITEM_TYPE_VERB:
case RED_PIPE_ITEM_TYPE_MIGRATE_DATA:
case RED_PIPE_ITEM_TYPE_PIXMAP_SYNC:
+ case RED_PIPE_ITEM_TYPE_DESTROY_SURFACE:
case RED_PIPE_ITEM_TYPE_PIXMAP_RESET:
case RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE:
case RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT:
diff --git a/server/dcc.h b/server/dcc.h
index 89934bc..63a7496 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -122,8 +122,8 @@ struct DisplayChannelClient {
#define RCC_TO_DCC(rcc) SPICE_CONTAINEROF((rcc), DisplayChannelClient, common.base)
typedef struct RedSurfaceCreateItem {
- SpiceMsgSurfaceCreate surface_create;
RedPipeItem pipe_item;
+ SpiceMsgSurfaceCreate surface_create;
} RedSurfaceCreateItem;
typedef struct RedGlScanoutUnixItem {
diff --git a/server/display-channel.h b/server/display-channel.h
index 76668de..647d8c0 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -241,8 +241,8 @@ static inline int get_stream_id(DisplayChannel *display, Stream *stream)
}
typedef struct RedSurfaceDestroyItem {
- SpiceMsgSurfaceDestroy surface_destroy;
RedPipeItem pipe_item;
+ SpiceMsgSurfaceDestroy surface_destroy;
} RedSurfaceDestroyItem;
typedef struct RedUpgradeItem {
commit 9ecff9e06106096c461af747aa9edd6038e25315
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:42:30 2016 +0100
Call red_pipe_item_unref instead of free
This is the standard way to release a RedPipeItem
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc.c b/server/dcc.c
index 0953efd..6f08cd9 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1676,7 +1676,7 @@ static void release_item_before_push(DisplayChannelClient *dcc, RedPipeItem *ite
case RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT:
case RED_PIPE_ITEM_TYPE_GL_SCANOUT:
case RED_PIPE_ITEM_TYPE_GL_DRAW:
- free(item);
+ red_pipe_item_unref(item);
break;
default:
spice_critical("invalid item type");
commit d26648404a305547737e8ee924154d15f62770af
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:01:40 2016 +0100
Simplify RED_PIPE_ITEM_TYPE_DRAW item release
Move ring_remove to the function to release this type of item.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc.c b/server/dcc.c
index db77cc7..0953efd 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -288,7 +288,9 @@ void red_drawable_pipe_item_free(RedPipeItem *item)
spice_assert(item->refcount == 0);
spice_warn_if_fail(!ring_item_is_linked(&item->link));
- spice_warn_if_fail(!ring_item_is_linked(&dpi->base));
+ if (ring_item_is_linked(&dpi->base)) {
+ ring_remove(&dpi->base);
+ }
drawable_unref(dpi->drawable);
free(dpi);
}
@@ -1636,12 +1638,6 @@ static void release_item_before_push(DisplayChannelClient *dcc, RedPipeItem *ite
spice_debug("item.type: %d", item->type);
switch (item->type) {
- case RED_PIPE_ITEM_TYPE_DRAW: {
- RedDrawablePipeItem *dpi = SPICE_CONTAINEROF(item, RedDrawablePipeItem, dpi_pipe_item);
- ring_remove(&dpi->base);
- red_pipe_item_unref(item);
- break;
- }
case RED_PIPE_ITEM_TYPE_STREAM_CREATE: {
StreamAgent *agent = SPICE_CONTAINEROF(item, StreamAgent, create_item);
stream_agent_unref(display, agent);
@@ -1652,6 +1648,7 @@ static void release_item_before_push(DisplayChannelClient *dcc, RedPipeItem *ite
stream_agent_unref(display, agent);
break;
}
+ case RED_PIPE_ITEM_TYPE_DRAW:
case RED_PIPE_ITEM_TYPE_STREAM_CLIP:
case RED_PIPE_ITEM_TYPE_UPGRADE:
case RED_PIPE_ITEM_TYPE_IMAGE:
commit 298c88757e281de551dd2441cb6580e2f51ec07c
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 18:00:03 2016 +0100
Remove useless assignment
Type was already initialized calling red_pipe_item_init
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/smartcard.c b/server/smartcard.c
index e483eec..b2fb766 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -541,7 +541,6 @@ static void smartcard_push_error(RedChannelClient *rcc, uint32_t reader_id, VSCE
red_pipe_item_init(&error_item->base, RED_PIPE_ITEM_TYPE_ERROR);
- error_item->base.type = RED_PIPE_ITEM_TYPE_ERROR;
error_item->vheader.reader_id = reader_id;
error_item->vheader.type = VSC_Error;
error_item->vheader.length = sizeof(error_item->error);
commit fa118d5567109c5f9c2176027ab08f437499c21e
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 13 17:34:49 2016 +0100
Remove unused refs field
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc.h b/server/dcc.h
index 1dd53bd..89934bc 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -154,7 +154,6 @@ typedef struct RedDrawablePipeItem {
RedPipeItem dpi_pipe_item; /* link for the client's pipe itself */
Drawable *drawable;
DisplayChannelClient *dcc;
- uint8_t refs;
} RedDrawablePipeItem;
DisplayChannelClient* dcc_new (DisplayChannel *display,
More information about the Spice-commits
mailing list