From 21c6cc5e4c66ba0d53aa3876f2c0f8746bf63fba Mon Sep 17 00:00:00 2001
From: Simon Ser <contact@emersion.fr>
Date: Sun, 17 May 2020 18:49:56 +0200
Subject: backend/drm: refuse to enable an output without a mode

---
 backend/drm/drm.c | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'backend')

diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 65734631..f052d994 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -422,6 +422,15 @@ static bool test_buffer(struct wlr_drm_connector *conn,
 static bool drm_connector_test(struct wlr_output *output) {
 	struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
 
+	if ((output->pending.committed & WLR_OUTPUT_STATE_ENABLED) &&
+			output->pending.enabled) {
+		if (output->current_mode == NULL &&
+				!(output->pending.committed & WLR_OUTPUT_STATE_MODE)) {
+			wlr_log(WLR_DEBUG, "Can't enable an output without a mode");
+			return false;
+		}
+	}
+
 	if ((output->pending.committed & WLR_OUTPUT_STATE_BUFFER) &&
 			output->pending.buffer_type == WLR_OUTPUT_STATE_BUFFER_SCANOUT) {
 		if (!test_buffer(conn, output->pending.buffer)) {
-- 
cgit v1.2.3