[igt-dev] [PATCH igt v6] lib: Provide an accelerated routine for readback from WC

Chris Wilson chris at chris-wilson.co.uk
Thu Mar 1 08:43:59 UTC 2018


Quoting Ville Syrjälä (2018-02-28 17:12:44)
> On Wed, Feb 28, 2018 at 09:00:16AM +0000, Chris Wilson wrote:
> > +#if defined(__x86_64__) && !defined(__clang__)
> > +#define MOVNT 512
> 
> What's this MOVNT define?

I can't remember. I presume I was thinking about hooking it up to a
detection bit. But 512? Definitely copied that from somewhere.

> > +#pragma GCC push_options
> > +#pragma GCC target("sse4.1")
> > +#pragma GCC diagnostic ignored "-Wpointer-arith"
> > +
> > +#define min(x, y) ({                            \
> > +     typeof(x) _min1 = (x);                  \
> > +     typeof(y) _min2 = (y);                  \
> > +     (void) (&_min1 == &_min2);              \
> > +     _min1 < _min2 ? _min1 : _min2;          \
> > +})
> 
> igt_aux.h has this already I believe.

Missed it, thanks. I just wasn't expecting it or MIN to be undefined.

> > +#include <smmintrin.h>
> > +static void memcpy_from_wc_sse41(void *dst, const void *src, unsigned long len)
> > +{
> > +     char buf[16];
> > +
> > +     /* Flush the internal buffer of potential stale gfx data */
> > +     __builtin_ia32_mfence();
> 
> Isn't there a _mm_mfence()?

If you remember there's only one '_', yes, apparently there is.

> Apart from those everything looks all right to me.
> Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Thanks,
-Chris


More information about the igt-dev mailing list