[Intel-gfx] [PATCH i-g-t] test/gem_mocs_settings: Testing MOCS register settings

Chris Wilson chris at chris-wilson.co.uk
Mon Apr 4 13:52:31 UTC 2016


On Mon, Apr 04, 2016 at 02:43:08PM +0100, Peter Antoine wrote:
> +static void run_test(int fd, unsigned mode)
> +{
> +	const int gen = intel_gen(intel_get_drm_devid(fd));
> +	const struct intel_execution_engine *e;
> +
> +	igt_require(gen >= 9);
> +
> +	test_mocs_values(fd);
> +
> +	switch(mode) {
> +	case NONE:	break;
> +	case RESET:	igt_force_gpu_reset();	break;
> +	case SUSPEND:	igt_system_suspend_autoresume(); break;
> +	case HIBERNATE:	igt_system_hibernate_autoresume(); break;
> +	};
> +
> +	/*
> +	 * Do render after other engines as older versions of code will
> +	 * cause the RCS context to program the registers and the test
> +	 * becomes invalid
> +	 */

If you defer fd allocation to here, then that is moot, as we can create
the fd for each test and be sure that the default context is
uninitialised.

> +	for (e = intel_execution_engines; e->name; e++)
> +		if (e->exec_id != I915_EXEC_DEFAULT &&
> +		    e->exec_id != I915_EXEC_RENDER &&
> +		    gem_has_ring(fd, e->exec_id | e->flags))
> +			test_context_mocs_values(fd, e, true);
> +
> +	for (e = intel_execution_engines; e->name; e++)
> +		if (e->exec_id == I915_EXEC_RENDER &&
> +		    gem_has_ring(fd, e->exec_id | e->flags)) {
> +			test_context_mocs_values(fd, e, true);
> +			test_context_mocs_values(fd, e, false);
> +		}

As well as checking for creating new contexts after resume, we also need
to check that the register values are preserved across suspend (i.e.
that the register state is being saved back into the context image and
then restored).

If we get truly paranoid (and why not?!) then we can create a pair of
contexts, change the register values in one and verify that the second
context is unaffected.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list