Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pekka Paalanen <ppaalanen@gmail.com>
To: Maxime Ripard <maxime@cerno.tech>
Cc: igt-dev@lists.freedesktop.org, Petri Latvala <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t v3 1/3] tests/kms_writeback: Use endianness accessor to fill pixels
Date: Tue, 28 Jun 2022 13:24:19 +0300	[thread overview]
Message-ID: <20220628132419.47ac8742@eldfell> (raw)
In-Reply-To: <20220610121647.975942-2-maxime@cerno.tech>

[-- Attachment #1: Type: text/plain, Size: 2123 bytes --]

On Fri, 10 Jun 2022 14:16:45 +0200
Maxime Ripard <maxime@cerno.tech> wrote:

> The fill_fb() function in the kms_writeback test suite will fill an
> XRGB8888 buffer using a pattern passed an an argument. However, the
> pattern is native endian, while XRGB8888 is little-endian.
> 
> Add an accessor and use it to fill the framebuffer with our pattern.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  lib/igt_core.h        | 9 +++++++++
>  tests/kms_writeback.c | 2 +-
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index 526282faff24..aa98e8ed8deb 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -31,6 +31,7 @@
>  #define IGT_CORE_H
>  
>  #include <assert.h>
> +#include <byteswap.h>
>  #include <setjmp.h>
>  #include <stdbool.h>
>  #include <stdint.h>
> @@ -1447,6 +1448,14 @@ void igt_kmsg(const char *format, ...);
>  #define READ_ONCE(x) (*(volatile typeof(x) *)(&(x)))
>  #define WRITE_ONCE(x, v) do *(volatile typeof(x) *)(&(x)) = (v); while (0)
>  
> +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
> +#define cpu_to_le32(x)  bswap_32(x)
> +#define le32_to_cpu(x)  bswap_32(x)
> +#else
> +#define cpu_to_le32(x)  (x)
> +#define le32_to_cpu(x)  (x)
> +#endif
> +

The explanation makes sense and these macros look right.

>  #define MSEC_PER_SEC (1000)
>  #define USEC_PER_SEC (1000*MSEC_PER_SEC)
>  #define NSEC_PER_SEC (1000*USEC_PER_SEC)
> diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
> index 6efc72df4327..cf70a28e7d56 100644
> --- a/tests/kms_writeback.c
> +++ b/tests/kms_writeback.c
> @@ -244,7 +244,7 @@ static void fill_fb(igt_fb_t *fb, uint32_t pixel)
>  
>  	pixel_count = fb->strides[0] * fb->height / sizeof(uint32_t);
>  	for (i = 0; i < pixel_count; i++)
> -		ptr[i] = pixel;
> +		ptr[i] = cpu_to_le32(pixel);
>  
>  	igt_fb_unmap_buffer(fb, ptr);
>  }

There just isn't enough context in this patch to see if this is
correct, but at least it matches the commit message.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>


Thanks,
pq

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-06-28 10:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10 12:16 [igt-dev] [PATCH i-g-t v3 0/3] Writeback fixes and improvements Maxime Ripard
2022-06-10 12:16 ` [igt-dev] [PATCH i-g-t v3 1/3] tests/kms_writeback: Use endianness accessor to fill pixels Maxime Ripard
2022-06-28 10:24   ` Pekka Paalanen [this message]
2022-06-10 12:16 ` [igt-dev] [PATCH i-g-t v3 2/3] lib/igt_fb: Ignore the X component when computing CRC Maxime Ripard
2022-06-10 12:16 ` [igt-dev] [PATCH i-g-t v3 3/3] tests/kms_writeback: Use a garbage X value to create fill our test buffer Maxime Ripard
2022-06-10 17:12 ` [igt-dev] ✓ Fi.CI.BAT: success for Writeback fixes and improvements (rev3) Patchwork
2022-06-14 18:24 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20220628132419.47ac8742@eldfell \
    --to=ppaalanen@gmail.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=maxime@cerno.tech \
    --cc=petri.latvala@intel.com \
    /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