diff mbox series

[4/6] drm/vkms: add reflect-x property

Message ID 20230406130138.70752-5-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series drm/vkms: introduce plane rotation property | expand

Commit Message

Maíra Canal April 6, 2023, 1:01 p.m. UTC
Currently, vkms doesn't support any reflection property. Therefore, add
the reflect-x property to vkms through a software implementation of the
operation. This is possible by reverse reading the x axis during the
blending.

Tested with igt@kms_rotation_crc@primary-reflect-x and
igt@kms_rotation_crc@sprite-reflect-x [1].

[1] https://patchwork.freedesktop.org/series/116025/

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 drivers/gpu/drm/vkms/vkms_formats.c | 2 +-
 drivers/gpu/drm/vkms/vkms_plane.c   | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index 07976194882b..72a57639e1e8 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.c
+++ b/drivers/gpu/drm/vkms/vkms_formats.c
@@ -45,7 +45,7 @@  static void *get_packed_src_addr(const struct vkms_frame_info *frame_info, int y
 
 static int get_x_position(const struct vkms_frame_info *frame_info, int x_limit, int x)
 {
-	if (frame_info->rotation & (DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270))
+	if (frame_info->rotation & (DRM_MODE_REFLECT_X | DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270))
 		return x_limit - x - 1;
 	return x;
 }
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index abaacad3bef2..e2bd2231fe4c 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -125,7 +125,8 @@  static void vkms_plane_atomic_update(struct drm_plane *plane,
 						     DRM_MODE_ROTATE_0 |
 						     DRM_MODE_ROTATE_90 |
 						     DRM_MODE_ROTATE_180 |
-						     DRM_MODE_ROTATE_270);
+						     DRM_MODE_ROTATE_270 |
+						     DRM_MODE_REFLECT_X);
 
 	drm_rect_rotate(&frame_info->dst, drm_rect_width(&frame_info->dst),
 			drm_rect_height(&frame_info->dst), frame_info->rotation);
@@ -243,7 +244,8 @@  struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
 					   DRM_MODE_ROTATE_0 |
 					   DRM_MODE_ROTATE_90 |
 					   DRM_MODE_ROTATE_180 |
-					   DRM_MODE_ROTATE_270);
+					   DRM_MODE_ROTATE_270 |
+					   DRM_MODE_REFLECT_X);
 
 	return plane;
 }