diff options
author | Ivan Molodetskikh <yalterz@gmail.com> | 2019-09-25 13:58:27 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-11-17 20:18:42 +0100 |
commit | 022df2542baa057b1965a7c7ee9c32e738f637d2 (patch) | |
tree | e650befe8f210c0fc44eb8fadf3b125c70a1b01f /sway/config/output.c | |
parent | Add -Wno-missing-braces (diff) | |
download | sway-022df2542baa057b1965a7c7ee9c32e738f637d2.tar.gz sway-022df2542baa057b1965a7c7ee9c32e738f637d2.tar.zst sway-022df2542baa057b1965a7c7ee9c32e738f637d2.zip |
output: add max_render_time
Diffstat (limited to 'sway/config/output.c')
-rw-r--r-- | sway/config/output.c | 33 |
1 files changed, 24 insertions, 9 deletions
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) { | |||
47 | oc->scale = -1; | 47 | oc->scale = -1; |
48 | oc->transform = -1; | 48 | oc->transform = -1; |
49 | oc->subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN; | 49 | oc->subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN; |
50 | oc->max_render_time = -1; | ||
50 | return oc; | 51 | return oc; |
51 | } | 52 | } |
52 | 53 | ||
@@ -81,6 +82,9 @@ void merge_output_config(struct output_config *dst, struct output_config *src) { | |||
81 | if (src->transform != -1) { | 82 | if (src->transform != -1) { |
82 | dst->transform = src->transform; | 83 | dst->transform = src->transform; |
83 | } | 84 | } |
85 | if (src->max_render_time != -1) { | ||
86 | dst->max_render_time = src->max_render_time; | ||
87 | } | ||
84 | if (src->background) { | 88 | if (src->background) { |
85 | free(dst->background); | 89 | free(dst->background); |
86 | dst->background = strdup(src->background); | 90 | dst->background = strdup(src->background); |
@@ -153,11 +157,12 @@ static void merge_id_on_name(struct output_config *oc) { | |||
153 | list_add(config->output_configs, ion_oc); | 157 | list_add(config->output_configs, ion_oc); |
154 | sway_log(SWAY_DEBUG, "Generated id on name output config \"%s\"" | 158 | sway_log(SWAY_DEBUG, "Generated id on name output config \"%s\"" |
155 | " (enabled: %d) (%dx%d@%fHz position %d,%d scale %f " | 159 | " (enabled: %d) (%dx%d@%fHz position %d,%d scale %f " |
156 | "transform %d) (bg %s %s) (dpms %d)", ion_oc->name, | 160 | "transform %d) (bg %s %s) (dpms %d) (max render time: %d)", |
157 | ion_oc->enabled, ion_oc->width, ion_oc->height, | 161 | ion_oc->name, ion_oc->enabled, ion_oc->width, ion_oc->height, |
158 | ion_oc->refresh_rate, ion_oc->x, ion_oc->y, ion_oc->scale, | 162 | ion_oc->refresh_rate, ion_oc->x, ion_oc->y, ion_oc->scale, |
159 | ion_oc->transform, ion_oc->background, | 163 | ion_oc->transform, ion_oc->background, |
160 | ion_oc->background_option, ion_oc->dpms_state); | 164 | ion_oc->background_option, ion_oc->dpms_state, |
165 | ion_oc->max_render_time); | ||
161 | } | 166 | } |
162 | } | 167 | } |
163 | free(id_on_name); | 168 | free(id_on_name); |
@@ -197,10 +202,12 @@ struct output_config *store_output_config(struct output_config *oc) { | |||
197 | } | 202 | } |
198 | 203 | ||
199 | sway_log(SWAY_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz " | 204 | sway_log(SWAY_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz " |
200 | "position %d,%d scale %f subpixel %s transform %d) (bg %s %s) (dpms %d)", | 205 | "position %d,%d scale %f subpixel %s transform %d) (bg %s %s) (dpms %d) " |
206 | "(max render time: %d)", | ||
201 | oc->name, oc->enabled, oc->width, oc->height, oc->refresh_rate, | 207 | oc->name, oc->enabled, oc->width, oc->height, oc->refresh_rate, |
202 | oc->x, oc->y, oc->scale, sway_wl_output_subpixel_to_string(oc->subpixel), | 208 | oc->x, oc->y, oc->scale, sway_wl_output_subpixel_to_string(oc->subpixel), |
203 | oc->transform, oc->background, oc->background_option, oc->dpms_state); | 209 | oc->transform, oc->background, oc->background_option, oc->dpms_state, |
210 | oc->max_render_time); | ||
204 | 211 | ||
205 | return oc; | 212 | return oc; |
206 | } | 213 | } |
@@ -325,6 +332,12 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { | |||
325 | wlr_output_enable(wlr_output, false); | 332 | wlr_output_enable(wlr_output, false); |
326 | } | 333 | } |
327 | 334 | ||
335 | if (oc && oc->max_render_time >= 0) { | ||
336 | sway_log(SWAY_DEBUG, "Set %s max render time to %d", | ||
337 | oc->name, oc->max_render_time); | ||
338 | output->max_render_time = oc->max_render_time; | ||
339 | } | ||
340 | |||
328 | return true; | 341 | return true; |
329 | } | 342 | } |
330 | 343 | ||
@@ -343,6 +356,7 @@ static void default_output_config(struct output_config *oc, | |||
343 | oc->subpixel = output->detected_subpixel; | 356 | oc->subpixel = output->detected_subpixel; |
344 | oc->transform = WL_OUTPUT_TRANSFORM_NORMAL; | 357 | oc->transform = WL_OUTPUT_TRANSFORM_NORMAL; |
345 | oc->dpms_state = DPMS_ON; | 358 | oc->dpms_state = DPMS_ON; |
359 | oc->max_render_time = 0; | ||
346 | } | 360 | } |
347 | 361 | ||
348 | static struct output_config *get_output_config(char *identifier, | 362 | static struct output_config *get_output_config(char *identifier, |
@@ -396,10 +410,11 @@ static struct output_config *get_output_config(char *identifier, | |||
396 | 410 | ||
397 | sway_log(SWAY_DEBUG, "Generated output config \"%s\" (enabled: %d)" | 411 | sway_log(SWAY_DEBUG, "Generated output config \"%s\" (enabled: %d)" |
398 | " (%dx%d@%fHz position %d,%d scale %f transform %d) (bg %s %s)" | 412 | " (%dx%d@%fHz position %d,%d scale %f transform %d) (bg %s %s)" |
399 | " (dpms %d)", result->name, result->enabled, result->width, | 413 | " (dpms %d) (max render time: %d)", result->name, result->enabled, |
400 | result->height, result->refresh_rate, result->x, result->y, | 414 | result->width, result->height, result->refresh_rate, |
401 | result->scale, result->transform, result->background, | 415 | result->x, result->y, result->scale, result->transform, |
402 | result->background_option, result->dpms_state); | 416 | result->background, result->background_option, result->dpms_state, |
417 | result->max_render_time); | ||
403 | } else if (oc_name) { | 418 | } else if (oc_name) { |
404 | // No identifier config, just return a copy of the name config | 419 | // No identifier config, just return a copy of the name config |
405 | free(result->name); | 420 | free(result->name); |