[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230619232249.16319-1-edgarmarjara@gmail.com>
Date: Mon, 19 Jun 2023 19:22:49 -0400
From: edagarmarjara <edgarmarjara@...il.com>
To: linux-kernel@...r.kernel.org
Cc: dri-devel@...ts.freedesktop.org,
MaĆra Canal <mairacanal@...eup.net>,
Arthur Grillo <arthurgrillo@...eup.net>,
Javier Martinez Canillas <javierm@...hat.com>,
edagarmarjara <edgarmarjara@...il.com>
Subject: [PATCH] Tercera entrega completa
---
drivers/gpu/drm/tests/drm_rect_test.c | 30 +++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_rect_test.c b/drivers/gpu/drm/tests/drm_rect_test.c
index e9809ea32696..d03e1d9b208d 100644
--- a/drivers/gpu/drm/tests/drm_rect_test.c
+++ b/drivers/gpu/drm/tests/drm_rect_test.c
@@ -35,6 +35,7 @@ static void drm_test_rect_clip_scaled_div_by_zero(struct kunit *test)
KUNIT_EXPECT_FALSE_MSG(test, drm_rect_visible(&src), "Source should not be visible\n");
}
+
static void drm_test_rect_clip_scaled_not_clipped(struct kunit *test)
{
struct drm_rect src, dst, clip;
@@ -196,11 +197,40 @@ static void drm_test_rect_clip_scaled_signed_vs_unsigned(struct kunit *test)
KUNIT_EXPECT_FALSE_MSG(test, drm_rect_visible(&src), "Source should not be visible\n");
}
+static void drm_test_rect_clip_over_scaled_signed_vs_unsigned(struct kunit *test)
+{
+
+ const void* gem_params(const void *prev, char *desc);
+ struct drm_rect src, dst, clip;
+ bool visible;
+
+ /*
+ * 'clip.x2 - dst.x1 >= dst width' could result a negative
+ * src rectangle width which is no longer expected by the
+ * code as it's using unsigned types. This could lead to
+ * the clipped source rectangle appering visible when it
+ * should have been fully clipped. Make sure both rectangles
+ * end up invisible.
+ * en esta parte cambio los valores y hago por aun mas afuera para el clip scaled
+ * para poder saber si al exagerar mas aun la escala sigue funcionando
+ */
+ drm_rect_init(&src, 2, 2, INT_MAX, INT_MAX);
+ drm_rect_init(&dst, 2, 2, 4, 4);
+ drm_rect_init(&clip, 6, 6, 3, 3);
+
+ visible = drm_rect_clip_scaled(&src, &dst, &clip);
+
+ KUNIT_EXPECT_FALSE_MSG(test, visible, "Destination should not be visible\n");
+ KUNIT_EXPECT_FALSE_MSG(test, drm_rect_visible(&src), "Source should not be visible\n");
+}
+
+
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),
KUNIT_CASE(drm_test_rect_clip_scaled_clipped),
KUNIT_CASE(drm_test_rect_clip_scaled_signed_vs_unsigned),
+ KUNIT_CASE(drm_test_rect_clip_over_scaled_signed_vs_unsigned), //Test entrega 2
{ }
};
--
2.34.1
Powered by blists - more mailing lists