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.
This commit is contained in:
Aleix Pol 2021-09-08 04:42:39 +02:00 committed by Aleix Pol Gonzalez
parent d11b4c8084
commit 2ef53e7350

View file

@ -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);