Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 34 additions & 10 deletions libweston/backend-rdp/rdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ rdp_output_repaint(struct weston_output *output_base, pixman_region32_t *damage,
&ec->primary_plane.damage, damage);
}

wl_event_source_timer_update(output->finish_frame_timer, 16);
wl_event_source_timer_update(output->finish_frame_timer, b->rdp_repaint_delay_ms);
return 0;
}

Expand Down Expand Up @@ -357,14 +357,15 @@ rdp_insert_new_mode(struct weston_output *output, int width, int height, int rat
static struct weston_mode *
ensure_matching_mode(struct weston_output *output, struct weston_mode *target)
{
struct rdp_backend *b = to_rdp_backend(output->compositor);
struct weston_mode *local;

wl_list_for_each(local, &output->mode_list, link) {
if ((local->width == target->width) && (local->height == target->height))
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
Expand Down Expand Up @@ -522,7 +523,7 @@ rdp_output_set_size(struct weston_output *base,
initMode.flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
initMode.width = width;
initMode.height = height;
initMode.refresh = RDP_MODE_FREQ;
initMode.refresh = rdpBackend->rdp_monitor_refresh_rate;
currentMode = ensure_matching_mode(&output->base, &initMode);
if (!currentMode)
return -1;
Expand Down Expand Up @@ -1609,7 +1610,7 @@ xf_input_keyboard_event(rdpInput *input, UINT16 flags, UINT16 code)
uint32_t scan_code, vk_code, full_code;
enum wl_keyboard_key_state keyState;
RdpPeerContext *peerContext = (RdpPeerContext *)input->context;
struct rdp_backend *b = peerContext->rdpBackend;
/*struct rdp_backend *b = peerContext->rdpBackend;*/

int notify = 0;
struct timespec time;
Expand Down Expand Up @@ -2003,8 +2004,9 @@ rdp_backend_create(struct weston_compositor *compositor,
char *fd_tail;
int fd, ret;
struct rdp_output *output;
char *rdp_debug_level;
char *s;
int i;
struct timespec ts;

b = zalloc(sizeof *b);
if (b == NULL)
Expand All @@ -2028,17 +2030,39 @@ rdp_backend_create(struct weston_compositor *compositor,
"rdp-backend",
"Debug messages from RDP backend\n",
NULL, NULL, NULL);
rdp_debug_level = getenv("WESTON_RDP_DEBUG_LEVEL");
if (rdp_debug_level) {
b->debugLevel = atoi(rdp_debug_level);
if (b->debugLevel > RDP_DEBUG_LEVEL_VERBOSE)
s = getenv("WESTON_RDP_DEBUG_LEVEL");
if (s) {
if (!safe_strtoint(s, &b->debugLevel))
b->debugLevel = RDP_DEBUG_LEVEL_DEFAULT;
else if (b->debugLevel > RDP_DEBUG_LEVEL_VERBOSE)
b->debugLevel = RDP_DEBUG_LEVEL_VERBOSE;
} else {
b->debugLevel = RDP_DEBUG_LEVEL_DEFAULT;
}
weston_log("RDP backend: WESTON_RDP_DEBUG_LEVEL: %d.\n", b->debugLevel);
weston_log("RDP backend: WESTON_RDP_DEBUG_LEVEL: %d\n", b->debugLevel);
/* After here, rdp_debug() is ready to be used */

s = getenv("WESTON_RDP_MONITOR_REFRESH_RATE");
if (s) {
if (!safe_strtoint(s, &b->rdp_monitor_refresh_rate))
b->rdp_monitor_refresh_rate = RDP_MODE_FREQ;
} else {
b->rdp_monitor_refresh_rate = RDP_MODE_FREQ;
}
rdp_debug(b, "RDP backend: WESTON_RDP_MONITOR_REFRESH_RATE: %d\n", b->rdp_monitor_refresh_rate);

s = getenv("WESTON_RDP_REPAINT_DELAY_MS");
if (s) {
if (!safe_strtoint(s, &b->rdp_repaint_delay_ms))
b->rdp_repaint_delay_ms = 16;
} else {
b->rdp_repaint_delay_ms = 16;
}
rdp_debug(b, "RDP backend: WESTON_RDP_REPAINT_DELAY_MS: %d\n", b->rdp_repaint_delay_ms);

clock_getres(CLOCK_MONOTONIC, &ts);
rdp_debug(b, "RDP backend: timer resolution tv_sec:%ld tv_nsec:%ld\n", (intmax_t)ts.tv_sec, ts.tv_nsec);

/* For diagnostics purpose, dump all enviroment to log file */
/* TODO: privacy review */
rdp_debug(b, "RDP backend: Environment dump - start\n");
Expand Down
3 changes: 3 additions & 0 deletions libweston/backend-rdp/rdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ struct rdp_backend {
bool enable_fractional_hi_dpi_support;
uint32_t debug_desktop_scaling_factor; /* must be between 100 to 500 */

int rdp_monitor_refresh_rate;
int rdp_repaint_delay_ms;

#if defined(HAVE_FREERDP_RDPAPPLIST_H) || defined(HAVE_FREERDP_GFXREDIR_H)
void *libFreeRDPServer;
#endif // defined(HAVE_FREERDP_RDPAPPLIST_H) || defined(HAVE_FREERDP_GFXREDIR_H)
Expand Down