[igt-dev] [RFT v4 3/6] igt/lib: Add wrapper to check if gtt mapping is available

Katarzyna Dec katarzyna.dec at intel.com
Tue Apr 16 13:25:28 UTC 2019


Sorry Antonio for entering this patchset discussion so late :).

On Mon, Mar 25, 2019 at 04:20:40PM -0700, Antonio Argenziano wrote:
> Add wrapper to get mmap_gtt version number and another to check if
> gtt mapping is at all available.
> 
> v2:
> 	- Check errno only after failed syscall. (Chris)
> 
> Cc: Katarzyna Dec <katarzyna.dec at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld at intel.com>
> Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> ---
>  lib/i915/gem_mman.c | 40 +++++++++++++++++++++++++++++++++++++++-
>  lib/i915/gem_mman.h | 11 +++++++++++
>  2 files changed, 50 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
> index 429de912..4d41a66d 100644
> --- a/lib/i915/gem_mman.c
> +++ b/lib/i915/gem_mman.c
> @@ -40,6 +40,41 @@
>  #define VG(x) do {} while (0)
>  #endif
>  
> +/**
> + * gem_mmap__gtt_version:
> + * @fd: open i915 drm file descriptor
> + *
> + * This wraps I915_PARAM_MMAP_GTT_VERSION. It will return the supported feature
> + * set for gtt mapping. Since the mappable aperture in not always present, this
> + * function will return '-1' in case there is none.
> + */
This doc is explicit enough, although I would prefer to unify it with the rest
of the file - 'Returns' section is missing.
> +static int gem_mmap__gtt_version(int fd)
> +{
> +	static int gtt_version = ~0;
What is the reason that you are using '~0' value here and not -1?
> +
> +	if (gtt_version == ~0) {

Kasia :)


More information about the igt-dev mailing list