[PATCH i-g-t] lib/gem_mman: Stop lying about I915_MMAP_OFFSET_GTT support

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Oct 11 08:21:47 UTC 2024


Hi Janusz,
On 2024-10-10 at 15:49:06 +0200, Janusz Krzysztofik wrote:
> A few tests depend on for_each_mmap_offset_type() helper used for
> selection of device supported mmap_offset types in loops either around
> dynamic sub-subtests or inside subtest bodies.  That helper in turn
> calls gem_has_mmap_offset_type() to omit unsupported mmap_offset types.
> Unfortunately, its code returns GTT as supported mmap_offset type also on
> new platforms that no longer support that type.  Poorly coded subtests may
> than take unexpected processing paths and return unexpected results that
> are not easy to understand and explain.
> 
> Fix it.
> 
> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11370
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>

LGTM,
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
>  lib/i915/gem_mman.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
> index 0b41ba70dd..cd0c65e213 100644
> --- a/lib/i915/gem_mman.c
> +++ b/lib/i915/gem_mman.c
> @@ -90,6 +90,8 @@ bool gem_has_mmap_offset_type(int fd, const struct mmap_offset *t)
>  	if (gem_has_mmap_offset(fd))
>  		if (gem_has_lmem(fd))
>  			return t->type == I915_MMAP_OFFSET_FIXED;
> +		else if (t->type == I915_MMAP_OFFSET_GTT)
> +			return gem_has_mappable_ggtt(fd);
>  		else
>  			return t->type != I915_MMAP_OFFSET_FIXED;
>  	else
> -- 
> 2.46.2
> 


More information about the Intel-gfx mailing list