From: Maíra Canal Date: Tue, 18 Apr 2023 13:05:25 +0000 (-0300) Subject: drm/vkms: add rotate-270 property X-Git-Tag: v6.6.17~3937^2~23^2~357 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd0755508d81736d026bc25647a89dfc79162d95;p=platform%2Fkernel%2Flinux-rpi.git drm/vkms: add rotate-270 property Currently, vkms supports the rotate-90, rotate-180, reflect-x and reflect-y properties. Therefore, improve the vkms IGT test coverage by adding the rotate-270 property to vkms. The rotation was implement by software: rotate the way the blending occurs by making the source x axis be the destination y axis and the source y axis be the destination x axis and reverse-read the axis. Now, vkms supports all possible rotation values. Tested with igt@kms_rotation_crc@primary-rotation-270 [1], and igt@kms_rotation_crc@sprite-rotation-270 [1]. [1] https://patchwork.freedesktop.org/series/116025/ Signed-off-by: Maíra Canal Reviewed-by: Melissa Wen Signed-off-by: Maíra Canal Link: https://patchwork.freedesktop.org/patch/msgid/20230418130525.128733-6-mcanal@igalia.com --- diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c index 491850f..906d3df 100644 --- a/drivers/gpu/drm/vkms/vkms_composer.c +++ b/drivers/gpu/drm/vkms/vkms_composer.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -61,6 +62,8 @@ static int get_y_pos(struct vkms_frame_info *frame_info, int y) switch (frame_info->rotation & DRM_MODE_ROTATE_MASK) { case DRM_MODE_ROTATE_90: return frame_info->rotated.x2 - y - 1; + case DRM_MODE_ROTATE_270: + return y + frame_info->rotated.x1; default: return y; } @@ -68,7 +71,7 @@ static int get_y_pos(struct vkms_frame_info *frame_info, int y) static bool check_limit(struct vkms_frame_info *frame_info, int pos) { - if (frame_info->rotation & DRM_MODE_ROTATE_90) { + if (drm_rotation_90_or_270(frame_info->rotation)) { if (pos >= 0 && pos < drm_rect_width(&frame_info->rotated)) return true; } else { diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c index f56f359..ebacb8e 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -2,6 +2,8 @@ #include #include + +#include #include #include @@ -44,7 +46,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 limit, int x) { - if (frame_info->rotation & DRM_MODE_REFLECT_X) + if (frame_info->rotation & (DRM_MODE_REFLECT_X | DRM_MODE_ROTATE_270)) return limit - x - 1; return x; } @@ -119,7 +121,7 @@ void vkms_compose_row(struct line_buffer *stage_buffer, struct vkms_plane_state for (size_t x = 0; x < limit; x++, src_pixels += frame_info->cpp) { int x_pos = get_x_position(frame_info, limit, x); - if (frame_info->rotation & DRM_MODE_ROTATE_90) + if (drm_rotation_90_or_270(frame_info->rotation)) src_pixels = get_packed_src_addr(frame_info, x + frame_info->rotated.y1) + frame_info->cpp * y; diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c index 1186c00..e5c625a 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -118,6 +118,7 @@ static void vkms_plane_atomic_update(struct drm_plane *plane, drm_framebuffer_get(frame_info->fb); frame_info->rotation = drm_rotation_simplify(new_state->rotation, DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | + DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y); @@ -212,11 +213,7 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev, drm_plane_helper_add(&plane->base, &vkms_plane_helper_funcs); drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, - DRM_MODE_ROTATE_0 | - DRM_MODE_ROTATE_90 | - DRM_MODE_ROTATE_180 | - DRM_MODE_REFLECT_X | - DRM_MODE_REFLECT_Y); + DRM_MODE_ROTATE_MASK | DRM_MODE_REFLECT_MASK); return plane; }