output: add max_render_time

This commit is contained in:
Ivan Molodetskikh 2019-09-25 13:58:27 +03:00 committed by Simon Ser
parent cb905effde
commit 022df2542b
10 changed files with 166 additions and 22 deletions

View file

@ -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);