[igt-dev] [PATCH i-g-t 09/93] lib: Add an intel_ctx wrapper struct and helpers (v5)

Dixit, Ashutosh ashutosh.dixit at intel.com
Thu Jun 10 05:12:48 UTC 2021


On Wed, 09 Jun 2021 10:35:52 -0700, Jason Ekstrand wrote:
>
> diff --git a/lib/intel_ctx.c b/lib/intel_ctx.c
>
> +/**
> + * SECTION:intel_ctx
> + * @short_description: Wrapper structs for dealing with contexts
> + * @title: Intel Context Wrapper
> + *
> + * This helper library contains a couple of wrapper structs for easier
> + * dealing with GEM contexts.  This includes a context configuration struct
> + * which represents important context construction parameters and a context
> + * struct which contains the context ID and its configuration.  This makes
> + * it easier to pass around a context without loosing the context create

losing

Running kernel checkpatch on IGT patches shows interesting things including
a free spell-check :)

> +static const intel_ctx_t __intel_ctx_0 = {};
> +
> +/**
> + * intel_ctx_0:
> + * @fd: open i915 drm file descriptor
> + *
> + * Returns an intel_ctx_t representing the default context.
> + */
> +const intel_ctx_t *intel_ctx_0(int fd)
> +{
> +	(void)fd;
> +	return &__intel_ctx_0;
> +}

OK, so this really is just a "representation" of ctx 0 since num_engines
etc. are not what they are for the actual ctx 0 (even with just the legacy
engines).

> diff --git a/lib/intel_ctx.h b/lib/intel_ctx.h
> new file mode 100644
> index 00000000..3e059478
> --- /dev/null
> +++ b/lib/intel_ctx.h
> @@ -0,0 +1,57 @@
> +// SPDX-License-Identifier: MIT

Annoyingly the comment style for source and header files are actually a bit
different:

https://www.kernel.org/doc/html/v4.18/process/license-rules.html#license-identifier-syntax


More information about the igt-dev mailing list