From patchwork Fri Apr 14 13:51:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13211521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C5FCC77B76 for ; Fri, 14 Apr 2023 13:52:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 73A8E10ED58; Fri, 14 Apr 2023 13:52:35 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4924B10ED58 for ; Fri, 14 Apr 2023 13:52:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=094L5f5WCBPZfzTO8UsZcIEKiunO/ad34q1icxwMEpM=; b=IYylu9m+TezHGIMBRqf5apGoPk kmyuo5DaGpT/uSb4wVakawUThuia9t6r4j2FAHTKD8O5Lsakok8kyJQa8FF8CoNbzMZirNtlljRpH zcmsG/NHAARx0sMhN176tLFw+yZ++pmLTMmPanMm/svPKviVV+TwCZV0eRgUbpbndzZiy1tbahajF 8xsgDWqt8BWy2ivHjYBsTpShOUXDoU8uuH0/sgmgm0r4gWi0sSKSVtllUdRtDnxgRgRpY6ROFsS06 oYr/sgpnz7d6G9g3PgcPv8Gz4xBSZWyaEhgIDrlltc8J/CxL4vbBHLIBMmLE/x58/MSGRR0vwmrn1 e0L/hMMg==; Received: from [177.34.168.16] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pnJqm-0015Av-1I; Fri, 14 Apr 2023 15:52:28 +0200 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: David Airlie , Daniel Vetter , Rodrigo Siqueira , Melissa Wen , Haneen Mohammed , Igor Matheus Andrade Torrente , Arthur Grillo Subject: [PATCH v2 6/7] drm/vkms: add reflect-y property Date: Fri, 14 Apr 2023 10:51:50 -0300 Message-Id: <20230414135151.75975-7-mcanal@igalia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230414135151.75975-1-mcanal@igalia.com> References: <20230414135151.75975-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Currently, vkms only support the reflect-x property. Therefore, add the reflect-y property to vkms through a software implementation of the operation. This is possible by reverse reading the y axis during the blending. Now, vkms support all possible rotation values. Tested with igt@kms_rotation_crc@primary-reflect-y and igt@kms_rotation_crc@sprite-reflect-y [1]. [1] https://patchwork.freedesktop.org/series/116025/ Signed-off-by: MaĆ­ra Canal --- drivers/gpu/drm/vkms/vkms_composer.c | 7 ++++++- drivers/gpu/drm/vkms/vkms_plane.c | 16 ++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c index b05bd008aeab..19d1078e9d34 100644 --- a/drivers/gpu/drm/vkms/vkms_composer.c +++ b/drivers/gpu/drm/vkms/vkms_composer.c @@ -92,8 +92,13 @@ static int get_y_pos(struct vkms_frame_info *frame_info, int y) return -1; return y + frame_info->dst.x1; default: - return y; + break; } + + if (frame_info->rotation & DRM_MODE_REFLECT_Y) + return drm_rect_height(&frame_info->dst) - y - 1; + + return y; } static bool check_limit(struct vkms_frame_info *frame_info, int pos) diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c index 11662afa9fe4..d08bda869a24 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -121,12 +121,8 @@ static void vkms_plane_atomic_update(struct drm_plane *plane, frame_info->fb = fb; memcpy(&frame_info->map, &shadow_plane_state->data, sizeof(frame_info->map)); 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_180 | - DRM_MODE_ROTATE_270 | - DRM_MODE_REFLECT_X); + frame_info->rotation = drm_rotation_simplify(new_state->rotation, DRM_MODE_ROTATE_MASK | + DRM_MODE_REFLECT_MASK); drm_rect_rotate(&frame_info->dst, drm_rect_width(&frame_info->dst), drm_rect_height(&frame_info->dst), frame_info->rotation); @@ -240,12 +236,8 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev, drm_plane_helper_add(&plane->base, 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_ROTATE_270 | - DRM_MODE_REFLECT_X); + drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_MASK | + DRM_MODE_REFLECT_MASK); return plane; }