Tercera entrega completa
Subsystems (2)
PATCH 1/1 Tercera entrega completa
--- drivers/gpu/drm/tests/drm_rect_test.c | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/gpu/drm/tests/drm_rect_test.c +30 -0
@@ -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 { } };
Signature · 1 line
2.34.1
Hi edagarmarjara,
First, you need to include a commit message to the patch. Check [1] to see a basic guide to submit patches.
drivers/gpu/drm/tests/drm_rect_test.c static void drm_test_rect_clip_scaled_div_by_zero(struct kunit *test) · line 38
Quoted 13 lines · edagarmarjara
--- drivers/gpu/drm/tests/drm_rect_test.c | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)drivers/gpu/drm/tests/drm_rect_test.c +1
-0@@ -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.
drivers/gpu/drm/tests/drm_rect_test.c static void drm_test_rect_clip_scaled_signed_vs_unsigned(struct kunit *test) · line 203
Quoted 11 lines
drivers/gpu/drm/tests/drm_rect_test.c +4
-0static 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.
drivers/gpu/drm/tests/drm_rect_test.c static void drm_test_rect_clip_scaled_signed_vs_unsigned(struct kunit *test) · line 215
Quoted 12 lines
drivers/gpu/drm/tests/drm_rect_test.c +12
-0+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.
drivers/gpu/drm/tests/drm_rect_test.c static void drm_test_rect_clip_scaled_signed_vs_unsigned(struct kunit *test) · line 224
Quoted 9 lines
drivers/gpu/drm/tests/drm_rect_test.c +9
-0+*/ +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.
drivers/gpu/drm/tests/drm_rect_test.c static void drm_test_rect_clip_scaled_signed_vs_unsigned(struct kunit *test) · line 233
Quoted 9 lines
drivers/gpu/drm/tests/drm_rect_test.c +4
-0+} + +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
Quoted 3 lines
drivers/gpu/drm/tests/drm_rect_test.c +0
-0{ } };