rdp: Allow configuring the refresh rate

We currently hardcode a 60Hz update rate for the rdp backend.

In some cases it may be useful to override this to increase the rate
for a faster monitor, or to decrease it to reduce network traffic.

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
dev
Hideyuki Nagase 3 years ago committed by Derek Foreman
parent bd214edf26
commit cf5ddd05cb
  1. 6
      compositor/main.c
  2. 2
      include/libweston/backend-rdp.h
  3. 11
      libweston/backend-rdp/rdp.c
  4. 2
      libweston/backend-rdp/rdp.h
  5. 13
      man/weston-rdp.man

@ -2777,6 +2777,7 @@ weston_rdp_backend_config_init(struct weston_rdp_backend_config *config)
config->no_clients_resize = 0; config->no_clients_resize = 0;
config->force_no_compression = 0; config->force_no_compression = 0;
config->remotefx_codec = true; config->remotefx_codec = true;
config->refresh_rate = RDP_DEFAULT_FREQ;
} }
static int static int
@ -2784,6 +2785,7 @@ load_rdp_backend(struct weston_compositor *c,
int *argc, char *argv[], struct weston_config *wc) int *argc, char *argv[], struct weston_config *wc)
{ {
struct weston_rdp_backend_config config = {{ 0, }}; struct weston_rdp_backend_config config = {{ 0, }};
struct weston_config_section *section;
int ret = 0; int ret = 0;
bool no_remotefx_codec = false; bool no_remotefx_codec = false;
@ -2812,6 +2814,10 @@ load_rdp_backend(struct weston_compositor *c,
config.remotefx_codec = !no_remotefx_codec; config.remotefx_codec = !no_remotefx_codec;
wet_set_simple_head_configurator(c, rdp_backend_output_configure); wet_set_simple_head_configurator(c, rdp_backend_output_configure);
section = weston_config_get_section(wc, "rdp", NULL, NULL);
weston_config_section_get_int(section, "refresh-rate",
&config.refresh_rate,
RDP_DEFAULT_FREQ);
ret = weston_compositor_load_backend(c, WESTON_BACKEND_RDP, ret = weston_compositor_load_backend(c, WESTON_BACKEND_RDP,
&config.base); &config.base);

@ -34,6 +34,7 @@ extern "C" {
#include <libweston/plugin-registry.h> #include <libweston/plugin-registry.h>
#define WESTON_RDP_OUTPUT_API_NAME "weston_rdp_output_api_v1" #define WESTON_RDP_OUTPUT_API_NAME "weston_rdp_output_api_v1"
#define RDP_DEFAULT_FREQ 60
struct weston_rdp_output_api { struct weston_rdp_output_api {
/** Initialize a RDP output with specified width and height. /** Initialize a RDP output with specified width and height.
@ -68,6 +69,7 @@ struct weston_rdp_backend_config {
int force_no_compression; int force_no_compression;
bool remotefx_codec; bool remotefx_codec;
int external_listener_fd; int external_listener_fd;
int refresh_rate;
}; };
#ifdef __cplusplus #ifdef __cplusplus

@ -311,6 +311,7 @@ rdp_insert_new_mode(struct weston_output *output, int width, int height, int rat
static struct weston_mode * static struct weston_mode *
ensure_matching_mode(struct weston_output *output, struct weston_mode *target) ensure_matching_mode(struct weston_output *output, struct weston_mode *target)
{ {
struct rdp_backend *b = to_rdp_backend(output->compositor);
struct weston_mode *local; struct weston_mode *local;
wl_list_for_each(local, &output->mode_list, link) { wl_list_for_each(local, &output->mode_list, link) {
@ -318,7 +319,7 @@ ensure_matching_mode(struct weston_output *output, struct weston_mode *target)
return local; return local;
} }
return rdp_insert_new_mode(output, target->width, target->height, RDP_MODE_FREQ); return rdp_insert_new_mode(output, target->width, target->height, b->rdp_monitor_refresh_rate);
} }
static int static int
@ -379,6 +380,7 @@ rdp_output_set_size(struct weston_output *base,
int width, int height) int width, int height)
{ {
struct rdp_output *output = to_rdp_output(base); struct rdp_output *output = to_rdp_output(base);
struct rdp_backend *rdpBackend = to_rdp_backend(base->compositor);
struct weston_head *head; struct weston_head *head;
struct weston_mode *currentMode; struct weston_mode *currentMode;
struct weston_mode initMode; struct weston_mode initMode;
@ -399,8 +401,7 @@ rdp_output_set_size(struct weston_output *base,
initMode.flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED; initMode.flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
initMode.width = width; initMode.width = width;
initMode.height = height; initMode.height = height;
initMode.refresh = RDP_MODE_FREQ; initMode.refresh = rdpBackend->rdp_monitor_refresh_rate;
currentMode = ensure_matching_mode(&output->base, &initMode); currentMode = ensure_matching_mode(&output->base, &initMode);
if (!currentMode) if (!currentMode)
return -1; return -1;
@ -1370,6 +1371,9 @@ rdp_backend_create(struct weston_compositor *compositor,
/* After here, rdp_debug() is ready to be used */ /* After here, rdp_debug() is ready to be used */
b->rdp_monitor_refresh_rate = config->refresh_rate * 1000;
rdp_debug(b, "RDP backend: WESTON_RDP_MONITOR_REFRESH_RATE: %d\n", b->rdp_monitor_refresh_rate);
compositor->backend = &b->base; compositor->backend = &b->base;
if (config->server_cert && config->server_key) { if (config->server_cert && config->server_key) {
@ -1485,6 +1489,7 @@ config_init_to_defaults(struct weston_rdp_backend_config *config)
config->force_no_compression = 0; config->force_no_compression = 0;
config->remotefx_codec = true; config->remotefx_codec = true;
config->external_listener_fd = -1; config->external_listener_fd = -1;
config->refresh_rate = RDP_DEFAULT_FREQ;
} }
WL_EXPORT int WL_EXPORT int

@ -49,7 +49,6 @@
#define MAX_FREERDP_FDS 32 #define MAX_FREERDP_FDS 32
#define DEFAULT_AXIS_STEP_DISTANCE 10 #define DEFAULT_AXIS_STEP_DISTANCE 10
#define RDP_MODE_FREQ 60 * 1000
#define DEFAULT_PIXEL_FORMAT PIXEL_FORMAT_BGRA32 #define DEFAULT_PIXEL_FORMAT PIXEL_FORMAT_BGRA32
struct rdp_output; struct rdp_output;
@ -72,6 +71,7 @@ struct rdp_backend {
int force_no_compression; int force_no_compression;
bool remotefx_codec; bool remotefx_codec;
int external_listener_fd; int external_listener_fd;
int rdp_monitor_refresh_rate;
}; };
enum peer_item_flags { enum peer_item_flags {

@ -24,6 +24,19 @@ backend will announce security options based on which files have been given.
The RDP backend is multi-seat aware, so if two clients connect on the backend, The RDP backend is multi-seat aware, so if two clients connect on the backend,
they will get their own seat. they will get their own seat.
.\" ***************************************************************
.SH CONFIGURATION
.
The RDP backend uses the following entries from
.BR weston.ini .
.SS Section rdp
.TP
\fBrefresh-rate\fR=\fIrate\fR
Specifies the desktop redraw rate in Hz. If unspecified, the default is 60Hz. Changing
this may be useful if you have a faster than 60Hz display, or if you want to reduce updates to
reduce network traffic.
.\" *************************************************************** .\" ***************************************************************
.SH OPTIONS .SH OPTIONS
. .

Loading…
Cancel
Save