Avoid no-op output reconfiguring

When an output command doesn't actually change anything in the output
config the processing will still all be done and cause other changes.
Notably if you run a command like:

	output * dpms on

even if it does nothing it will still cause all the inputs to be
reconfigured and very noticeable amounts of input latency to occur.

To fix this save the current output config in the output data and on
configure, if the config is the same just return without doing anything
else.

Fixes #6280
This commit is contained in:
Pedro Côrte-Real 2021-05-18 23:15:02 +01:00
parent 075845ceb2
commit 9ab2852c15
3 changed files with 74 additions and 0 deletions

View file

@ -636,6 +636,10 @@ struct output_config *new_output_config(const char *name);
void merge_output_config(struct output_config *dst, struct output_config *src);
struct output_config *duplicate_output_config(const struct output_config *src);
bool compare_output_config(const struct output_config *dst, const struct output_config *src);
bool apply_output_config(struct output_config *oc, struct sway_output *output);
bool test_output_config(struct output_config *oc, struct sway_output *output);

View file

@ -57,6 +57,8 @@ struct sway_output {
uint32_t refresh_nsec;
int max_render_time; // In milliseconds
struct wl_event_source *repaint_timer;
struct output_config *current_config;
};
struct sway_output *output_create(struct wlr_output *wlr_output);