diff mbox series

[v4,5/5] drm/test: Add test cases for drm_rect_rotate_inv()

Message ID 20230406115338.36228-6-arthurgrillo@riseup.net (mailing list archive)
State New, archived
Headers show
Series Create tests for the drm_rect functions | expand

Commit Message

Arthur Grillo April 6, 2023, 11:53 a.m. UTC
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 <arthurgrillo@riseup.net>
---
 drivers/gpu/drm/tests/drm_rect_test.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Maíra Canal April 17, 2023, 4:21 p.m. UTC | #1
On 4/6/23 08:53, Arthur Grillo wrote:
> 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 <arthurgrillo@riseup.net>

Thanks for the patch!

Reviewed-by: Maíra Canal <mcanal@igalia.com>

Best Regards,
- 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, &params->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, &params->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),
>   	{ }
>   };
>
diff mbox series

Patch

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, &params->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, &params->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),
 	{ }
 };