[Intel-gfx] [PATCH i-g-t 1/2] tests/pm_rps: Replace custom load function with dummy load

Chris Wilson chris at chris-wilson.co.uk
Fri Feb 24 11:34:49 UTC 2017


On Fri, Feb 24, 2017 at 11:58:52AM +0100, Radoslaw Szwichtenberg wrote:
> There is no point in using custom function if there lib counterpart.
> 
> Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> Cc: Michal Winiarski <michal.winiarski at intel.com>
> Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg at intel.com>
> ---
>  tests/pm_rps.c | 79 +++++++++++-----------------------------------------------
>  1 file changed, 14 insertions(+), 65 deletions(-)
> 
> diff --git a/tests/pm_rps.c b/tests/pm_rps.c
> index 5a54d9d..7aa66a8 100644
> --- a/tests/pm_rps.c
> +++ b/tests/pm_rps.c
> @@ -560,58 +560,18 @@ static void reset_gpu(void)
>  	close(fd);
>  }
>  
> -static uint32_t *make_busy(int fd, uint32_t handle)
> +static void boost_freq(int fd, int *boost_freqs)
>  {
> -	const int gen = intel_gen(intel_get_drm_devid(fd));
> -	struct drm_i915_gem_exec_object2 obj;
> -	struct drm_i915_gem_relocation_entry reloc;
> -	struct drm_i915_gem_execbuffer2 execbuf;
> -	uint32_t *batch;
> -	int i;
> -
> -	memset(&execbuf, 0, sizeof(execbuf));
> -	execbuf.buffers_ptr = (uintptr_t)&obj;
> -	execbuf.buffer_count = 1;
> -
> -	memset(&obj, 0, sizeof(obj));
> -	obj.handle = handle;
> -
> -	obj.relocs_ptr = (uintptr_t)&reloc;
> -	obj.relocation_count = 1;
> -	memset(&reloc, 0, sizeof(reloc));
> -
> -	batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE);
> -	gem_set_domain(fd, obj.handle,
> -			I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
> -
> -	reloc.target_handle = obj.handle; /* recurse */
> -	reloc.presumed_offset = 0;
> -	reloc.offset = sizeof(uint32_t);
> -	reloc.delta = 0;
> -	reloc.read_domains = I915_GEM_DOMAIN_COMMAND;
> -	reloc.write_domain = 0;
> -
> -	i = 0;
> -	batch[i] = MI_BATCH_BUFFER_START;
> -	if (gen >= 8) {
> -		batch[i] |= 1 << 8 | 1;
> -		batch[++i] = 0;
> -		batch[++i] = 0;
> -	} else if (gen >= 6) {
> -		batch[i] |= 1 << 8;
> -		batch[++i] = 0;
> -	} else {
> -		batch[i] |= 2 << 6;
> -		batch[++i] = 0;
> -		if (gen < 4) {
> -			batch[i] |= 1;
> -			reloc.delta = 1;
> -		}
> -	}
> -	i++;
> +	int64_t timeout = 1;
> +	int ring = -1;
> +	igt_spin_t *load;
>  
> -	gem_execbuf(fd, &execbuf);
> -	return batch;
> +	load = igt_spin_batch_new(fd, ring, 0);
> +	gem_wait(fd, load->handle, &timeout);
> +	read_freqs(boost_freqs);
> +	dump(boost_freqs);
> +	igt_spin_batch_end(load);
> +	igt_spin_batch_free(fd, load);

Ok, couldn't spot a problem with the conversion, but a little whitespace
wouldn't go amiss. At least a comment to remind us that it is a
"feature" of waiting that grants us a bost.

igt_spin_batch_end is redundant as _free will do it for you.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list