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

Antonio Argenziano antonio.argenziano at intel.com
Tue Feb 26 18:44:17 UTC 2019



On 26/02/19 10:29, Chris Wilson wrote:
> 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?

How about: make the variable not static and remove the if?

> 
> 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 :)

OK, there isn't really much in gem_mman, I'll add a patch before this 
one to remove what is there and not add this here.

Antonio

> 
>> +
>> +       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