summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-10-03 21:31:20 +0200
committerFrediano Ziglio <fziglio@redhat.com>2015-12-02 12:34:47 +0000
commit4980850dd2feea6a85b344addbe9baf005e1c229 (patch)
treebc1fba4b2578b2f0fffc43ec773c74ac7ad3e3e5
parent47b023866faac2c5e3302d4d3fc42a0260a5557c (diff)
display: add update_compression() method
Acked-by: Pavel Grunt <pgrunt@redhat.com>
-rw-r--r--server/display-channel.c17
-rw-r--r--server/display-channel.h2
-rw-r--r--server/red_worker.c21
3 files changed, 23 insertions, 17 deletions
diff --git a/server/display-channel.c b/server/display-channel.c
index 29fa1bb4..2bf65a87 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1875,3 +1875,20 @@ exit:
red_put_surface_cmd(surface);
free(surface);
}
+
+void display_channel_update_compression(DisplayChannel *display, DisplayChannelClient *dcc)
+{
+ if (dcc->jpeg_state == SPICE_WAN_COMPRESSION_AUTO) {
+ display->enable_jpeg = dcc->common.is_low_bandwidth;
+ } else {
+ display->enable_jpeg = (dcc->jpeg_state == SPICE_WAN_COMPRESSION_ALWAYS);
+ }
+
+ if (dcc->zlib_glz_state == SPICE_WAN_COMPRESSION_AUTO) {
+ display->enable_zlib_glz_wrap = dcc->common.is_low_bandwidth;
+ } else {
+ display->enable_zlib_glz_wrap = (dcc->zlib_glz_state == SPICE_WAN_COMPRESSION_ALWAYS);
+ }
+ spice_info("jpeg %s", display->enable_jpeg ? "enabled" : "disabled");
+ spice_info("zlib-over-glz %s", display->enable_zlib_glz_wrap ? "enabled" : "disabled");
+}
diff --git a/server/display-channel.h b/server/display-channel.h
index 7bef638a..7187600e 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -304,6 +304,8 @@ void display_channel_process_surface_cmd (DisplayCha
RedSurfaceCmd *surface,
uint32_t group_id,
int loadvm);
+void display_channel_update_compression (DisplayChannel *display,
+ DisplayChannelClient *dcc);
static inline int validate_surface(DisplayChannel *display, uint32_t surface_id)
{
diff --git a/server/red_worker.c b/server/red_worker.c
index 0f5152a6..47029493 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -954,34 +954,21 @@ static void handle_new_display_channel(RedWorker *worker, RedClient *client, Red
uint32_t *common_caps, int num_common_caps,
uint32_t *caps, int num_caps)
{
- DisplayChannel *display_channel;
+ DisplayChannel *display;
DisplayChannelClient *dcc;
spice_return_if_fail(worker->display_channel);
- display_channel = worker->display_channel;
+ display = worker->display_channel;
spice_info("add display channel client");
- dcc = dcc_new(display_channel, client, stream, migrate,
+ dcc = dcc_new(display, client, stream, migrate,
common_caps, num_common_caps, caps, num_caps,
worker->image_compression, worker->jpeg_state, worker->zlib_glz_state);
if (!dcc) {
return;
}
- if (dcc->jpeg_state == SPICE_WAN_COMPRESSION_AUTO) {
- display_channel->enable_jpeg = dcc->common.is_low_bandwidth;
- } else {
- display_channel->enable_jpeg = (dcc->jpeg_state == SPICE_WAN_COMPRESSION_ALWAYS);
- }
-
- if (dcc->zlib_glz_state == SPICE_WAN_COMPRESSION_AUTO) {
- display_channel->enable_zlib_glz_wrap = dcc->common.is_low_bandwidth;
- } else {
- display_channel->enable_zlib_glz_wrap = (dcc->zlib_glz_state ==
- SPICE_WAN_COMPRESSION_ALWAYS);
- }
- spice_info("jpeg %s", display_channel->enable_jpeg ? "enabled" : "disabled");
- spice_info("zlib-over-glz %s", display_channel->enable_zlib_glz_wrap ? "enabled" : "disabled");
+ display_channel_update_compression(display, dcc);
guest_set_client_capabilities(worker);
dcc_start(dcc);