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 4e3f3842a1

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
This commit is contained in:
Robert Mader 2022-06-12 20:25:24 +02:00 committed by Marge Bot
parent 9e71278488
commit c6cf4bd9c3

View File

@ -145,8 +145,8 @@ meta_kms_plane_update_set_rotation (MetaKmsPlane *plane,
META_KMS_PLANE_ROTATION_REFLECT_X; META_KMS_PLANE_ROTATION_REFLECT_X;
break; break;
case META_MONITOR_TRANSFORM_FLIPPED_180: case META_MONITOR_TRANSFORM_FLIPPED_180:
kms_rotation = META_KMS_PLANE_ROTATION_ROTATE_180 | kms_rotation = META_KMS_PLANE_ROTATION_ROTATE_0 |
META_KMS_PLANE_ROTATION_REFLECT_X; META_KMS_PLANE_ROTATION_REFLECT_Y;
break; break;
case META_MONITOR_TRANSFORM_FLIPPED_270: case META_MONITOR_TRANSFORM_FLIPPED_270:
kms_rotation = META_KMS_PLANE_ROTATION_ROTATE_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: case META_MONITOR_TRANSFORM_180:
return plane->rotations & META_KMS_PLANE_ROTATION_ROTATE_180; return plane->rotations & META_KMS_PLANE_ROTATION_ROTATE_180;
case META_MONITOR_TRANSFORM_FLIPPED: case META_MONITOR_TRANSFORM_FLIPPED:
return plane->rotations & (META_KMS_PLANE_ROTATION_ROTATE_0 | return (plane->rotations & META_KMS_PLANE_ROTATION_ROTATE_0) &&
META_KMS_PLANE_ROTATION_REFLECT_X); (plane->rotations & META_KMS_PLANE_ROTATION_REFLECT_X);
case META_MONITOR_TRANSFORM_FLIPPED_180: case META_MONITOR_TRANSFORM_FLIPPED_180:
return plane->rotations & (META_KMS_PLANE_ROTATION_ROTATE_180 | return (plane->rotations & META_KMS_PLANE_ROTATION_ROTATE_0) &&
META_KMS_PLANE_ROTATION_REFLECT_X); (plane->rotations & META_KMS_PLANE_ROTATION_REFLECT_Y);
/* /*
* Deny these transforms as testing shows that they don't work * 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 * anyway, e.g. due to the wrong buffer modifiers. They might as well be