From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>,
Matthew Auld <matthew.auld@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [i-g-t, V3] lib/i915: Use FIXED mapping only for discrete memory
Date: Tue, 31 Aug 2021 11:02:22 -0700 [thread overview]
Message-ID: <87fsupv6fl.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20210831060013.1215605-1-tejaskumarx.surendrakumar.upadhyay@intel.com>
On Mon, 30 Aug 2021 23:00:13 -0700, Tejas Upadhyay wrote:
>
> The FIXED mapping is only used for discrete, and mapping type
> is pre-defined. This disables the other type of mmap
> offsets when discrete memory is used.
>
> Taken from kernel commit:
> commit 7961c5b60f23 ("drm/i915: Add TTM offset argument to mmap.")
>
> Changes since V2:
> - Add previous logic check for GTT offset type - Ashutosh Dixit
> - Added documentation for library API change - Daniel Vetter
> Changes since V1:
> - Make logic more readable - Petri Latvala
>
> Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
> ---
> include/drm-uapi/i915_drm.h | 1 +
> lib/i915/gem_mman.c | 20 +++++++++++++++++++-
> 2 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/include/drm-uapi/i915_drm.h b/include/drm-uapi/i915_drm.h
> index a1c0030c..b46367f2 100644
> --- a/include/drm-uapi/i915_drm.h
> +++ b/include/drm-uapi/i915_drm.h
> @@ -871,6 +871,7 @@ struct drm_i915_gem_mmap_offset {
> #define I915_MMAP_OFFSET_WC 1
> #define I915_MMAP_OFFSET_WB 2
> #define I915_MMAP_OFFSET_UC 3
> +#define I915_MMAP_OFFSET_FIXED 4
I don't believe we can add stuff to i915_drm.h like this we need to sync
with the kernel in drm-next? Also I915_MMAP_OFFSET_FIXED is already
available in lib/i915/i915_drm_local.h, so do we need to add this?
Matt, do you have any comments on this since you introduced the FIXED mmap
type? I am ok with the patch otherwise. Thanks.
>
> /*
> * Zero-terminated chain of extensions.
> diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
> index 0406a0b9..aa9ac6f3 100644
> --- a/lib/i915/gem_mman.c
> +++ b/lib/i915/gem_mman.c
> @@ -73,9 +73,27 @@ bool gem_has_legacy_mmap(int fd)
> return errno != EOPNOTSUPP;
> }
>
> +/**
> + * gem_has_mmap_offset_type:
> + * @fd: open i915 drm file descriptor
> + * @*t: pointer to mmap_offset
> + *
> + * This functions checks the mmap offset type is supported or not.
> + * For discrete memory only FIXED mmap_offset type is supported
> + * and for non-discrete memory all other offset type except FIXED
> + * are supported.
> + *
> + * Returns: True if supported or False if not.
> + */
> bool gem_has_mmap_offset_type(int fd, const struct mmap_offset *t)
> {
> - return gem_has_mmap_offset(fd) || t->type == I915_MMAP_OFFSET_GTT;
> + if (gem_has_mmap_offset(fd))
> + if (gem_has_lmem(fd))
> + return t->type == I915_MMAP_OFFSET_FIXED;
> + else
> + return t->type != I915_MMAP_OFFSET_FIXED;
> + else
> + return t->type == I915_MMAP_OFFSET_GTT;
> }
>
> /**
> --
> 2.31.1
>
next prev parent reply other threads:[~2021-08-31 18:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-31 6:00 [igt-dev] [i-g-t, V3] lib/i915: Use FIXED mapping only for discrete memory Tejas Upadhyay
2021-08-31 6:51 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/i915: Use FIXED mapping only for discrete memory (rev4) Patchwork
2021-08-31 7:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-08-31 18:02 ` Dixit, Ashutosh [this message]
2021-09-01 10:03 ` [igt-dev] [i-g-t, V3] lib/i915: Use FIXED mapping only for discrete memory Matthew Auld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fsupv6fl.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=tejaskumarx.surendrakumar.upadhyay@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox