From 6717b78bd6dcb1e103556cf86813c715c4212106 Mon Sep 17 00:00:00 2001
From: Scott Anderson <ascent12@hotmail.com>
Date: Sat, 9 Sep 2017 23:06:44 +1200
Subject: Retry atomic commit on failure

So we don't lose any previously "good" properties that were set.
---
 backend/drm/drm-atomic.c | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'backend')

diff --git a/backend/drm/drm-atomic.c b/backend/drm/drm-atomic.c
index 64028812..adb5bb47 100644
--- a/backend/drm/drm-atomic.c
+++ b/backend/drm/drm-atomic.c
@@ -53,6 +53,13 @@ static bool atomic_commit(int drm_fd, struct atomic *atom,
 	int ret = drmModeAtomicCommit(drm_fd, atom->req, flags, output);
 	if (ret) {
 		wlr_log_errno(L_ERROR, "Atomic commit failed");
+
+		// Try to commit without new changes
+		drmModeAtomicSetCursor(atom->req, atom->cursor);
+		ret = drmModeAtomicCommit(drm_fd, atom->req, flags, output);
+		if (ret) {
+			wlr_log_errno(L_ERROR, "Atomic commit failed");
+		}
 	}
 
 	drmModeAtomicSetCursor(atom->req, 0);
-- 
cgit v1.2.3