mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 16:36:26 +01:00
Fix segfault in wlr_output_manager_v1_set_configuration
Calling wlr_output_manager_v1_set_configuration with an enabled output and a NULL mode is incorrect if the output doesn't support modes. When DPMS'ing an output, wlr_output_enable(output, false) is called. This de-allocates the CRTC and sets wlr_output.current_mode to NULL. Because we mark DPMS'ed outputs as enabled, we also need to provide a correct output mode. Add a field to sway_output to hold the current mode. Closes: https://github.com/swaywm/wlroots/issues/1867
This commit is contained in:
parent
58a40ce07b
commit
ec14a00e8c
4 changed files with 5 additions and 0 deletions
|
@ -32,6 +32,8 @@ struct sway_output {
|
||||||
int lx, ly; // layout coords
|
int lx, ly; // layout coords
|
||||||
int width, height; // transformed buffer size
|
int width, height; // transformed buffer size
|
||||||
enum wl_output_subpixel detected_subpixel;
|
enum wl_output_subpixel detected_subpixel;
|
||||||
|
// last applied mode when the output is DPMS'ed
|
||||||
|
struct wlr_output_mode *current_mode;
|
||||||
|
|
||||||
bool enabled, configured;
|
bool enabled, configured;
|
||||||
list_t *workspaces;
|
list_t *workspaces;
|
||||||
|
|
|
@ -278,6 +278,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
|
||||||
sway_log(SWAY_ERROR, "Failed to modeset output %s", wlr_output->name);
|
sway_log(SWAY_ERROR, "Failed to modeset output %s", wlr_output->name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
output->current_mode = wlr_output->current_mode;
|
||||||
|
|
||||||
if (oc && oc->scale > 0) {
|
if (oc && oc->scale > 0) {
|
||||||
sway_log(SWAY_DEBUG, "Set %s scale to %f", oc->name, oc->scale);
|
sway_log(SWAY_DEBUG, "Set %s scale to %f", oc->name, oc->scale);
|
||||||
|
|
|
@ -662,6 +662,7 @@ static void update_output_manager_config(struct sway_server *server) {
|
||||||
root->output_layout, output->wlr_output);
|
root->output_layout, output->wlr_output);
|
||||||
// We mark the output enabled even if it is switched off by DPMS
|
// We mark the output enabled even if it is switched off by DPMS
|
||||||
config_head->state.enabled = output->enabled;
|
config_head->state.enabled = output->enabled;
|
||||||
|
config_head->state.mode = output->current_mode;
|
||||||
if (output_box) {
|
if (output_box) {
|
||||||
config_head->state.x = output_box->x;
|
config_head->state.x = output_box->x;
|
||||||
config_head->state.y = output_box->y;
|
config_head->state.y = output_box->y;
|
||||||
|
|
|
@ -269,6 +269,7 @@ void output_disable(struct sway_output *output) {
|
||||||
|
|
||||||
output->enabled = false;
|
output->enabled = false;
|
||||||
output->configured = false;
|
output->configured = false;
|
||||||
|
output->current_mode = NULL;
|
||||||
|
|
||||||
arrange_root();
|
arrange_root();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue