[igt-dev] [PATCH i-g-t v3] lib/i915: Add mmap_offset support

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 26 18:29:58 UTC 2019


Quoting Antonio Argenziano (2019-02-26 18:23:53)
> +bool has_mmap_offset(int fd)

Prefix please.

> +{
> +       static int has_mmap_offset = -1;

What's our plan to avoiding the static?

I don't think we need the statics for these, as their use should be
limited to fixtures. Once plan has been decided upon, enact it for all
in gem_mman.c :)

> +
> +       if (has_mmap_offset == -1) {
> +               struct drm_i915_getparam gp;
> +
> +               has_mmap_offset = 0;
> +
> +               memset(&gp, 0, sizeof(gp));
> +               gp.param = 0x55; /* I915_PARAM_MMAP_OFFSET_VERSION */
> +               gp.value = &has_mmap_offset;
> +               ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
> +       }
> +
> +       return has_mmap_offset > 0;
> +}


More information about the igt-dev mailing list