[PATCH 5/6] drm/format-helper-test: Add multi-plane support to conversion_buf_size()

Maira Canal mairacanal at riseup.net
Sat Aug 5 13:22:54 UTC 2023


On 7/21/23 15:23, Arthur Grillo wrote:
> The drm_fb_memcpy() supports multi-plane formats. To fully test it in
> the future, add multi-plane support to the conversion_buf_size() helper.
> 
> Signed-off-by: Arthur Grillo <arthurgrillo at riseup.net>

Reviewed-by: Maíra Canal <mairacanal at riseup.net>

Best Regards,
- Maíra

> ---
>   .../gpu/drm/tests/drm_format_helper_test.c    | 28 +++++++++----------
>   1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c b/drivers/gpu/drm/tests/drm_format_helper_test.c
> index de4677868647..6ecd92898e8e 100644
> --- a/drivers/gpu/drm/tests/drm_format_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c
> @@ -472,7 +472,7 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = {
>    * The size of the destination buffer or negative value on error.
>    */
>   static size_t conversion_buf_size(u32 dst_format, unsigned int dst_pitch,
> -				  const struct drm_rect *clip)
> +				  const struct drm_rect *clip, int plane)
>   {
>   	const struct drm_format_info *dst_fi = drm_format_info(dst_format);
>   
> @@ -480,7 +480,7 @@ static size_t conversion_buf_size(u32 dst_format, unsigned int dst_pitch,
>   		return -EINVAL;
>   
>   	if (!dst_pitch)
> -		dst_pitch = drm_format_info_min_pitch(dst_fi, 0, drm_rect_width(clip));
> +		dst_pitch = drm_format_info_min_pitch(dst_fi, plane, drm_rect_width(clip));
>   
>   	return dst_pitch * drm_rect_height(clip);
>   }
> @@ -554,7 +554,7 @@ static void drm_test_fb_xrgb8888_to_gray8(struct kunit *test)
>   	};
>   
>   	dst_size = conversion_buf_size(DRM_FORMAT_R8, result->dst_pitch,
> -				       &params->clip);
> +				       &params->clip, 0);
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   
>   	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
> @@ -587,7 +587,7 @@ static void drm_test_fb_xrgb8888_to_rgb332(struct kunit *test)
>   	};
>   
>   	dst_size = conversion_buf_size(DRM_FORMAT_RGB332, result->dst_pitch,
> -				       &params->clip);
> +				       &params->clip, 0);
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   
>   	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
> @@ -620,7 +620,7 @@ static void drm_test_fb_xrgb8888_to_rgb565(struct kunit *test)
>   	};
>   
>   	dst_size = conversion_buf_size(DRM_FORMAT_RGB565, result->dst_pitch,
> -				       &params->clip);
> +				       &params->clip, 0);
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   
>   	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
> @@ -663,7 +663,7 @@ static void drm_test_fb_xrgb8888_to_xrgb1555(struct kunit *test)
>   	};
>   
>   	dst_size = conversion_buf_size(DRM_FORMAT_XRGB1555, result->dst_pitch,
> -				       &params->clip);
> +				       &params->clip, 0);
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   
>   	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
> @@ -697,7 +697,7 @@ static void drm_test_fb_xrgb8888_to_argb1555(struct kunit *test)
>   	};
>   
>   	dst_size = conversion_buf_size(DRM_FORMAT_ARGB1555, result->dst_pitch,
> -				       &params->clip);
> +				       &params->clip, 0);
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   
>   	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
> @@ -731,7 +731,7 @@ static void drm_test_fb_xrgb8888_to_rgba5551(struct kunit *test)
>   	};
>   
>   	dst_size = conversion_buf_size(DRM_FORMAT_RGBA5551, result->dst_pitch,
> -				       &params->clip);
> +				       &params->clip, 0);
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   
>   	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
> @@ -765,7 +765,7 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)
>   	};
>   
>   	dst_size = conversion_buf_size(DRM_FORMAT_RGB888, result->dst_pitch,
> -				       &params->clip);
> +				       &params->clip, 0);
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   
>   	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
> @@ -803,7 +803,7 @@ static void drm_test_fb_xrgb8888_to_argb8888(struct kunit *test)
>   	};
>   
>   	dst_size = conversion_buf_size(DRM_FORMAT_ARGB8888,
> -				       result->dst_pitch, &params->clip);
> +				       result->dst_pitch, &params->clip, 0);
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   
>   	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
> @@ -838,7 +838,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)
>   	};
>   
>   	dst_size = conversion_buf_size(DRM_FORMAT_XRGB2101010,
> -				       result->dst_pitch, &params->clip);
> +				       result->dst_pitch, &params->clip, 0);
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   
>   	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
> @@ -872,7 +872,7 @@ static void drm_test_fb_xrgb8888_to_argb2101010(struct kunit *test)
>   	};
>   
>   	dst_size = conversion_buf_size(DRM_FORMAT_ARGB2101010,
> -				       result->dst_pitch, &params->clip);
> +				       result->dst_pitch, &params->clip, 0);
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   
>   	buf = kunit_kzalloc(test, dst_size, GFP_KERNEL);
> @@ -906,7 +906,7 @@ static void drm_test_fb_xrgb8888_to_mono(struct kunit *test)
>   		.pitches = { params->pitch, 0, 0 },
>   	};
>   
> -	dst_size = conversion_buf_size(DRM_FORMAT_C1, result->dst_pitch, &params->clip);
> +	dst_size = conversion_buf_size(DRM_FORMAT_C1, result->dst_pitch, &params->clip, 0);
>   
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   
> @@ -939,7 +939,7 @@ static void drm_test_fb_swab(struct kunit *test)
>   		.pitches = { params->pitch, 0, 0 },
>   	};
>   
> -	dst_size = conversion_buf_size(DRM_FORMAT_XRGB8888, result->dst_pitch, &params->clip);
> +	dst_size = conversion_buf_size(DRM_FORMAT_XRGB8888, result->dst_pitch, &params->clip, 0);
>   
>   	KUNIT_ASSERT_GT(test, dst_size, 0);
>   


More information about the dri-devel mailing list