[igt-dev] [PATCH i-g-t 19/77] tests/gem_exec_whisper: Convert to intel_ctx_t

Dixit, Ashutosh ashutosh.dixit at intel.com
Thu Jun 17 02:17:38 UTC 2021


On Mon, 14 Jun 2021 09:36:34 -0700, Jason Ekstrand wrote:
>
> @@ -98,6 +101,13 @@ static void init_hang(struct hang *h, int fd)
>
>	gen = intel_gen(intel_get_drm_devid(h->fd));
>
> +	if (gem_has_contexts(fd)) {
> +		h->ctx = intel_ctx_create(h->fd, cfg);

Probably could submit against the ctx passed into whisper(), but probably
doesn't matter so should be ok.

> @@ -221,10 +234,10 @@ static void whisper(int fd, unsigned engine, unsigned flags)
>		gem_require_contexts(fd);
>
>	if (flags & QUEUES)
> -		igt_require(gem_has_queues(fd));
> +		igt_require(gem_has_vm(fd));

Don't need to check for I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE support here?

> @@ -294,18 +308,20 @@ static void whisper(int fd, unsigned engine, unsigned flags)
>		igt_assert(loc == sizeof(uint32_t) * i);
>		batch[++i] = MI_BATCH_BUFFER_END;
>
> -		if (flags & CONTEXTS) {
> -			for (n = 0; n < 64; n++)
> -				contexts[n] = gem_context_clone_with_engines(fd, 0);
> -		}
> -		if (flags & QUEUES) {
> -			for (n = 0; n < 64; n++)
> -				contexts[n] = gem_queue_create(fd);
> -		}
>		if (flags & FDS) {
>			for (n = 0; n < 64; n++) {
>				fds[n] = gem_reopen_driver(fd);
> -				gem_context_copy_engines(fd, 0, fds[n], 0);
> +			}
> +		}
> +		if (flags & (CONTEXTS | QUEUES | FDS)) {
> +			local_cfg = ctx->cfg;
> +			if (flags & QUEUES) {
> +				igt_assert(!(flags & FDS));

Is this assert needed, what is the reason for it?

> +				local_cfg.vm = gem_vm_create(fd);

Don't need to handle I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE here (so
that contexts share a timeline)?

> +			}
> +			for (n = 0; n < 64; n++) {
> +				int this_fd = (flags & FDS) ? fds[n] : fd;
> +				contexts[n] = intel_ctx_create(this_fd, &local_cfg);
>			}
>		}


More information about the igt-dev mailing list