[igt-dev] [RFC 2/5] lib/ioctl_wrappers: add mmap_offset support

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 21 19:47:59 UTC 2019


Quoting Antonio Argenziano (2019-02-21 19:27:42)
> From: "Kalamarz, Lukasz" <lukasz.kalamarz at intel.com>
> 
> With recently proposed changes, IGT need to start supporting new
> way of mmaping object, which will be used from now by default.
> This patch modify gem_mmap_wc and gem_mmap functions to be
> in sync with those changes.
> 
> Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz at intel.com>
> Cc: Janulgue Abdiel <abdiel.janulgue at intel.com>
> Cc: Matthew Auld <matthew.auld at intel.com>
> Cc: Michal Winiarski <michal.winiarski at intel.com>
> Cc: Antonio Argenziano <antonio.argenziano at intel.com>
> Cc: Daniele Spurio Ceraolo <daniele.ceraolospurio at intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> ---
>  lib/ioctl_wrappers.c | 150 +++++++++++++++++++++++++++++++++++++------
>  1 file changed, 129 insertions(+), 21 deletions(-)
> 
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index 404c2fbf..d9b46088 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -641,6 +641,24 @@ void gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
>         igt_assert_eq(__gem_execbuf_wr(fd, execbuf), 0);
>  }
>  
> +static bool has_mmap_offset(int fd)
> +{
> +       static int has_mmap_offset = -1;

a) nothing new in ioctl_wrappers, please

b) do not repeat the mistakes of using static, assuming all fd are the
same. Just don't call has_mmap_offset() more than is strictly required.
-Chris


More information about the igt-dev mailing list