From 6c68c30ef88187a08ec6dff2d77eb07f26eb48c8 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 29 Oct 2018 19:37:29 +0000 Subject: igt/gem_ppgtt: Unroll 32b memset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: MichaƂ Winiarski --- tests/i915/gem_ppgtt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/i915/gem_ppgtt.c') 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; -- cgit v1.2.3