From f6f0a9f3f6220bb5719f2139594e003cc784fe56 Mon Sep 17 00:00:00 2001
From: Laszlo Agocs <laszlo.agocs@qt.io>
Date: Fri, 12 Apr 2019 10:38:48 +0200
Subject: [PATCH] eglfs: Make the logs from atomic support usable

Atomic being supported and atomic being requested are two different things.
(the latter is only true when QT_QPA_EGLFS_KMS_ATOMIC is set)

Log accordingly since this can be very important to know when investigating
problems.

Change-Id: I6947d18e7c0eaef3fe160095cb046770f9c93efe
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
---
 src/platformsupport/kmsconvenience/qkmsdevice.cpp | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
index 5f134f5867..7e3a870421 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp
+++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
@@ -581,10 +581,16 @@ void QKmsDevice::createScreens()
 
 #if QT_CONFIG(drm_atomic)
     // check atomic support
-    m_has_atomic_support = !drmSetClientCap(m_dri_fd, DRM_CLIENT_CAP_ATOMIC, 1)
-                           && qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_ATOMIC");
-    if (m_has_atomic_support)
-        qCDebug(qLcKmsDebug) << "Atomic Support found";
+    m_has_atomic_support = !drmSetClientCap(m_dri_fd, DRM_CLIENT_CAP_ATOMIC, 1);
+    if (m_has_atomic_support) {
+        qCDebug(qLcKmsDebug, "Atomic reported as supported");
+        if (qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_ATOMIC")) {
+            qCDebug(qLcKmsDebug, "Atomic enabled");
+        } else {
+            qCDebug(qLcKmsDebug, "Atomic disabled");
+            m_has_atomic_support = false;
+        }
+    }
 #endif
 
     drmModeResPtr resources = drmModeGetResources(m_dri_fd);