[PATCH v2 5/7] drm/vkms: add reflect-x property
Maíra Canal
mcanal at igalia.com
Fri Apr 14 13:51:49 UTC 2023
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 at kms_rotation_crc@primary-reflect-x and
igt at kms_rotation_crc@sprite-reflect-x [1].
[1] https://patchwork.freedesktop.org/series/116025/
Signed-off-by: Maíra Canal <mcanal at 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 --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index c4513f3d6876..2f8b41bf9ff9 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 5f69e0efd85f..11662afa9fe4 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;
}
--
2.39.2
More information about the dri-devel
mailing list