mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 00:16:22 +01:00
apply_output_config: dpms on before modeset
On the DRM backend, if an output is dpms'd off and a different output is hotplugged, the CRTC for the output is reclaimed. When modesetting an output without a CRTC, a CRTC will not be given to an output that is not desired to be enabled. This splits setting the dpms state in apply_output_config. If the output should be dpms on, the it is enabled before attempting to modeset. Otherwise, it is dpms'd off after setting everything else. This also adds DPMS_ON to the default output configs.
This commit is contained in:
parent
e8c472aee9
commit
96de2b539c
1 changed files with 9 additions and 13 deletions
|
@ -199,6 +199,11 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oc && oc->dpms_state == DPMS_ON) {
|
||||||
|
sway_log(SWAY_DEBUG, "Turning on screen");
|
||||||
|
wlr_output_enable(wlr_output, true);
|
||||||
|
}
|
||||||
|
|
||||||
bool modeset_success;
|
bool modeset_success;
|
||||||
if (oc && oc->width > 0 && oc->height > 0) {
|
if (oc && oc->width > 0 && oc->height > 0) {
|
||||||
sway_log(SWAY_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width,
|
sway_log(SWAY_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width,
|
||||||
|
@ -263,19 +268,9 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oc) {
|
if (oc && oc->dpms_state == DPMS_OFF) {
|
||||||
switch (oc->dpms_state) {
|
sway_log(SWAY_DEBUG, "Turning off screen");
|
||||||
case DPMS_ON:
|
wlr_output_enable(wlr_output, false);
|
||||||
sway_log(SWAY_DEBUG, "Turning on screen");
|
|
||||||
wlr_output_enable(wlr_output, true);
|
|
||||||
break;
|
|
||||||
case DPMS_OFF:
|
|
||||||
sway_log(SWAY_DEBUG, "Turning off screen");
|
|
||||||
wlr_output_enable(wlr_output, false);
|
|
||||||
break;
|
|
||||||
case DPMS_IGNORE:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -294,6 +289,7 @@ static void default_output_config(struct output_config *oc,
|
||||||
oc->x = oc->y = -1;
|
oc->x = oc->y = -1;
|
||||||
oc->scale = 1;
|
oc->scale = 1;
|
||||||
oc->transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
oc->transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||||
|
oc->dpms_state = DPMS_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct output_config *get_output_config(char *identifier,
|
static struct output_config *get_output_config(char *identifier,
|
||||||
|
|
Loading…
Reference in a new issue