From 022df2542baa057b1965a7c7ee9c32e738f637d2 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Wed, 25 Sep 2019 13:58:27 +0300 Subject: output: add max_render_time --- sway/config/output.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'sway/config/output.c') diff --git a/sway/config/output.c b/sway/config/output.c index 25956fac..1d5f81da 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -47,6 +47,7 @@ struct output_config *new_output_config(const char *name) { oc->scale = -1; oc->transform = -1; oc->subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN; + oc->max_render_time = -1; return oc; } @@ -81,6 +82,9 @@ void merge_output_config(struct output_config *dst, struct output_config *src) { if (src->transform != -1) { dst->transform = src->transform; } + if (src->max_render_time != -1) { + dst->max_render_time = src->max_render_time; + } if (src->background) { free(dst->background); dst->background = strdup(src->background); @@ -153,11 +157,12 @@ static void merge_id_on_name(struct output_config *oc) { list_add(config->output_configs, ion_oc); sway_log(SWAY_DEBUG, "Generated id on name output config \"%s\"" " (enabled: %d) (%dx%d@%fHz position %d,%d scale %f " - "transform %d) (bg %s %s) (dpms %d)", ion_oc->name, - ion_oc->enabled, ion_oc->width, ion_oc->height, + "transform %d) (bg %s %s) (dpms %d) (max render time: %d)", + ion_oc->name, ion_oc->enabled, ion_oc->width, ion_oc->height, ion_oc->refresh_rate, ion_oc->x, ion_oc->y, ion_oc->scale, ion_oc->transform, ion_oc->background, - ion_oc->background_option, ion_oc->dpms_state); + ion_oc->background_option, ion_oc->dpms_state, + ion_oc->max_render_time); } } free(id_on_name); @@ -197,10 +202,12 @@ struct output_config *store_output_config(struct output_config *oc) { } sway_log(SWAY_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz " - "position %d,%d scale %f subpixel %s transform %d) (bg %s %s) (dpms %d)", + "position %d,%d scale %f subpixel %s transform %d) (bg %s %s) (dpms %d) " + "(max render time: %d)", oc->name, oc->enabled, oc->width, oc->height, oc->refresh_rate, oc->x, oc->y, oc->scale, sway_wl_output_subpixel_to_string(oc->subpixel), - oc->transform, oc->background, oc->background_option, oc->dpms_state); + oc->transform, oc->background, oc->background_option, oc->dpms_state, + oc->max_render_time); return oc; } @@ -325,6 +332,12 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { wlr_output_enable(wlr_output, false); } + if (oc && oc->max_render_time >= 0) { + sway_log(SWAY_DEBUG, "Set %s max render time to %d", + oc->name, oc->max_render_time); + output->max_render_time = oc->max_render_time; + } + return true; } @@ -343,6 +356,7 @@ static void default_output_config(struct output_config *oc, oc->subpixel = output->detected_subpixel; oc->transform = WL_OUTPUT_TRANSFORM_NORMAL; oc->dpms_state = DPMS_ON; + oc->max_render_time = 0; } static struct output_config *get_output_config(char *identifier, @@ -396,10 +410,11 @@ static struct output_config *get_output_config(char *identifier, sway_log(SWAY_DEBUG, "Generated output config \"%s\" (enabled: %d)" " (%dx%d@%fHz position %d,%d scale %f transform %d) (bg %s %s)" - " (dpms %d)", result->name, result->enabled, result->width, - result->height, result->refresh_rate, result->x, result->y, - result->scale, result->transform, result->background, - result->background_option, result->dpms_state); + " (dpms %d) (max render time: %d)", result->name, result->enabled, + result->width, result->height, result->refresh_rate, + result->x, result->y, result->scale, result->transform, + result->background, result->background_option, result->dpms_state, + result->max_render_time); } else if (oc_name) { // No identifier config, just return a copy of the name config free(result->name); -- cgit v1.2.3-54-g00ecf