[igt-dev] [PATCH i-g-t] igt/gem_ppgtt: Unroll 32b memset

Michał Winiarski michal.winiarski at intel.com
Wed Oct 31 09:12:15 UTC 2018


On Mon, Oct 29, 2018 at 07:37:29PM +0000, Chris Wilson wrote:
> Manually unroll the 32b memset in create_bo() to set a cacheline at a
> time, for a 2x speed improve of the whole test.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

Reviewed-by: Michał Winiarski <michal.winiarski at intel.com>

-Michał

> ---
>  tests/i915/gem_ppgtt.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/i915/gem_ppgtt.c b/tests/i915/gem_ppgtt.c
> index af5e3e07..86fe59f2 100644
> --- a/tests/i915/gem_ppgtt.c
> +++ b/tests/i915/gem_ppgtt.c
> @@ -47,16 +47,20 @@
>  static drm_intel_bo *create_bo(drm_intel_bufmgr *bufmgr,
>  			       uint32_t pixel)
>  {
> +	uint64_t value = (uint64_t)pixel << 32 | pixel, *v;
>  	drm_intel_bo *bo;
> -	uint32_t *v;
>  
>  	bo = drm_intel_bo_alloc(bufmgr, "surface", SIZE, 4096);
>  	igt_assert(bo);
>  
>  	do_or_die(drm_intel_bo_map(bo, 1));
>  	v = bo->virtual;
> -	for (int i = 0; i < SIZE/4; i++)
> -		v[i] = pixel;
> +	for (int i = 0; i < SIZE / sizeof(value); i += 8) {
> +		v[i + 0] = value; v[i + 1] = value;
> +		v[i + 2] = value; v[i + 3] = value;
> +		v[i + 4] = value; v[i + 5] = value;
> +		v[i + 6] = value; v[i + 7] = value;
> +	}
>  	drm_intel_bo_unmap(bo);
>  
>  	return bo;
> -- 
> 2.19.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list