dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "José Expósito" <jose.exposito89@gmail.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: javierm@redhat.com, mairacanal@riseup.net,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 03/13] drm/format-helper: Fix test-input format conversion
Date: Fri, 23 Dec 2022 13:38:23 +0100	[thread overview]
Message-ID: <Y6WhP2+pGh4fDFEh@fedora> (raw)
In-Reply-To: <20221220161145.27568-4-tzimmermann@suse.de>

On Tue, Dec 20, 2022 at 05:11:35PM +0100, Thomas Zimmermann wrote:
> Convert test input for format helpers from host byte order to
> little-endian order. The current code does it the other way around,
> but there's no effective difference to the result.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: José Expósito <jose.exposito89@gmail.com>

> ---
>  .../gpu/drm/tests/drm_format_helper_test.c    | 35 +++++++++++++------
>  1 file changed, 25 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c b/drivers/gpu/drm/tests/drm_format_helper_test.c
> index cd1d7da3483c..e7c49e6d3f6d 100644
> --- a/drivers/gpu/drm/tests/drm_format_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c
> @@ -279,6 +279,21 @@ static u32 *le32buf_to_cpu(struct kunit *test, const u32 *buf, size_t buf_size)
>  	return dst;
>  }
>  
> +static __le32 *cpubuf_to_le32(struct kunit *test, const u32 *buf, size_t buf_size)
> +{
> +	__le32 *dst = NULL;
> +	int n;
> +
> +	dst = kunit_kzalloc(test, sizeof(*dst) * buf_size, GFP_KERNEL);
> +	if (!dst)
> +		return NULL;
> +
> +	for (n = 0; n < buf_size; n++)
> +		dst[n] = cpu_to_le32(buf[n]);
> +
> +	return dst;
> +}
> +
>  static void convert_xrgb8888_case_desc(struct convert_xrgb8888_case *t,
>  				       char *desc)
>  {
> @@ -294,7 +309,7 @@ static void drm_test_fb_xrgb8888_to_gray8(struct kunit *test)
>  	const struct convert_to_gray8_result *result = &params->gray8_result;
>  	size_t dst_size;
>  	__u8 *buf = NULL;
> -	__u32 *xrgb8888 = NULL;
> +	__le32 *xrgb8888 = NULL;
>  	struct iosys_map dst, src;
>  
>  	struct drm_framebuffer fb = {
> @@ -310,7 +325,7 @@ static void drm_test_fb_xrgb8888_to_gray8(struct kunit *test)
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
>  	iosys_map_set_vaddr(&dst, buf);
>  
> -	xrgb8888 = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE);
> +	xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
>  	iosys_map_set_vaddr(&src, xrgb8888);
>  
> @@ -324,7 +339,7 @@ static void drm_test_fb_xrgb8888_to_rgb332(struct kunit *test)
>  	const struct convert_to_rgb332_result *result = &params->rgb332_result;
>  	size_t dst_size;
>  	__u8 *buf = NULL;
> -	__u32 *xrgb8888 = NULL;
> +	__le32 *xrgb8888 = NULL;
>  	struct iosys_map dst, src;
>  
>  	struct drm_framebuffer fb = {
> @@ -340,7 +355,7 @@ static void drm_test_fb_xrgb8888_to_rgb332(struct kunit *test)
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
>  	iosys_map_set_vaddr(&dst, buf);
>  
> -	xrgb8888 = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE);
> +	xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
>  	iosys_map_set_vaddr(&src, xrgb8888);
>  
> @@ -354,7 +369,7 @@ static void drm_test_fb_xrgb8888_to_rgb565(struct kunit *test)
>  	const struct convert_to_rgb565_result *result = &params->rgb565_result;
>  	size_t dst_size;
>  	__u16 *buf = NULL;
> -	__u32 *xrgb8888 = NULL;
> +	__le32 *xrgb8888 = NULL;
>  	struct iosys_map dst, src;
>  
>  	struct drm_framebuffer fb = {
> @@ -370,7 +385,7 @@ static void drm_test_fb_xrgb8888_to_rgb565(struct kunit *test)
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
>  	iosys_map_set_vaddr(&dst, buf);
>  
> -	xrgb8888 = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE);
> +	xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
>  	iosys_map_set_vaddr(&src, xrgb8888);
>  
> @@ -387,7 +402,7 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)
>  	const struct convert_to_rgb888_result *result = &params->rgb888_result;
>  	size_t dst_size;
>  	__u8 *buf = NULL;
> -	__u32 *xrgb8888 = NULL;
> +	__le32 *xrgb8888 = NULL;
>  	struct iosys_map dst, src;
>  
>  	struct drm_framebuffer fb = {
> @@ -403,7 +418,7 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
>  	iosys_map_set_vaddr(&dst, buf);
>  
> -	xrgb8888 = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE);
> +	xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
>  	iosys_map_set_vaddr(&src, xrgb8888);
>  
> @@ -421,7 +436,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)
>  	const struct convert_to_xrgb2101010_result *result = &params->xrgb2101010_result;
>  	size_t dst_size;
>  	__u32 *buf = NULL;
> -	__u32 *xrgb8888 = NULL;
> +	__le32 *xrgb8888 = NULL;
>  	struct iosys_map dst, src;
>  
>  	struct drm_framebuffer fb = {
> @@ -437,7 +452,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
>  	iosys_map_set_vaddr(&dst, buf);
>  
> -	xrgb8888 = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE);
> +	xrgb8888 = cpubuf_to_le32(test, params->xrgb8888, TEST_BUF_SIZE);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb8888);
>  	iosys_map_set_vaddr(&src, xrgb8888);
>  
> -- 
> 2.39.0
> 

  parent reply	other threads:[~2022-12-23 12:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-20 16:11 [PATCH v2 00/13] drm: Fix color-format selection in fbdev emulation Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 01/13] firmware/sysfb: Fix EFI/VESA format selection Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 02/13] drm/format-helper: Comment on RGB888 byte order Thomas Zimmermann
