From patchwork Thu Apr 6 11:53:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arthur Grillo X-Patchwork-Id: 13203234 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 D2601C76196 for ; Thu, 6 Apr 2023 11:54:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1791E10EB85; Thu, 6 Apr 2023 11:54:29 +0000 (UTC) Received: from mx1.riseup.net (mx1.riseup.net [198.252.153.129]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8665410EB83 for ; Thu, 6 Apr 2023 11:54:26 +0000 (UTC) Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4Psg016JKDzDqZN; Thu, 6 Apr 2023 11:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1680782066; bh=kzMfuXnxVYJCWj63nyZRC1qdSQsx+q+0kFaPSbPbyaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lIrbJ/O36CzEE8KR/i16JCc1oeBKYgmTKpV2t20GZP0IBlKH/hxbwLsdnR5xKrcNG w88fJfz6qKPIE3D2K61C8Mvn7t55DyZzHiX+RUv+CcBRYyQEx/N05CgFGrRwjlOP7E 7TB30QyW2zwhLTGearkY7oviJ40MWxSd3QSEknjM= X-Riseup-User-ID: E5D274BB7D709CDCA242948A5285830592E53667BC25D9DB79A6DA859DBEEFC8 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4Psfzx277Rz1yNK; Thu, 6 Apr 2023 11:54:21 +0000 (UTC) From: Arthur Grillo To: dri-devel@lists.freedesktop.org Subject: [PATCH v4 5/5] drm/test: Add test cases for drm_rect_rotate_inv() Date: Thu, 6 Apr 2023 08:53:38 -0300 Message-Id: <20230406115338.36228-6-arthurgrillo@riseup.net> In-Reply-To: <20230406115338.36228-1-arthurgrillo@riseup.net> References: <20230406115338.36228-1-arthurgrillo@riseup.net> 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: carlos.craveiro@usp.br, tales.aparecida@gmail.com, dlatypov@google.com, javierm@redhat.com, mairacanal@riseup.net, maxime@cerno.tech, andrealmeid@riseup.net, Arthur Grillo , matheus.vieira.g@usp.br Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Insert a parameterized test for the drm_rect_rotate_inv() to ensure its correctness and prevent future regressions. The test covers all rotation modes. It uses the same test cases from drm_test_rect_rotate(). Signed-off-by: Arthur Grillo Reviewed-by: MaĆ­ra Canal --- drivers/gpu/drm/tests/drm_rect_test.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_rect_test.c b/drivers/gpu/drm/tests/drm_rect_test.c index 1269dfc8b756..6d85e78ba903 100644 --- a/drivers/gpu/drm/tests/drm_rect_test.c +++ b/drivers/gpu/drm/tests/drm_rect_test.c @@ -543,6 +543,16 @@ static void drm_test_rect_rotate(struct kunit *test) drm_rect_compare(test, &r, ¶ms->expected); } +static void drm_test_rect_rotate_inv(struct kunit *test) +{ + const struct drm_rect_rotate_case *params = test->param_value; + struct drm_rect r = params->expected; + + drm_rect_rotate_inv(&r, params->width, params->height, params->rotation); + + drm_rect_compare(test, &r, ¶ms->rect); +} + static struct kunit_case drm_rect_tests[] = { KUNIT_CASE(drm_test_rect_clip_scaled_div_by_zero), KUNIT_CASE(drm_test_rect_clip_scaled_not_clipped), @@ -552,6 +562,7 @@ static struct kunit_case drm_rect_tests[] = { KUNIT_CASE_PARAM(drm_test_rect_calc_hscale, drm_rect_hscale_gen_params), KUNIT_CASE_PARAM(drm_test_rect_calc_vscale, drm_rect_vscale_gen_params), KUNIT_CASE_PARAM(drm_test_rect_rotate, drm_rect_rotate_gen_params), + KUNIT_CASE_PARAM(drm_test_rect_rotate_inv, drm_rect_rotate_gen_params), { } };