Re: [PATCH] drm/format_helper: Add Kunit tests for drm_fb_xrgb8888_to_mono()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Arthur,

Thanks a lot for your patch!

Arthur Grillo <arthurgrillo@xxxxxxxxxx> writes:

> Extend the existing test cases to test the conversion from XRGB8888 to
> monochromatic.
>
> Signed-off-by: Arthur Grillo <arthurgrillo@xxxxxxxxxx>
> ---

[...]

> +static size_t conversion_buf_size_mono(unsigned int dst_pitch, const struct drm_rect *clip)
> +{
> +	if (!dst_pitch) {
> +		unsigned int linepixels = drm_rect_width(clip) * 1;
> +
> +		dst_pitch = DIV_ROUND_UP(linepixels, 8);
> +	}
> +
> +	return dst_pitch * drm_rect_height(clip);
> +}
> +

I don't think you need a new helper only for this. There are other
formats that have sub-byte pixels, so you may want to instead make
the existing conversion_buf_size() function more general.

Could you please base on the following patch that I just posted?

https://lists.freedesktop.org/archives/dri-devel/2023-March/394466.html

I believe with that you should be able to drop this format specific
helper and just use the fourcc DRM_FORMAT_C1 instead.

[...]

>  
> +static void drm_test_fb_xrgb8888_to_mono(struct kunit *test)
> +{
> +	const struct convert_xrgb8888_case *params = test->param_value;
> +	const struct convert_to_mono_result *result = &params->mono_result;
> +	size_t dst_size;
> +	u8 *buf = NULL;
> +	__le32 *xrgb8888 = NULL;
> +	struct iosys_map dst, src;
> +
> +	struct drm_framebuffer fb = {
> +		.format = drm_format_info(DRM_FORMAT_XRGB8888),
> +		.pitches = { params->pitch, 0, 0 },
> +	};
> +
> +	dst_size = conversion_buf_size_mono(result->dst_pitch, &params->clip);
> +

Then here you could just do:

	dst_size = conversion_buf_size(DRM_FORMAT_C1, result->dst_pitch,
				       &params->clip);

If you do that, feel free to add:

Reviewed-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux