public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] lib/i915/gem_mman.c: add cpu coherency mapping wrapper
Date: Thu, 16 Jan 2020 13:47:07 -0800	[thread overview]
Message-ID: <87muanvztw.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <157900049765.27314.15743110141892570457@skylake-alporthouse-com>

On Tue, 14 Jan 2020 03:14:57 -0800, Chris Wilson wrote:
>
> Quoting Dixit, Ashutosh (2020-01-14 05:59:54)
> > On Mon, 13 Jan 2020 21:27:28 -0800, Zbigniew Kempczyński wrote:
> > >
> > > For reduce code redundancy adding a wrapper for cpu memory mapping.
> > >
> > > +void *__gem_mmap__cpu_coherent(int fd, uint32_t handle, uint64_t offset,
> > > +                            uint64_t size, unsigned prot)
> > > +{
> > > +     void *ptr = __gem_mmap_offset__cpu(fd, handle, offset, size, prot);
> > > +
> > > +     if (!ptr)
> > > +             ptr = __gem_mmap__cpu(fd, handle, offset, size, prot);
> > > +
> > > +     return ptr;
> > > +}
> >
> > We need similar wrappers for WC and GTT too. So why don't we put this code
>
> That's gem_mmap__device_coherent.
>
> > in __gem_mmap__cpu() itself and we can do the same for __gem_mmap__wc() and
> > __gem_mmap__gtt() too? Otherwise what are we going to call those functions?
> > Something like:
> >
> > void *__gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot)
> > {
> >         if (gem_has_mmap_offset(fd))
> >                 return __gem_mmap_offset(fd, handle, offset, size, prot, I915_MMAP_OFFSET_WB);
> >         else
> >                 return __gem_mmap(fd, handle, offset, size, prot, 0);
> > }
> >
> > So I am not sure of the point of introducing new wrappers, this code could
> > just be put in the old existing wrappers.
>
> The point is that we are separating intent from implementation. Where a
> test is not looking at the mmap ioctl, but just wants access to a
> buffer, how it wants to access that buffer is the important bit of
> information.

After Chris' explanation:

Acked-by: Ashutosh Dixit <ashutosh.dixit@intel.com>

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2020-01-16 21:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14  5:27 [igt-dev] [PATCH i-g-t] lib/i915/gem_mman.c: add cpu coherency mapping wrapper Zbigniew Kempczyński
2020-01-14  5:59 ` Dixit, Ashutosh
2020-01-14 11:14   ` Chris Wilson
2020-01-16 21:47     ` Dixit, Ashutosh [this message]
2020-01-14  6:12 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-01-16  9:18 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=87muanvztw.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    /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