[Intel-gfx] [PATCH i-g-t] igt/gem_exec_nop/headless: Verify GT performance in headless mode

Imre Deak imre.deak at intel.com
Thu Apr 13 14:52:54 UTC 2017


On Thu, Apr 13, 2017 at 02:14:17PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Check that no-op execution speed is the same in headless mode
> and with the display active.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100572
> Cc: Imre Deak <imre.deak at intel.com>
> ---
>  tests/gem_exec_nop.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
> 
> diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
> index 5d0d4957545e..e0e53a3108c6 100644
> --- a/tests/gem_exec_nop.c
> +++ b/tests/gem_exec_nop.c
> @@ -112,6 +112,45 @@ static void single(int fd, uint32_t handle,
>  		 ring_name, count, time*1e6 / count);
>  }
>  
> +static void headless(int fd, uint32_t handle)
> +{
> +	const struct intel_execution_engine *e = &intel_execution_engines[0];
> +	unsigned int nr_connected = 0;
> +	drmModeConnector *connector;
> +	drmModeRes *res;
> +	unsigned long n1, n2;
> +	double delta;
> +
> +	res = drmModeGetResources(fd);
> +	igt_assert(res);
> +
> +	/* require one connected connector for the test */
> +	for (int i = 0; i < res->count_connectors; i++) {
> +		connector = drmModeGetConnectorCurrent(fd, res->connectors[i]);
> +		if (connector->connection == DRM_MODE_CONNECTED)
> +			nr_connected++;
> +		drmModeFreeConnector(connector);
> +	}
> +	igt_require(nr_connected == 1);

You could do an actual modeset in case fbcon is not configured.
Also need to call kmstest_set_vt_graphics_mode() to prevent blanking. 
Otherwise the display part looks ok to me.

--Imre

> +
> +	/* warmup */
> +	nop_on_ring(fd, handle, e->exec_id | e->flags, 2, &n1);
> +	/* benchmark nops */
> +	nop_on_ring(fd, handle, e->exec_id | e->flags, 2, &n1);
> +
> +	/* force the last connector off */
> +	kmstest_unset_all_crtcs(fd, res);
> +
> +	/* warmup */
> +	nop_on_ring(fd, handle, e->exec_id | e->flags, 2, &n2);
> +	/* benchmark nops again */
> +	nop_on_ring(fd, handle, e->exec_id | e->flags, 2, &n2);
> +
> +	/* check that the two execution speeds are roughly the same */
> +	delta = abs((long)n2 - (long)n1);
> +	igt_assert(delta < n1 * 0.1f);
> +}
> +
>  static bool ignore_engine(int fd, unsigned engine)
>  {
>  	if (engine == 0)
> @@ -494,6 +533,9 @@ igt_main
>  	igt_subtest("context-sequential")
>  		sequential(device, handle, FORKED | CONTEXT, 150);
>  
> +	igt_subtest("headless")
> +		headless(device, handle);
> +
>  	igt_fixture {
>  		igt_stop_hang_detector();
>  		gem_close(device, handle);
> -- 
> 2.9.3
> 


More information about the Intel-gfx mailing list