[Spice-commits] 2 commits - server/dcc-encoders.c server/dcc-encoders.h server/dcc.c server/dcc.h
Frediano Ziglio
fziglio at kemper.freedesktop.org
Fri Jun 10 08:16:51 UTC 2016
server/dcc-encoders.c | 21 ++++++++++-----------
server/dcc-encoders.h | 7 ++++++-
server/dcc.c | 6 +++---
server/dcc.h | 5 -----
4 files changed, 19 insertions(+), 20 deletions(-)
New commits:
commit 9c5a8d5bce7b09c75acf5ab488cd4c0e9cae1443
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri Jun 3 16:13:50 2016 +0100
More encapsulation for dcc_encoders_free
Encoders function should not use DisplayChannelClient
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index 04bb60c..6aaf954 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -415,9 +415,8 @@ void dcc_encoders_init(DisplayChannelClient *dcc)
enc->zlib_level = ZLIB_DEFAULT_COMPRESSION_LEVEL;
}
-void dcc_encoders_free(DisplayChannelClient *dcc)
+void image_encoders_free(ImageEncoders *enc)
{
- ImageEncoders *enc = &dcc->encoders;
quic_destroy(enc->quic);
enc->quic = NULL;
lz_destroy(enc->lz);
diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
index 116b148..23355f7 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -37,7 +37,7 @@ typedef struct RedGlzDrawable RedGlzDrawable;
typedef struct ImageEncoders ImageEncoders;
void dcc_encoders_init (DisplayChannelClient *dcc);
-void dcc_encoders_free (DisplayChannelClient *dcc);
+void image_encoders_free(ImageEncoders *enc);
void dcc_free_glz_drawable (DisplayChannelClient *dcc,
RedGlzDrawable *drawable);
int dcc_free_some_independent_glz_drawables (DisplayChannelClient *dcc);
diff --git a/server/dcc.c b/server/dcc.c
index ee21bb1..7724e11 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -499,7 +499,7 @@ void dcc_stop(DisplayChannelClient *dcc)
free(dcc->send_data.stream_outbuf);
free(dcc->send_data.free_list.res);
dcc_destroy_stream_agents(dcc);
- dcc_encoders_free(dcc);
+ image_encoders_free(&dcc->encoders);
if (dcc->gl_draw_ongoing) {
display_channel_gl_draw_done(dc);
commit c2bc754559e5345bf7934c6993cd4e8a23a59490
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri Jun 3 16:04:35 2016 +0100
Encapsulate zlib information in ImageEncoders structure
This change is less clean the other similar patches as zlib and
glz require more steps.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index 7b27aff..04bb60c 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -386,14 +386,14 @@ static inline void image_encoders_init_lz4(ImageEncoders *enc)
}
#endif
-static void dcc_init_zlib(DisplayChannelClient *dcc)
+static void image_encoders_init_zlib(ImageEncoders *enc)
{
- dcc->zlib_data.usr.more_space = zlib_usr_more_space;
- dcc->zlib_data.usr.more_input = zlib_usr_more_input;
+ enc->zlib_data.usr.more_space = zlib_usr_more_space;
+ enc->zlib_data.usr.more_input = zlib_usr_more_input;
- dcc->zlib = zlib_encoder_create(&dcc->zlib_data.usr, ZLIB_DEFAULT_COMPRESSION_LEVEL);
+ enc->zlib = zlib_encoder_create(&enc->zlib_data.usr, ZLIB_DEFAULT_COMPRESSION_LEVEL);
- if (!dcc->zlib) {
+ if (!enc->zlib) {
spice_critical("create zlib encoder failed");
}
}
@@ -409,10 +409,10 @@ void dcc_encoders_init(DisplayChannelClient *dcc)
#ifdef USE_LZ4
image_encoders_init_lz4(enc);
#endif
- dcc_init_zlib(dcc);
+ image_encoders_init_zlib(enc);
// todo: tune level according to bandwidth
- dcc->zlib_level = ZLIB_DEFAULT_COMPRESSION_LEVEL;
+ enc->zlib_level = ZLIB_DEFAULT_COMPRESSION_LEVEL;
}
void dcc_encoders_free(DisplayChannelClient *dcc)
@@ -428,8 +428,8 @@ void dcc_encoders_free(DisplayChannelClient *dcc)
lz4_encoder_destroy(enc->lz4);
enc->lz4 = NULL;
#endif
- zlib_encoder_destroy(dcc->zlib);
- dcc->zlib = NULL;
+ zlib_encoder_destroy(enc->zlib);
+ enc->zlib = NULL;
}
/* Remove from the to_free list and the instances_list.
diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
index d4378de..116b148 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -177,6 +177,11 @@ struct ImageEncoders {
Lz4Data lz4_data;
Lz4EncoderContext *lz4;
#endif
+
+ int zlib_level;
+
+ ZlibData zlib_data;
+ ZlibEncoder *zlib;
};
typedef struct compress_send_data_t {
diff --git a/server/dcc.c b/server/dcc.c
index 0bc0e04..ee21bb1 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -746,14 +746,14 @@ static int dcc_compress_image_glz(DisplayChannelClient *dcc,
goto glz;
}
stat_start_time_init(&start_time, &display_channel->zlib_glz_stat);
- zlib_data = &dcc->zlib_data;
+ zlib_data = &dcc->encoders.zlib_data;
encoder_data_init(&zlib_data->data);
zlib_data->data.u.compressed_data.next = glz_data->data.bufs_head;
zlib_data->data.u.compressed_data.size_left = glz_size;
- zlib_size = zlib_encode(dcc->zlib, dcc->zlib_level,
+ zlib_size = zlib_encode(dcc->encoders.zlib, dcc->encoders.zlib_level,
glz_size, zlib_data->data.bufs_head->buf.bytes,
sizeof(zlib_data->data.bufs_head->buf));
diff --git a/server/dcc.h b/server/dcc.h
index bdfc001..c6c9903 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -63,11 +63,6 @@ struct DisplayChannelClient {
ImageEncoders encoders;
- int zlib_level;
-
- ZlibData zlib_data;
- ZlibEncoder *zlib;
-
int expect_init;
PixmapCache *pixmap_cache;
More information about the Spice-commits
mailing list