All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Tercera entrega completa
@ 2023-06-19 23:22 edagarmarjara
  2023-06-24 20:08   ` Maira Canal
  0 siblings, 1 reply; 3+ messages in thread
From: edagarmarjara @ 2023-06-19 23:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: dri-devel, Maíra Canal, Arthur Grillo,
	Javier Martinez Canillas, edagarmarjara

---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Tercera entrega completa
  2023-06-19 23:22 [PATCH] Tercera entrega completa edagarmarjara
@ 2023-06-24 20:08   ` Maira Canal
  0 siblings, 0 replies; 3+ messages in thread
From: Maira Canal @ 2023-06-24 20:08 UTC (permalink / raw)
  To: edagarmarjara, linux-kernel
  Cc: dri-devel, Arthur Grillo, Javier Martinez Canillas

Hi edagarmarjara,

First, you need to include a commit message to the patch. Check [1] to 
see a basic guide to submit patches.

On 6/19/23 20:22, edagarmarjara wrote:
> ---
>   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");
>   }
>   
> +

This line is not needed. You can run checkpatch.sh to catch common style 
mistakes.

>   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);

Hum... I guess you don't need this function signature here.

> +	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

I believe you can try to explain the test in smaller comments. Sometimes 
the tests explain by itself. Also, avoid to use Spanish in comments.

> +	 */
> +	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");

I believe you could introduce more test cases for this test instead of 
only one.

> +}
> +
> +
>   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

I believe you could remove the comment here.

[1] https://docs.kernel.org/process/submitting-patches.html

Best Regards,
- Maíra

>   	{ }
>   };
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Tercera entrega completa
@ 2023-06-24 20:08   ` Maira Canal
  0 siblings, 0 replies; 3+ messages in thread
From: Maira Canal @ 2023-06-24 20:08 UTC (permalink / raw)
  To: edagarmarjara, linux-kernel
  Cc: Arthur Grillo, dri-devel, Javier Martinez Canillas

Hi edagarmarjara,

First, you need to include a commit message to the patch. Check [1] to 
see a basic guide to submit patches.

On 6/19/23 20:22, edagarmarjara wrote:
> ---
>   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");
>   }
>   
> +

This line is not needed. You can run checkpatch.sh to catch common style 
mistakes.

>   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);

Hum... I guess you don't need this function signature here.

> +	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

I believe you can try to explain the test in smaller comments. Sometimes 
the tests explain by itself. Also, avoid to use Spanish in comments.

> +	 */
> +	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");

I believe you could introduce more test cases for this test instead of 
only one.

> +}
> +
> +
>   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

I believe you could remove the comment here.

[1] https://docs.kernel.org/process/submitting-patches.html

Best Regards,
- Maíra

>   	{ }
>   };
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-24 20:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-19 23:22 [PATCH] Tercera entrega completa edagarmarjara
2023-06-24 20:08 ` Maira Canal
2023-06-24 20:08   ` Maira Canal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.