From 2ef53e73502fa26c7fab896b798e0ff480f3fca5 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 8 Sep 2021 04:42:39 +0200 Subject: [PATCH] drm: Make hardware rotation opt-in The current implementation sometimes will leave the screens unusable, therefore KWIN_DRM_SW_ROTATIONS_ONLY=1 is default. Use KWIN_DRM_SW_ROTATIONS_ONLY=0 to test hardware DRM operations. --- src/plugins/platforms/drm/drm_output.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/drm/drm_output.cpp b/src/plugins/platforms/drm/drm_output.cpp index d4ed3b5027..e654a4d754 100644 --- a/src/plugins/platforms/drm/drm_output.cpp +++ b/src/plugins/platforms/drm/drm_output.cpp @@ -307,8 +307,10 @@ void DrmOutput::updateTransform(Transform transform) { setTransformInternal(transform); const auto planeTransform = outputToPlaneTransform(transform); - if (!qEnvironmentVariableIsSet("KWIN_DRM_SW_ROTATIONS_ONLY") - && !m_pipeline->setTransformation(planeTransform)) { + static bool valid; + // If not set or wrong value, assume KWIN_DRM_SW_ROTATIONS_ONLY=1 until DRM transformations are reliable + static int envOnlySoftwareRotations = qEnvironmentVariableIntValue("KWIN_DRM_SW_ROTATIONS_ONLY", &valid) != 0; + if (valid && !envOnlySoftwareRotations && !m_pipeline->setTransformation(planeTransform)) { qCDebug(KWIN_DRM) << "setting transformation to" << planeTransform << "failed!"; // just in case, if we had any rotation before, clear it m_pipeline->setTransformation(DrmPlane::Transformation::Rotate0);