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 v2 7/8] lib/igt_fb: Ignore the X component when computing CRC
Date: Fri, 29 Apr 2022 15:58:29 +0300 [thread overview]
Message-ID: <20220429155829.71bd6eae@eldfell> (raw)
In-Reply-To: <20220328145509.2331195-8-maxime@cerno.tech>
[-- Attachment #1: Type: text/plain, Size: 2569 bytes --]
On Mon, 28 Mar 2022 16:55:08 +0200
Maxime Ripard <maxime@cerno.tech> wrote:
> The igt_fb_get_fnv1a_crc() function will compute a FNV-1a hash over the
> content of the framebuffer. The sole user of this function is the
> writeback test suite, which will use it to compare an XRGB8888 buffer
> used in input to an XRGB8888 buffer filled by the writeback connector.
>
> However, that function uses each bytes of each buffers to compute the
> hash, and therefore the writeback code assumes that the hardware will
> preserve the content of the X component through the writeback pipeline,
> which isn't true for all hardware. VC4 doesn't for example.
>
> Since that function is only ever used for XRGB8888 buffers, let's just
> set the most significant to 0 (which is the X padding) for each pixel
> when computing the hash, and thus ignore whatever the hardware will
> return here.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Yes, this is absolutely a requirement when handling any pixel format
with X-channel.
Thanks,
pq
> ---
> lib/igt_fb.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index eafbe7fd41cd..66c52bb83876 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -4392,15 +4392,19 @@ int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc)
> {
> const uint32_t FNV1a_OFFSET_BIAS = 2166136261;
> const uint32_t FNV1a_PRIME = 16777619;
> + uint32_t *line = NULL;
> uint32_t hash;
> void *map;
> - char *ptr, *line = NULL;
> + char *ptr;
> int x, y, cpp = igt_drm_format_to_bpp(fb->drm_format) / 8;
> uint32_t stride = calc_plane_stride(fb, 0);
>
> if (fb->num_planes != 1)
> return -EINVAL;
>
> + if (fb->drm_format != DRM_FORMAT_XRGB8888)
> + return -EINVAL;
> +
> ptr = igt_fb_map_buffer(fb->fd, fb);
> igt_assert(ptr);
> map = ptr;
> @@ -4422,9 +4426,17 @@ int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc)
>
> igt_memcpy_from_wc(line, ptr, fb->width * cpp);
>
> - for (x = 0; x < fb->width * cpp; x++) {
> - hash ^= line[x];
> - hash *= FNV1a_PRIME;
> + for (x = 0; x < fb->width; x++) {
> + unsigned int i;
> + uint32_t pixel = le32_to_cpu(line[x]);
> + pixel &= 0x00ffffff;
> +
> + for (i = 0; i < sizeof(pixel); i++) {
> + uint8_t component = (pixel >> (i * 8)) & 0xff;
> +
> + hash ^= component;
> + hash *= FNV1a_PRIME;
> + }
> }
> }
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-04-29 12:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-28 14:55 [igt-dev] [PATCH i-g-t v2 0/8] Writeback fixes and improvements Maxime Ripard
2022-03-28 14:55 ` [igt-dev] [PATCH i-g-t v2 1/8] lib/igt_frame: Rename summary fd variable Maxime Ripard
2022-03-28 14:55 ` [igt-dev] [PATCH i-g-t v2 2/8] lib/igt_frame: Move frame dump logging to function Maxime Ripard
2022-03-28 14:55 ` [igt-dev] [PATCH i-g-t v2 3/8] lib/igt_frame: Move frame path creation " Maxime Ripard
2022-03-28 14:55 ` [igt-dev] [PATCH i-g-t v2 4/8] lib/igt_frame: Add function to dump frames in RGB and raw Maxime Ripard
2022-04-29 12:46 ` Pekka Paalanen
2022-05-04 14:56 ` Maxime Ripard
2022-05-05 7:21 ` Pekka Paalanen
2022-03-28 14:55 ` [igt-dev] [PATCH i-g-t v2 5/8] tests/kms_writeback: Use endianness accessor to fill pixels Maxime Ripard
2022-03-28 14:55 ` [igt-dev] [PATCH i-g-t v2 6/8] tests/kms_writeback: Dump the frames if the don't match Maxime Ripard
2022-04-29 12:55 ` Pekka Paalanen
2022-05-04 14:57 ` Maxime Ripard
2022-03-28 14:55 ` [igt-dev] [PATCH i-g-t v2 7/8] lib/igt_fb: Ignore the X component when computing CRC Maxime Ripard
2022-04-29 12:58 ` Pekka Paalanen [this message]
2022-03-28 14:55 ` [igt-dev] [PATCH i-g-t v2 8/8] tests/kms_writeback: Use a garbage X value to create fill our test buffer Maxime Ripard
2022-04-29 13:01 ` Pekka Paalanen
2022-03-28 16:07 ` [igt-dev] ✓ Fi.CI.BAT: success for Writeback fixes and improvements (rev2) Patchwork
2022-03-28 19:08 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-03-30 7:30 ` Maxime Ripard
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=20220429155829.71bd6eae@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