intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Matthew Auld <matthew.william.auld@gmail.com>
Cc: "Ekstrand, Jason" <jason.ekstrand@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Kenneth Graunke <kenneth@whitecape.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Add TTM offset argument to mmap.
Date: Fri, 9 Jul 2021 14:47:56 +0200	[thread overview]
Message-ID: <4df9ac49-93c2-a9c2-03a3-1f6542700d8d@linux.intel.com> (raw)
In-Reply-To: <CAM0jSHP0Dvik-FKQ9XdY-xbJmRX4GufJaC5QU4yyZ=Kzby8k4w@mail.gmail.com>

Op 09-07-2021 om 11:30 schreef Matthew Auld:
> On Mon, 5 Jul 2021 at 15:36, Matthew Auld
> <matthew.william.auld@gmail.com> wrote:
>> On Thu, 1 Jul 2021 at 12:50, Maarten Lankhorst
>> <maarten.lankhorst@linux.intel.com> wrote:
>>> Op 01-07-2021 om 13:42 schreef Maarten Lankhorst:
>>>> This is only used for ttm, and tells userspace that the mapping type is
>>>> ignored. This disables the other type of mmap offsets when discrete
>>>> memory is used, so fix the selftests as well.
>>>>
>>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>>> ---
>>>>  drivers/gpu/drm/i915/gem/i915_gem_mman.c      | 17 +++++++++++-
>>>>  .../gpu/drm/i915/gem/i915_gem_object_types.h  |  1 +
>>>>  .../drm/i915/gem/selftests/i915_gem_mman.c    | 27 +++++++++++++++++--
>>>>  include/uapi/drm/i915_drm.h                   |  9 ++++---
>>>>  4 files changed, 47 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
>>>> index a90f796e85c0..b34be9e5d094 100644
>>>> --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
>>>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
>>>> @@ -679,10 +679,16 @@ __assign_mmap_offset(struct drm_i915_gem_object *obj,
>>>>               return -ENODEV;
>>>>
>>>>       if (obj->ops->mmap_offset)  {
>>>> +             if (mmap_type != I915_MMAP_TYPE_TTM)
>>>> +                     return -ENODEV;
>>>> +
>>>>               *offset = obj->ops->mmap_offset(obj);
>>>>               return 0;
>>>>       }
>>>>
>>>> +     if (mmap_type == I915_MMAP_TYPE_TTM)
>>>> +             return -ENODEV;
>>>> +
>>>>       if (mmap_type != I915_MMAP_TYPE_GTT &&
>>>>           !i915_gem_object_has_struct_page(obj) &&
>>>>           !i915_gem_object_has_iomem(obj))
>>>> @@ -727,7 +733,9 @@ i915_gem_dumb_mmap_offset(struct drm_file *file,
>>>>  {
>>>>       enum i915_mmap_type mmap_type;
>>>>
>>>> -     if (boot_cpu_has(X86_FEATURE_PAT))
>>>> +     if (HAS_LMEM(to_i915(dev)))
>>>> +             mmap_type = I915_MMAP_TYPE_TTM;
>>>> +     else if (boot_cpu_has(X86_FEATURE_PAT))
>>>>               mmap_type = I915_MMAP_TYPE_WC;
>> Hmm, I think we still need to check for X86_FEATURE_PAT somewhere,
>> since this is still just WC for lmem?
>>
>>>>       else if (!i915_ggtt_has_aperture(&to_i915(dev)->ggtt))
>>>>               return -ENODEV;
>>>> @@ -798,6 +806,10 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
>>>>               type = I915_MMAP_TYPE_UC;
>>>>               break;
>>>>
>>>> +     case I915_MMAP_OFFSET_TTM:
>>>> +             type = I915_MMAP_TYPE_TTM;
>>>> +             break;
>> Would it not be simpler to just convert to WC or WB here, if we
>> encounter _TTM? With that we also don't need to touch the dumb mmap
>> stuff and i915_gem_mmap()?
>>
>> if (IS_DGFX()) {
>>         if (args->type != OFFSET_TTM)
>>                return -ENODEV:
>>
>>        GEM_BUG_ON(!obj->mm.n_placements);
>>        if (i915_gem_object_placement_possible(obj, INTEL_MEMORY_LOCAL)) {
>>               type = TYPE_WC;
>>       else
>>               ttype = TYPE_WB;
>> }
>>
>> https://patchwork.freedesktop.org/patch/442579/?series=92209&rev=1
> fyi this patch is now merged, in case you need the
> i915_gem_object_placement_possible() helper.

I think a separate type is better, as it could still be mapped WB if evicted to system memory?

~Maarten

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-07-09 12:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01 11:42 [Intel-gfx] [PATCH] drm/i915: Add TTM offset argument to mmap Maarten Lankhorst
2021-07-01 11:50 ` Maarten Lankhorst
2021-07-05 14:36   ` Matthew Auld
2021-07-09  9:30     ` Matthew Auld
2021-07-09 12:47       ` Maarten Lankhorst [this message]
2021-07-01 11:50 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2021-07-01 12:19 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-07-01 13:27 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-07-09 14:14 ` [Intel-gfx] [PATCH] " Jason Ekstrand
2021-07-14 10:03 Maarten Lankhorst
2021-07-14 16:17 ` Jason Ekstrand
2021-07-14 17:05   ` Maarten Lankhorst
2021-07-14 18:35     ` Jason Ekstrand

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=4df9ac49-93c2-a9c2-03a3-1f6542700d8d@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jason.ekstrand@intel.com \
    --cc=kenneth@whitecape.org \
    --cc=matthew.william.auld@gmail.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;
as well as URLs for NNTP newsgroup(s).