[mutter] backends/native: Fix checks for 'reflect-x' and 'reflect-y' bits



commit c6cf4bd9c334fa4c59835520c4ef14c2d8887344
Author: Robert Mader <robert mader posteo de>
Date:   Sun Jun 12 20:25:24 2022 +0200

    backends/native: Fix checks for 'reflect-x' and 'reflect-y' bits
    
    Checking for both bits at once means only one matching bit is
    sufficient - very likely in case of `rotate-0'.
    
    This fixes crashes on hardware that does not support 'reflect-'
    bits when setting a flipped output transform.
    
    While on it, also update the check for `reflect-y` instead of
    `reflect-x` + `rotate-180`. They are logically equivalent,
    however some hardware may support `reflect-y` but not both
    other bits.
    
    Fixes commit 4e3f3842a1211e8b4274afdadcb2820e25ce6628
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>

 src/backends/native/meta-kms-plane.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/backends/native/meta-kms-plane.c b/src/backends/native/meta-kms-plane.c
index 07422c3384..134c37ed0f 100644
--- a/src/backends/native/meta-kms-plane.c
+++ b/src/backends/native/meta-kms-plane.c
@@ -145,8 +145,8 @@ meta_kms_plane_update_set_rotation (MetaKmsPlane           *plane,
                      META_KMS_PLANE_ROTATION_REFLECT_X;
       break;
     case META_MONITOR_TRANSFORM_FLIPPED_180:
-      kms_rotation = META_KMS_PLANE_ROTATION_ROTATE_180 |
-                     META_KMS_PLANE_ROTATION_REFLECT_X;
+      kms_rotation = META_KMS_PLANE_ROTATION_ROTATE_0 |
+                     META_KMS_PLANE_ROTATION_REFLECT_Y;
       break;
     case META_MONITOR_TRANSFORM_FLIPPED_270:
       kms_rotation = META_KMS_PLANE_ROTATION_ROTATE_270 |
@@ -170,11 +170,11 @@ meta_kms_plane_is_transform_handled (MetaKmsPlane         *plane,
     case META_MONITOR_TRANSFORM_180:
       return plane->rotations & META_KMS_PLANE_ROTATION_ROTATE_180;
     case META_MONITOR_TRANSFORM_FLIPPED:
-      return plane->rotations & (META_KMS_PLANE_ROTATION_ROTATE_0 |
-                                 META_KMS_PLANE_ROTATION_REFLECT_X);
+      return (plane->rotations & META_KMS_PLANE_ROTATION_ROTATE_0) &&
+             (plane->rotations & META_KMS_PLANE_ROTATION_REFLECT_X);
     case META_MONITOR_TRANSFORM_FLIPPED_180:
-      return plane->rotations & (META_KMS_PLANE_ROTATION_ROTATE_180 |
-                                 META_KMS_PLANE_ROTATION_REFLECT_X);
+      return (plane->rotations & META_KMS_PLANE_ROTATION_ROTATE_0) &&
+             (plane->rotations & META_KMS_PLANE_ROTATION_REFLECT_Y);
     /*
      * Deny these transforms as testing shows that they don't work
      * anyway, e.g. due to the wrong buffer modifiers. They might as well be


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]