From 04e055832713ffe69a311fef297353ccf50bb6be Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 14 Apr 2022 12:25:43 -0500 Subject: [PATCH] rdp: Allow disabling RemoteFX codec There are currently compatibility issues between FreeRDP's implementation of the RemoteFX codec and Microsoft's implementation. Perhaps this will be fixed in the future and this option can go away, but for now it's necessary to have a way to disable the codec if the windows client is going to be connecting to a weston server. Signed-off-by: Derek Foreman --- compositor/main.c | 4 ++++ include/libweston/backend-rdp.h | 1 + libweston/backend-rdp/rdp.c | 4 +++- libweston/backend-rdp/rdp.h | 1 + man/weston-rdp.man | 5 +++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/compositor/main.c b/compositor/main.c index 1b7e01fe..dfc3d4bd 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -2774,6 +2774,7 @@ weston_rdp_backend_config_init(struct weston_rdp_backend_config *config) config->env_socket = 0; config->no_clients_resize = 0; config->force_no_compression = 0; + config->remotefx_codec = true; } static int @@ -2782,6 +2783,7 @@ load_rdp_backend(struct weston_compositor *c, { struct weston_rdp_backend_config config = {{ 0, }}; int ret = 0; + bool no_remotefx_codec = false; struct wet_output_config *parsed_options = wet_init_parsed_options(c); if (!parsed_options) @@ -2800,9 +2802,11 @@ load_rdp_backend(struct weston_compositor *c, { WESTON_OPTION_STRING, "rdp-tls-cert", 0, &config.server_cert }, { WESTON_OPTION_STRING, "rdp-tls-key", 0, &config.server_key }, { WESTON_OPTION_BOOLEAN, "force-no-compression", 0, &config.force_no_compression }, + { WESTON_OPTION_BOOLEAN, "no-remotefx-codec", 0, &no_remotefx_codec }, }; parse_options(rdp_options, ARRAY_LENGTH(rdp_options), argc, argv); + config.remotefx_codec = !no_remotefx_codec; wet_set_simple_head_configurator(c, rdp_backend_output_configure); diff --git a/include/libweston/backend-rdp.h b/include/libweston/backend-rdp.h index b3542507..2c55818b 100644 --- a/include/libweston/backend-rdp.h +++ b/include/libweston/backend-rdp.h @@ -66,6 +66,7 @@ struct weston_rdp_backend_config { int env_socket; int no_clients_resize; int force_no_compression; + bool remotefx_codec; }; #ifdef __cplusplus diff --git a/libweston/backend-rdp/rdp.c b/libweston/backend-rdp/rdp.c index 218e2fcb..07bf1fe2 100644 --- a/libweston/backend-rdp/rdp.c +++ b/libweston/backend-rdp/rdp.c @@ -1141,7 +1141,7 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b) settings->OsMinorType = OSMINORTYPE_PSEUDO_XSERVER; settings->ColorDepth = 32; settings->RefreshRect = TRUE; - settings->RemoteFxCodec = TRUE; + settings->RemoteFxCodec = b->remotefx_codec; settings->NSCodec = TRUE; settings->FrameMarkerCommandEnabled = TRUE; settings->SurfaceFrameMarkerEnabled = TRUE; @@ -1220,6 +1220,7 @@ rdp_backend_create(struct weston_compositor *compositor, 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; + b->remotefx_codec = config->remotefx_codec; compositor->backend = &b->base; @@ -1308,6 +1309,7 @@ config_init_to_defaults(struct weston_rdp_backend_config *config) config->env_socket = 0; config->no_clients_resize = 0; config->force_no_compression = 0; + config->remotefx_codec = true; } WL_EXPORT int diff --git a/libweston/backend-rdp/rdp.h b/libweston/backend-rdp/rdp.h index 96807f6e..65e6f0fa 100644 --- a/libweston/backend-rdp/rdp.h +++ b/libweston/backend-rdp/rdp.h @@ -67,6 +67,7 @@ struct rdp_backend { int tls_enabled; int no_clients_resize; int force_no_compression; + bool remotefx_codec; }; enum peer_item_flags { diff --git a/man/weston-rdp.man b/man/weston-rdp.man index f6cdd1de..1d6ccfd0 100644 --- a/man/weston-rdp.man +++ b/man/weston-rdp.man @@ -43,6 +43,11 @@ By default when a client connects on the RDP backend, it will instruct weston to resize to the dimensions of the client's announced resolution. When this option is set, weston will force the client to resize to its own resolution. .TP +\fB\-\-no-remotefx-codec +The RemoteFX compression codec is enabled by default, but it may be necessary +to disable it to work around incompatabilities between implementations. This +option may be removed in the future when all known issues are resolved. +.TP \fB\-\-rdp4\-key\fR=\fIfile\fR The file containing the RSA key for doing RDP security. As RDP security is known to be insecure, this option should be avoided in production.