Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_output.cpp
Show First 20 Lines • Show All 644 Lines • ▼ Show 20 Line(s) | 644 | if (m_dpmsModePending == DpmsMode::On) { | |||
---|---|---|---|---|---|
645 | dpmsFinishOn(); | 645 | dpmsFinishOn(); | ||
646 | } else { | 646 | } else { | ||
647 | dpmsFinishOff(); | 647 | dpmsFinishOff(); | ||
648 | } | 648 | } | ||
649 | m_dpmsMode = m_dpmsModePending; | 649 | m_dpmsMode = m_dpmsModePending; | ||
650 | return true; | 650 | return true; | ||
651 | } | 651 | } | ||
652 | 652 | | |||
653 | void DrmOutput::updateTransform(Transform transform) | 653 | DrmPlane::Transformations outputToPlaneTransform(DrmOutput::Transform transform) | ||
654 | { | 654 | { | ||
655 | DrmPlane::Transformation planeTransform; | 655 | using OutTrans = DrmOutput::Transform; | ||
zzag: Use full name, e.g. OutputTransform. | |||||
656 | using PlaneTrans = DrmPlane::Transformation; | ||||
656 | 657 | | |||
657 | // TODO: Do we want to support reflections (flips)? | 658 | // TODO: Do we want to support reflections (flips)? | ||
658 | 659 | | |||
659 | switch (transform) { | 660 | switch (transform) { | ||
660 | case Transform::Normal: | 661 | case OutTrans::Normal: | ||
661 | case Transform::Flipped: | 662 | case OutTrans::Flipped: | ||
662 | planeTransform = DrmPlane::Transformation::Rotate0; | 663 | return PlaneTrans::Rotate0; | ||
663 | break; | 664 | case OutTrans::Rotated90: | ||
664 | case Transform::Rotated90: | 665 | case OutTrans::Flipped90: | ||
665 | case Transform::Flipped90: | 666 | return PlaneTrans::Rotate90; | ||
666 | planeTransform = DrmPlane::Transformation::Rotate90; | 667 | case OutTrans::Rotated180: | ||
667 | break; | 668 | case OutTrans::Flipped180: | ||
668 | case Transform::Rotated180: | 669 | return PlaneTrans::Rotate180; | ||
669 | case Transform::Flipped180: | 670 | case OutTrans::Rotated270: | ||
670 | planeTransform = DrmPlane::Transformation::Rotate180; | 671 | case OutTrans::Flipped270: | ||
671 | break; | 672 | return PlaneTrans::Rotate270; | ||
672 | case Transform::Rotated270: | | |||
673 | case Transform::Flipped270: | | |||
674 | planeTransform = DrmPlane::Transformation::Rotate270; | | |||
675 | break; | | |||
676 | default: | 673 | default: | ||
677 | Q_UNREACHABLE(); | 674 | Q_UNREACHABLE(); | ||
678 | } | 675 | } | ||
676 | } | ||||
677 | | ||||
678 | bool DrmOutput::hardwareTransforms() const | ||||
679 | { | ||||
680 | if (!m_primaryPlane) { | ||||
681 | return false; | ||||
682 | } | ||||
683 | return m_primaryPlane->transformation() == outputToPlaneTransform(transform()); | ||||
684 | } | ||||
685 | | ||||
686 | int DrmOutput::rotation() const | ||||
687 | { | ||||
688 | return transformToRotation(transform()); | ||||
689 | } | ||||
690 | | ||||
691 | void DrmOutput::updateTransform(Transform transform) | ||||
692 | { | ||||
693 | const auto planeTransform = outputToPlaneTransform(transform); | ||||
679 | 694 | | |||
680 | if (m_primaryPlane) { | 695 | if (m_primaryPlane) { | ||
696 | // At the moment we have to exclude hardware transforms for vertical buffers. | ||||
697 | // For that we need to support other buffers and graceful fallback from atomic tests. | ||||
698 | // Reason is that standard linear buffers are not suitable. | ||||
699 | const bool isPortrait = transform == Transform::Rotated90 | ||||
700 | || transform == Transform::Flipped90 | ||||
701 | || transform == Transform::Rotated270 | ||||
702 | || transform == Transform::Flipped270; | ||||
703 | | ||||
704 | if (!qEnvironmentVariableIsSet("KWIN_DRM_SW_ROTATIONS_ONLY") && | ||||
Please omit "rotation" in the environment variable name and use something more generic, e.g. "output transforms," etc. zzag: Please omit "rotation" in the environment variable name and use something more generic, e.g. | |||||
romangg: How about `KWIN_DRM_OUTPUT_SW_ONLY_TRANSFORM`? | |||||
705 | (m_primaryPlane->supportedTransformations() & planeTransform) && | ||||
706 | !isPortrait) { | ||||
681 | m_primaryPlane->setTransformation(planeTransform); | 707 | m_primaryPlane->setTransformation(planeTransform); | ||
708 | } else { | ||||
709 | m_primaryPlane->setTransformation(DrmPlane::Transformation::Rotate0); | ||||
710 | } | ||||
682 | } | 711 | } | ||
683 | m_modesetRequested = true; | 712 | m_modesetRequested = true; | ||
684 | 713 | | |||
685 | // the cursor might need to get rotated | 714 | // the cursor might need to get rotated | ||
686 | updateCursor(); | 715 | updateCursor(); | ||
687 | showCursor(); | 716 | showCursor(); | ||
688 | } | 717 | } | ||
689 | 718 | | |||
▲ Show 20 Lines • Show All 418 Lines • Show Last 20 Lines |
Use full name, e.g. OutputTransform.