2022-12-21 19:30   ` Maíra Canal
2022-12-23 12:37   ` José Expósito
2022-12-20 16:11 ` [PATCH v2 03/13] drm/format-helper: Fix test-input format conversion Thomas Zimmermann
2022-12-21 19:40   ` Maíra Canal
2022-12-23 12:38   ` José Expósito [this message]
2022-12-20 16:11 ` [PATCH v2 04/13] drm/format-helper: Store RGB565 in little-endian order Thomas Zimmermann
2022-12-21 19:55   ` Maíra Canal
2022-12-23 12:39   ` José Expósito
2022-12-20 16:11 ` [PATCH v2 05/13] drm/format-helper: Type fixes in format-helper tests Thomas Zimmermann
2022-12-21 19:58   ` Maíra Canal
2022-12-23 12:40   ` José Expósito
2022-12-20 16:11 ` [PATCH v2 06/13] drm/format-helper: Flip src/dst-format branches in blit helper Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 07/13] drm/format-helper: Add conversion from XRGB8888 to ARGB8888 Thomas Zimmermann
2022-12-21 12:37   ` kernel test robot
2022-12-21 20:07   ` Maíra Canal
2023-01-02 10:00     ` Thomas Zimmermann
2022-12-23 12:44   ` José Expósito
2023-01-02 10:01     ` Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 08/13] drm/format-helper: Add conversion from XRGB8888 to ARGB2101010 Thomas Zimmermann
2022-12-23 12:45   ` José Expósito
2022-12-20 16:11 ` [PATCH v2 09/13] drm/format-helper: Add conversion from XRGB8888 to 15-bit RGB555 formats Thomas Zimmermann
2022-12-21 13:58   ` kernel test robot
2022-12-23 12:48   ` José Expósito
2022-12-20 16:11 ` [PATCH v2 10/13] drm/fh-helper: Split fbdev single-probe helper Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 11/13] drm/fb-helper: Fix single-probe color-format selection Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 12/13] drm/format-helper: Simplify drm_fb_build_fourcc_list() Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 13/13] drm/format-helper: Remove unnecessary conversion helpers Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y6WhP2+pGh4fDFEh@fedora \
    --to=jose.exposito89@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=mairacanal@riseup.net \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox