From b0e16d4c5394f86424be0ff2889b37a9eb723a91 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 20 Jun 2019 16:27:27 +0200 Subject: [PATCH] backend-rdp: allow to force compression off By default the client communicates its preference with regards to compression to the server. However, some clients always use compression, which is not ideal for certain environments (e.g. low performance embedded devices in a local network with plenty of bandwidth). Allow to disable compression server-side which will override the clients request for compression. Signed-off-by: Stefan Agner --- compositor/main.c | 4 +++- include/libweston/backend-rdp.h | 1 + libweston/backend-rdp/rdp.c | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/compositor/main.c b/compositor/main.c index 1289327bc..fa46292f4 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -2508,6 +2508,7 @@ weston_rdp_backend_config_init(struct weston_rdp_backend_config *config) config->server_key = NULL; config->env_socket = 0; config->no_clients_resize = 0; + config->force_no_compression = 0; } static int @@ -2532,7 +2533,8 @@ load_rdp_backend(struct weston_compositor *c, { WESTON_OPTION_BOOLEAN, "no-clients-resize", 0, &config.no_clients_resize }, { WESTON_OPTION_STRING, "rdp4-key", 0, &config.rdp_key }, { WESTON_OPTION_STRING, "rdp-tls-cert", 0, &config.server_cert }, - { WESTON_OPTION_STRING, "rdp-tls-key", 0, &config.server_key } + { WESTON_OPTION_STRING, "rdp-tls-key", 0, &config.server_key }, + { WESTON_OPTION_BOOLEAN, "force-no-compression", 0, &config.force_no_compression }, }; parse_options(rdp_options, ARRAY_LENGTH(rdp_options), argc, argv); diff --git a/include/libweston/backend-rdp.h b/include/libweston/backend-rdp.h index 7a63643f5..b3542507a 100644 --- a/include/libweston/backend-rdp.h +++ b/include/libweston/backend-rdp.h @@ -65,6 +65,7 @@ struct weston_rdp_backend_config { char *server_key; int env_socket; int no_clients_resize; + int force_no_compression; }; #ifdef __cplusplus diff --git a/libweston/backend-rdp/rdp.c b/libweston/backend-rdp/rdp.c index b55f45acc..31af10965 100644 --- a/libweston/backend-rdp/rdp.c +++ b/libweston/backend-rdp/rdp.c @@ -131,6 +131,7 @@ struct rdp_backend { char *rdp_key; int tls_enabled; int no_clients_resize; + int force_no_compression; }; enum peer_item_flags { @@ -971,6 +972,11 @@ xf_peer_activate(freerdp_peer* client) return FALSE; } + if (b->force_no_compression && settings->CompressionEnabled) { + weston_log("Forcing compression off\n"); + settings->CompressionEnabled = FALSE; + } + if (output->base.width != (int)settings->DesktopWidth || output->base.height != (int)settings->DesktopHeight) { @@ -1364,6 +1370,7 @@ rdp_backend_create(struct weston_compositor *compositor, b->base.create_output = rdp_output_create; b->rdp_key = config->rdp_key ? strdup(config->rdp_key) : NULL; b->no_clients_resize = config->no_clients_resize; + b->force_no_compression = config->force_no_compression; compositor->backend = &b->base; @@ -1447,6 +1454,7 @@ config_init_to_defaults(struct weston_rdp_backend_config *config) config->server_key = NULL; config->env_socket = 0; config->no_clients_resize = 0; + config->force_no_compression = 0; } WL_EXPORT int