public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Liviu Dudau <liviu.dudau@arm.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: IGT GPU Tools <igt-dev@lists.freedesktop.org>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Intel GFX ML <intel-gfx@lists.freedesktop.org>,
	Brian Starkey <brian.starkey@arm.com>
Subject: Re: [igt-dev] [Intel-gfx] [PATCH i-g-t v5 3/6] lib: Add function to hash a framebuffer
Date: Wed, 16 Jan 2019 11:20:09 +0000	[thread overview]
Message-ID: <20190116112009.GZ20661@e110455-lin.cambridge.arm.com> (raw)
In-Reply-To: <154757805730.30063.1853125668491466900@skylake-alporthouse-com>

On Tue, Jan 15, 2019 at 06:47:47PM +0000, Chris Wilson wrote:
> Quoting Liviu Dudau (2019-01-15 17:47:44)
> > +int igt_fb_get_crc(struct igt_fb *fb, igt_crc_t *crc)
> > +{
> > +#define FNV1a_OFFSET_BIAS 2166136261
> > +#define FNV1a_PRIME 16777619
> > +       uint32_t hash;
> > +       void *map;
> > +       char *ptr, *line = NULL;
> > +       int x, y, cpp = igt_drm_format_to_bpp(fb->drm_format) / 8;
> > +       uint32_t stride = calc_plane_stride(fb, 0);
> > +
> > +       if (fb->is_dumb)
> > +               map = kmstest_dumb_map_buffer(fb->fd, fb->gem_handle, fb->size,
> > +                                             PROT_READ);
> > +       else
> > +               map = gem_mmap__gtt(fb->fd, fb->gem_handle, fb->size,
> > +                                   PROT_READ);
> > +       ptr = map;
> > +
> > +       /*
> > +        * Framebuffers are often uncached, which can make byte-wise accesses
> > +        * very slow. We copy each line of the FB into a local buffer to speed
> > +        * up the hashing.
> > +        */
> > +       line = malloc(stride);
> > +       if (!line) {
> > +               munmap(map, fb->size);
> > +               return -ENOMEM;
> > +       }
> > +
> > +       hash = FNV1a_OFFSET_BIAS;
> > +
> > +       for (y = 0; y < fb->height; y++, ptr += stride) {
> > +
> > +               memcpy(line, ptr, stride);
> 
> igt_memcpy_from_wc() for the reasons cited above.
> -Chris

Hi Chris,

Thanks for pointing out the function, I was not aware of it!

Now, looking at the implementation, and ignoring the fact that it is in a
file called igt_x86.c, it looks to me that it will end up calling memcpy
anyway for Arm drivers. Not being a GCC expert, I am wondering if the
ifunc() wrapper around resolve_memcpy_from_wc() will not actually
prevent the compiler from choosing an optimised version of memcpy for Arm.

I can refresh the patch if you think it is safe to use igt_memcpy_from_wc() for
non-x86 architectures.

Best regards,
Liviu

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-01-16 11:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 17:47 [igt-dev] [PATCH i-g-t v5 0/6] igt: Add support for testing writeback connectors Liviu Dudau
2019-01-15 17:47 ` [igt-dev] [PATCH i-g-t v5 1/6] lib/igt_kms: Add writeback support Liviu Dudau
2019-02-04 13:31   ` [Intel-gfx] " Brian Starkey
2019-03-06 21:30     ` [Intel-gfx] [igt-dev] " Rodrigo Siqueira
2019-03-18 10:41       ` Liviu Dudau
2019-03-18 22:05         ` Rodrigo Siqueira
2019-03-20 14:46           ` Liviu Dudau
2019-01-15 17:47 ` [igt-dev] [PATCH i-g-t v5 2/6] kms_writeback: Add initial writeback tests Liviu Dudau
2019-01-15 17:47 ` [Intel-gfx] [PATCH i-g-t v5 3/6] lib: Add function to hash a framebuffer Liviu Dudau
2019-01-15 18:47   ` [igt-dev] " Chris Wilson
2019-01-16 11:20     ` Liviu Dudau [this message]
2019-01-16 11:50       ` Chris Wilson
2019-01-16 12:21     ` [igt-dev] [PATCH i-g-t v6] " Liviu Dudau
2019-01-15 17:47 ` [igt-dev] [PATCH i-g-t v5 4/6] kms_writeback: Add writeback-check-output Liviu Dudau
2019-01-15 17:47 ` [igt-dev] [PATCH i-g-t v5 5/6] lib/igt_kms: Add igt_output_clone_pipe for cloning Liviu Dudau
2019-02-04 13:27   ` Brian Starkey
2019-01-15 17:47 ` [igt-dev] [PATCH i-g-t v5 6/6] kms_writeback: Add tests using a cloned output Liviu Dudau
2019-01-15 19:08 ` [igt-dev] ✓ Fi.CI.BAT: success for igt: Add support for testing writeback connectors (rev3) Patchwork
2019-01-16  0:13 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-01-16 12:41 ` [igt-dev] ✗ Fi.CI.BAT: failure for igt: Add support for testing writeback connectors (rev4) Patchwork
2019-02-04 13:36 ` [igt-dev] [PATCH i-g-t v5 0/6] igt: Add support for testing writeback connectors Brian Starkey
2019-03-06 21:42 ` [igt-dev] ✗ Fi.CI.BAT: failure for igt: Add support for testing writeback connectors (rev5) 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=20190116112009.GZ20661@e110455-lin.cambridge.arm.com \
    --to=liviu.dudau@arm.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=brian.starkey@arm.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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