aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-15 03:01:19 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-02-18 15:11:48 -0500
commit8d708b8e1d804198a2c6a53342def6d1505845db (patch)
treecdb27c19bcc60ca7074fa300acd25f7b57b0d2c9
parentseatop_move_tiling: do not move to descendant (diff)
downloadsway-8d708b8e1d804198a2c6a53342def6d1505845db.tar.gz
sway-8d708b8e1d804198a2c6a53342def6d1505845db.tar.zst
sway-8d708b8e1d804198a2c6a53342def6d1505845db.zip
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.
-rw-r--r--sway/config/output.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/sway/config/output.c b/sway/config/output.c
index 970764b0..f1a06379 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -199,6 +199,11 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
199 return true; 199 return true;
200 } 200 }
201 201
202 if (oc && oc->dpms_state == DPMS_ON) {
203 sway_log(SWAY_DEBUG, "Turning on screen");
204 wlr_output_enable(wlr_output, true);
205 }
206
202 bool modeset_success; 207 bool modeset_success;
203 if (oc && oc->width > 0 && oc->height > 0) { 208 if (oc && oc->width > 0 && oc->height > 0) {
204 sway_log(SWAY_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width, 209 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) {
263 } 268 }
264 } 269 }
265 270
266 if (oc) { 271 if (oc && oc->dpms_state == DPMS_OFF) {
267 switch (oc->dpms_state) { 272 sway_log(SWAY_DEBUG, "Turning off screen");
268 case DPMS_ON: 273 wlr_output_enable(wlr_output, false);
269 sway_log(SWAY_DEBUG, "Turning on screen");
270 wlr_output_enable(wlr_output, true);
271 break;
272 case DPMS_OFF:
273 sway_log(SWAY_DEBUG, "Turning off screen");
274 wlr_output_enable(wlr_output, false);
275 break;
276 case DPMS_IGNORE:
277 break;
278 }
279 } 274 }
280 275
281 return true; 276 return true;
@@ -294,6 +289,7 @@ static void default_output_config(struct output_config *oc,
294 oc->x = oc->y = -1; 289 oc->x = oc->y = -1;
295 oc->scale = 1; 290 oc->scale = 1;
296 oc->transform = WL_OUTPUT_TRANSFORM_NORMAL; 291 oc->transform = WL_OUTPUT_TRANSFORM_NORMAL;
292 oc->dpms_state = DPMS_ON;
297} 293}
298 294
299static struct output_config *get_output_config(char *identifier, 295static struct output_config *get_output_config(char *identifier,